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 /healthfor readinessPOST /invokefor 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.