The parameters for creating an invocation context.
Optional Readonlya2aRequest-level metadata passed from an incoming A2A request or caller.
Optional ReadonlyabortOptionalactiveThe running streaming tools of this invocation.
OptionalagentThe agent driving this invocation.
Unset when the root being run is a bare BaseNode — a Workflow
handed straight to the Runner — because there is no agent in play at
that level. Nodes deeper in the graph that are agents get their own
contexts with this set. Mirrors adk-python, whose field is
BaseAgent | BaseNode | None and which passes None on the node path.
Most code reaches this from inside an agent's own execution, where it is
always set; prefer requireAgent there, so a broken invariant
fails by name rather than as a property access on undefined.
Optional ReadonlyartifactOptionalbranchThe branch of the invocation context.
The format is like agent_1.agent_2.agent_3, where agent_1 is the parent of agent_2, and agent_2 is the parent of agent_3.
Branch is used when multiple sub-agents shouldn't see their peer agents' conversation history.
Optional ReadonlycredentialWhether to end this invocation.
Set to true in callbacks or tools to terminate this invocation.
OptionaleventAn optional channel into which a running tool can push events to be interleaved into the agent's output stream. Set by the LLM flow around tool execution so a NodeTool (running a node/workflow) can surface the node's intermediate and interrupt events. Cleared once tools finish.
ReadonlyinvocationThe id of this invocation context.
OptionalisolationWorkflow: the isolation scope of the node this context runs in. Events carrying a different scope are withheld from this agent's LLM request.
Optional ReadonlyliveThe live request queue feeding the model on the bidirectional (live) path.
Set only for invocations started via runner.runLive.
OptionalliveThe most recent session resumption handle observed on the live path. Updated as the server emits resumption updates so a reconnect can restore server-side state instead of replaying history. Mutable by design.
Optional ReadonlymemoryReadonlynodeNesting depth of node-as-tool (NodeTool) executions in this
invocation. Incremented each time a node runs as a tool (via a depth+1
clone), so NodeTool can bound node -> tool -> node recursion.
The manager for keeping track of plugins in this invocation.
OptionalrunConfigurations for live agents under this invocation.
ReadonlysessionThe current session of this invocation context.
Optional ReadonlysessionOptionaltranscriptionCaches necessary, data audio or contents, that are needed by transcription.
Optional ReadonlyuserThe user content that started this invocation.
OptionalworkflowWorkflow: field-resolution scope for {Class.field} /
<Class.field from node> instruction placeholders (set by
LLMAgentWrapper).
The app name of the current session.
The user ID of the current session.
Returns a copy of this context with overrides applied. The spread carries
every own field over (including the shared cost manager), so the copy keeps
a single LLM-call counter for the invocation.
Note: this copies own enumerable fields by value — scalar mutable fields
(e.g. endInvocation) are decoupled from the original, while object-valued
fields (session, …) stay shared by reference.
An invocation context represents the data of a single invocation of an agent.
An invocation: 1. Starts with a user message and ends with a final response. 2. Can contain one or multiple agent calls. 3. Is handled by runner.runAsync().
An invocation runs an agent until it does not request to transfer to another agent.
An agent call: 1. Is handled by agent.runAsync(). 2. Ends when agent.runAsync() ends.
An LLM agent call is an agent with a BaseLLMFlow. An LLM agent call can contain one or multiple steps.
An LLM agent runs steps in a loop until:
endInvocationis set to true by any callbacks or tools.A step:
The summarization of the function response is considered another step, since it is another llm call. A step ends when it's done calling llm and tools, or if
endInvocationis set to true at any time.