Prompts in AgentBuilder define the instructions and configuration for how LLMs interact within your agents. Each prompt specifies:
System Instructions: The core prompt sent to the LLM
Model Configuration: Which model to use
Available Tools: Functions the LLM can call
Input Validation: Required parameters and schemas
Context Options: What history to include
Prompts are file-based and auto-discovered. Create a TypeScript file in agents/prompts/ and export your prompt definition—no manual registration needed!
Create your first prompt in agents/prompts/customer_support.ts:
Copy
import { definePrompt } from '@standardagents/builder';export default definePrompt({ name: 'customer_support', toolDescription: 'Handle customer support inquiries', prompt: \`You are a helpful customer support agent.Always be polite and try to resolve issues quickly.\`, model: 'gpt-4o', includeChat: true,});
Your prompt is now available! Reference it in any agent via sideA: prompt: 'customer_support'.
Tools can be function tools (from agents/tools/), prompt tools (other prompts with exposeAsTool: true), or agent tools (agents with exposeAsTool: true).
Set exposeAsTool: true to make prompts callable as sub-prompts:
Copy
// agents/prompts/code_reviewer.tsexport default definePrompt({ name: 'code_reviewer', toolDescription: 'Review code for bugs and improvements', exposeAsTool: true, prompt: \`You are an expert code reviewer.Analyze code for bugs, performance, and best practices.\`, model: 'gpt-4o', requiredSchema: z.object({ code: z.string().describe('Code to review'), language: z.string().describe('Programming language'), }),});// Use in another promptexport default definePrompt({ name: 'developer_assistant', tools: ['code_reviewer'], // Can now call it // ...});
When an LLM calls a prompt tool, a sub-prompt execution occurs with its own context. Messages are stored with parent_id linking back to the parent execution.
definePrompt({ name: 'complex_analysis', prompt: 'Analyze this complex problem...', model: 'claude-sonnet', reasoning: { effort: 'high', // low | medium | high maxTokens: 10000, // Maximum reasoning tokens exclude: false, // Include reasoning in response include: false, // Include reasoning in history },});
export default definePrompt({ name: 'customer_support', toolDescription: 'Handle customer support inquiries', prompt: \`You are a customer support agent.Your responsibilities:- Answer questions about products- Help resolve issues- Create tickets when needed- Escalate complex issuesAlways be professional and empathetic.\`, model: 'gpt-4o', includeChat: true, tools: [ 'search_knowledge_base', 'lookup_customer', 'create_ticket', ],});
prompt: \`You are a customer support agent.## Your Role- Answer product questions- Resolve issues- Create tickets for complex problems## Guidelines- Be professional and empathetic- Ask clarifying questions- Never share internal information## Available Tools- search_knowledge_base: Find product info- create_ticket: Create support tickets\`
Use Descriptive Tool Descriptions
✅ Good:
Copy
toolDescription: 'Search the knowledge base for product information, FAQs, and troubleshooting guides. Returns relevant articles.'
❌ Avoid:
Copy
toolDescription: 'Search stuff'
Validate Inputs with Zod
Copy
requiredSchema: z.object({ customerId: z.string().min(1).describe('Customer ID from CRM'), issue: z.string().min(10).describe('Issue description'), priority: z.enum(['low', 'medium', 'high']).default('medium'),}).strict()
Enable Context When Needed
Copy
// For conversationsincludeChat: true// For single-shot tasksincludeChat: false