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

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

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());