Class CallbackContext

Direct Known Subclasses:
ToolContext

public class CallbackContext extends Context
The context of various callbacks for an agent invocation.

Extends Context for backward compatibility; agent and model callback signatures still use this type.

  • Constructor Details

    • CallbackContext

      public CallbackContext(InvocationContext invocationContext, @Nullable EventActions eventActions)
      Initializes callback context.
      Parameters:
      invocationContext - Current invocation context.
      eventActions - Callback event actions, or null for new empty ones.
    • CallbackContext

      public CallbackContext(InvocationContext invocationContext, @Nullable EventActions eventActions, @Nullable String eventId)
      Initializes callback context.
      Parameters:
      invocationContext - Current invocation context.
      eventActions - Callback event actions, or null for new empty ones.
      eventId - The ID of the event associated with this context, or null if there is none.
    • CallbackContext

      @Experimental protected CallbackContext(InvocationContext invocationContext, @Nullable EventActions eventActions, @Nullable String eventId, @Nullable com.google.genai.types.Schema stateSchema)
      Initializes a callback context whose Context.state() checks writes against stateSchema, if given, as a workflow node's does: it stores converted values and throws StateSchemaException on a mismatch or undeclared key.