PromptManager

View as MarkdownOpen in Claude

PromptManager manages agent prompt text, supporting both raw text and structured POM-based prompts. When POM mode is active (the default), sections are rendered to Markdown via the underlying PomBuilder.

1import { PromptManager } from '@signalwire/sdk';
2
3const pm = new PromptManager();
4pm.addSection('Role', { body: 'You are a helpful support agent.' });
5pm.addSection('Rules', { bullets: ['Be concise', 'Be polite'] });
6console.log(pm.getPrompt());

Constructor

usePom
booleanDefaults to true

Whether to use structured POM sections. When false, only raw text via setPromptText() is supported.

Methods

Example

1import { PromptManager } from '@signalwire/sdk';
2
3const pm = new PromptManager();
4pm.addSection('Role', { body: 'You are a friendly customer support agent.' });
5pm.addSection('Rules', { bullets: ['Be concise', 'Be polite', 'Never guess'] });
6pm.setPostPrompt('Summarize the conversation in JSON format.');
7
8console.log(pm.getPrompt());
9// ## Role
10// You are a friendly customer support agent.
11//
12// ## Rules
13// - Be concise
14// - Be polite
15// - Never guess