adk_core library

Flutter and Web-safe ADK entrypoint.

This surface intentionally excludes APIs that require dart:io, dart:ffi, dart:mirrors, local process execution, or local filesystem access. Use package:adk_dart/adk_dart.dart for the full VM and CLI surface.

Classes

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.
AdkMetricRecord
One ADK metric sample.
AdkMetricsRecorder
Sink for ADK metric samples.
AgentNode
Node that wraps an ADK BaseAgent.
AgentTool
Tool adapter that executes another agent as a tool call.
App
App container describing root agent, plugins, and runtime options.
ArtifactVersion
Metadata describing one persisted artifact version.
BaseAgent
Base class for all agent implementations.
BaseAgentState
Generic mutable state holder for agent-local state.
BaseArtifactService
Base contract for artifact persistence services.
BaseLlm
Base interface for model adapters used by the runner.
BaseMemoryService
Base contract for memory ingestion and search implementations.
BaseNode
Base class for node-based workflow units.
BasePlugin
Base class for ADK runtime plugins.
BaseSessionService
Contract for session lifecycle and event persistence operations.
BaseTelemetryService
Contract for telemetry trace/span lifecycle services.
BaseTool
Base contract for one callable tool exposed to the model runtime.
CallCodeEvent
Request to execute code.
CodeResultEvent
Result of code execution.
Content
One conversation turn consisting of a role and Part list.
ContentEvent
User-visible text content.
Context
Mutable context for a single agent invocation.
Edge
Directed workflow edge.
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.
Frontmatter
L1 skill metadata parsed from SKILL.md frontmatter.
FunctionCall
Function-call payload emitted by model responses.
FunctionCallingConfig
Function-calling configuration attached to tool settings.
FunctionDeclaration
Function-calling declaration exposed to the model.
FunctionNode
Function-backed workflow node.
FunctionResponse
Function-response payload sent back to the model.
FunctionTool
Wraps a Dart callable as a runtime tool.
Gemini
Google Gemini model adapter with REST, interactions, and live support.
GenerateContentConfig
Generation configuration for text/content model calls.
GetSessionConfig
Options for narrowing session retrieval results.
HttpOptions
HTTP configuration for model API requests.
HttpRetryOptions
Retry policy for HTTP model requests.
InlineData
Inline binary payload attached to a Part.
InMemoryAdkMetricsRecorder
Metrics recorder that stores samples in memory for tests and adapters.
InMemoryArtifactService
Artifact service backed by process-local memory maps.
InMemoryMemoryService
Memory service backed by process-local event collections.
InMemoryRunner
Runner wired with in-memory session and artifact services.
InMemorySessionService
Session service backed by process-local maps.
InMemorySkillBuilder
Builder for one in-memory skill.
InMemorySkillData
Complete in-memory payload for one skill source entry.
InMemorySkillSource
In-memory SkillSource implementation.
InMemorySkillSourceBuilder
Builder for InMemorySkillSource.
InMemoryTelemetryService
In-memory telemetry implementation for local development and tests.
InvocationContext
Mutable invocation context shared across agent execution steps.
InvocationPlan
One invocation strategy used to call flexible user functions.
JoinNode
Node that passes through aggregated predecessor inputs.
ListSessionsResponse
Response model for session list operations.
ListSkillsTool
Tool to list all locally available skills.
LiveActivityEnd
Marker indicating the end of a live activity segment.
LiveActivityStart
Marker indicating the start of a live activity segment.
LiveConnectConfig
Realtime connection configuration for live model sessions.
LiveRequest
A single queued live request payload.
LiveRequestQueue
In-memory FIFO queue for live requests.
LiveSkillGcsStore
Web stub for live GCS-backed skill storage.
LlmAgent
Core LLM agent that drives model and tool orchestration flows.
LlmRequest
Full model request payload used by LLM adapters.
LlmResponse
Normalized model response emitted by LLM adapters.
LlmToolConfig
Tool-level configuration wrapper for model requests.
LoadMcpResourceTool
Tool that injects MCP resource contents into pending LLM requests.
LoadSkillResourceTool
Tool to load a resource from a skill bundle.
LoadSkillTool
Tool to load a skill's main instructions.
LocalSkillSource
Filesystem-backed SkillSource, unsupported on Web.
LoopAgent
Workflow agent that iterates through sub-agents repeatedly.
LoopAgentState
Serialized resumability state for LoopAgent.
McpBaseTool
Lightweight MCP tool descriptor used by McpTool.
McpResourceContent
Content returned by resources/read.
McpSessionManager
Central registry and transport manager for MCP sessions.
McpTool
Auth-aware MCP tool wrapper that delegates calls through McpSessionManager.
McpToolset
Toolset that exposes tools and resources from one MCP connection.
MemoryEntry
One memory item with content and optional metadata.
Node
Node designed for subclassing.
NodeInfo
Workflow node metadata attached to an Event.
NodePathBuilder
Represents a path to a node in a hierarchical workflow.
NodeState
Mutable state for one workflow node.
NoopAdkMetricsRecorder
Metrics recorder that intentionally drops all samples.
ParallelAgent
Workflow agent that runs sub-agents concurrently.
ParallelWorker
Node that runs a wrapped child node for every input item in parallel.
Part
One multimodal content part within a Content turn.
PluginManager
Coordinates plugin registration and callback dispatching.
ReplaySequenceBarrier
Chronological barrier used to coordinate deterministic replay ordering.
RequestInput
Data used to request additional user input from a workflow or agent.
RequestInputTool
Long-running tool that requests human input before execution continues.
Resources
L3 skill resources loaded from references/assets/scripts directories.
ResumabilityConfig
Resumability settings for an app.
RunConfig
Configuration object controlling one agent run behavior.
Runner
Coordinates session lifecycle, plugins, and agent execution.
RunSkillScriptTool
Tool to execute scripts from a skill bundle.
Script
Wrapper for script content.
SearchMemoryResponse
Response model returned by memory search operations.
SearchSkillsTool
Tool to search a configured skill registry for relevant skills.
SequentialAgent
Workflow agent that runs sub-agents one-by-one.
SequentialAgentState
Serialized resumability state for SequentialAgent.
Session
A conversational session containing state and event history.
SingleTurnAgentTool
Tool adapter for a sub-agent configured with mode: 'single_turn'.
Skill
Complete skill representation with metadata, instructions, and resources.
SkillDescriptor
Minimal shape shared by all skill descriptors.
SkillGcsStore
Web stub for GCS-backed skill storage.
SkillRegistry
In-memory registry for named Skill objects.
SkillSource
Asynchronous source interface for skill metadata, instructions, resources.
SkillToolset
Toolset exposing skill-discovery, loading, and script-execution tools.
State
Map-like state container with change tracking.
StdioConnectionParams
Process launch options for an MCP stdio server.
StreamableHTTPConnectionParams
Connection options for an MCP server that supports Streamable HTTP.
StructuredEvent
Base class for typed structured events.
TaskAgentTool
Tool adapter for a sub-agent configured with mode: 'task'.
TaskRequest
A request to delegate work to a task agent.
TaskResult
Result returned by a task agent after completion.
TelemetryLogRecord
One log entry recorded under a telemetry span.
TelemetrySpan
Span model representing one traced operation.
ThoughtEvent
Reasoning text emitted by the model.
ToolCallEvent
Request to execute a tool.
ToolConfirmationEvent
Request for user confirmation of tool calls.
ToolDeclaration
Tool declaration payload sent to model backends.
ToolNode
Node that wraps an ADK BaseTool.
ToolResultEvent
Result returned by a tool.
ToolThreadPoolConfig
Thread-pool configuration for concurrent tool execution.
UrlContextTool
Built-in URL context retrieval tool for supported Gemini models.
VertexAiRagResource
Vertex AI RAG resource reference.
VertexAiRagRetrieval
Retrieval tool that integrates with Vertex AI RAG.
VertexAiRagStore
Store-level RAG query configuration used by VertexAiRagRetrieval.
VertexAiSearchConfig
Retrieval configuration used by VertexAiSearchTool.
VertexAiSearchDataStoreSpec
One Vertex AI Search data store reference.
VertexAiSearchTool
Built-in retrieval tool wrapper for Vertex AI Search.
VertexRagRetrievalTool
Server-side Vertex AI RAG retrieval tool.
Workflow
Node-based workflow agent.
WorkflowContext
Shared runtime context passed to workflow nodes.
WorkflowResult
Execution result from Workflow.runWorkflow.

