Skip to main content
The Escalation Pattern is a resource-efficient approach to task handling where simpler, less resource-intensive agents handle tasks first, with more capable (but potentially more expensive) agents only being engaged when necessary.

Key Characteristics

Escalation Pattern The Escalation Pattern optimizes resource usage by intelligently routing tasks to appropriate agents based on complexity and agent capabilities. At its core, this pattern recognizes that not all queries require the same level of expertise or computational resources to address effectively. By establishing a hierarchy of agents with increasing capabilities and costs, the system can balance efficiency and quality.
  • Progressive Capability: Tasks start with basic agents and escalate through progressively more capable agents only when needed.
  • Resource Efficiency: Simpler, less expensive agents handle straightforward tasks, while more powerful agents are reserved for complex problems.
  • Clear Escalation Criteria: Well-defined confidence thresholds and structured responses determine when to escalate to the next level.
  • Context Preservation: All context and query information is maintained throughout the escalation process.
  • Graceful Degradation: System handles varying complexity levels efficiently, providing the best available answer.

Information Flow

Escalation Flow The flow of information in the Escalation Pattern follows a deliberate path designed to maximize efficiency while ensuring that queries receive appropriate attention. Each query undergoes evaluation at multiple levels if necessary, with decisions made based on structured confidence assessments rather than subjective impressions. This systematic approach ensures consistent handling of queries and optimal resource allocation.
  • Query Reception: The triage agent receives the user query and routes it to the basic agent.
  • Confidence Assessment: Each agent evaluates the query and provides a structured response with a confidence score.
  • Escalation Decision:
    • If confidence is below threshold (typically < 8/10), escalate to the next agent level
    • If confidence is above threshold, return the response to the user
  • Context Tracking: Context variables track each agent’s confidence score, escalation count, and reasons.
  • Result Delivery: The final answer is returned through the triage agent to the user.

Implementation

Implementing the Escalation Pattern requires careful design of both the agent architecture and the communication protocol between agents. The implementation leverages structured data formats and explicit confidence reporting to make escalation decisions transparent and consistent. By using the group chat orchestration engine, the pattern can be implemented with minimal custom code while maintaining robust escalation logic and context preservation.
  • Structured Response Format: A Pydantic model (ConsideredResponse) captures answer, confidence, reasoning, and escalation information.
  • Confidence Thresholds: Agents escalate queries when their confidence falls below a defined threshold (8/10).
  • Agent-Specific Context Variables: Each agent’s confidence and escalation decisions are tracked independently.
  • OnContextCondition: Transitions between agents are triggered by evaluating context variables.
  • Tool Functions: Specialized tool functions process structured responses and manage escalation logic.

Agent Flow

Code

In this code example we use OpenAI’s GPT-4o mini with structured outputs.

Output