# Uses of Class
com.google.adk.agents.InvocationContext

Packages that use InvocationContext
Package
Description
com.google.adk.a2a.agent
com.google.adk.a2a.converters
com.google.adk.agents
com.google.adk.codeexecutors
com.google.adk.flows
com.google.adk.flows.llmflows
com.google.adk.plugins
com.google.adk.plugins.agentanalytics
com.google.adk.telemetry
com.google.adk.tools
com.google.adk.utils

- ## Uses of InvocationContext in com.google.adk.a2a.agent

  Methods in com.google.adk.a2a.agent with parameters of type InvocationContext
  Modifier and Type
  Method
  Description
  `protected io.reactivex.rxjava3.core.Flowable<Event>`
  RemoteA2AAgent.`runAsyncImpl(InvocationContext invocationContext)`
  `protected io.reactivex.rxjava3.core.Flowable<Event>`
  RemoteA2AAgent.`runLiveImpl(InvocationContext invocationContext)`

- ## Uses of InvocationContext in com.google.adk.a2a.converters

  Methods in com.google.adk.a2a.converters with parameters of type InvocationContext
  Modifier and Type
  Method
  Description
  `static Event`
  ResponseConverter.`artifactToEvent(io.a2a.spec.Artifact artifact, InvocationContext invocationContext)`
  Converts an artifact to an ADK event.
  `static Optional<Event>`
  ResponseConverter.`clientEventToEvent(io.a2a.client.ClientEvent event, InvocationContext invocationContext)`
  Converts a A2A `ClientEvent` to an ADK `Event`, based on the event type.
  `static com.google.common.collect.ImmutableList<io.a2a.spec.Part<?>>`
  EventConverter.`messagePartsFromContext(InvocationContext context)`
  Returns the parts from the context events that should be sent to the agent.
  `static Event`
  ResponseConverter.`messageToEvent(io.a2a.spec.Message message, InvocationContext invocationContext)`
  Converts an A2A message back to ADK events.
  `static Event`
  ResponseConverter.`messageToEvent(io.a2a.spec.Message message, InvocationContext invocationContext, boolean isPending)`
  Converts an A2A message back to ADK events.
  `static Event`
  ResponseConverter.`messageToFailedEvent(io.a2a.spec.Message message, InvocationContext invocationContext)`
  Converts an A2A message for a failed task to ADK event filling in the error message.
  `static Event`
  ResponseConverter.`taskToEvent(io.a2a.spec.Task task, InvocationContext invocationContext)`
  Converts an A2A `Task` to an ADK `Event`.

