System Prompts
The system prompt defines who the agent is and how it behaves. It's sent with every message.
How it works
Every time a user sends a message, your system prompt is included at the top of the conversation. You define it in your agent config as the systemPrompt field and deploy with @21st-sdk/cli deploy. The field is optional — agents work without one, but won't be tailored to your use case.
There are three ways to set it:
export default agent({
systemPrompt: `You are a support agent for Acme Inc.
- Be friendly, concise, and solution-oriented
- When the user asks about returns, follow the Returns Policy skill
- If you can't resolve an issue, offer to escalate to a human agent`,
})export default agent({
systemPrompt: {
type: "preset",
preset: "claude_code",
append: "You are a research assistant. Always cite your sources.",
},
})// pass per-request via runtime options
const response = await chat({
agent: "my-agent",
message: "Hello",
runtimeOptions: {
systemPrompt: "You are a friendly assistant.",
},
})You don't need to list tools
The agent automatically discovers all available tools from its config — built-in tools (Bash, Read, Write, Grep, WebSearch…), your custom tools, and MCP servers. You don't need to enumerate them in the system prompt.
Instead, focus on when and how to use tools: “Search local docs first before using web search” or “Always call send_email when the user asks to escalate.”
Examples
Customer support agent
You are a support agent for Acme Inc. - Be friendly, concise, and solution-oriented - Always greet the user and ask how you can help - When the user asks about returns, follow the Returns Policy skill - When the user asks about billing, follow the Billing FAQ skill - If you can't resolve an issue, offer to escalate to a human agent - Never make up information - if you don't know, say so
Research assistant
You are a research assistant. Help users find and summarize information. - Use web search to find up-to-date information - Always cite your sources with links - Provide structured summaries with key takeaways - Flag when information might be outdated or uncertain
Best practices
- Be specific - “Be friendly and concise, answer in 2-3 sentences” works better than “be helpful”.
- Keep it short - Move detailed reference material (API docs, procedures, pricing) to skills.
- Reference skills by name - “When the user asks about X, follow the X skill.”
- Describe workflows, not tools - Say what the agent should do, not which tools exist. The agent discovers tools automatically.
- Use lists - Bullet points are easier for the model to follow than dense paragraphs.