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

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