# Server

> createAgent options, adapters for Hono, Next.js and Express, and the doctor check.

Source: https://sideagent.dev/docs/server

`createAgent` is async: it parses the spec and, if you configured knowledge, embeds it. Create the agent once and reuse it. It returns an object with a request `handler` and a `doctor()` check.

## Options

| Option | What it does |
| --- | --- |
| `spec` | OpenAPI 3.0 or 3.1: a URL, an object or a JSON string. |
| `baseUrl` | Pinned API host. The spec's `servers` list is ignored. |
| `llm` | `baseUrl`, `apiKey` and `model` of any OpenAI-compatible host. |
| `allow` | Default-deny allowlist of operation IDs, or `tag:name`. |
| `allowedOrigins` | Browser origins that may call the endpoint. |
| `getAuth` | Returns the user ID and the headers to forward to your API. |
| `approvalSecret` | Signs approval tokens. Set it on serverless or multi-instance deployments, so every instance verifies the same tokens. |
| `checkpointer`, `threadStore` | Persistent chat history. See [Chat history](https://sideagent.dev/docs/history.md). |
| `knowledge`, `vectorStore` | Markdown and URL sources the agent can search. See [Knowledge](https://sideagent.dev/docs/knowledge.md). |

## Adapters

`honoHandler(agent)`, `nextRoute(agent)` and `expressHandler(agent)`. The core `agent.handler(request)` takes a standard `Request` and returns a `Response`.

## Doctor

Call `await agent.doctor()` at startup. It reports what the agent can do (operations loaded, knowledge sources, warnings) and checks the LLM connection.
