add_section

View as MarkdownOpen in Claude

Add a POM section to the context prompt. Cannot be used together with set_prompt().

Parameters

title
strRequired

Section heading.

body
strRequired

Section body text.

Returns

Context — Self for method chaining.

Example

1from signalwire import AgentBase
2
3agent = AgentBase(name="my-agent", route="/agent")
4
5contexts = agent.define_contexts()
6ctx = contexts.add_context("default")
7ctx.add_section("Role", "You are a billing specialist.")
8ctx.add_section("Guidelines", "Always verify account ownership first.")
9ctx.add_step("greet").set_text("Greet the caller and ask how you can help.")
10
11agent.serve()