Skip to main content
Move a call between agents and let agents talk to each other: handoff helpers for transferring control, and agent-to-agent (A2A) messaging primitives.

agent_switch

Build a handoff instruction that transfers control to another agent. Produces a dictionary keyed by the agent-switch marker, suitable for signalling the runtime that the active agent should change.
to
str
required
Name of the target agent to switch to.
from_
str
default:""
Name of the agent initiating the switch. Omitted from the payload when empty.
reason
str
default:""
Optional human-readable explanation for the switch. Omitted from the payload when empty.
inherit_context
bool
default:"True"
Whether the target agent should inherit the current conversation context. Defaults to True.
extra
dict | None
Additional top-level keys merged into the returned dictionary.
returns
dict
A dictionary containing the agent-switch payload, with any extra keys merged in at the top level.

AGENT_SWITCH_KEY


AgentCard

Descriptor advertising an agent’s identity and capabilities.

Fields

agent_id
str
default:""
Unique identifier for the agent.
name
str
default:""
Human-readable name of the agent.
description
str
default:""
Description of what the agent does.
capabilities
List[str]
default:"…"
List of capabilities the agent provides.
metadata
Dict[str, Any]
default:"…"
Arbitrary additional metadata about the agent.

A2AMessage

A message exchanged between two agents.

Fields

source_agent_id
str
default:""
Identifier of the sending agent.
target_agent_id
str
default:""
Identifier of the receiving agent.
message_type
str
default:"text"
Type discriminator for the message (e.g. 'text').
payload
Dict[str, Any]
default:"…"
Message contents keyed by field name.