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.pyarrow-up-right for a working end-to-end example.

Key Concepts

Supervisor

Escalation is designed to reach a supervisor configured on the Digital Employee identity:

  • DigitalEmployeeIdentity.supervisor

  • DigitalEmployeeSupervisor(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

circle-exclamation

Step 3: Configure the supervisor

circle-info

Note: The following environment variables are required to enable escalation:

  • SUPERVISOR_NAME

  • SUPERVISOR_EMAIL

Step 4: Create the identity

Step 5: Set up configurations

circle-info

Note: The following environment variables are required to enable the Google Mail MCP escalation channel:

  • GOOGLE_MAIL_MCP_URL

  • GOOGLE_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.pyarrow-up-right) 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.pyarrow-up-right.

2) Register the channel before deploy

Notes

  • One instance per channel type: EscalationChannel equality 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