Enums

EventType
Categories emitted by toStructuredEvents.
FunctionCallingConfigMode
Function-calling modes recognized by model providers.
NodeStatus
Runtime status for a workflow node.
StreamingMode
Streaming transport mode used by a run.
ToolErrorType
Semantic tool error types aligned with OpenTelemetry error attributes.
ToolExecutionMode
Execution mode used when a model requests multiple tools in one turn.

Constants

DEFAULT_ROUTE → const String
Default route value used by routed workflow edges.
defaultSkillSystemInstruction → const String
Default system instruction injected when skill tools are enabled.
finishTaskSuccessResult → const String
Success result returned by FinishTaskTool.run.
finishTaskToolName → const String
Function name used by task agents to signal completion.
genAiAgentInvocationDurationMetric → const String
Metric name for agent invocation durations.
genAiAgentRequestSizeMetric → const String
Metric name for agent request sizes.
genAiAgentResponseSizeMetric → const String
Metric name for agent response sizes.
genAiAgentWorkflowStepsMetric → const String
Metric name for agent workflow step counts.
genAiToolExecutionDurationMetric → const String
Metric name for tool execution durations.
genAiToolRequestSizeMetric → const String
Metric name for tool request sizes.
genAiToolResponseSizeMetric → const String
Metric name for tool response sizes.
START → const String
Sentinel node name used for workflow start edges.