- ## Uses of InvocationContext in com.google.adk.agents

  Fields in com.google.adk.agents declared as InvocationContext
  Modifier and Type
  Field
  Description
  `protected final InvocationContext`
  ReadonlyContext.`invocationContext`
  Methods in com.google.adk.agents that return InvocationContext
  Modifier and Type
  Method
  Description
  `InvocationContext`
  InvocationContext.Builder.`build()`
  Builds the `InvocationContext` instance.
  `InvocationContext`
  PlanningContext.`invocationContext()`
  Returns the full `InvocationContext` for advanced use cases.
  `InvocationContext`
  ReadonlyContext.`invocationContext()`
  Returns the invocation context.
  Methods in com.google.adk.agents with parameters of type InvocationContext
  Modifier and Type
  Method
  Description
  `io.reactivex.rxjava3.core.Maybe<Map<String,Object>>`
  Callbacks.AfterToolCallback.`call(InvocationContext invocationContext, BaseTool baseTool, Map<String,Object> input, ToolContext toolContext, Object response)`
  Async callback after tool runs.
  `Optional<Map<String,Object>>`
  Callbacks.AfterToolCallbackSync.`call(InvocationContext invocationContext, BaseTool baseTool, Map<String,Object> input, ToolContext toolContext, Object response)`
  `io.reactivex.rxjava3.core.Maybe<Map<String,Object>>`
  Callbacks.BeforeToolCallback.`call(InvocationContext invocationContext, BaseTool baseTool, Map<String,Object> input, ToolContext toolContext)`
  Async callback before tool runs.
  `Optional<Map<String,Object>>`
  Callbacks.BeforeToolCallbackSync.`call(InvocationContext invocationContext, BaseTool baseTool, Map<String,Object> input, ToolContext toolContext)`
  `io.reactivex.rxjava3.core.Maybe<Map<String,Object>>`
  Callbacks.OnToolErrorCallback.`call(InvocationContext invocationContext, BaseTool baseTool, Map<String,Object> input, ToolContext toolContext, Exception error)`
  Async callback when tool call fails.
  `Optional<Map<String,Object>>`
  Callbacks.OnToolErrorCallbackSync.`call(InvocationContext invocationContext, BaseTool baseTool, Map<String,Object> input, ToolContext toolContext, Exception error)`
  `io.reactivex.rxjava3.core.Flowable<Event>`
  BaseAgent.`runAsync(InvocationContext parentContext)`
  Runs the agent asynchronously.
  `protected abstract io.reactivex.rxjava3.core.Flowable<Event>`
  BaseAgent.`runAsyncImpl(InvocationContext invocationContext)`
  Agent-specific asynchronous logic.
  `protected io.reactivex.rxjava3.core.Flowable<Event>`
  LlmAgent.`runAsyncImpl(InvocationContext invocationContext)`
  `protected io.reactivex.rxjava3.core.Flowable<Event>`
  LoopAgent.`runAsyncImpl(InvocationContext invocationContext)`
  `protected io.reactivex.rxjava3.core.Flowable<Event>`
  ParallelAgent.`runAsyncImpl(InvocationContext invocationContext)`
  Runs sub-agents in parallel and emits their events.
  `protected io.reactivex.rxjava3.core.Flowable<Event>`
  PlannerAgent.`runAsyncImpl(InvocationContext invocationContext)`
  `protected io.reactivex.rxjava3.core.Flowable<Event>`
  SequentialAgent.`runAsyncImpl(InvocationContext invocationContext)`
  Runs sub-agents sequentially.
  `io.reactivex.rxjava3.core.Flowable<Event>`
  BaseAgent.`runLive(InvocationContext parentContext)`
  Runs the agent synchronously.
  `protected abstract io.reactivex.rxjava3.core.Flowable<Event>`
  BaseAgent.`runLiveImpl(InvocationContext invocationContext)`
  Agent-specific synchronous logic.
  `protected io.reactivex.rxjava3.core.Flowable<Event>`
  LlmAgent.`runLiveImpl(InvocationContext invocationContext)`
  `protected io.reactivex.rxjava3.core.Flowable<Event>`
  LoopAgent.`runLiveImpl(InvocationContext invocationContext)`
  `protected io.reactivex.rxjava3.core.Flowable<Event>`
  ParallelAgent.`runLiveImpl(InvocationContext invocationContext)`
  Not supported for ParallelAgent.
  `protected io.reactivex.rxjava3.core.Flowable<Event>`
  PlannerAgent.`runLiveImpl(InvocationContext invocationContext)`
  `protected io.reactivex.rxjava3.core.Flowable<Event>`
  SequentialAgent.`runLiveImpl(InvocationContext invocationContext)`
  Runs sub-agents sequentially in live mode.
  Constructors in com.google.adk.agents with parameters of type InvocationContext
  Modifier
  Constructor
  Description
  ``
  `CallbackContext(InvocationContext invocationContext, EventActions eventActions)`
  Initializes callback context.
  ``
  `CallbackContext(InvocationContext invocationContext, EventActions eventActions, String eventId)`
  Initializes callback context.
  ``
  `PlanningContext(InvocationContext invocationContext, com.google.common.collect.ImmutableList<BaseAgent> availableAgents)`
  ``
  `ReadonlyContext(InvocationContext invocationContext)`

