本文へ移動
cccskills
無料GitHub で公開

agentforce-agent-handoff-patterns

Use when designing how an Agentforce agent transfers the conversation to a human agent (Omni-Channel), to another bot/agent, or to an alternate workflow — including context package, deflection, escalation triggers, and user messaging. Triggers: 'agent to human handoff', 'agentforce escalate to omni channel', 'agent to agent handoff', 'transfer conversation with context', 'agent deflection fallback'. NOT for topic scope and selector design — use agentforce/agent-topic-design. NOT for the overall Einstein Bot plus Agentforce estate topology — use architect/conversational-ai-architecture.

インストール方法を見る

含まれるファイル(8)

  • SKILL.md12.0 KB
  • references/examples.md2.5 KB
  • references/gotchas.md8.7 KB
  • references/llm-anti-patterns.md4.8 KB
  • references/metadata-examples.md10.1 KB
  • references/well-architected.md3.8 KB
  • scripts/check_agentforce_agent_handoff_patterns.py2.9 KB
  • templates/handoff-design.md899 B

SKILL.md(原文)

インストールする前に、エージェントに与えられる指示の中身を確認できます。

Agentforce Agent Handoff Patterns

Most agent failures are handoff failures. The agent knew it was stuck, did not have a clean way to transfer the conversation, and either looped, hallucinated, or dumped the user into a cold queue without context. Good handoff design treats the transfer as a first-class capability with its own triggers, its own context schema, and its own messaging — not as "throw an error and let Omni-Channel figure it out."

Three kinds of handoff matter: agent-to-human (Omni-Channel), agent-to-agent (swap persona, specialization, or domain), and agent-to-workflow (spawn a case, route to a Flow, schedule a callback). Each has different mechanics but shares the same design skeleton: trigger → context package → user message → receiver acknowledgment → (optional) hand-back.

Terminology. Subagent is the April 2026 rename of topic. Functionality did not change and the API surface did not rename — the metadata type is still GenAiPlugin, and the skill slug agentforce/agent-topic-design keeps the older word.


Before Starting

  • List the handoff triggers expected for this agent (policy, confidence, scope, authorization, user request).
  • List destinations and what each needs to take the conversation from here.
  • Confirm Omni-Channel queue structure and presence model.
  • Confirm whether hand-back (returning to the agent after human resolution) is a requirement.

Questions to Ask Before Configuring

Ask these before designing any transfer. Each one traces to a gotcha in references/gotchas.md.

QuestionWhy it mattersWhat a good answer addsWhat proper configuration adds over just doing it
"Is the agent built in the legacy builder or in Agent Script?"Legacy agents escalate only through the standard Escalation topic; Agent Script uses @utils.escalate with a connection block (Gotchas 6, 7)The escalation mechanism to configureA transfer that actually routes instead of a custom topic that never does
"Which Omni-Channel flow and queue receive the conversation, and what happens when nobody is available?"Escalation needs a fallback queue for Messaging Session, and a fallback route if the primary is down (Gotchas 1, 9)The flow, the queue, and the fallback behaviourNo customer stranded in a silent wait
"Which conditions trigger a handoff?"The Escalation topic escalates only on explicit request until widened (Gotcha 6)A trigger list across user, confidence, scope, policy, authorization and technicalHandoffs that follow policy, not just "let me speak to a human"
"What must the rep see so the customer does not repeat themselves?"A transcript dump is not a summary (Gotcha 3)The context package fields and where they are writtenA case the rep can act on in seconds
"Does the conversation ever come back to the agent, or move between agents?"Transitions are one way and restart the target; connected subagents are independent agents (Gotchas 4, 5, 12)The hand-back or delegation design, with the variables that carry stateNo repeated questions after a detour
"Which channel and agent type serve the customer?"Only Agentforce Service Agent connects to enhanced Messaging (Gotcha 10)A confirmed channel and agent typeA design that can be connected

Core Concepts

Platform Mechanics

DestinationLegacy builderAgent ScriptSource
Service rep (Omni-Channel)Standard Escalation topic, which routes through its outbound Omni-Channel flow; no custom topic can do this@utils.escalate plus a connection messaging block naming the Omni-Channel flowGenerative AI guide, Agent Topic: Escalation; Agentforce Developer Guide, Utils and Agent Script Blocks
Fallback when the primary route is unavailableBot.defaultOutboundFlow (API 65.0 and later) and a fallback queue for Messaging SessionSameMetadata API reference, Bot; Enhanced Chat example
Another agentMulti-agent configurationconnected_subagent block, used as a reasoning actionAgentforce Developer Guide, Agent Script Blocks
Another subagent in the same agentTopic routing@utils.transition to @subagent.Name (one way)Agentforce Developer Guide, Utils
Workflow (case, callback)Custom action on the Escalation topic or the owning subagentCustom action, then escalate or endGenerative AI guide, Agent Topic: Escalation
End of conversationNot applicable@utils.end_sessionAgentforce Developer Guide, Utils

