Skip to main content

What Are Prompts?

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!

Quick Start

Create your first prompt in agents/prompts/customer_support.ts:
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'.

Core Configuration

Essential Fields

Unique identifier for this prompt.
name: 'customer_support'  // snake_case recommended
The system instructions sent to the LLM.
prompt: \`You are a helpful assistant.

Your responsibilities:
- Answer questions accurately
- Be professional and friendly
- Use tools when needed\`
Supports template variables:
prompt: \`Hello {{userName}}, today is {{currentDate}}.\`
Which model configuration to use.
model: 'gpt-4o'  // Must be defined in agents/models/
Description for when prompt is used as a tool. Always required.
toolDescription: 'Analyze data and generate insights'

Context Options

Control what conversation history the LLM sees:

includeChat

Include full conversation history
includeChat: true  // For conversational prompts
Use when:
  • Multi-turn conversations
  • Context is important
  • Follow-up questions

includePastTools

Include previous tool results
includePastTools: true  // For research tasks
Use when:
  • Building on previous findings
  • Iterative analysis
  • Multi-step workflows

Tools in Prompts

Specify which tools the LLM can call:
definePrompt({
  name: 'support_prompt',
  tools: [
    'search_knowledge_base',              // Function tool
    'summarizer',                         // Prompt tool
    'billing_specialist',                 // Agent tool
    { 
      name: 'code_reviewer',              // With options
      includeTextResponse: true,
      includeToolCalls: false,
    },
  ],
  // ...
});
Tools can be function tools (from agents/tools/), prompt tools (other prompts with exposeAsTool: true), or agent tools (agents with exposeAsTool: true).

Input Validation

Use Zod schemas to validate inputs when prompts are called as tools:
import { definePrompt } from '@standardagents/builder';
import { z } from 'zod';

export default definePrompt({
  name: 'data_analyst',
  toolDescription: 'Analyze data and generate insights',
  exposeAsTool: true,
  prompt: 'You are a data analysis expert...',
  model: 'gpt-4o',
  requiredSchema: z.object({
    data: z.string().describe('Data to analyze (JSON format)'),
    question: z.string().describe('Analysis question'),
    format: z.enum(['summary', 'detailed', 'json']).default('summary'),
  }),
});

Exposing Prompts as Tools

Set exposeAsTool: true to make prompts callable as sub-prompts:
// agents/prompts/code_reviewer.ts
export 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 prompt
export 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.

Extended Thinking

Configure reasoning for models that support it:
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
  },
});
  • Effort Levels
  • Options
LevelBehaviorUse Case
'low'Minimal reasoningSimple tasks
'medium'BalancedMost tasks
'high'Maximum depthComplex problems

Common Patterns

Conversational Assistant

export default definePrompt({
  name: 'assistant',
  toolDescription: 'General assistant for conversations',
  prompt: \`You are a helpful assistant.
Provide clear, accurate, and friendly responses.\`,
  model: 'gpt-4o',
  includeChat: true,
});

Customer Support with Tools

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 issues

Always be professional and empathetic.\`,
  model: 'gpt-4o',
  includeChat: true,
  tools: [
    'search_knowledge_base',
    'lookup_customer',
    'create_ticket',
  ],
});

Specialized Sub-Prompt

export default definePrompt({
  name: 'data_analyst',
  toolDescription: 'Analyze data and generate insights',
  exposeAsTool: true,
  prompt: 'You are a data analyst expert...',
  model: 'gpt-4o',
  reasoning: {
    effort: 'medium',
    exclude: false,
  },
  requiredSchema: z.object({
    data: z.string().describe('Data to analyze'),
    question: z.string().describe('Analysis question'),
  }),
  tools: ['calculate_statistics', 'generate_chart'],
});

Best Practices

Structure your prompts for clarity:
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\`
Good:
toolDescription: 'Search the knowledge base for product information, FAQs, and troubleshooting guides. Returns relevant articles.'
Avoid:
toolDescription: 'Search stuff'
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()
// For conversations
includeChat: true

// For single-shot tasks
includeChat: false

Next Steps