web.fetch

The web.fetch tool fetches content from a URL via HTTP or HTTPS.

Capability Required

tool.invoke:web.fetch

Network access also requires spec.network.policy: full or allowlist with the target host.

Input Schema

{
  "type": "object",
  "required": ["url"],
  "properties": {
    "url": {
      "type": "string",
      "description": "The URL to fetch (http:// or https://)."
    }
  }
}

Note: Headers and other HTTP options can be added in future versions. For now, use {{secret:<name>}} in the URL for authentication tokens where supported.

Output Schema

{
  "type": "object",
  "properties": {
    "status": { "type": "integer", "description": "HTTP status code." },
    "body":   { "type": "string",  "description": "Response body (UTF-8 text)." }
  }
}

Examples

#![allow(unused)]
fn main() {
// Simple GET
let result = agent.invoke_tool("web.fetch", json!({
    "url": "https://example.com"
})).await?;

println!("HTTP {}", result["status"]);
println!("{}", &result["body"].as_str().unwrap_or("")[..200]);
}
#![allow(unused)]
fn main() {
// Fetch with secret in URL (API key pattern)
let result = agent.invoke_tool("web.fetch", json!({
    "url": "https://api.example.com/data?key={{secret:api-key}}"
})).await?;
}
ash tools invoke <agent-id> web.fetch '{"url": "https://httpbin.org/get"}'

Network Policy

Declare appropriate network access in the manifest:

spec:
  network:
    policy: allowlist
    allowlist:
      - "api.example.com:443"
      - "httpbin.org:443"

Cost

Estimated cost: 0.1

Error Cases

ErrorCause
network policy denies outboundHost not in allowlist or policy is none
connection refusedTarget server not reachable
timeoutRequest exceeded timeout
HTTP 4xx/5xxReturned as success with appropriate status code