Properties

adkMetricsRecorder AdkMetricsRecorder
The process-wide metrics recorder used by ADK helpers.
no setter
requestInput RequestInputTool
Default request-input tool instance.
final
urlContext UrlContextTool
Shared URL context tool instance.
final

Functions

buildNode(Object nodeLike, {String? name, String description = '', List<String>? dependsOn, bool? rerunOnResume, bool? waitForOutput, RetryConfig? retryConfig, Duration? timeout}) BaseNode
Converts a workflow-compatible object into a BaseNode.
contentSizeBytes(Content? content) int
Returns the UTF-8 and inline-data byte size of content.
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.
eventActionsFromJson(Map<String, Object?> json) EventActions
Deserializes json into EventActions.
eventActionsToJson(EventActions actions) Map<String, Object?>
Serializes actions into a JSON-compatible map.
eventNodeInfoFromJson(Map<String, Object?> json) NodeInfo
Deserializes json into workflow NodeInfo.
eventNodeInfoToJson(NodeInfo nodeInfo, {bool snakeCase = false}) Map<String, Object?>
Serializes nodeInfo into a JSON-compatible map.
formatSkillsAsXml(List<SkillDescriptor> skills) String
Renders a skill summary list as XML text for model prompts.
getRequestInputInterruptIds(Event event) List<String>
Returns request-input interrupt ids contained in event.
getTime() double
Returns the current time in seconds since the Unix epoch.
getUtcNow() DateTime
Returns the current UTC time derived from getTime.
hasRequestInputFunctionCall(Event event) bool
Whether event contains a request-input function call.
listSkillsInDir(String skillsBasePath) Map<String, Frontmatter>
Returns no directory-backed skills on Web.
listSkillsInGcsDir(String bucketName, {String skillsBasePath = '', Object? storageStore}) Future<Map<String, Frontmatter>>
Throws because GCS-backed skill loading is unsupported on Web.
loadSkillFromDir(String skillDirPath) Skill
Throws because directory-based skill loading is unsupported on Web.
loadSkillFromGcsDir(String bucketName, String skillId, {String skillsBasePath = '', Object? storageStore}) Future<Skill>
Throws because GCS-backed skill loading is unsupported on Web.
loadSkillFromZipBytes(List<int> zipBytes) Skill
Loads a Skill from ZIP bytes containing a root-level SKILL.md.
newUuid() String
Returns a new unique identifier string.
node(WorkflowFunction function, {required String name, String description = '', List<String>? dependsOn, bool rerunOnResume = false, RetryConfig? retryConfig, Duration? timeout}) FunctionNode
Convenience wrapper matching Python's node(...) helper.
parallelWorker(Object nodeLike, {int? maxConcurrency, RetryConfig? retryConfig, Duration? timeout}) ParallelWorker
Wraps nodeLike in a ParallelWorker.
readSkillProperties(String skillDirPath) Frontmatter
Throws because skill-property file loading is unsupported on Web.
recordAgentInvocationDuration(String agentName, Duration duration, {Object? error, AdkMetricsRecorder? recorder}) → void
Records the duration of an agent invocation.
recordAgentRequestSize(String agentName, Content? userContent, {AdkMetricsRecorder? recorder}) → void
Records the byte size of the user content sent to an agent.
recordAgentResponseSize(String agentName, List<Event>? events, {AdkMetricsRecorder? recorder}) → void
Records the byte size of the last response content authored by an agent.
recordAgentWorkflowSteps(String agentName, List<Event> events, {AdkMetricsRecorder? recorder}) → void
Records the number of events authored by an agent.
recordToolExecutionDuration(String toolName, String agentName, Duration duration, {Object? error, AdkMetricsRecorder? recorder}) → void
Records the duration of a tool execution.
recordToolRequestSize(String toolName, String agentName, Map<String, Object?> functionArgs, {AdkMetricsRecorder? recorder}) → void
Records the byte size of string-valued tool arguments.
recordToolResponseSize(String toolName, String agentName, Event? responseEvent, {AdkMetricsRecorder? recorder}) → void
Records the byte size of a tool response event.
resetAdkMetricsRecorderForTest() → void
Restores the process-wide metrics recorder to a no-op recorder.
resetIdProvider() → void
Restores the default unique ID provider.
resetTimeProvider() → void
Restores the default system time provider.
setAdkMetricsRecorder(AdkMetricsRecorder recorder) → void
Sets the process-wide ADK metrics recorder.
setIdProvider(IdProvider provider) → void
Sets the provider used by newUuid.
setTimeProvider(TimeProvider provider) → void
Sets the provider used by getTime.
toolRequestSizeBytes(Map<String, Object?> functionArgs) int
Returns the request byte size for string-valued tool arguments.
toStructuredEvents(Event event) List<StructuredEvent>
Converts a raw Event into typed structured events.
validateAppName(String name) → void
Validates that name is a supported app identifier.
validateSkillDir(String skillDirPath) List<String>
Reports unsupported validation mode on Web.

