/service-engagement:service-agentforce-human-escalation-configurefrom Salesforce Service Engagement
Configures and verifies Agentforce agent-to-human escalation including handoff queues, fallback routing, and failure thresholds. Idempotent per developer name, refuses production orgs.
Ships in Salesforce Service Engagement. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them; scripts run unread.
Wire an Agentforce agent so it can hand a conversation off to a human agent through an Omni-Channel queue. This skill configures and verifies the escalation surfaces, then reports a single machine-readable JSON verdict. It is idempotent per developer name and refuses to write to production orgs. It runs standalone or as a stage in a larger setup flow (after the agent is created and active).
The agent, queue, outbound flow name, routed context object, service channel, and failure thresholds are all inputs, so the same skill serves any scenario (IT employee support, customer messaging, etc.) — the caller supplies the scenario-specific identifiers.
This skill is the authoritative owner of agent-to-human (outbound) escalation. service-agentforce-channel-configure may wire a basic outbound flow + connection block in the same pass as inbound channel setup, but it delegates full escalation configuration and verification here.
Escalation in Agentforce is assembled from surfaces with different verifiability:
canEscalate=true on the escalation topic (GenAiPlugin); outboundRouteConfigs on the agent's Messaging planner surface (GenAiPlannerBundle), where the SAME block couples outboundRouteName to outboundRouteType=OmniChannelFlow on a Messaging-class surface; a QueueBased outbound RoutingFlow with a non-null ActiveVersionId; a human queue with a QueueSobject for the context object, its QueueRoutingConfig bound to the queue, and at least one active human member (a queue with zero members can never route an escalation to a human, so it never reaches CONFIGURED); and the agent Active after republish.AgentWork creation, and same-session context preservation. These cannot be driven headlessly — they are a documented manual test + eval rubric. See references/runtime-verification.md.Salesforce exposes two Agentforce authoring models, and Phase 1b auto-detects which the org supports from its metadata types. The routing infrastructure (queue, QueueSobject, members, QueueRoutingConfig, outbound RoutingFlow) is identical in both; only the agent-side escalation surface differs.
GenAiPlugin + GenAiPlannerBundle. The agent surface is canEscalate (topic) + outboundRouteConfigs (planner Messaging surface). This surface is authored in Phase 4 (hand-edited, or via the optional AUTHOR_SURFACES=1 pass) and round-trip verified in Phase 7.AiAuthoringBundle (Agent Script) and no GenAiPlannerBundle. There is no outboundRouteConfigs metadata; the agent surface is a reachable @utils.escalate action (Service agents) or a create-record action (Employee agents, which cannot use @utils.escalate), and the queue routing is carried entirely by the deterministic routing half. This skill verifies that surface from the retrieved bundle and delegates its authoring to agentforce-generate.Detection can be pinned with AUTHORING_MODEL_OVERRIDE=classic|nga when both coexist. Full rules, the Service-vs-Employee split, and the NGA verdict set live in references/nga-escalation.md.
canEscalate); wiring outboundRouteConfigs on the GenAiPlannerBundle Messaging surface; deploying the bundled QueueBased outbound RoutingFlow; create-or-adopt of the human queue (QueueSobject for the context object) and its QueueRoutingConfig; authoring the failure-threshold directives; republish + reactivate; and a deterministic config round-trip verdict. Idempotent re-run.sessionHandlerAsa on the MessagingChannel) and the agent's outbound connection block (owned by service-agentforce-channel-configure); provisioning the messaging channel itself (service-digital-engagement-channel-configure); broader Omni-Channel routing infrastructure; standalone queue provisioning outside an escalation context; and any production-org write.| Input | Positional | Env | Default |
|---|---|---|---|
| Org alias | 1 (required) | — | — |
| Agent developer name | 2 | AGENT_DEVELOPER_NAME | Support_Agent |
| Queue developer name | 3 | QUEUE_DEVELOPER_NAME | Human_Support_Queue |
| Escalation topic API name | 4 | ESCALATION_TOPIC_API_NAME | (unset — surface unverified) |
| Planner bundle API name | 5 | PLANNER_BUNDLE_API_NAME | (unset — surface unverified) |
| Outbound flow developer name | — | FLOW_DEVELOPER_NAME | Human_Escalation_Outbound_Flow |
| Outbound flow label | — | FLOW_LABEL | flow name with _ → space |
| Context object (routed sObject) | — | CONTEXT_OBJECT | MessagingSession |
| Service channel dev name / label | — | SERVICE_CHANNEL_DEV_NAME / SERVICE_CHANNEL_LABEL | sfdc_livemessage / Messaging |
| Human members to add if empty | — | QUEUE_MEMBER_USERNAMES | (unset) |
| Failure threshold (consecutive failed attempts before hand-off) | — | DEFAULT_FAILURE_THRESHOLD | 2 |
| Threshold directive authored (out-of-band flag) | — | THRESHOLD_AUTHORED | 0 |
For a non-MessagingSession context object (e.g. Case, VoiceCall), pass the matching SERVICE_CHANNEL_DEV_NAME / SERVICE_CHANNEL_LABEL.
sf CLI installed and authenticated to the target org (sf org display -o <alias> shows Connected). All calls use --target-org <alias>.node ≥ 18 and jq on PATH (the deterministic classifiers and JSON assembly).BotVersion is Active. This skill fails closed if not.MessagingSession handoff, an active MessagingChannel exists. This skill fails closed if none is found. Other context objects use a different transport and are not gated on MessagingChannel.If a precondition fails, sf surfaces the raw error — do not fabricate state; surface it and stop.
Before any write, the orchestrator queries Organization (IsSandbox, TrialExpirationDate, OrganizationType) and computes safe_to_write. If the org is a real production customer org, the skill emits status: "BLOCKED" and stops. This is enforced in scripts/verify-and-configure.sh — never bypass it.
BotDefinition (+ latest BotVersion), classified deterministically by scripts/classify-agent-active.mjs. Not found or inactive → block with the activation click-path.MessagingSession, SOQL MessagingChannel WHERE IsActive=true; zero rows → block with a pointer to service-digital-engagement-channel-configure.Resolve the queue by DeveloperName. If missing, deploy a Queue (canonical Metadata API element order: doesSendEmailToMembers, name, queueSobject) with a QueueSobject for CONTEXT_OBJECT. For an adopted queue missing the binding, add the context object additively via the Data API. Create the QueueRoutingConfig if absent and bind it to the queue (Group.QueueRoutingConfigId), re-querying to confirm the bind persisted.
Members (human routability): the queue must have at least one active human member — otherwise the escalation routes to an empty queue. The skill counts GroupMember rows that resolve to an active User. If there are none and you pass QUEUE_MEMBER_USERNAMES (comma-separated usernames), it validates each against the username grammar up front, resolves the active User, and POSTs the GroupMember; it then re-counts. If the queue still has zero active human members the verdict is INCOMPLETE with queueHasActiveDirectUserMember in missing (an active direct user is necessary — not sufficient — for human routability; full Omni permission-set + presence-status eligibility is proven only at runtime). When there is no eligible member, the skill also skips QueueRoutingConfig binding and outbound-flow activation, so it never wires an empty queue. Use an approved Omni provisioning workflow when richer member reconciliation is required.
Deploy the bundled outbound flow template assets/force-app/main/default/flows/Human_Escalation_Outbound_Flow.flow-meta.xml, substituting the flow name/label, queue DeveloperName, and service-channel tokens. The flow looks the queue up by DeveloperName at runtime (portable, no hardcoded Id). After deploy, FlowDefinitionView.ActiveVersionId must be non-null.
These two edits require per-org topic/bundle discovery, so they are authored explicitly (retrieve → edit → deploy), then verified by the orchestrator when you pass the topic/bundle API names. Follow references/escalation-mechanism.md:
GenAiPlugin), set <canEscalate>true</canEscalate>, deploy.GenAiPlannerBundle, add outboundRouteConfigs (escalationMessage, outboundRouteName=<FLOW_DEVELOPER_NAME>, outboundRouteType=OmniChannelFlow) on the Messaging planner surface, deploy. The verifier couples name + type inside the SAME block on a Messaging-class surface (via scripts/extract-outbound-route.mjs) — a bundle with the right name and an OmniChannelFlow type in unrelated blocks will not pass.The failure threshold and any per-topic overrides are directives, not enforced counters — there is no metadata field that counts failed turns (see references/failure-policy.md). The orchestrator does not write these into the agent; it only renders DEFAULT_FAILURE_THRESHOLD (default 2) into the local directive template assets/escalation-thresholds.instructions.md — pass e.g. DEFAULT_FAILURE_THRESHOLD=3 for a three-attempt scenario — and reports that value under threshold.default_failures (with threshold.directive_rendered) as verdict evidence. Authoring the rendered directive into the agent's Agent Script is a manual/out-of-band step; set THRESHOLD_AUTHORED=1 on the verifier run to record threshold.authored=true. The directive is eval-verified, never a headless runtime read, so it never blocks the deterministic verdict.
After the Phase 4/5 edits, republish and reactivate the agent so they take effect. These are manual operator commands for the hand-edited path; the orchestrator itself only publishes/deactivates/reactivates the agent inside the optional AUTHOR_SURFACES=1 pass (see "Running it"):
sf agent validate authoring-bundle --api-name "$AGENT_DN" --target-org "$ORG" --json
sf agent publish authoring-bundle --api-name "$AGENT_DN" --target-org "$ORG" --json
sf agent activate --api-name "$AGENT_DN" --target-org "$ORG"
The orchestrator round-trips every deterministic surface, assembles an evidence object, and classifies it with scripts/verify-escalation-config.mjs into one of three states so a missing escalation policy can never masquerade as fully configured:
CONFIGURED — all deterministic surfaces satisfied and the failure-threshold directive is authored.ROUTING_CONFIGURED_POLICY_PENDING — routing and the agent escalation surface are verified, but the failure-threshold directive (thresholdAuthored) is not yet confirmed. Author it (AUTHOR_SURFACES=1 / THRESHOLD_AUTHORED=1) and re-run to reach CONFIGURED.INCOMPLETE — one or more deterministic surfaces are missing (see missing[]).Note the NGA escalation-surface detection (scripts/classify-nga-escalation.mjs) is an advisory preflight — it matches for a reachable @utils.escalate / create-record action in the authoring bundle but does not prove runtime reachability from the topic. Treat a passing NGA surface check as a strong signal, not end-to-end runtime proof; confirm the live handoff with the Phase 8 runtime step.
Confirm the conversational trigger, AgentWork creation, and same-session context preservation with a live conversation — see references/runtime-verification.md.
bash scripts/verify-and-configure.sh <org-alias> \
[<agent-developer-name>] [<queue-developer-name>] \
[<escalation-topic-api-name>] [<planner-bundle-api-name>]
FLOW_DEVELOPER_NAME, FLOW_LABEL, CONTEXT_OBJECT, SERVICE_CHANNEL_DEV_NAME, SERVICE_CHANNEL_LABEL, QUEUE_MEMBER_USERNAMES.PLAN_ONLY=1 previews (read-only) and stops before any write.THRESHOLD_AUTHORED=1 marks the directive policy as authored for the verdict.AUTHOR_SURFACES=1 (optional, run mode) — deterministically author the two doc-driven surfaces instead of hand-editing XML, following the Agentforce lifecycle in agentforce-generate/references/known-issues.md (Issue 18): publish (regenerate the compiled bundle) → retrieve the GenAiPlugin topic + GenAiPlannerBundle in metadata format (--target-metadata-dir … --unzip) → deactivate the agent (deploys fail while it is active) → apply a schema-aware, XSD-ordered, loss-less, idempotent patch (scripts/patch-escalation-surfaces.mjs) that sets canEscalate=true (after aiPluginUtterances, before description) and inserts outboundRouteConfigs (outboundRouteType=OmniChannelFlow, before <surface> on a Messaging-class planner surface, targeting the outbound flow) → deploy with --metadata-dir → activate (fail-closed; the agent is never left inactive silently) → re-read the latest BotVersion so the verdict reflects the freshly-authored version. It requires the topic and/or bundle API names, runs only after the membership gate (never wires an empty queue), and refuses (blocks) rather than guess if it cannot find a safe, XSD-ordered patch point. Omit it to keep the skill verify-only.canEscalate and outboundRouteConfigs surfaces are verified only when you pass <escalation-topic-api-name> / <planner-bundle-api-name> (they are authored via the doc-driven edits in Phase 4).Typical two-pass flow: run once to stand up the queue + outbound flow and preconditions; perform the Phase 4/5/6 doc-driven edits; then re-run with the topic + bundle API names and THRESHOLD_AUTHORED=1 to reach CONFIGURED.
A single JSON object to stdout:
{
"skill": "service-agentforce-human-escalation-configure",
"status": "CONFIGURED",
"agent": { "developer_name": "Support_Agent", "active": true },
"queue": { "developer_name": "Human_Support_Queue", "id": "00G...", "active_direct_user_member_count": 1 },
"outbound_flow": { "api_name": "Human_Escalation_Outbound_Flow", "active_version_id": "301..." },
"escalation_topic": "Escalate_To_Human",
"planner_bundle": "Support_Agent",
"config_verification": {
"verdict": "CONFIGURED",
"deterministicPass": true,
"directivePass": true,
"checks": [],
"missing": []
},
"next_steps": [],
"manual_actions": [],
"blocking_issue": null
}
status: CONFIGURED (all deterministic surfaces satisfied), INCOMPLETE (some config_verification.missing), or BLOCKED (bad input / auth / production / precondition; exit 1).CONFIGURED (idempotent).Existing queue, QueueSobject, QueueRoutingConfig, queue members, and an already-active outbound flow are reused, not recreated (members are only added when the queue has zero active members and QUEUE_MEMBER_USERNAMES is supplied; already-present members are left untouched). The doc-driven edits (canEscalate, outboundRouteConfigs) are set-if-absent. A second run against a fully configured org performs no writes and returns CONFIGURED.
Before investigating or changing any of the deterministic Node classifiers referenced above (scripts/classify-agent-active.mjs, scripts/verify-escalation-config.mjs, scripts/extract-outbound-route.mjs, scripts/classify-nga-escalation.mjs), read references/classifier-contracts.md for each one's exact input/output contract.
Run the bundled escalation contract tests after changing this skill or its scripts:
python3 scripts/tests/test_escalation_contracts.py
assets/escalation-thresholds.instructions.md (opens in a new tab)assets/force-app/main/default/flows/Human_Escalation_Outbound_Flow.flow-meta.xml (opens in a new tab)assets/package.xml (opens in a new tab)assets/sfdx-project.json (opens in a new tab)references/_vendored/input-validation.md (opens in a new tab)references/_vendored/queue-resolution.md (opens in a new tab)references/classifier-contracts.md (opens in a new tab)references/escalation-mechanism.md (opens in a new tab)references/failure-policy.md (opens in a new tab)references/nga-escalation.md (opens in a new tab)references/runtime-verification.md (opens in a new tab)scripts/classify-agent-active.mjs (opens in a new tab)scripts/classify-nga-escalation.mjs (opens in a new tab)scripts/extract-outbound-route.mjs (opens in a new tab)scripts/patch-escalation-surfaces.mjs (opens in a new tab)scripts/tests/__init__.py (opens in a new tab)scripts/tests/_bootstrap.py (opens in a new tab)scripts/tests/test_escalation_contracts.py (opens in a new tab)scripts/verify-and-configure.sh (opens in a new tab)scripts/verify-escalation-config.mjs (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub forcedotcom/sf-skills --plugin service-engagement13 skills in this plugin
/service-agentforce-channel-configureWires an existing, active Agentforce agent to a channel by resolving a fallback queue, setting up inbound routing (either PATCH SessionHandlerId on the MessagingChannel, or an inbound RoutingFlow for Voice/Email), and optionally configuring outbound escalation. Use when the user wants to add a channel to an existing agent, connect an agent to a messaging or voice channel, route Voice or Email-to-Case to an Agentforce agent, or set up a fallback queue for an agent channel. Also applies to an existing Help Agent. The channel infrastructure must already exist — this skill adds routing. DO NOT TRIGGER when the agent does not yet exist or still needs Help Agent setup (use agentforce-generate or service-helpagent-coordinate), when setting up Email-to-Case with an agent end-to-end (use service-email-to-case-configure), when creating the MessagingChannel itself (use service-digital-engagement-channel-configure), or when creating an Embedded Service Deployment (use service-digital-engagement-deployment-configure)./service-de-channel-activateActivate an Enhanced `MessagingChannel` (WhatsApp/Apple/Facebook/SMS/RCS) by PATCHing `MessagingChannelUsage.DeploymentStatus` from `Disabled` to `Provisioning` via the REST sobject endpoint. The UDD save-hook dispatches by `MessageType` for the external callout (`WHATS_APP`→Meta `/register`, `FACEBOOK`→`subscribeFacebookPage`, `TEXT`→`registerCsotSms`; Apple/LINE need none), writes the terminal `Active`/`Error`, and flips `IsActive`. Synchronous on the HTTP response — WhatsApp returns 204 after Meta confirms (~15-21s); no-callout channels are near-instant. No Aura RPC, no CSRF cookies. Use to activate an already-inserted Enhanced channel headlessly via REST. Do not use for full end-to-end setup — use `service-de-headless-channel-configure`./service-de-channel-create**INTERNAL USE ONLY — invoked by `service-de-headless-channel-configure`.** Insert an Enhanced messaging `MessagingChannel` (plus child `MessagingChannelUsage` as a free side-effect) of any type — WhatsApp, LINE, Apple Business Chat, Facebook, or SMS. Given a `{MESSAGE_TYPE}` and its inputs, runs the shared preflight → Connect-insert → verify flow, branching only where a type differs. Uses `POST /services/data/v{V}/connect/livemessage/channels` — no Aura session, no shell-stored token. **Invoke `service-de-headless-channel-configure` instead** — it handles insert → route → activate in one flow; replaces the four former per-type creation skills./service-de-channel-routing-configureConfigure routing on a newly-inserted Enhanced `MessagingChannel` so activation will accept it. Given a `{CHANNEL_ID}`, walks through picking a routing type (Omni-Channel Queue, Omni-Flow, Agentforce Service Agent, Digital Worker, or direct User), locates or provisions the target, then PATCHes `SessionHandlerId` (plus `FallbackQueueId` where required). Use between insertion and activation — activation fails server-side with `nullQueueId`/`LiveMessageSetupException` if no valid `SessionHandlerId` is set. Do not use for full end-to-end setup — use `service-de-headless-channel-configure`./service-de-channel-settings-configureConfigure settings on an already-existing Enhanced `MessagingChannel` (any type — WhatsApp, Text/SMS, LINE, Apple, Facebook, EmbeddedMessaging), given its `{CHANNEL_ID}`. Covers five facets: consent (ConsentType + per-language keyword records), automated responses, messaging keywords, session-inactivity timeouts, and pre-chat parameters. Consent + a matching language-keyword record are required for activation's readiness check. TRIGGER when setting or changing settings on a channel that already exists (opt-out keyword, consent type, double opt-in confirmation, initial/help auto-responses, OptIn/OptOut keywords, session-inactivity timeout) — typically between insertion/routing and activation, or on a live channel. DO NOT TRIGGER for creating a new channel (`service-de-channel-create`), deploying a MIAW/EmbeddedMessaging channel from metadata XML (`service-digital-engagement-channel-configure`), setting routing (`service-de-channel-routing-configure`), or activating a channel (`service-de-channel-activate`)./service-de-headless-channel-configureTop-level orchestrator: given a messaging channel type and its inputs, produces an activated Enhanced `MessagingChannel` in the target org — without the Meta/LINE/Apple setup popups. Prompts for `{MESSAGE_TYPE}` if not supplied, then sequences insert → route → consent → activate → requested settings (auto-responses, keywords, session inactivity) via the type-agnostic dispatcher (`service-de-channel-create`) plus the shared routing/settings/activation leaves, and reports every requested setting as configured, not applicable, or failed. Resumes from partial state on re-run. Use to set up an Enhanced channel (WhatsApp, Facebook, LINE, Apple, SMS) end-to-end, bypassing in-org setup popups. Do not use for a single stage of an already-inserted channel — use the matching leaf skill (`service-de-channel-activate`, `service-de-channel-settings-configure`, `service-de-channel-routing-configure`) instead.3 plugins in 2 repositories ship this exact skill · first indexed Nov 14, 2026
Other plugins' skills for the same job