AgentsAgentBase

set_prompt_pom

View as MarkdownOpen in Claude

Set the prompt directly as a POM (Prompt Object Model) dictionary structure. This is a low-level method that accepts the POM data format directly. For most cases, use prompt_add_section() to build POM prompts incrementally.

The POM format structures prompts into titled sections with body text, bullet points, and nested subsections. This structure helps the AI model parse complex instructions more reliably than flat text.

Parameters

pom
list[dict[str, Any]]Required

POM dictionary structure. Each item in the list is a section with keys:

  • title (str) — Section heading
  • body (str) — Section body text
  • bullets (list[str]) — Optional bullet points
  • numbered (bool) — Whether the section is numbered
  • subsections (list[dict]) — Optional nested sections with the same keys

Returns

AgentBase — Returns self for method chaining.

Example

1from signalwire import AgentBase
2
3agent = AgentBase(name="support", route="/support")
4agent.set_prompt_pom([
5 {
6 "title": "Role",
7 "body": "You are a customer support agent for Acme Corp."
8 },
9 {
10 "title": "Guidelines",
11 "body": "",
12 "bullets": [
13 "Always greet the caller by name if available",
14 "Never share internal pricing details",
15 "Escalate to a human if the caller requests it"
16 ]
17 },
18 {
19 "title": "Capabilities",
20 "body": "You can help with the following:",
21 "subsections": [
22 {"title": "Orders", "body": "Look up order status, process returns"},
23 {"title": "Billing", "body": "Check balances, explain charges"}
24 ]
25 }
26])
27agent.serve()