pub struct WebFetchTool { /* private fields */ }Expand description
Builtin tool that fetches a URL and returns the response body as text.
Designed for agents that need to retrieve documentation, APIs, or web pages.
Responses are capped at 5 MB and then character-truncated to 50 000 chars;
HTML is not stripped — the agent receives the raw body. By default the tool
blocks requests to private/link-local IP ranges (IpPolicy::Strict) to
prevent SSRF; set HEARTBIT_ALLOW_PRIVATE_IPS=1 to relax this for local
development.
Implementations§
Source§impl WebFetchTool
impl WebFetchTool
Sourcepub fn new() -> Self
pub fn new() -> Self
Construct with IpPolicy::default() — Strict unless
HEARTBIT_ALLOW_PRIVATE_IPS=1 is set in the environment.
Panics if the HTTP client cannot be built. Use WebFetchTool::try_new
if you need to handle the error.
Sourcepub fn try_new() -> Result<Self, Error>
pub fn try_new() -> Result<Self, Error>
Construct with IpPolicy::default(), returning Err on failure.
Returns Err if the underlying HTTP client cannot be constructed
(e.g., TLS initialisation failure).
Sourcepub fn with_ip_policy(ip_policy: IpPolicy) -> Self
pub fn with_ip_policy(ip_policy: IpPolicy) -> Self
Construct with an explicit IP policy.
Use IpPolicy::AllowPrivate only for single-tenant / dev
deployments where the agent legitimately needs to access internal
services.
Panics if the HTTP client cannot be built. Use WebFetchTool::try_with_ip_policy
if you need to handle the error.
Sourcepub fn try_with_ip_policy(ip_policy: IpPolicy) -> Result<Self, Error>
pub fn try_with_ip_policy(ip_policy: IpPolicy) -> Result<Self, Error>
Construct with an explicit IP policy, returning Err on failure.
Returns Err if the underlying HTTP client cannot be constructed.