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:
DigitalEmployeeBuilder().set_supervisor(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: Set up escalation configuration
Important: Use the term "escalation protocol" in the Digital Employee instructions whenever we need to refer to or trigger the escalation flow.
Step 3: Build the Digital Employee with escalation
Note: The following environment variables are required to enable the Google Mail MCP escalation channel:
GOOGLE_MAIL_MCP_URLGOOGLE_DOCS_MCP_URLGOOGLE_MCP_X_API_KEYSUPERVISOR_NAMESUPERVISOR_EMAIL
These values are loaded via .add_configs_from_env() and become part of the deployed agent configuration. Adjust the environment variables based on your escalation channel.
Step 4: Run the Digital Employee
Note: The new pattern uses async/await. Use employee.invoke(...) instead of the old employee.run(...) method.
Custom Escalation Channels
Escalation channels are extensible. To create your own channel, implement EscalationChannel (see digital_employee_core/escalation/base_escalation_channel.py) and configure it via .set_escalation_config().
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) Configure the channel
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 building.
Last updated