references/metadata-examples.md shows the context-package action, the Agent Script escalation block and the fallback element to review.

Handoff Trigger Types

  1. User-initiated — "I want to speak to a person."
  2. Confidence-based — agent is unsure after N attempts.
  3. Scope-based — user crossed into a topic this agent does not cover.
  4. Policy-based — refund > threshold, fraud flag, VIP customer.
  5. Authorization-based — action requires manager or regulated approval.
  6. Technical — system unavailable, data missing.

Context Package

The handoff receiver needs:

  • Original user intent and paraphrased summary.
  • Data the agent gathered (account, policy, case numbers).
  • Actions attempted and their outcomes.
  • Why the handoff fired.
  • A conversation transcript link, not the raw transcript in the payload.

Destinations

DestinationUse
Omni-Channel queueHuman agent, with pre-populated case or conversation.
Another Agentforce agentSpecialized persona or different domain.
WorkflowAsync case, Flow, Queue, scheduled callback.
No handoff (refuse + recommend)Sometimes the right answer is "I can't help; here's how."

User Messaging

Every handoff needs an explicit user message that says what is happening and what to expect. "Let me connect you with an agent" is better than silence. Predicted wait time (if known) is better than vague.

Hand-Back

If the agent will resume after human resolution (common in hybrid service models), the hand-back protocol must preserve or summarize what the human did.


Common Patterns

Pattern 1: Structured Escalation To Omni-Channel

On trigger: run a custom action that creates a case with a structured description, then escalate through the Escalation topic's Omni-Channel flow (legacy builder) or @utils.escalate (Agent Script) with an escalation message. The case captures the context package in a standard format.

Pattern 2: Warm Agent-To-Agent Handoff

One agent hands to another without losing conversation continuity. In Agent Script the receiver is a connected_subagent, a complete independent agent, so pass a summary and the variables it needs rather than the verbatim history.

Pattern 3: Confidence-Triggered Escalation

After 2 unsuccessful resolution attempts on the same intent, fire escalation. Avoids infinite loops where the agent keeps retrying the same failing path.

Pattern 4: Authorization Gate Handoff

For actions beyond the agent's authority (e.g. refund > limit), pause, hand to an approver (human or approval process), resume on approval.

Pattern 5: Deflection-With-Recommendation

If no suitable human is available or the query is out-of-scope with no sensible destination, do not queue indefinitely. Provide a clear next-best-action (support link, callback scheduler).


Decision Guidance

SituationRecommended ApproachReason
User explicitly asks for humanImmediate handoff with contextRespect user intent
Agent stuck in a loopConfidence-triggered escalationBreaks infinite retries
Out-of-scope with no destinationDeflection with recommendationDo not park user in void
Refund > thresholdAuthorization-gated handoffCompliance
Specialized domain (e.g. claims vs billing)Agent-to-agent handoffPersona clarity
Queue overloadedCallback scheduling, not queue dumpRespect wait-time expectations

Review Checklist

  • Each handoff trigger has a destination.
  • Context package schema is documented.
  • User message per handoff type is written.
  • Confidence-based escalation is configured.
  • Deflection path exists when no human is available.
  • Hand-back protocol is designed if applicable.

Recommended Workflow

  1. List handoff triggers relevant to this agent.
  2. Map each to a destination.
  3. Design the context package (fields, format, size).
  4. Write user messaging per handoff type.
  5. Implement the transfer mechanism from the Platform Mechanics table: the context-package action, then the Escalation topic flow or @utils.escalate with its connection block, plus the fallback queue and fallback route.
  6. Test in preview with and without an available rep, and verify hand-back works if required.

Salesforce-Specific Gotchas

  1. Escalation needs a fallback queue for the Messaging Session object; without fallbacks, a conversation can wait with no one available.
  2. Case routing by owner vs queue has different audit trails.
  3. Context dumped as raw text into a case description is unsearchable and bloats storage.
  4. Agent-to-agent handoff starts an independent agent: the new agent does not see the previous subagent's instructions.
  5. Hand-back is not automatic; within one agent, transitions are one way and restart the target subagent. UNVERIFIED (2026-10-03): how a session resumes after a human takes over.
  6. In the legacy builder, only the standard Escalation topic can route to service reps.

Proactive Triggers

  • No confidence-based escalation configured → Flag High. Loops likely.
  • Context package is raw transcript dump → Flag Medium. Human agents drown in it.
  • No deflection path when queues are empty → Flag High. Users stuck.
  • Authorization-gated actions with no handoff → Flag Critical. Agent may act outside authority.
  • Hand-back not designed when needed → Flag Medium.