- ## Uses of InvocationContext in com.google.adk.codeexecutors

  Methods in com.google.adk.codeexecutors with parameters of type InvocationContext
  Modifier and Type
  Method
  Description
  `abstract CodeExecutionUtils.CodeExecutionResult`
  BaseCodeExecutor.`executeCode(InvocationContext invocationContext, CodeExecutionUtils.CodeExecutionInput codeExecutionInput)`
  Executes code and return the code execution result.
  `CodeExecutionUtils.CodeExecutionResult`
  BuiltInCodeExecutor.`executeCode(InvocationContext invocationContext, CodeExecutionUtils.CodeExecutionInput codeExecutionInput)`
  `CodeExecutionUtils.CodeExecutionResult`
  ContainerCodeExecutor.`executeCode(InvocationContext invocationContext, CodeExecutionUtils.CodeExecutionInput codeExecutionInput)`
  `CodeExecutionUtils.CodeExecutionResult`
  VertexAiCodeExecutor.`executeCode(InvocationContext invocationContext, CodeExecutionUtils.CodeExecutionInput codeExecutionInput)`

- ## Uses of InvocationContext in com.google.adk.flows

  Methods in com.google.adk.flows with parameters of type InvocationContext
  Modifier and Type
  Method
  Description
  `io.reactivex.rxjava3.core.Flowable<Event>`
  BaseFlow.`run(InvocationContext invocationContext)`
  Run this flow.
  `default io.reactivex.rxjava3.core.Flowable<Event>`
  BaseFlow.`runLive(InvocationContext invocationContext)`

- ## Uses of InvocationContext in com.google.adk.flows.llmflows

  Methods in com.google.adk.flows.llmflows with parameters of type InvocationContext
  Modifier and Type
  Method
  Description
  `static Event`
  OutputSchema.`createFinalModelResponseEvent(InvocationContext context, String jsonResponse)`
  Create a final model response event from set_model_response JSON.
  `static Optional<Event>`
  Functions.`generateRequestConfirmationEvent(InvocationContext invocationContext, Event functionCallEvent, Event functionResponseEvent)`
  Generates a request confirmation event from a function response event.
  `static io.reactivex.rxjava3.core.Maybe<Event>`
  Functions.`handleFunctionCalls(InvocationContext invocationContext, Event functionCallEvent, Map<String,BaseTool> tools)`
  Handles standard, non-streaming function calls.
  `static io.reactivex.rxjava3.core.Maybe<Event>`
  Functions.`handleFunctionCalls(InvocationContext invocationContext, Event functionCallEvent, Map<String,BaseTool> tools, Map<String, ToolConfirmation> toolConfirmations)`
  Handles standard, non-streaming function calls with tool confirmations.
  `static io.reactivex.rxjava3.core.Maybe<Event>`
  Functions.`handleFunctionCallsLive(InvocationContext invocationContext, Event functionCallEvent, Map<String,BaseTool> tools)`
  Handles function calls in a live/streaming context, supporting background execution and stream termination.
  `static io.reactivex.rxjava3.core.Maybe<Event>`
  Functions.`handleFunctionCallsLive(InvocationContext invocationContext, Event functionCallEvent, Map<String,BaseTool> tools, Map<String, ToolConfirmation> toolConfirmations)`
  Handles function calls in a live/streaming context with tool confirmations, supporting background execution and stream termination.
  `protected io.reactivex.rxjava3.core.Flowable<Event>`
  BaseLlmFlow.`postprocess(InvocationContext context, Event baseEventForLlmResponse, LlmRequest llmRequest, LlmResponse llmResponse, io.opentelemetry.context.Context parentContext)`
  Post-processes the LLM response after receiving it from the LLM.
  `io.reactivex.rxjava3.core.Single<RequestProcessor.RequestProcessingResult>`
  AgentTransfer.`processRequest(InvocationContext context, LlmRequest request)`
  `io.reactivex.rxjava3.core.Single<RequestProcessor.RequestProcessingResult>`
  Basic.`processRequest(InvocationContext context, LlmRequest request)`
  `io.reactivex.rxjava3.core.Single<RequestProcessor.RequestProcessingResult>`
  Compaction.`processRequest(InvocationContext context, LlmRequest request)`
  `io.reactivex.rxjava3.core.Single<RequestProcessor.RequestProcessingResult>`
  Contents.`processRequest(InvocationContext context, LlmRequest request)`
  `io.reactivex.rxjava3.core.Single<RequestProcessor.RequestProcessingResult>`
  Identity.`processRequest(InvocationContext context, LlmRequest request)`
  `io.reactivex.rxjava3.core.Single<RequestProcessor.RequestProcessingResult>`
  Instructions.`processRequest(InvocationContext context, LlmRequest request)`
  `io.reactivex.rxjava3.core.Single<RequestProcessor.RequestProcessingResult>`
  OutputSchema.`processRequest(InvocationContext context, LlmRequest request)`
  `io.reactivex.rxjava3.core.Single<RequestProcessor.RequestProcessingResult>`
  RequestConfirmationLlmRequestProcessor.`processRequest(InvocationContext invocationContext, LlmRequest llmRequest)`
  `io.reactivex.rxjava3.core.Single<RequestProcessor.RequestProcessingResult>`
  RequestProcessor.`processRequest(InvocationContext context, LlmRequest request)`
  Process the LLM request as part of the pre-processing stage.
  `io.reactivex.rxjava3.core.Single<ResponseProcessor.ResponseProcessingResult>`
  ResponseProcessor.`processResponse(InvocationContext context, LlmResponse response)`
  Process the LLM response as part of the post-processing stage.
  `io.reactivex.rxjava3.core.Flowable<Event>`
  BaseLlmFlow.`run(InvocationContext invocationContext)`
  Executes the full LLM flow by repeatedly calling `BaseLlmFlow.runOneStep(Context, InvocationContext)` until a final response is produced.
  `io.reactivex.rxjava3.core.Flowable<Event>`
  BaseLlmFlow.`runLive(InvocationContext invocationContext)`
  Executes the LLM flow in streaming mode.

