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

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