adk-runner
Agent execution runtime for ADK-Rust.
Overview
adk-runner provides the execution runtime for ADK-Rust:
- Runner - Manages agent execution with full context
- Session Integration - Automatic session creation and state management
- Memory Injection - Retrieves and injects relevant memories
- Artifact Handling - Manages binary artifacts during execution
- Event Streaming - Streams agent events with state propagation
- Agent Transfer - Automatic handling of agent-to-agent transfers
Installation
[]
= "0.1"
Or use the meta-crate:
[]
= { = "0.1", = ["runner"] }
Quick Start
use ;
use InMemorySessionService;
use InMemoryArtifactService;
use Content;
use Arc;
// Create services
let sessions = new;
let artifacts = new;
// Configure runner with agent
let config = RunnerConfig ;
// Create runner
let runner = new?;
// Run agent for a user/session
let mut stream = runner.run.await?;
// Process events
use StreamExt;
while let Some = stream.next.await
RunnerConfig
| Field | Type | Description |
|---|---|---|
app_name |
String |
Application identifier |
agent |
Arc<dyn Agent> |
Root agent to execute |
session_service |
Arc<dyn SessionService> |
Session storage backend |
artifact_service |
Option<Arc<dyn ArtifactService>> |
Optional artifact storage |
memory_service |
Option<Arc<dyn Memory>> |
Optional memory/RAG service |
run_config |
Option<RunConfig> |
Streaming mode config |
Runner vs Direct Agent Execution
| Feature | Direct agent.run() |
Runner |
|---|---|---|
| Session management | Manual | Automatic |
| Memory injection | Manual | Automatic |
| Artifact storage | Manual | Automatic |
| State persistence | Manual | Automatic |
| Agent transfers | Manual | Automatic |
| Event history | Manual | Automatic |
Use Runner for production; direct execution for testing.
Agent Transfers
Runner automatically handles agent-to-agent transfers:
// When an agent sets transfer_to_agent in EventActions,
// Runner automatically:
// 1. Finds the target agent in the agent tree
// 2. Creates a new invocation context
// 3. Preserves session state across the transfer
// 4. Continues streaming events from the new agent
State Propagation
Runner applies state changes immediately:
// When an agent emits an event with state_delta,
// Runner applies it to the mutable session so
// downstream agents can read the updated state.
Related Crates
- adk-rust - Meta-crate with all components
- adk-core - Core traits
- adk-session - Session storage
- adk-artifact - Artifact storage
- adk-cli - CLI using runner
License
Apache-2.0
Part of ADK-Rust
This crate is part of the ADK-Rust framework for building AI agents in Rust.