***

title: serve
slug: /reference/typescript/agents/agent-base/serve
description: Start a Hono web server to serve this agent's SWML and SWAIG endpoints.
max-toc-depth: 3
---------------------

For a complete index of all SignalWire documentation pages, fetch https://signalwire.com/docs/llms.txt

[run]: /docs/server-sdks/reference/typescript/agents/agent-base/run

Start a Hono web server (via `@hono/node-server`) to serve this agent. The server
exposes endpoints for SWML document delivery, SWAIG function execution,
post-prompt summary handling, and health checks.

The server automatically includes:

* SWML document endpoint at the agent's route
* SWAIG function dispatch at `{route}/swaig`
* Post-prompt handler at `{route}/post_prompt`
* `/health` and `/ready` health check endpoints
* Security headers middleware
* Basic Auth middleware

<Info>
  [`run()`][run] is an alias for `serve()`. Both methods are equivalent in the
  TypeScript SDK.
</Info>

## **Parameters**

None.

## **Returns**

`Promise<void>` -- Resolves once the server is running.

## **Example**

```typescript {5}
import { AgentBase } from '@signalwire/sdk';

const agent = new AgentBase({ name: 'my-agent', host: '0.0.0.0', port: 3000 });
agent.setPromptText('You are a helpful assistant.');
await agent.serve(); // Blocks here, serving at http://0.0.0.0:3000/
```