---
title: ".fetch()"
description: "Handle a web-standard Request with the agent's Hono application."
---

> Documentation Index
> Fetch the complete documentation index at: https://xsaf.ilha.build/llms.txt
> Use this file to discover all available pages before exploring further.

# .fetch()

## Signature

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

## Usage

```ts
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()`](/xsaf/serve), when present
- routes installed by HTTP-capable [`.channel()`](/xsaf/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.

Source: https://xsaf.ilha.build/xsaf/fetch/index.mdx
