LlmAgent
Focused reasoning
A model, instructions, tools, callbacks, and streamed output—the small, useful center of most systems.
ADK-Rust brings typed agents, tools, durable state, realtime media, and open protocols into one async runtime—so you can move from a focused agent to a system you can operate with confidence.
Begin with the unit of work
An agent is an async Rust component. It receives an invocation context, performs work with models or tools, and emits typed events as it progresses. LLM agents, workflows, realtime agents, coding agents, and custom Rust agents all use this shared contract.
What makes ADK-Rust compelling is that the agent remains part of a software system you can understand and control. Model calls, tool inputs, state changes, approvals, and streamed events have explicit Rust contracts. The same runtime can support a focused assistant, a durable multi-agent workflow, a realtime voice experience, or an agent that works across services—while preserving the performance, concurrency, portability, and operational discipline Rust teams expect.
If you know LangGraph, Google ADK, the OpenAI Agents SDK, or CrewAI, you will recognize tools, handoffs, workflows, memory, guardrails, and tracing. ADK-Rust brings those ideas into a Rust-native runtime and connects them with realtime media, code execution, RAG, artifacts, and open protocols such as MCP, A2A, ACP, and AWP. Version 2 expands that foundation with graph, realtime, coding, and CodeAct agents; provider-aware tool schemas; composable project templates and cargo adk build; stronger state and operating controls; and a consistent typed event trail from the first model call to production.
How to read the architecture
Follow the diagram from left to right. A product surface sends a request to the Runner. The Runner attaches session state and invocation context, then calls the selected agent. Models, tools, and state support the work while typed events carry progress and results back.
Runner, agents, typed events, model/tool loops, sessions, callbacks, transfers, and cancellation.
MCP, A2A, ACP, AWP, HTTP, SSE, and realtime transports connect separate systems and trust zones.
Studio, UI, Playground, and the control plane consume ADK-Rust; they do not run inside the Runner.
Framework surface
ADK-Rust brings the full agent lifecycle into one framework: compose agent behavior, give it tools, preserve context, connect it to other systems, and operate it safely in production. The groups below show how those capabilities fit together.
Build LLM, workflow, graph, realtime, and coding agents; equip them with typed tools, MCP, RAG, memory, sessions, and artifacts; connect them through REST, A2A, ACP, and AWP; then add authorization, guardrails, telemetry, and evaluation for production.
Compose capability
The main model-driven agent. Give it instructions, an LLM, tools, callbacks, and optional sub-agents; the Runner streams its work as typed events.
Act capability
Turns a typed async Rust function into a model-callable tool and derives the argument schema from Rust types.
Remember capability
Keep conversation events and application state together so a user can continue the same interaction over multiple turns.
Connect capability
Exposes familiar HTTP endpoints for clients that send a request and receive a structured response.
Operate capability
Establishes who is calling the system through API keys, OAuth, OIDC, SSO, and application identity.
Build capability
Generate working starting shapes for focused agents, tools, retrieval, APIs, workflows, realtime sessions, and custom logic.
See how it works
The Runner resolves the session, builds the invocation context, runs the agent, streams model and tool work, applies state changes, persists durable events, and returns progress to the caller as it happens.
That same trail can feed a terminal, a web UI, an API client, evaluation, or a realtime conversation.
Follow a real request
A customer asks, “Why did my payment fail?” The Runner opens the correct session, streams model output and tool activity, records state changes, and returns each useful event to the interface. The user sees progress while the operator gains a complete execution record.
Compose the behavior
A router identifies the work that must be done. Specialists handle the parts they understand best. Sequential and parallel workflows control execution order, while graph checkpoints keep evidence, approvals, and progress attached to the same job.
LlmAgent
A model, instructions, tools, callbacks, and streamed output—the small, useful center of most systems.
Sequential · Parallel · Loop
Express order, concurrency, repetition, and exit conditions directly in the Rust program.
GraphAgent
Branch, checkpoint, interrupt for a person, and resume after the process or conversation has moved on.
CodingAgent · CodeActAgent
Let an agent inspect, edit, and run code inside a workspace and sandbox boundary you control.
RealtimeAgent
Carry audio, transcripts, video frames, interruptions, and server-side tools through one live session.
CustomAgent
Implement the Agent contract for product-specific behavior written directly in Rust.
The system around the agent
Useful agents need tools, state, interfaces, boundaries, and evidence. ADK-Rust exposes each piece through composable Rust interfaces that you own.
One product, several responsibilities
In a customer-support product, the model drafts the response, tools inspect the order, the session carries customer context, authorization controls refunds, an artifact stores the receipt, and telemetry records the outcome. Each responsibility stays visible in the runtime.
Hosted frontier models, fast routing models, local Ollama, and native mistral.rs inference sit behind a common Llm contract.
Gemini · OpenAI · Anthropic · OpenRouter · DeepSeek · Groq · Ollama · Bedrock · Azure AI · compatible endpoints
Turn a typed Rust function, MCP server, skill, browser session, coding agent, or sandboxed process into a capability the runtime can inspect and call.
#[tool] · FunctionTool · MCP · ACP · skills · browser · code
Sessions hold the event history. Memory retrieves useful knowledge. Artifacts preserve files. Graph checkpoints make long work resumable.
SQLite · PostgreSQL · Redis · MongoDB · Firestore · Neo4j · encrypted sessions
ADK-Rust keeps audio, transcripts, video frames, tool calls, interruption, and changing context inside a Rust-owned session.
OpenAI Realtime · Gemini Live · Vertex Live · LiveKit · optional WebRTC
Chunk documents, embed them, search vector stores, rerank results, and isolate memory by project before the model answers.
RAG pipelines · semantic memory · knowledge graph · five vector-store implementations
Authorization, callbacks, guardrails, sandbox profiles, cancellation, telemetry, and evaluation form the production execution boundary.
RBAC · OAuth/OIDC · tool confirmation · PII guardrails · OpenTelemetry · eval
Choose the boundary
Begin with where the capability runs.
Keep sub-agents inside one ADK-Rust runtime when they share deployment, state, and trust. Introduce a protocol when the capability, agent, coding workspace, or website has a deployment, process, ownership, or trust boundary of its own.
Same Rust process
Agent, sub-agent, or tool
External tools or resources
MCP
Independently deployed agent
A2A
Coding process or IDE
ACP
Agent-readable website
AWP
Model Context Protocol
What is MCP?
A standard way for an external server to publish tools an agent can call and resources it can read.
Agent-to-Agent Protocol
What is A2A?
A network protocol for discovering a remote agent, sending it work, following progress, and receiving results across an HTTP boundary.
Agent Client Protocol
What is ACP?
A protocol that standardizes sessions between coding agents and the clients that host them, including editors, CLIs, and orchestration systems.
Agentic Web Protocol
What is AWP?
A web protocol through which a site publishes who it is, what agents can do, which policies apply, and whether its agent-facing services are healthy.
Developer quickstart
Begin with a small, working Rust project. The guided steps below explain what the generator adds, how to compile the project locally, and where to extend it as your product grows.
What you will have at the end
A compiled Rust agent with a typed tool, an interactive Launcher session, telemetry setup, session and guardrail integration points, and a real model response in the terminal. The generated project is ordinary Rust source that you can read, change, and extend.
Before you begin
Two things are required on your machine
Rust 1.95 or newer.
Install with rustup or update the stable toolchain.
A model API key.
This path uses GOOGLE_API_KEY; another provider can be selected later.
cargo-adk adds the cargo adk commands used to create, inspect, build, and deploy agent projects.
cargo install cargo-adkStart with an agent that can call typed Rust tools. Add observability, session state, and guardrail hooks while the project is generated.
cargo adk new support-agent --template tools \
--addon telemetry --addon sessions --addon guardrailsThe generated example uses Gemini by default. Copy the safe example file, then place your key in the untracked .env file.
cd support-agent
cp .env.example .env
# set GOOGLE_API_KEY in .envcargo adk build checks the generated dependencies, feature combination, Rust types, and release binary without deploying anything.
cargo adk buildLaunch the generated console, enter a message, and watch the same typed runtime that can later power an API, workflow, or realtime product.
cargo runInstall once
$ cargo install cargo-adkGenerate the project
$ cargo adk new support-agent \
+ --template tools \
+ --addon telemetry \
+ --addon sessions \
+ --addon guardrailsConfigure the model
$ cd support-agent
cp .env.example .env
# Add GOOGLE_API_KEY to .envVerify, then run
$ cargo adk build
cargo run ADK-Rust — support-agent
Type a message to chat. Type 'exit' to quit.
You > Greet Ada casually.
[tool] greet({"name":"Ada","style":"casual"})
Hey Ada! What's up?
You > exit
Goodbye.Understand the scaffold
The template supplies the working agent shape. Each add-on contributes the required crate features, imports, configuration, and an explicit place to finish the integration.
Template
Generates an LLM agent with a typed #[tool] function and the schema wiring needed for model tool calls.
Add-on
Enables OpenTelemetry integration so model, tool, and runtime work can be traced.
Add-on
Adds session-service wiring so conversation state can survive beyond one model call.
Add-on
Adds the feature and clear hooks for input validation, output checks, and content filtering.
Choose a different starting shape
Pick the shape that matches the first piece of useful work. Templates generate editable Rust source, dependencies, provider configuration, and a runnable entry point.
llmAgent templateGenerates an LlmAgentBuilder, Gemini model setup, instructions, session-backed Launcher, and an interactive terminal.
Choose this when
Choose it for assistants, extraction, classification, or a focused model-and-tool loop.
Generated starting point
One LLM agent · streamed console · provider configuration
cargo adk new my-agent --template llmtoolsAgent templateAdds src/tools.rs with a working #[tool] function, typed arguments, JSON Schema generation, and registration on the LLM agent.
Choose this when
Choose it when the agent needs to calculate, retrieve data, call business logic, or perform an action.
Generated starting point
LlmAgent · Greet tool · serde · schemars · adk-tool
cargo adk new my-agent --template toolsragAgent templateCreates a RAG pipeline with document chunking, Gemini embeddings, an in-memory vector store, a sample document, and RagTool.
Choose this when
Choose it for product documentation, policies, research collections, or answers grounded in private material.
Generated starting point
RagPipeline · chunker · embeddings · vector search · RagTool
cargo adk new my-agent --template ragapiAgent templateGenerates an Axum server with health, session creation, and streamed run endpoints around an LLM agent.
Choose this when
Choose it when a web application, mobile client, backend service, or automation platform will call the agent.
Generated starting point
Axum · REST routes · SSE responses · in-memory sessions
cargo adk new my-agent --template apia2aPattern aliasResolves to the a2a-server pattern and combines an LLM agent with server and session capabilities for Agent-to-Agent access.
Choose this when
Choose it when another agent must discover and call this agent across a deployment or ownership boundary.
Generated starting point
A2A server · agent identity · task handling · sessions
cargo adk new my-agent --template a2agraphAgent templateEnables the graph capability and creates the imports and agent starting point for nodes, edges, checkpoints, interruption, and resume.
Choose this when
Choose it for long-running work with branches, approval steps, recovery, or durable execution state.
Generated starting point
Graph feature · workflow agent · topology starting point
cargo adk new my-agent --template graphrealtimeAgent templateEnables realtime support and creates a concise voice-agent starting point with realtime imports and provider configuration.
Choose this when
Choose it for natural conversation, interruption, live translation, audio tools, or incoming video frames.
Generated starting point
Realtime feature · voice instructions · transport starting point
cargo adk new my-agent --template realtimesequentialWorkflow templateGenerates researcher and writer agents inside a SequentialAgent so each stage receives the work produced by the previous stage.
Choose this when
Choose it when the process has clear phases such as collect, analyze, draft, review, and publish.
Generated starting point
Two LLM agents · ordered execution · shared invocation trail
cargo adk new my-agent --template sequentialparallelWorkflow templateGenerates two specialist agents inside a ParallelAgent and gathers their work through one parent workflow.
Choose this when
Choose it when several investigations can begin from the same input and complete independently.
Generated starting point
Two LLM agents · concurrent execution · aggregated results
cargo adk new my-agent --template parallelloopWorkflow templateCreates a worker inside LoopAgent with an explicit completion signal and a five-iteration safety limit.
Choose this when
Choose it for drafting, critique, repair, validation, or search processes that improve through repeated passes.
Generated starting point
LoopAgent builder · worker agent · completion instruction · max iterations
cargo adk new my-agent --template loopconditionalWorkflow templateGenerates technical and general agents inside a ConditionalAgent that selects a path from the incoming request.
Choose this when
Choose it when categories of work need different instructions, tools, models, or domain specialists.
Generated starting point
ConditionalAgent · two routes · LLM-based selection
cargo adk new my-agent --template conditionalcustomAgent templateCreates a MyAgent type with the Agent trait methods and a run function ready for your own Rust execution logic and event stream.
Choose this when
Choose it for deterministic orchestration, existing state machines, domain runtimes, or behavior that needs full Rust control.
Generated starting point
Agent trait skeleton · InvocationContext · EventStream entry point
cargo adk new my-agent --template customThe CLI registry also includes the provider-specific openai template, five enterprise patterns, the basic and a2a aliases, and composable capability add-ons.
cargo adk templatescargo adk addonsCompile what you need
First choose a template for the project’s execution shape. Then select a feature tier for the capabilities compiled into the binary.
Feature tiers control dependencies, compile time, binary surface, and the available framework APIs. Persistent databases, MCP, cloud secret managers, and specific realtime transports remain explicit choices.
Agents · Gemini · Runner · sessions
A focused agent with the smallest default surface.
Tools · memory · graph · server · auth · eval · telemetry
Most APIs, workflow systems, and internal agent products.
Realtime base · browser · RAG · payments · AWP
Products that need richer interaction and interoperability.
Audio · code execution · sandbox
Opt into the heaviest local and execution capabilities.
adk-rust = { version = "2.0.0", features = ["standard"] }Build with ADK-Rust
Your first useful milestone is one request, one visible tool call, and one session you understand. The guided quickstart builds that path. From there, add the workflows, state, protocols, and operating controls your product requires.