Skip to main content
Back to how-to guides Use this pattern when an agent hands a conversation to a person and the person must start with the right details, queue, and priority.

Concept

An ESCALATE block does two jobs. It decides when to escalate, and it decides what the person receives. Escalate to a human agent covers the first job. This guide covers the second. The platform builds the package from five sources. Each source reaches a different place, so check the destination before you rely on a field. The platform also sends the contact card and caller identity without any setting. See What the desk receives automatically. Every escalation also creates a task in the project’s human task inbox, due 24 hours after creation. Escalation reaches a person only when two things are true:
  • The project has a human-agent connection.
  • The ESCALATE block has a routing block with connection, queue, or skills.
Without both, the platform records the task and flags the session as escalated. It does not connect a person. See Troubleshooting.

Minimal working example

This agent escalates disputes above $500. It sends the case details to the billing queue. Project-local assumptions: the project has a human-agent connection named support_desk, and the desk has a queue named billing_disputes.
The agent collects dispute_amount and case_id with GATHER. The trigger fires when dispute_amount exceeds 500. The desk receives the reason, the priority, the queue, the skills, the conversation, and the case values in metadata.

How it works

Reason and priority

The reason is the REASON text of the trigger that fired. If the model starts the escalation, the model writes the reason. The reason must contain 5 to 500 characters. The platform shortens a longer reason to 500 characters and rejects a shorter one with INVALID_ESCALATION_REASON. Priority is low, medium, high, or critical. A trigger can also use a number. The platform maps 0 or less to critical, 1 to high, 2 to medium, and 3 or more to low. An omitted priority becomes medium. A word outside the list in a trigger produces the warning W351 and becomes medium. The platform adds reason and priority to the metadata of every desk transfer. You cannot override these two keys in routing.metadata. routing.priority is a separate number. It sets the priority of the queue entry at the desk.

Context for the human

context_for_human lists session variable names. At escalation time, the platform copies the current value of each listed variable. It stores the copy in the escalation task, in the escalation trace event, and in the input of the CONNECTOR_ACTION call. The list does not go to the desk transfer. To put a value in front of the person at the desk, add it to routing.metadata or, for SmartAssist, routing.user_info. Keep these rules in mind:
  • Each item is a variable name. An item written as key: value or NAME: ... produces the warning W357. The platform still treats the text as a variable name, so the value is missing.
  • The names conversation_history and conversation_summary have no special meaning. They are ordinary variable names. List them only if your agent stores a variable with that name.
  • A listed variable that has no value produces an escalation_context_missing trace event with the field names.
  • An empty list sends only the agent name and the number of conversation turns.

Conversation history

The platform sends the session conversation history with every desk transfer. You do not configure it in ESCALATE. It contains the customer, assistant, and system messages. It leaves out messages that the platform marks as internal. Each desk integration decides how to display it.

What the desk receives automatically

The platform builds a contact card and a context snapshot from the session. You set nothing for these. Name your session variables email, phone, first_name, last_name, and customer_id when you want them on the contact card.

Routing the package

A queue or metadata variable that resolves to nothing sends no value. The platform never sends the literal {{...}} text. Some desks accept more keys, such as named_agents, agent_matching_conditions, sub_type, and provider_config. The receiving integration defines these. See the ESCALATE reference.

Masking and PII

The package carries values in three forms. Treat each form differently. With PII redaction on, the platform stores values that it recognizes as PII, and fields marked sensitive: true, as vault tokens. The default is on in staging and production. If the person needs to read a value, have the CRM tool return a masked value and store that. The compiler warns with ESCALATE_ROUTING_USER_INFO_SENSITIVE_REFERENCE when a user_info template reads a sensitive field. Pass only the fields the person needs. The escalation trace event includes the context fields.

Common variations

Choose the desk by channel

Use a list under routing to send each channel to its own desk. The platform checks the entries in order and uses the first match. Write conditions with fields the platform can evaluate in code, such as system.channel. Free text is a compile error.
Add one trailing entry with WHEN: always. If no entry matches, the platform makes no desk transfer. It does not fall back to the project default connection for a list. The escalation task still exists. Only one default entry is allowed, and it must come last.

