Escalation Configuration
Overview
Escalation allows a Digital Employee to route a task to a human supervisor (see Digital Employee Supervisor) when it is blocked (e.g., tool failures, missing permissions, critical ambiguity). Escalation is opt-in and must be explicitly enabled.
In this repository, see examples/escalation_example.py for a working end-to-end example.
Key Concepts
Supervisor
Escalation is designed to reach a supervisor configured on the Digital Employee identity:
DigitalEmployeeIdentity.supervisorDigitalEmployeeSupervisor(name=..., email=...)
If escalation is enabled and a supervisor exists, the escalation protocol is included in the generated prompt.
Escalation Channels
Escalation is delivered via one or more channels (e.g., email).
Channels can introduce additional runtime dependencies (MCP connectors/tools). This matters at deployment time.
In this guide, we will use the GoogleMailMCPEscalationChannel as an example.
Example
Step 1: Import dependencies
Step 2: Define the job with escalation instructions
Important: Use the term "escalation protocol" in the Digital Employee instructions whenever we need to refer to or trigger the escalation flow.
Step 3: Configure the supervisor
Note: The following environment variables are required to enable escalation:
SUPERVISOR_NAMESUPERVISOR_EMAIL
Step 4: Create the identity
Step 5: Set up configurations
Note: The following environment variables are required to enable the Google Mail MCP escalation channel:
GOOGLE_MAIL_MCP_URLGOOGLE_MCP_X_API_KEY
These values are typically passed into DigitalEmployeeConfiguration so they become part of the deployed agent configuration. Adjust the environment variables based on your escalation channel.
Step 6: Initialize the Digital Employee
Step 7: Enable escalation and add channels
Step 8: Deploy and run
Deployment Order Matters
Enable escalation and add channels before calling
digital_employee.deploy().The deploy step will bundle any required MCP connectors/tools introduced by escalation channels.
Custom Escalation Channels
Escalation channels are extensible. To create your own channel, implement EscalationChannel (see digital_employee_core/escalation/base_escalation_channel.py) and register it via digital_employee.add_escalation_channel(...).
1) Implement the channel
Create a new class that extends EscalationChannel that defines:
get_required_mcps(): MCP connectors the channel needs at runtime.get_required_tools(): Additional tools (if any). Return[]if not needed.get_prompt_header(): Short title shown in the escalation protocol.get_prompt_body(supervisor, ...): Concrete instructions describing how the agent should escalate using your tools/MCP.
Minimal skeleton:
For a reference implementation, see digital_employee_core/escalation/channels/google_mail_mcp_channel.py.
2) Register the channel before deploy
Notes
One instance per channel type:
EscalationChannelequality is based on class type, so adding the same channel type multiple times is treated as a duplicate.Tool restrictions: If your channel uses MCP tools, ensure those tools are allowed (if you are using whitelisted MCP tools, see MCP Allowed Tools Configuration).
Best Practices
Define clear escalation triggers in
DigitalEmployeeJob.instruction(e.g., tool failures, permission issues, urgent blockers).Configure least-privilege tools for MCPs where possible (see MCP Allowed Tools Configuration).
Validate supervisor identity (non-empty name/email) during development to avoid “silent” non-actionable escalations.
Test with prompt preview (
build_prompt()) before deploying.
Last updated