Output Artifacts

ArtifactDescription
Trigger → destination tablePer trigger, where to send
Context package schemaFields and format
User message catalogPer handoff type

Related Skills

  • agentforce/agent-topic-design — subagent scope that informs scope-based handoffs.
  • agentforce/agentforce-guardrails — guardrails that fire authorization handoffs.
  • admin/omni-channel-routing-setup — destination queue design.
  • agentforce/agentforce-service-ai-setup — service-agent integration.
  • agentforce/agentforce-agent-creation: channel connection and activation, which must precede routing.

レビュー

まだレビューはありません。使ってみた感想をお寄せください。

同じリポジトリのスキル

概要と使いどころ

Use this skill when writing test-first, behavior-driven acceptance criteria in Given/When/Then format for a Salesforce user story. Covers happy path, edge cases, negative paths, permission boundaries, and data-state preconditions so the AC block can drive UAT scripts and Apex test design downstream. Trigger keywords: given when then, gherkin, behavior driven AC, test first acceptance criteria, scenario outline, BDD acceptance criteria. NOT for the user-story format itself (use admin/user-story-writing-for-salesforce). NOT for UAT script writing (use admin/uat-test-case-design). NOT for Apex test method generation (use agents/test-class-generator). NOT for high-level UAT planning (use admin/uat-and-acceptance-criteria). More triggers: acceptance criteria record, ac_id, req_id on a criterion, artefact under test, negative case for a rule-type requirement, no-match fall-through criterion, oracle for a Then clause, test type apex flow manual, criteria linter, check_ac_format.py, --manifest-dir.

日本語の概要は準備中です。原文の説明を表示しています。

PranavNagrecha/AwesomeSalesforceSkills192026年10月4日 更新

Task and Event objects: polymorphic WhatId/WhoId, Activity object model, ActivityHistory vs OpenActivity, activity timeline customization, bulk task creation, Einstein Activity Capture boundaries. NOT for turning on EAC or calendar sync — use admin/einstein-activity-capture-setup. NOT for Email-to-Case — use admin/case-management-setup. Covers ActivitiesSettings metadata, enableActivities, shared Task/Event custom fields and FLS, TaskStatus value sets, Shared Activities and TaskRelation/EventRelation, recurring and child activities, and partial-success bulk DML on Task.

日本語の概要は準備中です。原文の説明を表示しています。

PranavNagrecha/AwesomeSalesforceSkills192026年10月4日 更新

Design Invocable Apex actions that return deterministic, agent-friendly errors instead of surfacing raw exceptions to the LLM. NOT for authoring the action itself — @InvocableMethod schema, labels, security context — use agentforce/custom-agent-actions-apex. NOT for the Apex tests that force each error branch — use agentforce/agent-action-unit-tests.

日本語の概要は準備中です。原文の説明を表示しています。

PranavNagrecha/AwesomeSalesforceSkills192026年10月4日 更新

Use when designing how an Agentforce agent extracts structured input parameters (slots) from a user's natural-language utterance to invoke an action. Triggers: 'agent extract date from user', 'agent action argument extraction', 'agentforce slot filling', 'agent invocable input mapping', 'agent fails to fill required parameter'. NOT for action authoring (use agentforce/agent-actions) or for prompt-template variable binding (use agentforce/prompt-builder-templates).

日本語の概要は準備中です。原文の説明を表示しています。

PranavNagrecha/AwesomeSalesforceSkills192026年10月4日 更新

Apex test patterns for @InvocableMethod agent actions: per-reason-code branch coverage, bulk safety, callout mocking, deterministic assertions. NOT for testing whether the agent routes to the right topic or answers well — use agentforce/agent-testing-and-evaluation. NOT for designing the error envelope the tests assert on — use agentforce/agent-action-error-handling.

日本語の概要は準備中です。原文の説明を表示しています。

PranavNagrecha/AwesomeSalesforceSkills192026年10月4日 更新

Designing or reviewing Agentforce actions: Flow actions, Apex invocable actions, prompt-template actions, action naming, input and output contracts, confirmation requirements, and safe error behavior. Triggers: 'agent actions', 'build an agent that can look up an order', 'make the agent able to check order status', 'give the agent a capability', 'agent that can retrieve a record', 'flow action for agent', 'agent invocable action', 'action schema design'. NOT for writing the Apex class itself — use agentforce/custom-agent-actions-apex. NOT for the reason_code error envelope that stops an agent retry loop — use agentforce/agent-action-error-handling.

日本語の概要は準備中です。原文の説明を表示しています。

PranavNagrecha/AwesomeSalesforceSkills192026年10月4日 更新

PranavNagrecha のスキルをすべて見る

このスキルの問題を報告する