***

title: PomBuilder
slug: /reference/typescript/agents/pom-builder
description: Build structured Prompt Object Model prompts with sections, subsections, and bullets.
max-toc-depth: 3
---------------------

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

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

[addsection]: /docs/server-sdks/reference/typescript/agents/pom-builder/add-section

[addsubsection]: /docs/server-sdks/reference/typescript/agents/pom-builder/add-subsection

[addtosection]: /docs/server-sdks/reference/typescript/agents/pom-builder/add-to-section

[findsection]: /docs/server-sdks/reference/typescript/agents/pom-builder/find-section

[getsection]: /docs/server-sdks/reference/typescript/agents/pom-builder/get-section

[hassection]: /docs/server-sdks/reference/typescript/agents/pom-builder/has-section

[rendermarkdown]: /docs/server-sdks/reference/typescript/agents/pom-builder/render-markdown

[todict]: /docs/server-sdks/reference/typescript/agents/pom-builder/to-dict

PomBuilder provides a fluent interface for creating structured prompts using
the Prompt Object Model (POM). POM organizes prompt content into titled sections,
subsections, and bullet lists -- producing consistent, well-structured prompts
that the AI can follow reliably.

Use PomBuilder when you need fine-grained control over prompt structure beyond
what `setPromptText()` and `promptAddSection()` on
[`AgentBase`][agentbase] provide. The builder
can render to Markdown format.

## **Methods**

<CardGroup cols={3}>
  <Card title="addSection" href="/docs/server-sdks/reference/typescript/agents/pom-builder/add-section">
    Add a new top-level section to the POM.
  </Card>

  <Card title="addSubsection" href="/docs/server-sdks/reference/typescript/agents/pom-builder/add-subsection">
    Add a subsection to an existing section.
  </Card>

  <Card title="addToSection" href="/docs/server-sdks/reference/typescript/agents/pom-builder/add-to-section">
    Add content to an existing section.
  </Card>

  <Card title="findSection" href="/docs/server-sdks/reference/typescript/agents/pom-builder/find-section">
    Find a section by title for direct manipulation.
  </Card>

  <Card title="getSection" href="/docs/server-sdks/reference/typescript/agents/pom-builder/get-section">
    Get a top-level section by title.
  </Card>

  <Card title="hasSection" href="/docs/server-sdks/reference/typescript/agents/pom-builder/has-section">
    Check if a section with a given title exists.
  </Card>

  <Card title="renderMarkdown" href="/docs/server-sdks/reference/typescript/agents/pom-builder/render-markdown">
    Render the POM as a Markdown string.
  </Card>

  <Card title="toDict" href="/docs/server-sdks/reference/typescript/agents/pom-builder/to-dict">
    Convert the POM to a list of section objects.
  </Card>
</CardGroup>

## **Examples**

### Building a structured prompt

```typescript {3}
import { PomBuilder } from '@signalwire/sdk';

const pom = new PomBuilder();
pom.addSection('Role', { body: 'You are a helpful assistant.' });
pom.addSection('Rules', { bullets: ['Be concise', 'Be accurate'] });

const markdown = pom.renderMarkdown();
console.log(markdown);
```

### Incremental construction

```typescript {3}
import { PomBuilder } from '@signalwire/sdk';

const pom = new PomBuilder();

// Start with a basic section
pom.addSection('Capabilities', { body: 'You can help with the following:' });

// Add bullets incrementally as skills are loaded
pom.addToSection('Capabilities', { bullet: 'Weather lookups' });
pom.addToSection('Capabilities', { bullet: 'Calendar scheduling' });
pom.addToSection('Capabilities', { bullets: [
  'Order tracking',
  'Account management',
] });

// Add a subsection
pom.addSubsection('Capabilities', 'Limitations', {
  body: 'You cannot process payments directly.',
});

console.log(pom.renderMarkdown());
```