set_user_prompt

View as MarkdownOpen in Claude

Inject a user message when entering this context. Useful for triggering the AI to speak first after a context switch.

Parameters

user_prompt
strRequired

User message to inject.

Returns

Context — Self for method chaining.

Example

1from signalwire import AgentBase
2
3agent = AgentBase(name="my-agent", route="/agent")
4
5contexts = agent.define_contexts()
6sales = contexts.add_context("default")
7sales.set_user_prompt("I'd like to learn about your products.")
8sales.add_step("pitch").set_text("Present our product lineup to the caller.")
9
10agent.serve()