agents library
Agent runtime, orchestration flows, planners, runners, apps, events, and types.
Provides BaseAgent, LlmAgent, SequentialAgent, ParallelAgent, LoopAgent, Runner, and InMemoryRunner for building and executing single-agent and multi-agent systems.
import 'package:adk_dart/agents.dart';
final agent = LlmAgent(
name: 'assistant',
model: 'gemini-2.5-flash',
instruction: 'Answer user questions concisely.',
);
Classes
- A2aBeforeRequestResult
- Result type returned by before-request interceptors.
- A2aClient
- Transport client interface for A2A message exchange.
- A2aClientCallContext
- Mutable call context passed to A2A client transports.
- A2aClientFactory
- Factory interface for creating A2aClient instances.
- A2aRemoteAgentConfig
- Configuration for RemoteA2aAgent.
- A2aRequestInterceptor
- Interceptor bundle for before/after A2A request processing.
- A2aRequestParametersConfig
- Additional request parameters for A2A transport calls.
- ActiveBackgroundTool
- One tool call running in the background of a live invocation.
- ActiveNonBlockingToolTasksView
-
Live
MapBaseview of non-blocking tool tasks backed by InvocationContext.activeBackgroundTools. - ActiveStreamingTool
- Tracks the active async task and optional live stream for a tool call.
- ActiveStreamingToolsView
-
Live
MapBaseview of streaming tools backed by InvocationContext.activeBackgroundTools. - ActivityEvent
- Generic activity or status event.
- AdkAbortController
- Controller used by callers to cancel an ADK invocation.
- AdkAbortSignal
- Read-only cancellation signal propagated through an invocation.
- AgentConfig
- Wrapper for a parsed root BaseAgentConfig.
- AgentConfigResolvers
- Resolver bundle used while constructing agents from config.
- AgentRefConfig
- Reference to a sub-agent via config path or code reference.
- AgentTransferLlmRequestProcessor
- Injects transfer instructions/tool declarations into LLM requests.
- App
- App container describing root agent, plugins, and runtime options.
- ArgumentConfig
- Named or positional argument configuration.
- AudioTranscriber
- Converts cached audio/transcription entries into textual Content turns.
- AutoFlow
- Default flow that adds automatic agent-transfer request processing.
- BaseAgent
- Base class for all agent implementations.
- BaseAgentConfig
- Common configuration fields shared across agent types.
- BaseAgentState
- Generic mutable state holder for agent-local state.
- BaseEventsSummarizer
- Base interface for event summarizers.
- BaseLlmFlow
- Core LLM flow coordinator for request/response processing and tool loops.
- BaseLlmRequestProcessor
- Contract for preprocessing a model request into emitted events.
- BaseLlmResponseProcessor
- Contract for postprocessing a model response into emitted events.
- BasePlanner
- Defines planner hooks that can adjust model requests and responses.
- BasicLlmRequestProcessor
- Populates baseline request fields from agent configuration.
- BranchPath
- Hierarchical path representation for dynamic execution branches.
- BuiltInPlanner
- Planner that injects a fixed thinking configuration into model requests.
- CallbackInfo
- Metadata describing the currently executing callback.
- CallCodeEvent
- Request to execute code.
- CodeConfig
- Callable code reference and arguments.
- CodeExecutionRequestProcessor
- Normalizes code execution results and data files before request submission.
- CodeExecutionResponseProcessor
- Executes fenced code blocks returned by the model.
- CodeResultEvent
- Result of code execution.
- CompactionRequestProcessor
- Runs token-threshold compaction before contents are prepared.
- Content
- One conversation turn consisting of a role and Part list.
- ContentEvent
- User-visible text content.
- ContentsLlmRequestProcessor
- Builds request contents from session events with ADK-level filtering.
- Context
- Mutable context for a single agent invocation.
- ContextCacheConfig
- Context-cache policy settings for an agent/app.
- ContextCacheRequestProcessor
- Enables context-cache config and cache metadata reuse on requests.
- DefaultA2aClientFactory
- Default client factory that creates HTTP JSON-RPC / SSE transport clients.
- DynamicInstructionsLlmRequestProcessor
- Request processor that folds tool-contributed dynamic instructions into the request after tools have been resolved.
- ErrorEvent
- Runtime error event.
- Event
- One runtime event emitted during an invocation.
- EventActions
- Mutable action payload attached to one event.
- EventCompaction
- Compaction summary metadata attached to an event.
- EventsCompactionConfig
- Configuration for event compaction behavior.
- FileData
- File reference payload attached to a Part.
- FinishedEvent
- Final response marker.
- FinishTaskTool
- Tool that validates final task output and signals completion.
- FunctionCall
- Function-call payload emitted by model responses.
- FunctionResponse
- Function-response payload sent back to the model.
- GoogleCloudSpeechRestRecognizer
- Pure-Dart REST recognizer backed by Google Cloud Speech-to-Text v1 API.
- HttpA2aClient
- Pure-Dart HTTP JSON-RPC 2.0 and SSE transport client for A2A agents.
- IdentityLlmRequestProcessor
- Adds framework-provided agent identity instructions.
- InlineData
- Inline binary payload attached to a Part.
- InMemoryRunner
- Runner wired with in-memory session and artifact services.
- InstructionsLlmRequestProcessor
- Appends global/static/dynamic instructions into the LLM request.
- InteractionsRequestProcessor
- Extracts previous interaction id for stateful interaction APIs.
- InvocationContext
- Mutable invocation context shared across agent execution steps.
- LangGraphAgent
- Agent that delegates response generation to LangGraph.
- LangGraphMessage
- A single message sent to or received from LangGraph.
- LiveActivityEnd
- Marker indicating the end of a live activity segment.
- LiveActivityStart
- Marker indicating the start of a live activity segment.
- LiveFunctionResponseQueue
- FIFO event queue used to collect finished live background tool responses.
- LiveRequest
- A single queued live request payload.
- LiveRequestQueue
- In-memory FIFO queue for live requests.
- LlmAgent
- Core LLM agent that drives model and tool orchestration flows.
- LlmAgentConfig
- LLM agent-specific configuration fields.
- LlmEventSummarizer
- Summarizes event history into a compaction event using an LLM.
- LoopAgent
- Workflow agent that iterates through sub-agents repeatedly.
- LoopAgentConfig
- Loop agent configuration fields.
- LoopAgentState
- Serialized resumability state for LoopAgent.
- ManagedAgent
- An agent backed by the Managed Agents API (interactions.create).
- McpInstructionProvider
- Instruction provider that resolves prompts from MCP resources.
- NodeInfo
- Workflow node metadata attached to an Event.
- NodePathBuilder
- Represents a path to a node in a hierarchical workflow.
- OpenInterrupt
- Represents an open, unanswered interrupt in an event stream.
- OutputSchemaRequestProcessor
- Handles output schema when the agent also has tools.
- ParallelAgent
- Workflow agent that runs sub-agents concurrently.
- ParallelAgentConfig
- Parallel agent configuration fields.
- Part
- One multimodal content part within a Content turn.
- PersistBarrier
- Lets multi-step LLM flows wait until the runner has persisted step events.
- PlanningRequest
- Legacy utility planner retained for compatibility with early adk_dart APIs.
- PlanningResult
- Result of RuleBasedPlanner.plan.
- PlanningStep
- One human-readable planning step.
- PlanReActPlanner
- Planner that enforces a Plan-ReAct style prompt/response contract.
- ReadonlyContext
- Immutable view over InvocationContext data.
- RealtimeCacheConfig
- Configuration for RealtimeCacheManager.
- RealtimeCacheEntry
- One cached realtime audio chunk with role and timestamp metadata.
- RealtimeCacheManager
- Manages input/output realtime audio and visual caches for live flows.
- RemoteA2aAgent
- Agent that forwards user/context messages to a remote A2A endpoint.
- RequestConfirmationLlmRequestProcessor
-
Resumes tool calls after user answers
adk_request_confirmation. - RequestInput
- Data used to request additional user input from a workflow or agent.
- ResumabilityConfig
- Resumability settings for an app.
- RuleBasedPlanner
- Generates a fixed heuristic plan from a high-level request.
- RunConfig
- Configuration object controlling one agent run behavior.
- Runner
- Coordinates session lifecycle, plugins, and agent execution.
- SequentialAgent
- Workflow agent that runs sub-agents one-by-one.
- SequentialAgentConfig
- Sequential agent configuration fields.
- SequentialAgentState
- Serialized resumability state for SequentialAgent.
- SingleFlow
- Standard single-agent flow wiring request and response processors.
- StructuredEvent
- Base class for typed structured events.
- TaskRequest
- A request to delegate work to a task agent.
- TaskResult
- Result returned by a task agent after completion.
- ThoughtEvent
- Reasoning text emitted by the model.
- ToolCallEvent
- Request to execute a tool.
- ToolConfirmationEvent
- Request for user confirmation of tool calls.
- ToolResultEvent
- Result returned by a tool.
- ToolThreadPoolConfig
- Thread-pool configuration for concurrent tool execution.
- TranscriptionEntry
- One transcription entry containing audio/text payload data.
- TranscriptionManager
- Builds and tracks transcription events in live flows.
- TransferTargetInfo
- Metadata describing an agent transfer target.
- UiWidget
- Provider-specific UI widget payload.
- VoiceActivity
- Voice activity event payload received from Live bidirectional stream.
Enums
- CallbackType
- Identifies the lifecycle stage of an executing callback.
- EventType
- Categories emitted by toStructuredEvents.
- FunctionResponseScheduling
- Controls when a function response should be scheduled and delivered during Live mode.
- LangGraphMessageRole
- Supported LangGraph chat message roles.
- ServiceTier
- Serving tiers the Gemini/interactions API offers for a model call.
- StreamingMode
- Streaming transport mode used by a run.
- ToolExecutionMode
- Execution mode used when a model requests multiple tools in one turn.
- VoiceActivityType
- Type of voice activity detected on the audio channel.
Constants
- a2aMetadataPrefix → const String
- Prefix for A2A metadata keys stored in event metadata.
- actionTag → const String
- Marker used for the action/tool-call section in model output.
- afFunctionCallIdPrefix → const String
- Prefix for ADK-generated client-side function call identifiers.
- agentCardWellKnownPath → const String
- Well-known path used to discover remote agent cards.
-
clientFunctionCallNames
→ const Set<
String> - Built-in client and HITL function call names emitted by ADK.
- defaultA2aTimeoutSeconds → const double
- Default timeout in seconds for A2A requests.
- defaultLiveToolFinishTimeout → const Duration
- Default timeout for waiting on running non-streaming tool calls when a live run ends normally.
- finalAnswerTag → const String
- Marker used for the final answer section in model output.
- finishTaskDefaultWrapperKey → const String
-
Default wrapper parameter key used by
finish_taskfor non-object schemas. - finishTaskErrorResult → const String
-
Error result returned by
finish_taskwhen a delegated task fails. - finishTaskSuccessResult → const String
- Success result returned by FinishTaskTool.run.
- finishTaskToolName → const String
- Function name used by task agents to signal completion.
- instructionBegin → const String
- Marker indicating the start of a fenced system instruction carried in user content.
- instructionEnd → const String
- Marker indicating the end of a fenced system instruction carried in user content.
- instructionPreamble → const String
- Preamble framing a dynamic system instruction carried in a user-role content block.
- internalMetadataPrefix → const String
-
Prefix of
customMetadatakeys that callers cannot set. - invocationAbortedErrorCode → const String
- Error code assigned to synthetic abort events.
- invocationAbortedErrorMessage → const String
- Default error message for synthetic abort events.
- lineBreak → const String
- Line break token used when composing multi-agent instructions.
- otherAgentContextPreamble → const String
- Preamble added to the leading part when presenting context from another agent.
- planningTag → const String
- Marker used for the planner section in model output.
- quotedContentBegin → const String
- Marker indicating the start of quoted/fenced agent content.
- quotedContentElided → const String
- Marker indicating an elided quote boundary to prevent injection escapes.
- quotedContentEnd → const String
- Marker indicating the end of quoted/fenced agent content.
- reasoningTag → const String
- Marker used for the reasoning section in model output.
- replanningTag → const String
- Marker used for the replanning section in model output.
- requestConfirmationFunctionCallName → const String
- Internal function name used to request tool confirmation.
- requestEucFunctionCallName → const String
- Internal function name used to request credentials.
- requestInputFunctionCallName → const String
- Internal function name used to request additional user input.
- restoredEventKey → const String
- Set on events that ADK restored into a session from outside it.
- toolDescriptionPreamble → const String
- Preamble added to instructions when untrusted tool descriptions are present.
- toolDisplayNamesMetadataKey → const String
- Key in Event.customMetadata storing a mapping of tool names to display titles.
- untrustedToolDescriptionBegin → const String
- Marker indicating the start of an untrusted tool description.
- untrustedToolDescriptionEnd → const String
- Marker indicating the end of an untrusted tool description.
Properties
- currentCallbackInfo → CallbackInfo?
-
Returns the active CallbackInfo in the current async Zone, if any.
no setter
Functions
-
addInstructionsToUserContent(
InvocationContext invocationContext, LlmRequest llmRequest, List< Content> instructionContents) → Future<void> -
Inserts instruction-related
instructionContentsat the proper position in the conversation flow. -
agentConfigDiscriminator(
Object? value) → String -
Resolves the agent-class discriminator from raw JSON-like
value. -
applyRewinds(
List< Event> events) → List<Event> -
Returns
eventswith rewound invocations removed. -
buildAbortEvents(
List< Event> events, {required String invocationId, required String rootAgentName, String? branch, Set<String> keepOpen = const <String>{}}) → List<Event> - Returns the events that seal an aborted invocation.
-
buildAuthRequestEvent(
InvocationContext invocationContext, Map< String, AuthConfig> authRequests, {String? author, String? role}) → Event -
Builds an auth request event for
authRequests. -
buildTargetAgentsInfo(
BaseAgent targetAgent) → String - Builds one target-agent description block.
-
buildTargetAgentsInfoFromTargetInfo(
TransferTargetInfo targetInfo) → String -
Builds one target-agent description block from
targetInfo. -
buildTaskInputUserContent(
{required List< Event> events, required String? isolationScope, bool isSingleTurn = false, Content? userContent}) → Content? - Rebuilds a scoped task's originating function-call arguments as user text.
-
buildTransferInstructionBody(
String toolName, List< BaseAgent> targetAgents) → String -
Builds shared transfer instruction text for
targetAgents. -
buildTransferInstructionBodyFromInfos(
String toolName, List< TransferTargetInfo> targetInfos) → String -
Builds shared transfer instruction text for resolved
targetInfos. -
buildTransferInstructions(
String toolName, LlmAgent agent, List< BaseAgent> targetAgents) → String -
Builds full transfer instructions for
agent. -
buildTransferInstructionsFromInfos(
String toolName, LlmAgent agent, List< TransferTargetInfo> targetInfos) → String -
Builds full transfer instructions for
agentfrom resolvedtargetInfos. -
buildTransferTargetInfo(
BaseAgent targetAgent, InvocationContext context) → Future< TransferTargetInfo> -
Resolves and caches transfer target metadata for
targetAgent. -
containsEmptyContent(
Event event, {bool includeThoughts = false}) → bool -
Whether
eventcontains no visible content for model context. -
createFinalModelResponseEvent(
InvocationContext invocationContext, String jsonResponse) → Event -
The final model-text event built from
jsonResponse. -
createRequestInputEvent(
RequestInput requestInput, {String invocationId = '', String author = '', String? role}) → Event -
Creates a long-running function-call event for
requestInput. -
createRequestInputResponse(
String interruptId, Map< String, dynamic> response) → Part - Creates a function-response part for a request-input interrupt.
-
elideQuoteMarkers(
String text) → String - Removes literal quote and system instruction markers from relayed content.
-
elideRelayedPartMarkers(
Part part) → Part -
Returns
partwith relay markers elided from fields an adapter flattens into text. -
elideSystemInstructionMarkers(
String text) → String -
Removes system instruction markers from
text. -
elideToolDescriptionMarkers(
String text) → String -
Removes tool description and system instruction markers from
text. -
eventActionsFromJson(
Map< String, Object?> json) → EventActions -
Deserializes
jsoninto EventActions. -
eventActionsToJson(
EventActions actions) → Map< String, Object?> -
Serializes
actionsinto a JSON-compatible map. -
eventNodeInfoFromJson(
Map< String, Object?> json) → NodeInfo -
Deserializes
jsoninto workflow NodeInfo. -
eventNodeInfoToJson(
NodeInfo nodeInfo, {bool snakeCase = false}) → Map< String, Object?> -
Serializes
nodeInfointo a JSON-compatible map. -
extractEventInterruptIds(
Event event) → Set< String> -
Returns all interrupt IDs carried by
event. -
extractLangGraphMessageText(
Object? messageOrContent) → String - Extracts plain-text reply content from a LangGraph invoke result or message.
-
fenceSchemaDescriptions(
Object? schema, {bool inValuePosition = false}) → Object? -
Recursively fences
descriptionfields in schemas. -
fenceToolDescription(
String description) → String -
Fences a tool- or parameter-supplied
descriptionas untrusted data. -
finalizeDynamicInstructions(
InvocationContext invocationContext, LlmRequest llmRequest) → Future< void> -
Finalizes and resolves tool-contributed dynamic instructions on
llmRequest. -
findActiveTaskScope(
Session session) → (String, String)? -
Finds the active paused task scope
(isolationScope, invocationId)insession, if any. -
findFinishTaskArgsFromHistory(
Session session, {String? isolationScope, Event? completedFrEvent}) → Map< String, dynamic> ? -
Searches
sessionevents (andcompletedFrEventmetadata history) for the latestfinish_taskfunction call and returns its arguments. -
findMatchingFunctionCall(
List< Event> events) → Event? - Finds the originating function-call event for the latest response event.
-
findPreviousInteractionState(
{required List< Event> events, required String agentName, required String? currentBranch}) → (String?, String?) -
Scans events in reverse to find the most recent (interactionId, environmentId) for
agentName. -
fromConfig(
String configPath, {AgentConfigResolvers? resolvers}) → BaseAgent -
Builds a root BaseAgent from a config file at
configPath. -
generateAuthEvent(
InvocationContext invocationContext, Event functionResponseEvent) → Event? -
Builds an auth request event from
functionResponseEvent, when needed. -
generateClientFunctionCallId(
) → String - Generates a new ADK client function-call identifier.
-
generateRequestConfirmationEvent(
InvocationContext invocationContext, Event functionCallEvent, Event functionResponseEvent) → Event? - Builds a tool-confirmation request event, when requested.
-
getActiveEvents(
List< Event> events) → List<Event> -
Returns the active (non-rewound) events from
events. -
getCompactionRanges(
List< Event> events) → List<(int, double, double)> -
Returns surviving
(eventIndex, startTimestamp, endTimestamp)compaction ranges in original event order. -
getContents(
{required String? currentBranch, required List< Event> events, String agentName = '', bool preserveFunctionCallIds = false, String? isolationScope, bool isSingleTurn = false, Content? userContent, bool includeThoughtsFromOtherAgents = false, String? nodePath}) → List<Content> -
Builds context contents from
eventswith compaction and branch handling. -
getCurrentTurnContents(
{required String? currentBranch, required List< Event> events, String agentName = '', bool preserveFunctionCallIds = false, String? isolationScope, bool isSingleTurn = false, Content? userContent, bool includeThoughtsFromOtherAgents = false, String? nodePath}) → List<Content> -
Returns the current-turn subset of contents for
events. -
getLongRunningFunctionCalls(
List< FunctionCall> functionCalls, Map<String, BaseTool> toolsDict) → Set<String> -
Returns IDs of long-running tool calls in
functionCalls. -
getOutputWrapperKey(
Object? outputSchema) → String? -
Returns the wrapper parameter key (
'result') for non-objectoutputSchemadefinitions, ornullwhenoutputSchemais an object schema (or omitted). -
getRequestInputInterruptIds(
Event event) → List< String> -
Returns request-input interrupt ids contained in
event. -
getStructuredModelResponse(
Event functionResponseEvent) → String? -
The serialized response payload from
set_model_responsetool output. -
getTransferTargets(
LlmAgent agent) → List< BaseAgent> -
Returns transfer targets allowed for
agent. -
guardedCallIds(
InvocationContext invocationContext) → Set< String> - Returns the IDs of function calls that an open interrupt still waits on.
-
handleFunctionCallListAsync(
InvocationContext invocationContext, List< FunctionCall> functionCalls, Map<String, BaseTool> toolsDict, {Set<String> ? filters, Map<String, ToolConfirmation> ? toolConfirmationDict}) → Future<Event?> -
Handles a list of
functionCallsand returns a merged response event. -
handleFunctionCallsAsync(
InvocationContext invocationContext, Event functionCallEvent, Map< String, BaseTool> toolsDict, {Set<String> ? filters, Map<String, ToolConfirmation> ? toolConfirmationDict}) → Future<Event?> -
Handles function calls attached to
functionCallEvent. -
handleFunctionCallsLive(
InvocationContext invocationContext, Event functionCallEvent, Map< String, BaseTool> toolsDict, {Set<String> ? filters, Map<String, ToolConfirmation> ? toolConfirmationDict}) → Future<Event?> -
Handles function calls attached to
functionCallEventin live mode. -
hasMeaningfulContent(
LlmResponse? response) → bool - Returns whether the LLM response contains meaningful, actionable content.
-
hasRequestInputFunctionCall(
Event event) → bool -
Whether
eventcontains a request-input function call. -
hasSlidingWindowConfig(
EventsCompactionConfig? config) → bool -
Whether
confighas sliding-window compaction parameters configured. -
hasTokenThresholdConfig(
EventsCompactionConfig? config) → bool -
Whether
confighas token-threshold compaction parameters configured. -
hasUnsealedToolCalls(
List< Event> events, {required String invocationId, Set<String> keepOpen = const <String>{}}) → bool -
Returns whether
eventshas any function calls ininvocationIdwithout a matching function response, excluding call IDs inkeepOpen. -
indexOpenInterrupts(
Iterable< Event> events) → Map<String, OpenInterrupt> -
Indexes interrupts in
eventsthat have not yet been answered. -
internalMetadata(
Map< String, Object?> ? metadata) → Map<String, Object?> -
Returns only the keys of
metadatathat have the internal prefix. -
isAbortEvent(
Event event) → bool -
Returns whether
eventwas synthesized to seal an aborted invocation. -
isAuthEvent(
Event event) → bool -
Whether
eventis an end-user credential exchange event (adk_request_euc). -
isEventBelongsToBranch(
String? invocationBranch, Event event) → bool -
Whether
eventbelongs toinvocationBranchcontext. -
isFinishTaskTerminalFr(
Event event) → bool -
Whether
eventcontains a terminalfinish_taskFunctionResponse. -
isInterruptEvent(
Event event) → bool -
Whether
eventrepresents an active interrupt pause. -
isLiveStreamingTool(
BaseTool? tool) → bool -
Whether
toolis a live streaming function tool (Stream-returning). -
isPausedTaskReply(
Event event, {List< Event> ? invocationEvents}) → bool -
Whether a task agent already paused on
eventto wait for the user. -
isToolSubBranchEvent(
String? currentBranch, Event event, String agentName, Set< String> toolCallIds) → bool -
Returns whether
eventis a tool's message published strictly belowcurrentBranch. -
joinNodePath(
String? parentPath, String nodeName, [String? runId]) → String - Appends a child segment to a node path, as NodePathBuilder does.
-
labelDynamicInstruction(
String instruction) → String -
Marks
instructionas a system instruction rather than a user turn. -
latestCompactionEndTimestamp(
List< Event> events) → double - Returns the latest end timestamp among compaction events.
-
latestPromptTokenCount(
{required List< Event> events, required String? currentBranch, required String agentName, String? isolationScope}) → int? -
Returns the latest prompt token count estimate from
events. -
launchFunctionCallLive(
{required InvocationContext invocationContext, required FunctionCall functionCall, required Map< String, BaseTool> toolsDict, required LlmAgent agent, required LiveFunctionResponseQueue functionResponseQueue, String? liveSessionId}) → void -
Runs one live
functionCallin its own background task and pushes its finished Event ontofunctionResponseQueue. -
launchFunctionCallsLive(
InvocationContext invocationContext, Event functionCallEvent, Map< String, BaseTool> toolsDict, LiveFunctionResponseQueue functionResponseQueue) → void -
Launches every function call in
functionCallEventin its own background task and queues each call's response event ontofunctionResponseQueueas it finishes. -
markRestored(
Event event) → Event - Marks an event restored from outside the session, in place or returning updated event.
-
mergeParallelFunctionResponseEvents(
List< Event> functionResponseEvents, [Map<String, dynamic> ? sessionState]) → Event - Merges multiple parallel function response events into one event.
-
notifyToolCancelled(
{required InvocationContext invocationContext, LlmAgent? agent, required BaseTool tool, required Map< String, dynamic> toolArgs, required ToolContext toolContext, Exception? cancelled}) → Future<void> -
Runs
onToolErrorcallbacks on tool call cancellation for cleanup. -
parentNodePath(
String path) → String - Returns the parent of a node path string, as NodePathBuilder does.
-
popKeptFunctionResponseEvent(
Object error) → Event? -
Pops and returns any kept function response event attached to
error. -
populateClientFunctionCallId(
Event modelResponseEvent) → void -
Populates missing function-call IDs on
modelResponseEvent. -
processCompactionEvents(
List< Event> events) → List<Event> -
Applies non-subsumed compaction events to
events. -
publicEvent(
Event event) → Event - Returns the event as callers see it, without internal metadata.
-
publicMetadata(
Map< String, Object?> ? metadata) → Map<String, Object?> ? -
Returns
metadataas callers see it, without internal keys. Returns null if no keys remain. -
publicSession(
Session session) → Session - Returns the session as callers see it, without internal metadata.
-
quoteUntrusted(
String text) → String - Fences relayed content so it cannot pass itself off as instructions.
-
removeClientFunctionCallId(
Content? content) → void -
Removes ADK-generated client IDs from
contentfor backend calls. -
resolveAgentReference(
AgentRefConfig refConfig, String referencingAgentConfigAbsPath, {required AgentConfigResolvers resolvers}) → BaseAgent - Resolves an AgentRefConfig into a concrete BaseAgent.
-
resolveCallbackName(
Object callback, {String fallback = '<anonymous>'}) → String -
Resolves a human-readable callback name for
callback. -
resolveCallbacks(
List< CodeConfig> callbacksConfig, {required AgentConfigResolvers resolvers}) → List<Object?> - Resolves callback code references into executable callback objects.
-
resolveCodeReference(
CodeConfig codeConfig, {required AgentConfigResolvers resolvers}) → Object? - Resolves a CodeConfig reference, applying configured arguments.
-
resolveFullyQualifiedName(
String name, {required AgentConfigResolvers resolvers}) → Object? -
Resolves a fully-qualified symbol
nameusingresolvers. -
resolveInvocationCustomMetadata(
InvocationContext invocationContext) → Map< String, Object?> -
Returns the mutable invocation-scoped custom metadata map for
invocationContext. -
runCompactionForSlidingWindow(
{required App app, required Session session, required BaseSessionService sessionService, bool skipTokenCompaction = false, AdkAbortSignal? abortSignal}) → Stream< Event> -
Runs sliding-window compaction for
appandsession. -
runCompactionForSlidingWindowConfig(
{required EventsCompactionConfig? config, required Session session, required BaseSessionService sessionService, BaseAgent? agent, String? agentName, String? currentBranch, bool skipTokenCompaction = false, String? isolationScope, AdkAbortSignal? abortSignal}) → Future< bool> -
Runs sliding-window compaction for
configandsessionand appends any resulting compaction event tosessionService. -
runCompactionForTokenThresholdConfig(
{required EventsCompactionConfig? config, required Session session, required BaseSessionService sessionService, BaseAgent? agent, String? agentName, String? currentBranch, String? isolationScope, AdkAbortSignal? abortSignal}) → Future< bool> - Runs token-threshold compaction when the configured threshold is exceeded.
-
runWithCallbackScope<
T> (CallbackInfo info, FutureOr< T> fn(), {Context? callbackContext}) → Future<T> -
Runs
fnwithin a Zone bound toinfoand bindscallbackContext's scoped Context.callbackInfo when provided. -
shouldIncludeEventInContext(
String? currentBranch, Event event, {String? isolationScope, bool includeThoughts = false}) → bool -
Whether
eventshould be included in model context. -
stopBackgroundToolTasks(
InvocationContext invocationContext) → Future< void> -
Cancels all running background tool tasks registered on
invocationContext. -
streamCompactionForSlidingWindowConfig(
{required EventsCompactionConfig? config, required Session session, required BaseSessionService sessionService, BaseAgent? agent, String? agentName, String? currentBranch, bool skipTokenCompaction = false, String? isolationScope, AdkAbortSignal? abortSignal}) → Stream< Event> -
Streams sliding-window compaction events for
configandsessionwithout appending the sliding-window event tosessionService. -
summarizeEvents(
List< Event> events, {Object? summarizer}) → Future<Content> -
Summarizes
eventsusingsummarizeror fallback default summarization. -
toStructuredEvents(
Event event) → List< StructuredEvent> - Converts a raw Event into typed structured events.
-
validateAppName(
String name) → void -
Validates that
nameis a supported app identifier. -
waitForLiveToolCalls(
InvocationContext invocationContext, {Duration timeout = defaultLiveToolFinishTimeout}) → Future< void> -
Waits up to
timeoutfor running non-streaming background tool calls oninvocationContextto finish. -
withoutInternalMetadata(
Map< String, Object?> ? metadata) → Map<String, Object?> ? -
Returns
metadatawithout keys that have the internal prefix.
Typedefs
-
A2aAfterRequestInterceptor
= FutureOr<
Event?> Function(InvocationContext context, Object a2aResponse, Event event) - Hook invoked after an A2A response is converted into an event.
-
A2aBeforeRequestInterceptor
= FutureOr<
A2aBeforeRequestResult> Function(InvocationContext context, A2aMessage request, A2aRequestParametersConfig parameters) - Hook invoked before an A2A request is sent.
- A2aClientEvent = (A2aTask, A2aEvent?)
-
Streaming A2A client event tuple of
(task, update). -
A2aRequestMetaProvider
= Map<
String, Object?> Function(InvocationContext context, A2aMessage request) - Callback that derives request metadata from invocation context.
-
AfterModelCallback
= FutureOr<
LlmResponse?> Function(CallbackContext callbackContext, LlmResponse llmResponse) - Callback invoked after model generation.
-
AfterToolCallback
= FutureOr<
Map< Function(BaseTool tool, Map<String, dynamic> ?>String, dynamic> args, ToolContext toolContext, Map<String, dynamic> toolResponse) - Callback invoked after a tool call succeeds.
- Agent = LlmAgent
- Alias for LlmAgent kept for API parity.
-
AgentLifecycleCallback
= FutureOr<
Content?> Function(CallbackContext callbackContext) - Callback signature for agent lifecycle hooks.
- AudioCacheConfig = RealtimeCacheConfig
- Backward-compatible alias for RealtimeCacheConfig.
- AudioCacheManager = RealtimeCacheManager
- Backward-compatible alias for RealtimeCacheManager.
-
AudioRecognizer
= Future<
List< Function(List<String> >int> audioData) - Recognizes text transcripts from raw audio bytes.
-
BeforeModelCallback
= FutureOr<
LlmResponse?> Function(CallbackContext callbackContext, LlmRequest llmRequest) - Callback invoked before model generation.
-
BeforeToolCallback
= FutureOr<
Map< Function(BaseTool tool, Map<String, dynamic> ?>String, dynamic> args, ToolContext toolContext) - Callback invoked before a tool call executes.
- CallbackContext = Context
- Mutable agent context exposed to callbacks.
- CustomAgentFactory = BaseAgent Function(BaseAgentConfig config, String configAbsPath, AgentConfigResolvers resolvers)
- Factory for custom agent classes loaded from config.
-
InstructionProvider
= FutureOr<
String> Function(ReadonlyContext context) - Dynamic instruction provider callback.
-
JsonMap
= Map<
String, dynamic> - JSON-compatible map type used across model and tool payloads.
-
LangGraphInvoker
= FutureOr<
Object?> Function({required List<LangGraphMessage> messages, required String threadId}) - Callback that invokes a LangGraph workflow.
-
LangGraphStateChecker
= FutureOr<
bool> Function(String threadId) - Callback that reports whether a LangGraph thread already has state.
-
McpPromptArgumentsProvider
= Map<
String, String> Function(ReadonlyContext context) - Builder signature for dynamically computing MCP prompt arguments from ReadonlyContext.
-
OnModelErrorCallback
= FutureOr<
LlmResponse?> Function(CallbackContext callbackContext, LlmRequest llmRequest, Exception error) - Callback invoked when model generation throws.
-
OnToolErrorCallback
= FutureOr<
Map< Function(BaseTool tool, Map<String, dynamic> ?>String, dynamic> args, ToolContext toolContext, Exception error) - Callback invoked when a tool call throws.
- StructuredErrorEvent = ErrorEvent
- Alias for callers that prefer an unambiguous Dart-specific name.
- SymbolResolver = Object? Function(String fullyQualifiedName)
- Symbol resolver for fully-qualified names in config references.
Exceptions / Errors
- A2aClientError
- Base error type for A2A client failures.
- A2aClientHttpError
- HTTP error type for A2A client failures.
- AdkAbortException
- Exception thrown when an operation observes an aborted ADK signal.
- AgentCardResolutionError
- Error thrown when resolving an agent card fails.
- LlmCallsLimitExceededError
- Error thrown when LLM call count exceeds the configured limit.