promptAddSection

View as MarkdownOpen in Claude

Add a new section to the prompt. Sections give the AI structured instructions that are easier to follow than a single block of text. Each section has a title and optional body text, bullet points, and subsections.

POM sections cannot be mixed with setPromptText() in the same agent. Use one approach or the other.

Parameters

title
stringRequired

Section heading displayed to the AI.

opts
object

Optional section content.

opts.body
string

Section body text.

opts.bullets
string[]

List of bullet point strings.

opts.numbered
boolean

Whether the section itself should be numbered.

opts.numberedBullets
boolean

Whether bullet points should be numbered instead of bulleted.

opts.subsections
object[]

List of subsection objects, each with title, optional body, and optional bullets.

Returns

AgentBase — Returns this for method chaining.

Example

1import { AgentBase } from '@signalwire/sdk';
2
3const agent = new AgentBase({ name: 'support', route: '/support' });
4agent.promptAddSection('Role', {
5 body: 'You are a customer support agent for Acme Corp.',
6});
7
8agent.promptAddSection('Guidelines', {
9 bullets: [
10 'Always greet the caller by name if available',
11 'Never share internal pricing details',
12 'Escalate to a human if the caller asks',
13 ],
14});
15await agent.serve();