- ## Uses of InvocationContext in com.google.adk.plugins

  Methods in com.google.adk.plugins with parameters of type InvocationContext
  Modifier and Type
  Method
  Description
  `io.reactivex.rxjava3.core.Completable`
  LoggingPlugin.`afterRunCallback(InvocationContext invocationContext)`
  `default io.reactivex.rxjava3.core.Completable`
  Plugin.`afterRunCallback(InvocationContext invocationContext)`
  Callback executed after an ADK runner run has completed.
  `io.reactivex.rxjava3.core.Completable`
  PluginManager.`afterRunCallback(InvocationContext invocationContext)`
  `io.reactivex.rxjava3.core.Completable`
  ReplayPlugin.`afterRunCallback(InvocationContext invocationContext)`
  `io.reactivex.rxjava3.core.Maybe<com.google.genai.types.Content>`
  LoggingPlugin.`beforeRunCallback(InvocationContext invocationContext)`
  `default io.reactivex.rxjava3.core.Maybe<com.google.genai.types.Content>`
  Plugin.`beforeRunCallback(InvocationContext invocationContext)`
  Callback executed before the ADK runner runs.
  `io.reactivex.rxjava3.core.Maybe<com.google.genai.types.Content>`
  PluginManager.`beforeRunCallback(InvocationContext invocationContext)`
  `io.reactivex.rxjava3.core.Maybe<com.google.genai.types.Content>`
  ReplayPlugin.`beforeRunCallback(InvocationContext invocationContext)`
  `io.reactivex.rxjava3.core.Maybe<Event>`
  LoggingPlugin.`onEventCallback(InvocationContext invocationContext, Event event)`
  `default io.reactivex.rxjava3.core.Maybe<Event>`
  Plugin.`onEventCallback(InvocationContext invocationContext, Event event)`
  Callback executed after an event is yielded from runner.
  `io.reactivex.rxjava3.core.Maybe<Event>`
  PluginManager.`onEventCallback(InvocationContext invocationContext, Event event)`
  `io.reactivex.rxjava3.core.Maybe<com.google.genai.types.Content>`
  LoggingPlugin.`onUserMessageCallback(InvocationContext invocationContext, @Nullable com.google.genai.types.Content userMessage)`
  `default io.reactivex.rxjava3.core.Maybe<com.google.genai.types.Content>`
  Plugin.`onUserMessageCallback(InvocationContext invocationContext, com.google.genai.types.Content userMessage)`
  Callback executed when a user message is received before an invocation starts.
  `io.reactivex.rxjava3.core.Maybe<com.google.genai.types.Content>`
  PluginManager.`onUserMessageCallback(InvocationContext invocationContext, com.google.genai.types.Content userMessage)`
  `io.reactivex.rxjava3.core.Maybe<com.google.genai.types.Content>`
  PluginManager.`runBeforeRunCallback(InvocationContext invocationContext)`
  `io.reactivex.rxjava3.core.Maybe<com.google.genai.types.Content>`
  PluginManager.`runOnUserMessageCallback(InvocationContext invocationContext, com.google.genai.types.Content userMessage)`

