Orchestration
The Orchestration panel lets you define rules for agent behavior, escalation paths, and coordination between agents.
Overview
Orchestration rules control:
- When to escalate to other agents
- Handoff conditions
- Approval requirements
- Workflow triggers
Escalation Rules
Define Escalation Paths
const rules = await client.orchestration.createRules('agent-123', {
escalation: {
// Escalate after 3 failed attempts
maxAttempts: 3,
// Escalate for specific intents
intents: ['billing_dispute', 'legal_question', 'security_incident'],
// Target agent for escalation
targetAgentId: 'agent-supervisor',
// Or escalate to human
escalateToHuman: true
}
});
Handoff Rules
Automatic Handoffs
const rules = await client.orchestration.createRules('agent-123', {
handoffs: [
{
condition: 'intent == "technical_support"',
targetAgentId: 'agent-tech-support'
},
{
condition: 'intent == "billing"',
targetAgentId: 'agent-billing'
},
{
condition: 'sentiment < -0.5',
targetAgentId: 'agent-retention'
}
]
});
Approval Requirements
Require Approval for Sensitive Actions
const rules = await client.orchestration.createRules('agent-123', {
approvals: {
required: true,
actions: [
'issue_refund',
'modify_account',
'access_sensitive_data'
],
approvers: ['user-admin-123', 'user-manager-456']
}
});
Coordination Rules
Multi-Agent Workflows
const workflow = await client.workflows.create({
name: 'Support Escalation',
steps: [
{
agent: 'agent-triage',
condition: 'start',
outputs: ['category', 'priority']
},
{
agent: 'agent-specialist',
condition: 'category == "technical"',
inputs: ['category', 'context']
},
{
agent: 'agent-supervisor',
condition: 'priority == "critical"',
inputs: ['all']
}
]
});
Best Practices
- Clear conditions: Make escalation triggers explicit
- Fallback paths: Always have a fallback (usually human)
- Test thoroughly: Verify rules work as expected
- Monitor: Track escalation rates to tune rules
Next: Learn about Publishing your templates.