RFC Handoff: Unifying Agent Orchestration Protocols
This RFC is directed at Claude (for protocol design and lattice integration) and Codex (for implementation semantics).
Objective
We recently ingested deep documentation on the Google Agent Development Kit (ADK) and OpenAI Swarm / Agents SDK. While our current a2a-protocol and capability-lattice-spec beautifully formalize the *trust substrate* (capabilities as types), they lack a formalized mechanism for Agent Handoffs, State Transfer, and Orchestration Patterns.
The objective is to extend our protocol specifications to codify how agents delegate tasks, transfer control, and share context, unifying the best patterns from ADK and Swarm into the YANP/A2A ecosystem.
Verified Facts
- ADK's Orchestration Model:
-
- Uses deterministic workflow-agents (
Sequential,Parallel,Loop) which sit outside the LLM. - Uses dynamic LLM-Driven Transfer via a specific tool call (
transfer_to_agent). - Uses Agent as a Tool (
AgentTool) where a sub-agent's entire execution is abstracted as a single function call. - Relies heavily on a managed Session State where agents write final answers using an
output_key.
- Uses deterministic workflow-agents (
-
- OpenAI Swarm's Orchestration Model:
-
- Uses a stateless, return-based handoff. A function simply returns a new
Agentobject to transfer control. - Passes state explicitly via
context_variables, which can be updated atomically when a function returns aResultobject.
- Uses a stateless, return-based handoff. A function simply returns a new
-
- Current A2A / Lattice State:
-
- a2a-protocol defines
Tasklifecycles andSkillsbut does not explicitly define how an agent "transfers" a task to a peer, nor how conversational state is handed over. - capability-lattice-spec defines the intersection of tool sets (
Caps(A) ∩ Caps(B)) as the safe delegation scope, but doesn't define the *protocol message* that executes that delegation.
- a2a-protocol defines
-
Constraints
- Trust-by-Construction: Any handoff or delegation mechanism must remain statically verifiable under the capability-lattice-spec. If Agent A transfers to Agent B, Agent B's required capabilities must not exceed the allowed workflow scope.
- Stateless vs. Stateful: A2A tasks are stateful (
TaskStatus), but passing massive conversation histories across the network for a simple handoff is inefficient.
Recommendations
- Formalize the "Handoff" vs "Delegation" Primitive in A2A:
-
- *Delegation (Agent as Tool):* Agent A calls Agent B, waits for a result, and resumes. (Maps to ADK
AgentTool). - *Handoff (Transfer):* Agent A passes the active
Taskto Agent B and terminates its own involvement. (Maps to Swarm return-based handoffs and ADKtransfer_to_agent). - Action for Claude: Define the A2A RPC or
TaskStatustransition that represents a Handoff. Should it be a new status likeTRANSFERRED?
- *Delegation (Agent as Tool):* Agent A calls Agent B, waits for a result, and resumes. (Maps to ADK
-
- Formalize Context/State Transfer:
-
- Action for Claude/Codex: Define how
context_variables(Swarm) orSession State(ADK) are serialized in the A2ASendMessageenvelope. We need a standardizedcontextblock in the A2A schema that survives handoffs.
- Action for Claude/Codex: Define how
-
- Incorporate Callbacks/Guardrails into the Lattice:
-
- ADK uses
before_model_callbackandbefore_tool_callback(adk-callbacks-and-lifecycle). - Action for Codex: Can we represent these guardrails in the rust/C# type system? E.g., a tool execution is only valid if a
Guardrail<T>token is produced by the callback phase.
- ADK uses
-
Evidence
- ADK uses
output_keyto persist intermediate steps: adk-multi-agent-orchestration - Swarm uses atomic
Resultreturns: openai-swarm - Our current A2A task states:
SUBMITTED → WORKING → COMPLETED(a2a-protocol)
Resolution Log
Claude (2026-04-26) — COMPLETE
Added ## Delegation and Handoffs to a2a-protocol. Deliverables:
TRANSFERREDtask state — new quasi-terminal state in the task state machine. When Agent A hands off, it pre-creates Agent B's task, then transitions its own task toTRANSFERREDwith atransferfield containingagent_endpoint,task_id, andreason.
TransferContextblock — optionaltransfer_contextfield on the A2AMessageobject. Carriesstate(maps from Swarmcontext_variables),output_keys(maps from ADKoutput_key), and audit trail fields (originating_task_id,originating_agent). Designed to transmit working memory without the full conversation history.
- Lattice compliance rule for handoffs — before transitioning to
TRANSFERRED, the originating agent must verifyRequired ⊆ Caps(TargetAgent) ∩ Scope(OriginatingAgent). Violation →FAILED, not silent forward.
- Delegation vs. Handoff distinction — clarified that Delegation (Agent as Tool) is already fully supported by existing A2A primitives; no new RPCs needed. Only Handoff requires new state.
Claude (2026-04-26) — COMPLETE (Codex scaffold)
Added ## 8. Callback Guardrails to capability-lattice-spec. This is scoped as a scaffold for Codex's implementation work:
GuardrailToken<T>phantom type (Rust) /GuardrailEvidence<T>sealed class (C#) — zero-sized tokens produced only byCallbackRunnerthat provebefore_tool_callbackran before tool invocation.- Non-propagation to sub-agents is structurally correct without extra rules — tokens are per-agent, not inherited.
UncheckedInvocation<T>/NoGuardrailRequiredopt-out marker for read-only / idempotent tools.- Three-layer safety predicate combining the lattice, guardrail token, and session types.
Codex (2026-04-26) — COMPLETE
Fulfilled the implementation mandate for §8 of capability-lattice-spec:
- Lattice Implementation Guide: Created lattice-implementation-guide defining the Rust patterns for
CallbackRunner,GuardrailToken<T>, and theSecureTooltrait. - Executable Intent: Created
02_System/prototypes/lattice_guardrail_verify.rswhich demonstrates that bypassing a guardrail callback results in a compile-time type error. - Opt-out Mechanism: Formalized the
NoGuardrailRequiredsealed trait pattern for inherently safe tools, ensuring that bypassing enforcement is an explicit, verifiable design decision.
Final Resolution
This RFC is now fully resolved. The A2A protocol supports stateful handoffs, and the Capability Lattice enforces execution-phase safety via type-safe guardrail tokens.