AgentsAgentBase

prompt_add_section

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 set_prompt_text() in the same agent. Use one approach or the other.

Parameters

title
strRequired

Section heading displayed to the AI.

body
str

Section body text.

bullets
Optional[list[str]]

List of bullet point strings.

numbered
boolDefaults to False

Whether the section itself should be numbered.

numbered_bullets
boolDefaults to False

Whether bullet points should be numbered instead of bulleted.

subsections
Optional[list[dict[str, Any]]]

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

Returns

AgentBase — Returns self for method chaining.

Example

1from signalwire import AgentBase
2
3agent = AgentBase(name="support", route="/support")
4agent.prompt_add_section("Role",
5 body="You are a customer support agent for Acme Corp.")
6
7agent.prompt_add_section("Guidelines", bullets=[
8 "Always greet the caller by name if available",
9 "Never share internal pricing details",
10 "Escalate to a human if the caller asks"
11])
12agent.serve()