Introduction to ADK-Rust
Agent Development Kit (ADK) is a flexible and modular framework for developing and deploying AI agents. While optimized for Gemini and the Google ecosystem, ADK is model-agnostic, deployment-agnostic, and built for compatibility with other frameworks. ADK was designed to make agent development feel more like software development, making it easier for developers to create, deploy, and orchestrate agentic architectures that range from simple tasks to complex workflows.
Note: ADK-Rust requires Rust 1.95.0 or higher.
Installation
Add ADK-Rust to your project:
cargo add adk-rust
Or add it to your Cargo.toml:
[dependencies]
adk-rust = "2.0.0"
tokio = { version = "1.40", features = ["full"] }
Quick Example
use adk_rust::prelude::*;
use std::sync::Arc;
#[tokio::main]
async fn main() -> std::result::Result<(), Box<dyn std::error::Error>> {
let api_key = std::env::var("GOOGLE_API_KEY")?;
let model = GeminiModel::new(&api_key, "gemini-2.5-flash")?;
let agent = LlmAgentBuilder::new("assistant")
.description("A helpful AI assistant")
.model(Arc::new(model))
.build()?;
println!("Agent '{}' ready!", agent.name());
Ok(())
}
Architecture Overview
ADK-Rust uses a layered architecture designed for modularity and extensibility:
Core Concepts
ADK-Rust is built around several key primitives that work together to create powerful AI agents:
Agents
The fundamental worker unit designed for specific tasks. ADK-Rust provides several agent types:
- LlmAgent: Uses a Large Language Model for reasoning and decision-making. This is the primary agent type for most use cases.
- RealtimeAgent: Voice-enabled agents using OpenAI Realtime API or Gemini Live API for bidirectional audio streaming.
- GraphAgent: LangGraph-style workflow orchestration with state management, checkpointing, and human-in-the-loop support.
- CustomAgent: Allows you to implement custom logic with full control over agent behavior.
- Workflow Agents: Deterministic agents that follow predefined execution paths:
SequentialAgent: Executes sub-agents in orderParallelAgent: Executes sub-agents concurrentlyLoopAgent: Iteratively executes sub-agents until a condition is met
Tools
Tools give agents abilities beyond conversation, letting them interact with external APIs, search information, or perform custom operations:
- FunctionTool: Wrap any async Rust function as a tool
- GoogleSearchTool: Built-in web search capability
- BrowserToolset: 46 WebDriver tools for web automation (navigation, forms, screenshots, etc.)
- ExitLoopTool: Control loop termination in LoopAgent
- McpToolset: Connect one MCP server and expose reviewed tools, resources, prompts, completion, subscriptions, elicitation, and negotiated tasks
- McpServerManager: Add, update, monitor, restart, persist, and aggregate a changing registry of local MCP servers while the application is running
Sessions
Sessions handle the context of a single conversation, including:
- Session ID: Unique identifier for the conversation
- Events: The conversation history (user messages, agent responses, tool calls)
- State: Working memory for the conversation with scoped prefixes (
app:,user:,temp:)
Callbacks
Custom code that runs at specific points in the agent's execution:
before_agent/after_agent: Intercept agent invocationsbefore_model/after_model: Intercept LLM callsbefore_tool/after_tool: Intercept tool executions
Callbacks enable logging, guardrails, caching, and behavior modification.
Artifacts
Binary data storage for files, images, or other non-text content:
- Save and load artifacts with versioning
- Namespace scoping (session-level or user-level)
- Pluggable storage backends
Events
The basic unit of communication representing things that happen during a session:
- User messages
- Agent responses
- Tool calls and results
- State changes
Events form the conversation history and enable replay and debugging.
Models
The underlying LLM that powers LlmAgents. ADK-Rust is optimized for Gemini but supports multiple providers through the Llm trait:
- Gemini: Google's Gemini models (
gemini-3-pro,gemini-3-flash,gemini-2.5-flash,gemini-2.5-pro) - OpenAI:
gpt-5.1,gpt-5,gpt-5-mini, Azure OpenAI - Anthropic:
claude-opus-4-6,claude-sonnet-4-6,claude-haiku-4-5 - DeepSeek:
deepseek-r1,deepseek-v3.1,deepseek-chatwith thinking mode - Groq: Ultra-fast inference with
llama-4-scout,llama-3.1-70b-versatile,mixtral-8x7b-32768 - Ollama: Local inference with
qwen3.6:35b-a3b,qwen3.5,llama3.2:3b,deepseek-r1:14b - mistral.rs: High-performance local inference with hardware acceleration
All providers implement the same trait for interchangeable use:
pub trait Llm: Send + Sync {
async fn generate(&self, request: LlmRequest) -> Result<LlmResponse>;
async fn generate_stream(&self, request: LlmRequest) -> Result<LlmResponseStream>;
}
Runner
The engine that manages execution flow, orchestrates agent interactions, and coordinates with backend services. The Runner handles:
- Agent invocation and response processing
- Tool execution
- Session and state management
- Event streaming
Feature Flags
ADK-Rust uses Cargo features for modularity. Four presets control which crates are compiled:
# Minimal (default) — Gemini, agents, runner, sessions
adk-rust = "2.0.0"
# Standard — adds tools, memory, telemetry, server, auth, graph, eval, guardrail, plugins, artifacts, skills
adk-rust = { version = "2.0.0", features = ["standard"] }
# Enterprise — standard + realtime, browser, RAG, payments, AWP
adk-rust = { version = "2.0.0", features = ["enterprise"] }
# Full — enterprise + audio, code execution, sandbox
adk-rust = { version = "2.0.0", features = ["full"] }
# Equivalent explicit minimal selection
adk-rust = { version = "2.0.0", default-features = false, features = ["minimal"] }
# Custom: Pick what you need
adk-rust = { version = "2.0.0", default-features = false, features = ["agents", "gemini", "tools"] }
Available features:
agents: Agent implementations (LlmAgent, CustomAgent, workflow agents)models: Model integrations (Gemini)openai: OpenAI models (GPT-5, GPT-5 Mini)anthropic: Anthropic models (Claude 4.6, Claude 4.5)deepseek: DeepSeek models (chat, reasoner)groq: Groq ultra-fast inferenceollama: Local Ollama modelstools: Tool system and built-in toolssessions: Session managementartifacts: Artifact storagememory: Memory system with semantic search and a bi-temporal knowledge-graph backend (GraphMemoryService)runner: Agent execution runtimeserver: HTTP server (REST + A2A)telemetry: tracing helpers; addtelemetry-otlponly when exporting OTLPcli: CLI launcher; addcli-openai,cli-anthropic, or another CLI provider feature only when neededmcp: Model Context Protocol integration foradk-toolrecord-payloads: opt in to full tracing payload capturegraph: Graph-based workflows (standard preset)realtime: Voice + multimodal streaming — OpenAI Realtime & Gemini Live, bidirectional audio, video frames, affective dialogue, server-side tools (enterprise preset)browser: Browser automation (enterprise preset)eval: Agent evaluation (standard preset)rag: RAG pipeline (enterprise preset)code: Code execution (full preset)sandbox: Sandboxed execution (full preset)audio: Audio processing (full preset)
Other Languages
ADK is available in multiple languages:
- Python:
pip install google-adk- Documentation - Go:
go get google.golang.org/adk- Documentation - Java: Maven/Gradle - Documentation
Next: Quickstart →