set_prompt

View as MarkdownOpen in Claude

Set the context’s prompt text directly. Cannot be used together with add_section() or add_bullets().

Parameters

prompt
strRequired

Plain-text prompt for this context.

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.set_prompt("You are handling billing inquiries. Be concise and accurate.")
8ctx.add_step("greet").set_text("Greet the caller and ask how you can help.")
9
10agent.serve()