Typedefs

AfterModelCallback = FutureOr<LlmResponse?> Function(CallbackContext callbackContext, LlmResponse llmResponse)
Callback invoked after model generation.
AfterToolCallback = FutureOr<Map<String, dynamic>?> Function(BaseTool tool, Map<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.
BeforeModelCallback = FutureOr<LlmResponse?> Function(CallbackContext callbackContext, LlmRequest llmRequest)
Callback invoked before model generation.
BeforeToolCallback = FutureOr<Map<String, dynamic>?> Function(BaseTool tool, Map<String, dynamic> args, ToolContext toolContext)
Callback invoked before a tool call executes.
CallbackContext = Context
Mutable agent context exposed to callbacks.
ConfirmationPredicate = FutureOr<bool> Function(Map<String, dynamic> args)
Callback signature for dynamic confirmation requirements.
GeminiGenerateHook = Stream<LlmResponse> Function(LlmRequest request, bool stream)
Hook for overriding Gemini generation behavior.
GeminiInteractionsInvoker = Stream<LlmResponse> Function(LlmRequest request, {required bool stream})
Invoker hook for Gemini interactions API generation.
GeminiLiveSessionFactory = GeminiLiveSession Function(LlmRequest request)
Factory that creates live Gemini session transports.
GoogleLlm = Gemini
Backward-compatible alias for Gemini.
IdProvider = String Function()
InstructionProvider = FutureOr<String> Function(ReadonlyContext context)
Dynamic instruction provider callback.
JsonMap = Map<String, dynamic>
JSON-compatible map type used across model and tool payloads.
McpConnectionParams = Object
Union type alias for supported MCP transport connection parameters.
McpHeaderProvider = Map<String, String> Function(ReadonlyContext readonlyContext)
Header-builder callback applied to MCP tool calls in this toolset.
McpSamplingCallback = FutureOr<Object?> Function(List<Map<String, Object?>> messages, {Map<String, Object?>? params})
Callback invoked when an MCP server requests client-side sampling.
McpToolExecutor = FutureOr<Object?> Function(Map<String, dynamic> args, {Map<String, String>? headers})
Callback signature for custom local MCP tool executors.
McpToolHeaderProvider = Map<String, String> Function(ReadonlyContext readonlyContext)
Header-builder callback used before making MCP tool HTTP calls.
OnModelErrorCallback = FutureOr<LlmResponse?> Function(CallbackContext callbackContext, LlmRequest llmRequest, Exception error)
Callback invoked when model generation throws.
OnToolErrorCallback = FutureOr<Map<String, dynamic>?> Function(BaseTool tool, Map<String, dynamic> args, ToolContext toolContext, Exception error)
Callback invoked when a tool call throws.
SkillMetadataValue = Object?
Metadata value allowed in skill frontmatter.
SkillResourceData = Object
Resource payload allowed in skill references/assets.
StructuredErrorEvent = ErrorEvent
Alias for callers that prefer an unambiguous Dart-specific name.
TimeProvider = double Function()
ToolContext = Context
Mutable tool execution context alias used by tool interfaces.
VertexAiRagQueryHandler = Future<List<String>> Function({List<String>? ragCorpora, List<VertexAiRagResource>? ragResources, int? similarityTopK, required String text, double? vectorDistanceThreshold})
Callback signature for live Vertex AI RAG querying.
WorkflowFunction = FutureOr<Object?> Function(WorkflowContext context, Object? nodeInput)
Function callback signature for FunctionNode.

Exceptions / Errors

AdkAbortException
Exception thrown when an operation observes an aborted ADK signal.
AlreadyExistsError
Exception indicating that a resource already exists.
InputValidationError
Exception indicating invalid user or API input.
LlmCallsLimitExceededError
Error thrown when LLM call count exceeds the configured limit.
McpHttpStatusException
Thrown when an HTTP request returns a non-success status code.
McpJsonRpcException
Thrown when a JSON-RPC response contains an error object.
NodeTimeoutError
Error thrown when a node exceeds its timeout.
NotFoundError
Exception indicating missing resources.
PluginManagerException
Exception thrown for plugin manager callback/close failures.
ResourceExhaustedModelException
Exception thrown when model capacity is exhausted.
SessionNotFoundError
Error thrown when a requested session cannot be found.
SkillSourceException
Exception used by SkillSource implementations.
ToolExecutionError
Exception raised when a tool fails with a semantic error classification.