***

title: renderSwml
slug: /reference/typescript/agents/agent-base/render-swml
description: Render the complete SWML document by assembling all 5 phases.
max-toc-depth: 3
---------------------

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

Render the complete SWML document by assembling all 5 phases: pre-answer, answer,
post-answer, AI, and post-AI verbs. This is called automatically by the Hono route
handler on each incoming request, but can also be called manually for testing or
debugging.

## **Parameters**

<ParamField path="callId" type="string" toc={true}>
  Optional call ID to use for session tokens. Auto-generated if omitted.
</ParamField>

## **Returns**

`string` -- The rendered SWML document as a JSON string.

## **Example**

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

const agent = new AgentBase({ name: 'support', route: '/support' });
agent.setPromptText('You are a helpful assistant.');
agent.addHints(['SignalWire', 'SWML']);

const swml = agent.renderSwml();
console.log(JSON.parse(swml));
```