Send display context to a SmartAssist desk

Add user_info to a SmartAssist connection. The platform sends the values as display context for the person. Set user_info_in_custom_data: true to copy them into customData.userInfo for flow routing.
The platform limits the package. It keeps at most 30 user_info keys. A key holds up to 64 bytes and a value up to 384 bytes. The whole package stays below 16 KB. The platform drops a value that is empty, unresolved, reserved, or not a scalar. It records only key names and reasons in the handoff_context_keys_dropped trace event, never values. The platform stamps the package with customData.artemis. This stamp holds the session ID, agent name, channel, whether the identity is verified, the identity source, and an update time. Treat the values as a snapshot from the moment of escalation.

Escalate from a flow step

A flow step that ends in THEN: ESCALATE runs the same escalation. The step has no trigger. The platform uses the default reason Escalated via flow step transition and the priority medium when the step carries none.
An agent that reaches a flow ESCALATE step without an ESCALATE block only sets the escalated flag. It reaches no one.

Let the model start the escalation

A trigger WHEN can be a quoted sentence. The model then decides when the sentence is true and calls the escalation tool with a reason and a priority. The model tool exists only when the block has at least one trigger.
The model can pass only reason and priority. If other triggers use conditions the platform can evaluate in code, the platform rejects a model-started escalation when none of those triggers matched. The trace shows ESCALATION_TRIGGER_NOT_MATCHED.

Open a ticket in an ITSM system

CONNECTOR_ACTION calls a connector action when the escalation starts. The call receives the context fields, the reason, the priority, the session ID, and the agent name. The platform stores the returned ticket ID and URL on the escalation task.
Project-local assumption: the project has a connector action named create_servicenow_incident. The call runs in the background with a 30 second limit. A failure is logged and does not stop the escalation.

Voice calls

A voice escalation moves the call itself. It needs routing.voice.call_transfer_type set to sip or pstn. Without it, the escalation fails with ESCALATION_VOICE_NOT_CONFIGURED and the caller stays with the agent. Voice transfer settings are in the ESCALATE reference.

Verification

  1. Validate the project. Check that no W357, W351, or ESCALATE_ROUTING_* warnings remain.
  2. Start a test conversation. Send a message that makes the trigger true, such as a dispute of 800 dollars.
  3. Open the session trace. Find the escalation event. Check the reason, the priority, and the context fields.
  4. Find the escalation_triggered event. The field hasAgentTransfer shows that routing is configured. It does not prove that a transfer started.
  5. Find the agent_transfer_initiated event. Check that success is true. If the event is missing, no transfer started.
  6. At the desk, open the conversation. Check the queue, the priority, the history, the contact card, and the metadata keys.
  7. For a routing list, repeat the test once for each channel. Find the escalation_routing_check events and check which entry matched.
  8. For a SmartAssist desk, find the handoff_context_keys_dropped and handoff_context_pii_suspected events. Check that no expected key is dropped and no key holds personal data.
  9. Rename the connection in a test project. Check that the task exists, that no agent_transfer_initiated event appears, and that later replies start with [HUMAN AGENT]. This shows you the failure path.

Production readiness checklist

  • The project has a human-agent connection, and each connection and queue in ESCALATE exists at the desk.
  • Every variable in context_for_human and routing.metadata has a source: a GATHER field, a tool result, or a SET assignment.
  • A routing list ends with a WHEN: always entry.
  • The desk shows the history, the reason, and the priority for a test escalation on every channel you support.
  • The context_for_human list holds no value the person does not need. The list does not reach the desk, but it reaches the task record, the trace, and the connector action.
  • You know the failure paths. If the desk rejects the transfer, the customer gets the error message and the agent keeps the conversation. If no connection resolves, the escalation still succeeds without a transfer.
  • You tested the case with no available person. Your desk defines the wait behavior with a flow policy.
  • Monitoring watches for escalation_rejected, escalation_routing_no_match, escalation_context_missing, and transfer failure events.

Common mistakes

Troubleshooting