PomBuilder

View as MarkdownOpen in Claude

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 provide. The builder can render to Markdown format.

Methods

Examples

Building a structured prompt

1import { PomBuilder } from '@signalwire/sdk';
2
3const pom = new PomBuilder();
4pom.addSection('Role', { body: 'You are a helpful assistant.' });
5pom.addSection('Rules', { bullets: ['Be concise', 'Be accurate'] });
6
7const markdown = pom.renderMarkdown();
8console.log(markdown);

Incremental construction

1import { PomBuilder } from '@signalwire/sdk';
2
3const pom = new PomBuilder();
4
5// Start with a basic section
6pom.addSection('Capabilities', { body: 'You can help with the following:' });
7
8// Add bullets incrementally as skills are loaded
9pom.addToSection('Capabilities', { bullet: 'Weather lookups' });
10pom.addToSection('Capabilities', { bullet: 'Calendar scheduling' });
11pom.addToSection('Capabilities', { bullets: [
12 'Order tracking',
13 'Account management',
14] });
15
16// Add a subsection
17pom.addSubsection('Capabilities', 'Limitations', {
18 body: 'You cannot process payments directly.',
19});
20
21console.log(pom.renderMarkdown());