setPromptPom

View as MarkdownOpen in Claude

Replace the agent’s prompt with the supplied POM (Prompt Object Model) array. Existing sections are cleared before the new ones are applied, so this is the batch equivalent of calling promptAddSection() for every entry. The shape must match what getPromptPom() returns.

Requires the agent to be constructed with usePom: true. Throws Error("usePom must be true to use setPromptPom") otherwise.

Parameters

pom
Record<string, unknown>[]Required

Ordered array of POM section objects. Each section supports title (string), body (string), bullets (string[]), numbered (boolean), numberedBullets (boolean), and subsections (array of { title, body?, bullets? }).

Returns

AgentBase — Returns this for method chaining.

Example

1import { AgentBase } from '@signalwire/sdk';
2
3const agent = new AgentBase({ name: 'support', route: '/support', usePom: true });
4
5agent.setPromptPom([
6 { title: 'Role', body: 'You are a support agent for Acme Corp.' },
7 {
8 title: 'Guidelines',
9 bullets: ['Greet by name', 'Never share internal pricing'],
10 },
11]);
12await agent.serve();