What Are Agents?
Agents in AgentBuilder define the structure and behavior of AI-powered conversations. Think of an agent as a blueprint that determines:- Who’s talking: Is it AI ↔ Human or AI ↔ AI?
- What they know: Which prompts guide the conversation
- What they can do: Which tools they have access to
- When to stop: When turns or conversations should end
Agents are file-based and auto-discovered. Just create a TypeScript file in
agents/agents/ and export your agent definition—no manual registration needed!Quick Start
Create your first agent inagents/agents/support_agent.ts:
- An AI (side A) converses with a human user
- The AI uses the
customer_supportprompt - The AI’s turn ends when it sends a text response
That’s it! Your agent is now available throughout your application. The framework automatically discovers it and makes it available via the generated
AgentBuilder.Agents type.Agent Types
AgentBuilder supports two fundamental types of agents:ai_human (Human-AI Conversations)
ai_human (Human-AI Conversations)
The most common agent type. An AI assistant converses with a human user.Perfect for:
- Customer support chatbots
- Personal assistants
- Q&A systems
- Interactive tutorials
dual_ai (AI-AI Conversations)
dual_ai (AI-AI Conversations)
Two AI participants conversing with each other in turn-based fashion.Perfect for:
- Debate simulations
- Iterative refinement (writer ↔ critic)
- Multi-perspective analysis
- Evaluation loops
Understanding Sides
Every agent has side A and optionally side B:Side A (Required)
The primary AI participant. Forai_human agents, this is always the AI assistant.
Side B (Optional)
Only required fordual_ai agents. For ai_human agents, side B represents the human user and doesn’t need configuration.
Stop Conditions
Stop conditions control when turns and conversations end. You can combine multiple conditions:Text Response
Stop when AI returns text without calling tools
Specific Tool
Stop when a particular tool is called
Max Turns
Stop after N turns by this side
End Tool
End entire conversation when tool is called
Common Patterns
Simple ConversationAgent Handoffs
Agents can be exposed as tools, enabling specialized routing and handoffs:When an LLM calls an agent tool, execution pauses, the specialist agent runs to completion, and the result is returned to the calling agent.
Common Use Cases
Customer Support
Workflow Assistant
Iterative Refinement
Best Practices
Use Descriptive Names
Use Descriptive Names
Choose clear, purpose-driven names:✅ Good:
customer_support_agent, billing_specialist, data_analyst❌ Avoid: agent1, bot, helperSet Safety Limits
Set Safety Limits
Always include For
maxTurns to prevent runaway conversations:dual_ai, also set maxSessionTurns:Choose Appropriate Stop Conditions
Choose Appropriate Stop Conditions
Match stop conditions to your use case:
- Conversational agents:
stopOnResponse: true - Workflow agents:
stopTool: 'workflow_complete' - Research agents:
endConversationTool: 'submit_results'
Use Labels for Clarity
Use Labels for Clarity
Labels make logs and UI more readable:
Organize with Tags
Organize with Tags