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:

  • 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

circle-exclamation

Step 3: Build the Digital Employee with escalation

circle-info

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

  • GOOGLE_MAIL_MCP_URL

  • GOOGLE_DOCS_MCP_URL

  • GOOGLE_MCP_X_API_KEY

  • SUPERVISOR_NAME

  • SUPERVISOR_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

circle-info

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

2) Configure the channel

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 building.

Last updated