Skip to main content

Module http_tool

Module http_tool 

Source
Expand description

HTTP tool provider — executes tool calls as REST requests via reqwest.

Tools declared with provider: http in .axon files dispatch their argument as the request body to the URL specified in runtime.

Request format: POST {runtime_url} Content-Type: application/json X-Axon-Tool: {tool_name}

Body: the tool argument (string, sent as JSON-wrapped if not already JSON)

Response handling:

  • 2xx: response body becomes tool output (success)
  • 4xx/5xx: error message with status code (failure)
  • Connection error: descriptive error (failure)

Timeout: parsed from ToolEntry.timeout field (e.g., “10s”, “500ms”). Default timeout: 30 seconds.

§Fase 34.e (v1.29.0) — Streaming surface via HttpStreamingTool. The async-trait Tool impl drives the upstream HTTP request via reqwest::Client (async) + drains the response body chunk-by-chunk. Content-Type drives framing:

  • text/event-stream → per-W3C-SSE-event ToolChunks
  • application/x-ndjson / application/jsonl → per-line ToolChunks
  • Other (raw bytes, JSON, etc.) → single-chunk wrap (D9 backwards- compat for non-streaming HTTP endpoints) Per-chunk cancel poll honors the D5 ≤100ms budget.

Structs§

HttpStreamingTool
HTTP tool with first-class streaming surface (Fase 34.e).

Functions§

dispatch_http
Execute an HTTP tool call.
parse_timeout_pub
Public accessor for timeout parsing (used by emcp module).