- ## Uses of InvocationContext in com.google.adk.plugins.agentanalytics

  Methods in com.google.adk.plugins.agentanalytics with parameters of type InvocationContext
  Modifier and Type
  Method
  Description
  `io.reactivex.rxjava3.core.Completable`
  BigQueryAgentAnalyticsPlugin.`afterRunCallback(InvocationContext invocationContext)`
  `io.reactivex.rxjava3.core.Maybe<com.google.genai.types.Content>`
  BigQueryAgentAnalyticsPlugin.`beforeRunCallback(InvocationContext invocationContext)`
  `void`
  TraceManager.`ensureInvocationSpan(InvocationContext context)`
  `String`
  TraceManager.`getTraceId(InvocationContext context)`
  `void`
  TraceManager.`initTrace(InvocationContext context)`
  `io.reactivex.rxjava3.core.Maybe<Event>`
  BigQueryAgentAnalyticsPlugin.`onEventCallback(InvocationContext invocationContext, Event event)`
  `io.reactivex.rxjava3.core.Maybe<com.google.genai.types.Content>`
  BigQueryAgentAnalyticsPlugin.`onUserMessageCallback(InvocationContext invocationContext, com.google.genai.types.Content userMessage)`

- ## Uses of InvocationContext in com.google.adk.telemetry

  Methods in com.google.adk.telemetry with parameters of type InvocationContext
  Modifier and Type
  Method
  Description
  `static <T> Tracing.TracerProvider<T>`
  Tracing.`traceAgent(String spanName, String agentName, String agentDescription, InvocationContext invocationContext)`
  Returns a transformer that traces an agent invocation.
  `static void`
  Tracing.`traceAgentInvocation(io.opentelemetry.api.trace.Span span, String agentName, String agentDescription, InvocationContext invocationContext)`
  Sets span attributes immediately available on agent invocation according to OTEL semconv version 1.37.
  `static void`
  Tracing.`traceCallLlm(io.opentelemetry.api.trace.Span span, InvocationContext invocationContext, String eventId, LlmRequest llmRequest, LlmResponse llmResponse, @Nullable Exception error)`
  Traces a call to the LLM.
  `static void`
  Tracing.`traceSendData(io.opentelemetry.api.trace.Span span, InvocationContext invocationContext, String eventId, List<com.google.genai.types.Content> data)`
  Traces the sending of data (history or new content) to the agent/model.

- ## Uses of InvocationContext in com.google.adk.tools

  Methods in com.google.adk.tools with parameters of type InvocationContext
  Modifier and Type
  Method
  Description
  `static ToolContext.Builder`
  ToolContext.`builder(InvocationContext invocationContext)`
  `io.reactivex.rxjava3.core.Flowable<Map<String,Object>>`
  FunctionTool.`callLive(Map<String,Object> args, ToolContext toolContext, InvocationContext invocationContext)`

- ## Uses of InvocationContext in com.google.adk.utils

  Methods in com.google.adk.utils with parameters of type InvocationContext
  Modifier and Type
  Method
  Description
  `static io.reactivex.rxjava3.core.Single<String>`
  InstructionUtils.`injectSessionState(InvocationContext context, String template)`
  Populates placeholders in an instruction template string with values from the session state or loaded artifacts.