AgentsAgentBase

set_prompt_text

View as MarkdownOpen in Claude

Set the agent’s system prompt as a raw text string. This is the simplest way to configure what the AI knows and how it behaves.

This sets the SWML ai.prompt field. See the SWML prompt reference for details on prompt behavior.

Cannot be mixed with POM-based prompt sections (prompt_add_section()) in the same agent. Use one approach or the other for the main prompt. Contexts can still be used alongside either approach.

Parameters

text
strRequired

The complete system prompt text. Supports multi-line strings.

Returns

AgentBase — Returns self for method chaining.

Example

1from signalwire import AgentBase
2
3agent = AgentBase(name="support", route="/support")
4agent.set_prompt_text("""
5You are a customer support agent for Acme Corp.
6You help customers with billing questions, order tracking, and returns.
7Always be polite and professional.
8""")
9agent.serve()