Skip to content

.fetch()

Handle a web-standard Request with the agent's Hono application.

Updated View as Markdown

Signature

agent.fetch(request: Request): Promise<Response>
agent.fetch(request: Request): Promise<Response>

Usage

const server = serve({
  fetch: (request) => agent.fetch(request),
  port: 3000,
});

Every agent owns a Hono app with:

  • GET /health for readiness
  • POST /invoke for JSON or streaming invocation
  • the MCP route configured by .serve(), when present
  • routes installed by HTTP-capable .channel() drivers

XSAF never opens a socket. Pass .fetch() to srvx, a Node adapter, Workers, or another compatible fetch-native host. Use agent.app when composing additional Hono routes or testing in memory.

The agent must be started before handling runtime requests.

Navigation

Type to search…

↑↓ navigate↵ selectEsc close