adk_rust/lib.rs
1//! # Agent Development Kit (ADK) for Rust
2//!
3//! [](https://crates.io/crates/adk-rust)
4//! [](https://docs.rs/adk-rust)
5//! [](https://github.com/zavora-ai/adk-rust/blob/main/LICENSE)
6//!
7//! A flexible and modular framework for developing and deploying AI agents in Rust.
8//! While optimized for Gemini and the Google ecosystem, ADK is model-agnostic,
9//! deployment-agnostic, and compatible with other frameworks.
10//!
11//! ## Quick Start
12//!
13//! Create your first AI agent in minutes:
14//!
15//! ```ignore
16//! use adk_rust::prelude::*;
17//! use adk_rust::Launcher;
18//! use std::sync::Arc;
19//!
20//! #[tokio::main]
21//! async fn main() -> Result<(), Box<dyn std::error::Error>> {
22//! let api_key = std::env::var("GOOGLE_API_KEY")?;
23//! let model = GeminiModel::new(&api_key, "gemini-2.5-flash")?;
24//!
25//! let agent = LlmAgentBuilder::new("assistant")
26//! .description("A helpful AI assistant")
27//! .instruction("You are a friendly assistant. Answer questions concisely.")
28//! .model(Arc::new(model))
29//! .build()?;
30//!
31//! // Run in interactive console mode
32//! Launcher::new(Arc::new(agent)).run().await?;
33//! Ok(())
34//! }
35//! ```
36//!
37//! ## Installation
38//!
39//! Add to your `Cargo.toml`:
40//!
41//! ```toml
42//! [dependencies]
43//! adk-rust = "2.0.0"
44//! tokio = { version = "1.40", features = ["full"] }
45//! dotenvy = "0.15" # For loading .env files
46//! ```
47//!
48//! ### Feature Presets
49//!
50//! ```toml
51//! # Minimal (default) — agents, Gemini, runner, sessions (fastest build)
52//! adk-rust = "2.0.0"
53//!
54//! # Standard — minimal + tools, memory, OpenAI, Anthropic, server, auth,
55//! # graph, eval, guardrails, skills, plugins, artifacts, telemetry
56//! adk-rust = { version = "2.0.0", features = ["standard"] }
57//!
58//! # Enterprise — standard + realtime, browser, rag, payments, awp
59//! adk-rust = { version = "2.0.0", features = ["enterprise"] }
60//!
61//! # Full — enterprise + experimental crates (audio, code, sandbox)
62//! adk-rust = { version = "2.0.0", features = ["full"] }
63//!
64//! # Custom — pick exactly what you need
65//! adk-rust = { version = "2.0.0", default-features = false, features = [
66//! "agents", "gemini", "tools", "sessions", "openai", "openrouter"
67//! ] }
68//! ```
69//!
70//! ## Agent Types
71//!
72//! ADK-Rust provides several agent types for different use cases:
73//!
74//! ### LlmAgent - AI-Powered Reasoning
75//!
76//! The core agent type that uses Large Language Models for intelligent
77//! reasoning. `GoogleSearchTool` below requires the `tools` feature (included in
78//! `standard` and above); the agent itself needs only the default tier:
79//!
80//! ```no_run
81//! use adk_rust::prelude::*;
82//! use std::sync::Arc;
83//!
84//! # async fn example() -> Result<()> {
85//! let api_key = std::env::var("GOOGLE_API_KEY").map_err(|e| AdkError::config(e.to_string()))?;
86//! let model = GeminiModel::new(&api_key, "gemini-2.5-flash")?;
87//!
88//! let agent = LlmAgentBuilder::new("researcher")
89//! .description("Research assistant with web search")
90//! .instruction("Search for information and provide detailed summaries.")
91//! .model(Arc::new(model))
92//! .tool(Arc::new(GoogleSearchTool::new())) // Add tools
93//! .build()?;
94//! # Ok(())
95//! # }
96//! ```
97//!
98//! ### Workflow Agents - Deterministic Pipelines
99//!
100//! For predictable, multi-step workflows:
101//!
102//! ```no_run
103//! use adk_rust::prelude::*;
104//! use std::sync::Arc;
105//!
106//! # async fn example() -> Result<()> {
107//! # let researcher: Arc<dyn Agent> = todo!();
108//! # let writer: Arc<dyn Agent> = todo!();
109//! # let reviewer: Arc<dyn Agent> = todo!();
110//! // Sequential: Execute agents in order
111//! let pipeline = SequentialAgent::new(
112//! "content_pipeline",
113//! vec![researcher, writer, reviewer]
114//! );
115//!
116//! // Parallel: Execute agents concurrently
117//! # let analyst1: Arc<dyn Agent> = todo!();
118//! # let analyst2: Arc<dyn Agent> = todo!();
119//! let parallel = ParallelAgent::new(
120//! "multi_analysis",
121//! vec![analyst1, analyst2]
122//! );
123//!
124//! // Loop: Iterate until condition met
125//! # let refiner: Arc<dyn Agent> = todo!();
126//! let loop_agent = LoopAgent::new("iterative_refiner", vec![refiner])
127//! .with_max_iterations(5);
128//! # Ok(())
129//! # }
130//! ```
131//!
132//! ### Multi-Agent Systems
133//!
134//! Build hierarchical agent systems with automatic delegation:
135//!
136//! ```no_run
137//! use adk_rust::prelude::*;
138//! use std::sync::Arc;
139//!
140//! # async fn example() -> Result<()> {
141//! # let model: Arc<dyn Llm> = todo!();
142//! # let code_agent: Arc<dyn Agent> = todo!();
143//! # let test_agent: Arc<dyn Agent> = todo!();
144//! let coordinator = LlmAgentBuilder::new("coordinator")
145//! .description("Development team coordinator")
146//! .instruction("Delegate coding tasks to specialists.")
147//! .model(model)
148//! .sub_agent(code_agent) // Delegate to sub-agents
149//! .sub_agent(test_agent)
150//! .build()?;
151//! # Ok(())
152//! # }
153//! ```
154//!
155//! ## Tools
156//!
157//! Give your agents capabilities beyond conversation. The tool types below
158//! require the `tools` feature (included in `standard` and above):
159//!
160//! ### Function Tools - Custom Operations
161//!
162//! Convert any async function into a tool:
163//!
164//! ```no_run
165//! use adk_rust::prelude::*;
166//! use adk_rust::serde_json::{json, Value};
167//! use std::sync::Arc;
168//!
169//! async fn get_weather(_ctx: Arc<dyn ToolContext>, args: Value) -> Result<Value> {
170//! let city = args["city"].as_str().unwrap_or("Unknown");
171//! // Your weather API call here
172//! Ok(json!({
173//! "temperature": 72.0,
174//! "conditions": "Sunny",
175//! "city": city
176//! }))
177//! }
178//!
179//! # fn example() -> Result<()> {
180//! let weather_tool = FunctionTool::new(
181//! "get_weather",
182//! "Get current weather for a city",
183//! get_weather,
184//! );
185//! # Ok(())
186//! # }
187//! ```
188//!
189//! ### Built-in Tools
190//!
191//! Ready-to-use tools included with ADK:
192//!
193//! - `GoogleSearchTool` - Web search via Google
194//! - `ExitLoopTool` - Control loop termination
195//! - `LoadArtifactsTool` - Access stored artifacts
196//!
197//! ### MCP Tools - External Integrations
198//!
199//! Connect to Model Context Protocol servers using the `rmcp` crate:
200//!
201//! ```ignore
202//! use adk_rust::prelude::*;
203//! use adk_rust::tool::McpToolset;
204//! use rmcp::{ServiceExt, transport::TokioChildProcess};
205//! use tokio::process::Command;
206//!
207//! # async fn example() -> Result<(), Box<dyn std::error::Error>> {
208//! // Connect to an MCP server (e.g., filesystem, database)
209//! let client = ().serve(TokioChildProcess::new(
210//! Command::new("npx")
211//! .arg("-y")
212//! .arg("@anthropic/mcp-server-filesystem")
213//! .arg("/path/to/dir")
214//! )?).await?;
215//!
216//! let mcp_tools = McpToolset::new(client);
217//!
218//! // Add all MCP tools to your agent
219//! # let builder: LlmAgentBuilder = todo!();
220//! let agent = builder.toolset(Arc::new(mcp_tools)).build()?;
221//! # Ok(())
222//! # }
223//! ```
224//!
225//! ## Sessions & State
226//!
227//! Manage conversation context and working memory:
228//!
229//! ```no_run
230//! use adk_rust::prelude::*;
231//! use adk_rust::session::{SessionService, CreateRequest};
232//! use adk_rust::serde_json::json;
233//! use std::collections::HashMap;
234//!
235//! # async fn example() -> Result<()> {
236//! let session_service = InMemorySessionService::new();
237//!
238//! // Create a session
239//! let session = session_service.create(CreateRequest {
240//! app_name: "my_app".to_string(),
241//! user_id: "user_123".to_string(),
242//! session_id: None,
243//! state: HashMap::new(),
244//! }).await?;
245//!
246//! // Read state (State trait provides read access)
247//! let state = session.state();
248//! let config = state.get("app:config"); // Returns Option<Value>
249//! # Ok(())
250//! # }
251//! ```
252//!
253//! ## Callbacks
254//!
255//! Intercept and customize agent behavior:
256//!
257//! ```no_run
258//! use adk_rust::prelude::*;
259//! use std::sync::Arc;
260//!
261//! # async fn example() -> Result<()> {
262//! # let model: Arc<dyn Llm> = todo!();
263//! let agent = LlmAgentBuilder::new("monitored_agent")
264//! .model(model)
265//! // Modify or inspect model responses
266//! .after_model_callback(Box::new(|_ctx, response| {
267//! Box::pin(async move {
268//! println!("Model responded");
269//! Ok(Some(response)) // Return modified response or None to keep original
270//! })
271//! }))
272//! // Track tool usage
273//! .before_tool_callback(Box::new(|_ctx| {
274//! Box::pin(async move {
275//! println!("Tool about to be called");
276//! Ok(None) // Continue execution
277//! })
278//! }))
279//! .build()?;
280//! # Ok(())
281//! # }
282//! ```
283//!
284//! ## Artifacts
285//!
286//! Store and retrieve binary data (images, files, etc.). Requires the
287//! `artifacts` feature (included in `standard` and above):
288//!
289//! ```no_run
290//! use adk_rust::prelude::*;
291//! use adk_rust::artifact::{ArtifactService, SaveRequest, LoadRequest};
292//!
293//! # async fn example() -> Result<()> {
294//! let artifact_service = InMemoryArtifactService::new();
295//!
296//! // Save an artifact
297//! let response = artifact_service.save(SaveRequest {
298//! app_name: "my_app".to_string(),
299//! user_id: "user_123".to_string(),
300//! session_id: "session_456".to_string(),
301//! file_name: "sales_chart.png".to_string(),
302//! part: Part::Text { text: "chart data".to_string() },
303//! version: None,
304//! }).await?;
305//!
306//! // Load an artifact
307//! let loaded = artifact_service.load(LoadRequest {
308//! app_name: "my_app".to_string(),
309//! user_id: "user_123".to_string(),
310//! session_id: "session_456".to_string(),
311//! file_name: "sales_chart.png".to_string(),
312//! version: None,
313//! }).await?;
314//! # Ok(())
315//! # }
316//! ```
317//!
318//! ## Deployment Options
319//!
320//! ### Console Mode (Interactive CLI)
321//!
322//! ```no_run
323//! use adk_rust::prelude::*;
324//! use adk_rust::Launcher;
325//! use std::sync::Arc;
326//!
327//! # async fn example() -> Result<()> {
328//! # let agent: Arc<dyn Agent> = todo!();
329//! // Interactive chat in terminal
330//! Launcher::new(agent).run().await?;
331//! # Ok(())
332//! # }
333//! ```
334//!
335//! ### Server Mode (REST API)
336//!
337//! ```bash
338//! # Run your agent as a web server
339//! cargo run -- serve --port 8080
340//! ```
341//!
342//! Provides endpoints:
343//! - `POST /chat` - Send messages
344//! - `GET /sessions` - List sessions
345//! - `GET /health` - Health check
346//!
347//! ### Agent-to-Agent (A2A) Protocol
348//!
349//! Expose your agent for inter-agent communication. Requires the `server`
350//! feature (included in `standard` and above):
351//!
352//! ```no_run
353//! use adk_rust::server::{create_app_with_a2a, ServerConfig};
354//! use adk_rust::AgentLoader;
355//!
356//! # async fn example() -> adk_rust::Result<()> {
357//! # let agent_loader: std::sync::Arc<dyn AgentLoader> = todo!();
358//! # let session_service: std::sync::Arc<dyn adk_rust::session::SessionService> = todo!();
359//! // Create server with A2A protocol support
360//! let config = ServerConfig::new(agent_loader, session_service);
361//! let app = create_app_with_a2a(config, Some("http://localhost:8080"));
362//!
363//! // Run the server (requires axum dependency)
364//! // let listener = tokio::net::TcpListener::bind("0.0.0.0:8080").await?;
365//! // axum::serve(listener, app).await?;
366//! # Ok(())
367//! # }
368//! ```
369//!
370//! ## Observability
371//!
372//! Built-in OpenTelemetry support for production monitoring. Requires the
373//! `telemetry` feature (included in `standard` and above); OTLP export adds
374//! `telemetry-otlp`:
375//!
376//! ```no_run
377//! use adk_rust::telemetry::init_telemetry;
378//!
379//! # fn example() -> Result<(), Box<dyn std::error::Error>> {
380//! // Basic telemetry with console logging
381//! init_telemetry("my-agent-service")?;
382//!
383//! // With `features = ["telemetry-otlp"]`, export spans to a collector instead:
384//! // adk_rust::telemetry::init_with_otlp("my-agent-service", "http://localhost:4317")?;
385//!
386//! // All agent operations now emit traces and metrics
387//! # Ok(())
388//! # }
389//! ```
390//!
391//! ## Architecture
392//!
393//! ADK-Rust uses a layered architecture for modularity:
394//!
395//! ```text
396//! ┌─────────────────────────────────────────────────────────────┐
397//! │ Application Layer │
398//! │ Launcher • REST Server • A2A │
399//! ├─────────────────────────────────────────────────────────────┤
400//! │ Runner Layer │
401//! │ Agent Execution • Event Streaming │
402//! ├─────────────────────────────────────────────────────────────┤
403//! │ Agent Layer │
404//! │ LlmAgent • CustomAgent • Sequential • Parallel • Loop │
405//! ├─────────────────────────────────────────────────────────────┤
406//! │ Service Layer │
407//! │ Models • Tools • Sessions • Artifacts • Memory │
408//! └─────────────────────────────────────────────────────────────┘
409//! ```
410//!
411//! ## Feature Flags
412//!
413//! | Feature | Description | Preset |
414//! |---------|-------------|--------|
415//! | `agents` | Agent implementations | minimal (default) |
416//! | `models` | Model integrations | minimal (default) |
417//! | `gemini` | Gemini model support | minimal (default) |
418//! | `runner` | Execution runtime | minimal (default) |
419//! | `sessions` | Session management | minimal (default) |
420//! | `tools` | Tool system | standard |
421//! | `skills` | Skill discovery | standard |
422//! | `artifacts` | Artifact storage | standard |
423//! | `memory` | Semantic memory | standard |
424//! | `telemetry` | OpenTelemetry | standard |
425//! | `guardrail` | Input/output validation | standard |
426//! | `auth` | Access control | standard |
427//! | `plugin` | Plugin system | standard |
428//! | `server` | HTTP server + A2A | standard |
429//! | `graph` | Graph workflows | standard |
430//! | `eval` | Agent evaluation | standard |
431//! | `openai` | OpenAI model support | standard |
432//! | `anthropic` | Anthropic model support | standard |
433//! | `realtime` | Voice/audio streaming | enterprise |
434//! | `browser` | Browser automation | enterprise |
435//! | `rag` | RAG pipeline | enterprise |
436//! | `payments` | Agentic commerce (ACP/AP2) | enterprise |
437//! | `awp` | Agentic Web Protocol | enterprise |
438//! | `code` | Code execution | full (experimental) |
439//! | `sandbox` | Sandboxed execution | full (experimental) |
440//! | `audio` | Audio processing | full (experimental) |
441//! | `cli` | CLI launcher | (opt-in, any preset) |
442//! | `gemini-agent-platform` | Gemini Enterprise Agent Platform integrations (Vertex model backend, managed Sessions, GCP Secret Manager); excludes realtime transports and host-side deploy tooling | (opt-in, any preset) |
443//! | `gemini-agent-platform-full` | `gemini-agent-platform` + Vertex AI Live API (realtime stack) | (opt-in, any preset) |
444//!
445//! ## Examples
446//!
447//! The [examples directory](https://github.com/zavora-ai/adk-rust/tree/main/examples)
448//! contains working examples for every feature:
449//!
450//! - **Agents**: LLM agent, workflow agents, multi-agent systems
451//! - **Tools**: Function tools, Google Search, MCP integration
452//! - **Sessions**: State management, conversation history
453//! - **Callbacks**: Logging, guardrails, caching
454//! - **Deployment**: Console, server, A2A protocol
455//!
456//! ## Related Crates
457//!
458//! ADK-Rust is composed of modular crates that can be used independently:
459//!
460//! - [`adk-core`](https://docs.rs/adk-core) - Core traits and types
461//! - [`adk-agent`](https://docs.rs/adk-agent) - Agent implementations
462//! - [`adk-model`](https://docs.rs/adk-model) - LLM integrations
463//! - [`adk-tool`](https://docs.rs/adk-tool) - Tool system
464//! - [`adk-session`](https://docs.rs/adk-session) - Session management
465//! - [`adk-artifact`](https://docs.rs/adk-artifact) - Artifact storage
466//! - [`adk-runner`](https://docs.rs/adk-runner) - Execution runtime
467//! - [`adk-server`](https://docs.rs/adk-server) - HTTP server
468//! - [`adk-telemetry`](https://docs.rs/adk-telemetry) - Observability
469
470#![warn(missing_docs)]
471#![cfg_attr(docsrs, feature(doc_cfg))]
472
473// ============================================================================
474// Core (always available)
475// ============================================================================
476
477/// Core traits and types.
478///
479/// Always available regardless of feature flags. Includes:
480/// - [`Agent`] - The fundamental trait for all agents
481/// - [`Tool`] / [`Toolset`] - For extending agents with capabilities
482/// - [`Session`] / [`State`] - For managing conversation context
483/// - [`Event`] - For streaming agent responses
484/// - [`AdkError`] / [`Result`] - Unified error handling
485pub use adk_core::*;
486
487// Re-export common dependencies for convenience
488pub use anyhow;
489pub use async_trait::async_trait;
490pub use futures;
491pub use serde;
492pub use serde_json;
493pub use tokio;
494
495// ============================================================================
496// Component Modules (feature-gated)
497// ============================================================================
498
499/// Agent implementations (LLM, Custom, Workflow agents).
500///
501/// Provides the core agent types:
502/// - [`LlmAgent`](agent::LlmAgent) - AI-powered agent using LLMs
503/// - [`CustomAgent`](agent::CustomAgent) - Implement custom agent logic
504/// - [`SequentialAgent`](agent::SequentialAgent) - Execute agents in sequence
505/// - [`ParallelAgent`](agent::ParallelAgent) - Execute agents concurrently
506/// - [`LoopAgent`](agent::LoopAgent) - Iterative execution until condition met
507///
508/// Available with feature: `agents`
509#[cfg(feature = "agents")]
510#[cfg_attr(docsrs, doc(cfg(feature = "agents")))]
511pub mod agent {
512 pub use adk_agent::*;
513}
514
515/// Model integrations (Gemini, etc.).
516///
517/// Provides LLM implementations:
518/// - [`GeminiModel`](model::GeminiModel) - Google's Gemini models
519///
520/// ADK is model-agnostic - implement the [`Llm`] trait for other providers.
521///
522/// Available with feature: `models`
523#[cfg(feature = "models")]
524#[cfg_attr(docsrs, doc(cfg(feature = "models")))]
525pub mod model {
526 pub use adk_model::*;
527}
528
529/// Tool system and built-in tools.
530///
531/// Give agents capabilities beyond conversation:
532/// - `FunctionTool` - Wrap async functions as tools
533/// - `GoogleSearchTool` - Web search
534/// - `ExitLoopTool` - Control loop agents
535/// - `McpToolset` - MCP server integration with the `mcp` feature
536/// - `CodeTool` / `PythonCodeTool` / `JavaScriptCodeTool` / `MontyPythonCodeTool` -
537/// Code execution with the `code-tools` feature (included in `full`); the
538/// embedded live paths need `code-embedded-js` / `code-embedded-python`
539///
540/// Available with feature: `tools`
541#[cfg(feature = "tools")]
542#[cfg_attr(docsrs, doc(cfg(feature = "tools")))]
543pub mod tool {
544 pub use adk_tool::*;
545}
546
547/// AgentSkills parsing, indexing, and runtime injection helpers.
548///
549/// Provides:
550/// - Skill file discovery from `.skills/`
551/// - Frontmatter validation (`name`, `description`)
552/// - Lexical skill selection
553/// - Runner plugin helper for skill injection
554///
555/// Available with feature: `skills`
556#[cfg(feature = "skills")]
557#[cfg_attr(docsrs, doc(cfg(feature = "skills")))]
558pub mod skill {
559 pub use adk_skill::*;
560}
561
562/// Session management.
563///
564/// Manage conversation context and state:
565/// - [`InMemorySessionService`](session::InMemorySessionService) - In-memory sessions
566/// - Session creation, retrieval, and lifecycle
567/// - State management with scoped prefixes
568///
569/// Available with feature: `sessions`
570#[cfg(feature = "sessions")]
571#[cfg_attr(docsrs, doc(cfg(feature = "sessions")))]
572pub mod session {
573 pub use adk_session::*;
574}
575
576/// Artifact storage.
577///
578/// Store and retrieve binary data:
579/// - [`InMemoryArtifactService`](artifact::InMemoryArtifactService) - In-memory storage
580/// - Version tracking for artifacts
581/// - Namespace scoping
582///
583/// Available with feature: `artifacts`
584#[cfg(feature = "artifacts")]
585#[cfg_attr(docsrs, doc(cfg(feature = "artifacts")))]
586pub mod artifact {
587 pub use adk_artifact::*;
588}
589
590/// Memory system with semantic search.
591///
592/// Long-term memory for agents:
593/// - [`InMemoryMemoryService`](memory::InMemoryMemoryService) - In-memory storage
594/// - Semantic search capabilities
595/// - Memory retrieval and updates
596///
597/// Available with feature: `memory`
598#[cfg(feature = "memory")]
599#[cfg_attr(docsrs, doc(cfg(feature = "memory")))]
600pub mod memory {
601 pub use adk_memory::*;
602}
603
604/// Agent execution runtime.
605///
606/// The engine that manages agent execution:
607/// - [`Runner`](runner::Runner) - Executes agents with full context
608/// - [`RunnerConfig`](runner::RunnerConfig) - Configuration options
609/// - Event streaming and tool coordination
610///
611/// Available with feature: `runner`
612#[cfg(feature = "runner")]
613#[cfg_attr(docsrs, doc(cfg(feature = "runner")))]
614pub mod runner {
615 pub use adk_runner::*;
616}
617
618/// HTTP server (REST + A2A).
619///
620/// Deploy agents as web services:
621/// - REST API for chat interactions
622/// - A2A (Agent-to-Agent) protocol support
623/// - Web UI integration
624///
625/// Available with feature: `server`
626#[cfg(feature = "server")]
627#[cfg_attr(docsrs, doc(cfg(feature = "server")))]
628pub mod server {
629 pub use adk_server::*;
630}
631
632/// Telemetry (OpenTelemetry integration).
633///
634/// Production observability:
635/// - Distributed tracing
636/// - Metrics collection
637/// - Log correlation
638///
639/// Available with feature: `telemetry`
640#[cfg(feature = "telemetry")]
641#[cfg_attr(docsrs, doc(cfg(feature = "telemetry")))]
642pub mod telemetry {
643 pub use adk_telemetry::*;
644}
645
646/// Graph-based workflow engine (LangGraph-inspired).
647///
648/// Build complex agent workflows with:
649/// - [`StateGraph`](graph::StateGraph) - Graph builder with nodes and edges
650/// - [`GraphAgent`](graph::GraphAgent) - ADK Agent integration
651/// - [`Checkpointer`](graph::Checkpointer) - Persistent state for human-in-the-loop
652/// - [`Router`](graph::Router) - Conditional edge routing helpers
653/// - Cycle support with recursion limits
654/// - Streaming execution modes
655///
656/// Available with feature: `graph`
657#[cfg(feature = "graph")]
658#[cfg_attr(docsrs, doc(cfg(feature = "graph")))]
659pub mod graph {
660 pub use adk_graph::*;
661}
662
663/// Graph, auth, and v8 wire contracts for safe computer-use orchestration.
664///
665/// Available with feature: `computer-use` (included in `standard`).
666#[cfg(feature = "computer-use")]
667#[cfg_attr(docsrs, doc(cfg(feature = "computer-use")))]
668pub mod computer_use {
669 pub use adk_computer_use::*;
670}
671
672/// Code execution substrate (experimental — `full` preset).
673///
674/// First-class code execution for agents, Studio, and generated projects:
675/// - [`CodeExecutor`](code::CodeExecutor) - Backend trait for execution
676/// - [`ExecutionRequest`](code::ExecutionRequest) - Typed execution request
677/// - [`ExecutionResult`](code::ExecutionResult) - Structured execution result
678/// - [`SandboxPolicy`](code::SandboxPolicy) - Sandbox capability model
679/// - [`Workspace`](code::Workspace) - Collaborative project context
680///
681/// Available with feature: `code`
682#[cfg(feature = "code")]
683#[cfg_attr(docsrs, doc(cfg(feature = "code")))]
684pub mod code {
685 pub use adk_code::*;
686}
687
688/// Python `CodeRuntime` for the CodeActAgent, backed by the Monty interpreter
689/// (experimental).
690///
691/// Lets a [`CodeActAgent`](agent::codeact::CodeActAgent) act by writing Python:
692/// - [`MontyRuntime`](codeact_monty::MontyRuntime) - The `CodeRuntime` implementation
693/// - [`OsAccess`](codeact_monty::OsAccess) - Host-granted filesystem/environment/clock policy
694/// - [`PathAccess`](codeact_monty::PathAccess) - Read-only / read-write mount modes
695///
696/// Available with feature: `codeact-monty` (implies `codeact`)
697#[cfg(feature = "codeact-monty")]
698#[cfg_attr(docsrs, doc(cfg(feature = "codeact-monty")))]
699pub mod codeact_monty {
700 pub use adk_codeact_monty::*;
701}
702
703/// Isolated code execution runtime (experimental — `full` preset).
704///
705/// Provides the [`SandboxBackend`](sandbox::SandboxBackend) trait and built-in backends:
706/// - [`ProcessBackend`](sandbox::ProcessBackend) - Subprocess execution with timeout and env isolation
707/// - `WasmBackend` - In-process WASM execution via wasmtime (requires `wasm` feature)
708/// - [`SandboxTool`](sandbox::SandboxTool) - Tool trait implementation for agent integration
709///
710/// Available with feature: `sandbox`
711#[cfg(feature = "sandbox")]
712#[cfg_attr(docsrs, doc(cfg(feature = "sandbox")))]
713pub mod sandbox {
714 pub use adk_sandbox::*;
715}
716
717/// Lightweight console launcher — always available with the `runner` feature.
718///
719/// When the `cli` feature is enabled, this is replaced by the full-featured
720/// `adk_cli::Launcher` with `--serve` mode, readline history, and thinking
721/// block rendering.
722#[cfg(all(feature = "runner", not(feature = "cli")))]
723#[cfg_attr(docsrs, doc(cfg(feature = "runner")))]
724pub use adk_runner::Launcher;
725
726/// Full-featured CLI launcher with console and serve modes.
727///
728/// Requires the `cli` feature (included in `standard` tier).
729/// Provides `--serve` mode, `rustyline` history, and `clap` CLI parsing.
730#[cfg(feature = "cli")]
731#[cfg_attr(docsrs, doc(cfg(feature = "cli")))]
732pub use adk_cli::Launcher;
733
734/// Real-time bidirectional streaming (voice, video).
735///
736/// Provides real-time audio/video streaming for voice-enabled agents:
737/// - [`RealtimeAgent`](realtime::RealtimeAgent) - Agent with voice capabilities
738/// - [`RealtimeRunner`](realtime::RealtimeRunner) - Session management and tool execution
739/// - Multiple providers: OpenAI Realtime, Gemini Live
740///
741/// Available with feature: `realtime`
742#[cfg(feature = "realtime")]
743#[cfg_attr(docsrs, doc(cfg(feature = "realtime")))]
744pub mod realtime {
745 pub use adk_realtime::*;
746}
747
748/// Browser automation (WebDriver).
749///
750/// Provides browser automation tools for agents:
751/// - [`BrowserSession`](browser::BrowserSession) - WebDriver session management
752/// - [`BrowserToolset`](browser::BrowserToolset) - Browser tools for agents
753///
754/// Available with feature: `browser`
755#[cfg(feature = "browser")]
756#[cfg_attr(docsrs, doc(cfg(feature = "browser")))]
757pub mod browser {
758 pub use adk_browser::*;
759}
760
761/// Agent evaluation framework.
762///
763/// Test and validate agent behavior:
764/// - [`Evaluator`](eval::Evaluator) - Run evaluation suites
765/// - [`EvaluationConfig`](eval::EvaluationConfig) - Configure evaluation parameters
766///
767/// Available with feature: `eval`
768#[cfg(feature = "eval")]
769#[cfg_attr(docsrs, doc(cfg(feature = "eval")))]
770pub mod eval {
771 pub use adk_eval::*;
772}
773
774/// Guardrails for safety and policy enforcement.
775///
776/// Validate agent inputs and outputs:
777/// - [`GuardrailSet`](guardrail::GuardrailSet) - Collection of guardrails
778/// - [`ContentFilter`](guardrail::ContentFilter) - Content safety filtering
779///
780/// Available with feature: `guardrail`
781#[cfg(feature = "guardrail")]
782#[cfg_attr(docsrs, doc(cfg(feature = "guardrail")))]
783pub mod guardrail {
784 pub use adk_guardrail::*;
785}
786
787/// Authentication and access control.
788///
789/// Manage agent permissions and identity:
790/// - [`Permission`](auth::Permission) - Permission definitions
791/// - [`AccessControl`](auth::AccessControl) - Access control enforcement
792///
793/// Available with feature: `auth`
794#[cfg(feature = "auth")]
795#[cfg_attr(docsrs, doc(cfg(feature = "auth")))]
796pub mod auth {
797 pub use adk_auth::*;
798}
799
800/// Agentic commerce and payment orchestration.
801///
802/// Provides protocol-neutral payment primitives and adapters for:
803/// - ACP stable `2026-01-30`
804/// - ACP experimental surfaces behind `acp-experimental`
805/// - AP2 `v0.1-alpha` as of `2026-03-22`
806///
807/// Available with feature: `payments`
808#[cfg(feature = "payments")]
809#[cfg_attr(docsrs, doc(cfg(feature = "payments")))]
810pub mod payment {
811 pub use adk_payments::*;
812}
813
814/// Plugin system for extending agent behavior.
815///
816/// Extensible callback architecture for agent lifecycle hooks:
817/// - Plugin registration and discovery
818/// - Before/after hooks for agent operations
819///
820/// Available with feature: `plugin`
821#[cfg(feature = "plugin")]
822#[cfg_attr(docsrs, doc(cfg(feature = "plugin")))]
823pub mod plugin {
824 pub use adk_plugin::*;
825}
826
827/// Audio processing pipeline (experimental — `full` preset).
828///
829/// Provides audio capabilities for agents:
830/// - [`TtsProvider`](audio::TtsProvider) - Text-to-speech synthesis
831/// - [`SttProvider`](audio::SttProvider) - Speech-to-text transcription
832/// - [`AudioProcessor`](audio::AudioProcessor) - Audio effects processing
833/// - `AudioPipeline` - Composable audio pipelines
834/// - Cloud providers: ElevenLabs, OpenAI, Gemini, Cartesia, Deepgram, AssemblyAI
835/// - Local inference: MLX (Apple Silicon), ONNX Runtime
836///
837/// Available with feature: `audio`
838#[cfg(feature = "audio")]
839#[cfg_attr(docsrs, doc(cfg(feature = "audio")))]
840pub mod audio {
841 pub use adk_audio::*;
842}
843
844/// Retrieval-Augmented Generation (RAG) pipeline.
845///
846/// Modular RAG system with trait-based components:
847/// - [`RagPipeline`](rag::RagPipeline) - Orchestrates ingest and query workflows
848/// - [`RagTool`](rag::RagTool) - Agentic retrieval via `Tool` trait
849/// - [`InMemoryVectorStore`](rag::InMemoryVectorStore) - Zero-dependency vector store
850/// - Chunking strategies: fixed-size, recursive, markdown-aware
851/// - Feature-gated backends: Gemini, OpenAI, Qdrant, LanceDB, pgvector
852///
853/// Available with feature: `rag`
854#[cfg(feature = "rag")]
855#[cfg_attr(docsrs, doc(cfg(feature = "rag")))]
856pub mod rag {
857 pub use adk_rag::*;
858}
859
860/// Shared action node types for graph workflows.
861///
862/// Provides the type definitions for all 14 action node types:
863/// - Trigger nodes (manual, webhook, schedule, event)
864/// - Data nodes (HTTP, Set, Transform)
865/// - Control flow nodes (Switch, Loop, Merge, Wait)
866/// - Compute nodes (Code)
867/// - Infrastructure nodes (Database)
868/// - Communication nodes (Email, Notification, RSS, File)
869///
870/// Available with feature: `action`
871#[cfg(feature = "action")]
872#[cfg_attr(docsrs, doc(cfg(feature = "action")))]
873pub use adk_action;
874
875/// Anthropic API client types and HTTP client.
876///
877/// Direct access to the `adk-anthropic` crate for low-level Anthropic API usage:
878/// - [`Anthropic`](anthropic_client::Anthropic) - HTTP client struct
879/// - Wire types: `MessageCreateParams`, `Message`, `ContentBlock`, etc.
880/// - Streaming: `MessageStreamEvent`, `ContentBlockDelta`
881/// - Error handling: `Error` enum with typed variants
882///
883/// For high-level agent usage, prefer `adk-model`'s `AnthropicClient` instead.
884///
885/// Available with feature: `anthropic-client`
886#[cfg(feature = "anthropic-client")]
887#[cfg_attr(docsrs, doc(cfg(feature = "anthropic-client")))]
888pub mod anthropic_client {
889 pub use adk_anthropic::*;
890}
891
892// ============================================================================
893// v0.7.0 Competitive Parity Feature Re-exports (opt-in only)
894// ============================================================================
895
896// --- adk-server features ---
897
898/// YAML agent configuration loader and hot reload watcher.
899///
900/// Declaratively define agents in YAML files with hot reload support:
901/// - [`YamlAgentDefinition`](server::yaml_agent::YamlAgentDefinition) - YAML schema types
902/// - [`AgentConfigLoader`](server::yaml_agent::AgentConfigLoader) - Load and validate YAML agent files
903/// - [`HotReloadWatcher`](server::yaml_agent::HotReloadWatcher) - Watch for file changes and reload agents
904///
905/// Available with feature: `yaml-agent`
906#[cfg(feature = "yaml-agent")]
907#[cfg_attr(docsrs, doc(cfg(feature = "yaml-agent")))]
908pub mod yaml_agent {
909 pub use adk_server::yaml_agent::*;
910}
911
912/// Agent Registry REST API for agent discovery and management.
913///
914/// Register, discover, and manage agents through a REST API:
915/// - [`AgentCard`](server::registry::AgentCard) - Agent metadata
916/// - [`AgentRegistryStore`](server::registry::AgentRegistryStore) - Storage backend trait
917/// - [`InMemoryAgentRegistryStore`](server::registry::InMemoryAgentRegistryStore) - In-memory storage
918/// - [`registry_router`](server::registry::registry_router) - Axum router for registry endpoints
919///
920/// Available with feature: `agent-registry`
921#[cfg(feature = "agent-registry")]
922#[cfg_attr(docsrs, doc(cfg(feature = "agent-registry")))]
923pub mod registry {
924 pub use adk_server::registry::*;
925}
926
927// --- adk-tool features ---
928
929/// MCP sampling callback support.
930///
931/// Handle `sampling/createMessage` requests from MCP servers:
932/// - [`SamplingHandler`](tool::sampling::SamplingHandler) - Trait for handling sampling requests
933/// - [`LlmSamplingHandler`](tool::sampling::LlmSamplingHandler) - Default handler routing to agent's LLM
934/// - [`SamplingRequest`](tool::sampling::SamplingRequest) / [`SamplingResponse`](tool::sampling::SamplingResponse) - Wire types
935///
936/// Available with feature: `mcp-sampling`
937#[cfg(feature = "mcp-sampling")]
938#[cfg_attr(docsrs, doc(cfg(feature = "mcp-sampling")))]
939pub mod sampling {
940 pub use adk_tool::sampling::*;
941}
942
943/// Native Slack toolset for agent-driven Slack interactions.
944///
945/// Built-in Slack tools for agents:
946/// - [`SlackToolset`](tool::slack::SlackToolset) - Toolset implementing `adk_core::Toolset`
947/// - Tools: `slack_send_message`, `slack_read_channel`, `slack_add_reaction`, `slack_list_threads`
948///
949/// Available with feature: `slack`
950#[cfg(feature = "slack")]
951#[cfg_attr(docsrs, doc(cfg(feature = "slack")))]
952pub mod slack {
953 pub use adk_tool::slack::*;
954}
955
956/// Native BigQuery toolset for data-analysis agents.
957///
958/// Built-in BigQuery tools for agents:
959/// - [`BigQueryToolset`](tool::bigquery::BigQueryToolset) - Toolset implementing `adk_core::Toolset`
960/// - Tools: `bigquery_execute_sql`, `bigquery_get_table_schema`, `bigquery_list_datasets`, `bigquery_list_tables`
961///
962/// Available with feature: `bigquery`
963#[cfg(feature = "bigquery")]
964#[cfg_attr(docsrs, doc(cfg(feature = "bigquery")))]
965pub mod bigquery {
966 pub use adk_tool::bigquery::*;
967}
968
969/// Native Spanner toolset for Cloud Spanner interactions.
970///
971/// Built-in Spanner tools for agents:
972/// - [`SpannerToolset`](tool::spanner::SpannerToolset) - Toolset implementing `adk_core::Toolset`
973/// - Tools: `spanner_execute_sql`, `spanner_get_table_schema`, `spanner_list_tables`
974///
975/// Available with feature: `spanner`
976#[cfg(feature = "spanner")]
977#[cfg_attr(docsrs, doc(cfg(feature = "spanner")))]
978pub mod spanner {
979 pub use adk_tool::spanner::*;
980}
981
982// --- adk-eval features ---
983
984/// User personas for evaluation.
985///
986/// Define simulated user personas for realistic multi-turn test conversations:
987/// - [`PersonaProfile`](eval::personas::PersonaProfile) - Persona definition
988/// - [`UserSimulator`](eval::personas::UserSimulator) - Generate persona-driven messages
989/// - [`PersonaRegistry`](eval::personas::PersonaRegistry) - Load personas from directory
990///
991/// Available with feature: `personas`
992#[cfg(feature = "personas")]
993#[cfg_attr(docsrs, doc(cfg(feature = "personas")))]
994pub mod personas {
995 pub use adk_eval::personas::*;
996}
997
998// --- adk-realtime features ---
999
1000/// Video avatar configuration for realtime sessions.
1001///
1002/// Attach a video avatar to realtime voice agents:
1003/// - [`AvatarConfig`](realtime::avatar::AvatarConfig) - Avatar source, lip-sync, and rendering settings
1004/// - [`LipSyncConfig`](realtime::avatar::LipSyncConfig) - Lip-sync configuration
1005/// - [`RenderingConfig`](realtime::avatar::RenderingConfig) - Rendering parameters
1006///
1007/// Available with feature: `video-avatar`
1008#[cfg(feature = "video-avatar")]
1009#[cfg_attr(docsrs, doc(cfg(feature = "video-avatar")))]
1010pub mod avatar {
1011 pub use adk_realtime::avatar::*;
1012}
1013
1014// ============================================================================
1015// Managed Agent Runtime (feature-gated, experimental)
1016// ============================================================================
1017
1018/// Managed agent runtime — durable, resumable, provider-neutral agent execution.
1019///
1020/// Provides the `ManagedAgentRuntime` trait and `DefaultManagedAgentRuntime`:
1021/// - [`ManagedAgentRuntime`](managed::ManagedAgentRuntime) - Central lifecycle trait
1022/// - [`DefaultManagedAgentRuntime`](managed::DefaultManagedAgentRuntime) - Default implementation
1023/// - [`ManagedAgentDef`](managed::types::ManagedAgentDef) - Declarative agent definition
1024/// - [`SessionEvent`](managed::types::SessionEvent) - Provider-neutral event stream
1025/// - [`UserEvent`](managed::types::UserEvent) - Client-to-agent events
1026/// - [`ModelResolver`](managed::ModelResolver) - ModelRef → Arc<dyn Llm> resolution
1027/// - [`ScriptedLlm`](managed::ScriptedLlm) - Deterministic testing double
1028///
1029/// STABILITY: Experimental, additive, feature-gated. No breaking changes to
1030/// existing `Runner`/`LlmAgent` APIs when this feature is disabled.
1031///
1032/// Available with feature: `managed-runtime`
1033#[cfg(feature = "managed-runtime")]
1034#[cfg_attr(docsrs, doc(cfg(feature = "managed-runtime")))]
1035pub mod managed {
1036 pub use adk_managed::*;
1037}
1038
1039// ============================================================================
1040// Enterprise Client SDK (feature-gated, experimental)
1041// ============================================================================
1042
1043/// Enterprise client SDK — native Rust client for the ADK-Rust Enterprise
1044/// Managed Agent Service.
1045///
1046/// Provides `EnterpriseClient` for interacting with the platform over HTTP/SSE:
1047/// - [`EnterpriseClient`](enterprise::EnterpriseClient) - Primary API client
1048/// - [`ClientConfig`](enterprise::ClientConfig) - Client configuration
1049/// - Agent, Environment, and Session CRUD
1050/// - SSE event streaming with auto-reconnect
1051/// - Vault and Memory management (beta)
1052///
1053/// This crate has zero dependency on `adk-model`, `adk-runner`, or `adk-agent` —
1054/// it communicates exclusively via HTTP with the managed agent platform.
1055///
1056/// STABILITY: Experimental, additive, feature-gated.
1057///
1058/// Available with feature: `enterprise-client`
1059#[cfg(feature = "enterprise-client")]
1060#[cfg_attr(docsrs, doc(cfg(feature = "enterprise-client")))]
1061pub use adk_enterprise;
1062
1063// ============================================================================
1064// Convenience Functions
1065// ============================================================================
1066
1067/// Detect LLM provider from environment variables.
1068///
1069/// Checks environment variables in precedence order and returns the first
1070/// matching provider that was compiled through Cargo features. The default
1071/// `minimal` tier detects Gemini via `GOOGLE_API_KEY`; add `openai` or
1072/// `anthropic` to widen detection.
1073///
1074/// 1. `ANTHROPIC_API_KEY` → Anthropic (Claude)
1075/// 2. `OPENAI_API_KEY` → OpenAI
1076/// 3. `GOOGLE_API_KEY` → Gemini
1077///
1078/// # Errors
1079///
1080/// Returns [`AdkError`] when no supported environment variable is set.
1081///
1082/// # Example
1083///
1084/// ```rust,ignore
1085/// use adk_rust::provider_from_env;
1086/// use std::sync::Arc;
1087///
1088/// let model: Arc<dyn adk_rust::Llm> = provider_from_env()?;
1089/// ```
1090pub fn provider_from_env() -> Result<std::sync::Arc<dyn Llm>> {
1091 #[cfg(feature = "anthropic")]
1092 {
1093 if let Ok(key) = std::env::var("ANTHROPIC_API_KEY") {
1094 return Ok(std::sync::Arc::new(model::anthropic::AnthropicClient::from_api_key(key)?));
1095 }
1096 }
1097
1098 #[cfg(feature = "openai")]
1099 {
1100 if let Ok(key) = std::env::var("OPENAI_API_KEY") {
1101 let config = model::openai::OpenAIConfig::new(key, "gpt-5-mini");
1102 return Ok(std::sync::Arc::new(model::openai::OpenAIClient::new(config)?));
1103 }
1104 }
1105
1106 #[cfg(feature = "gemini")]
1107 {
1108 if let Ok(key) = std::env::var("GOOGLE_API_KEY") {
1109 return Ok(std::sync::Arc::new(model::GeminiModel::new(key, "gemini-2.5-flash")?));
1110 }
1111 }
1112
1113 Err(AdkError::config(
1114 "No LLM provider detected. Set one of: ANTHROPIC_API_KEY, OPENAI_API_KEY, GOOGLE_API_KEY",
1115 ))
1116}
1117
1118/// High-level single-turn agent invocation.
1119///
1120/// Creates an agent with the given instructions, sends the input, and returns
1121/// the text response. Uses [`provider_from_env`] to auto-detect the LLM provider.
1122///
1123/// This is the fastest way to get started with ADK — a single function call
1124/// that handles provider selection, session creation, agent building, and
1125/// execution.
1126///
1127/// # Arguments
1128///
1129/// * `instructions` - System instructions for the agent
1130/// * `input` - User input to send to the agent
1131///
1132/// # Returns
1133///
1134/// The agent's text response as a `String`.
1135///
1136/// # Errors
1137///
1138/// Returns [`AdkError`] when no supported environment variable is set, or
1139/// when agent execution fails.
1140///
1141/// # Example
1142///
1143/// ```rust,ignore
1144/// use adk_rust::run;
1145///
1146/// let response = run("You are a helpful assistant.", "What is 2 + 2?").await?;
1147/// println!("{response}");
1148/// ```
1149#[cfg(all(feature = "agents", feature = "sessions", feature = "runner"))]
1150pub async fn run(instructions: &str, input: &str) -> Result<String> {
1151 use futures::StreamExt;
1152 use std::collections::HashMap;
1153 use std::sync::Arc;
1154
1155 type ProviderPair = (Arc<dyn Llm>, Option<Arc<dyn CacheCapable>>);
1156
1157 let (model, cache_capable): ProviderPair = {
1158 #[allow(unused_assignments)]
1159 let mut result: Option<ProviderPair> = None;
1160
1161 #[cfg(feature = "anthropic")]
1162 {
1163 if result.is_none()
1164 && let Ok(key) = std::env::var("ANTHROPIC_API_KEY")
1165 {
1166 let m = model::anthropic::AnthropicClient::from_api_key(key)?;
1167 result = Some((Arc::new(m), None));
1168 }
1169 }
1170
1171 #[cfg(feature = "openai")]
1172 {
1173 if result.is_none()
1174 && let Ok(key) = std::env::var("OPENAI_API_KEY")
1175 {
1176 let config = model::openai::OpenAIConfig::new(key, "gpt-4o-mini");
1177 let m = model::openai::OpenAIClient::new(config)?;
1178 result = Some((Arc::new(m), None));
1179 }
1180 }
1181
1182 #[cfg(feature = "gemini")]
1183 {
1184 if result.is_none()
1185 && let Ok(key) = std::env::var("GOOGLE_API_KEY")
1186 {
1187 let m = Arc::new(model::GeminiModel::new(key, "gemini-2.5-flash")?);
1188 let cc: Arc<dyn CacheCapable> = m.clone();
1189 result = Some((m, Some(cc)));
1190 }
1191 }
1192
1193 result.ok_or_else(|| {
1194 AdkError::config(
1195 "No LLM provider detected. Set one of: ANTHROPIC_API_KEY, OPENAI_API_KEY, GOOGLE_API_KEY",
1196 )
1197 })?
1198 };
1199
1200 let agent =
1201 agent::LlmAgentBuilder::new("adk_run").instruction(instructions).model(model).build()?;
1202
1203 let session_service: Arc<dyn adk_session::SessionService> =
1204 Arc::new(session::InMemorySessionService::new());
1205
1206 let session_id = SessionId::generate();
1207
1208 session_service
1209 .create(session::CreateRequest {
1210 app_name: "adk_run".into(),
1211 user_id: "user".into(),
1212 session_id: Some(session_id.to_string()),
1213 state: HashMap::new(),
1214 })
1215 .await?;
1216
1217 let mut runner_builder = runner::Runner::builder()
1218 .app_name("adk_run")
1219 .agent(Arc::new(agent))
1220 .session_service(session_service);
1221 if let Some(cache_capable) = cache_capable {
1222 runner_builder = runner_builder.cache_capable(cache_capable);
1223 }
1224 let runner = runner_builder.build()?;
1225
1226 let content = Content::new("user").with_text(input);
1227 let mut stream = runner.run(UserId::new("user")?, session_id, content).await?;
1228
1229 let mut result = String::new();
1230 while let Some(event) = stream.next().await {
1231 let event = event?;
1232 if let Some(content) = &event.llm_response.content {
1233 for part in &content.parts {
1234 if let Some(text) = part.text() {
1235 result.push_str(text);
1236 }
1237 }
1238 }
1239 }
1240
1241 Ok(result)
1242}
1243
1244// ============================================================================
1245// Prelude
1246// ============================================================================
1247
1248/// Convenience prelude for common imports.
1249///
1250/// Import everything you need with a single line:
1251///
1252/// ```
1253/// use adk_rust::prelude::*;
1254/// ```
1255///
1256/// This includes:
1257/// - Core traits: `Agent`, `Tool`, `Llm`, `Session`
1258/// - Agent builders: `LlmAgentBuilder`, `CustomAgentBuilder`
1259/// - Workflow agents: `SequentialAgent`, `ParallelAgent`, `LoopAgent`
1260/// - Models: `GeminiModel`
1261/// - Tools: `FunctionTool`, `GoogleSearchTool`, `McpToolset`
1262/// - Services: `InMemorySessionService`, `InMemoryArtifactService`
1263/// - Runtime: `Runner`, `RunnerConfig`
1264/// - Common types: `Arc`, `Result`, `Content`, `Event`
1265pub mod prelude {
1266 // Core types (always available)
1267 pub use crate::{
1268 AdkError, Agent, BeforeModelResult, Content, Event, EventStream, InvocationContext, Llm,
1269 LlmRequest, LlmResponse, Part, Result, RunConfig, RunConfigBuilder, Session, State, Tool,
1270 ToolContext, Toolset,
1271 };
1272
1273 // Agents
1274 #[cfg(feature = "agents")]
1275 pub use crate::agent::{
1276 ConditionalAgent, CustomAgent, CustomAgentBuilder, LlmAgent, LlmAgentBuilder,
1277 LlmConditionalAgent, LlmConditionalAgentBuilder, LoopAgent, ParallelAgent, SequentialAgent,
1278 };
1279
1280 // Models
1281 #[cfg(feature = "gemini")]
1282 pub use crate::model::GeminiModel;
1283
1284 // Model providers (when specific features are enabled)
1285 #[cfg(feature = "openai")]
1286 pub use crate::model::openai::{OpenAIClient, OpenAIConfig};
1287
1288 #[cfg(feature = "openrouter")]
1289 pub use crate::model::openrouter::{
1290 OpenRouterApiMode, OpenRouterClient, OpenRouterConfig, OpenRouterPlugin,
1291 OpenRouterProviderPreferences, OpenRouterReasoningConfig, OpenRouterRequestOptions,
1292 OpenRouterResponseTool,
1293 };
1294
1295 #[cfg(feature = "anthropic")]
1296 pub use crate::model::anthropic::{AnthropicClient, AnthropicConfig, Effort, ThinkingMode};
1297
1298 #[cfg(feature = "deepseek")]
1299 pub use crate::model::deepseek::{DeepSeekClient, DeepSeekConfig};
1300
1301 #[cfg(feature = "groq")]
1302 pub use crate::model::groq::{GroqClient, GroqConfig};
1303
1304 #[cfg(feature = "ollama")]
1305 pub use crate::model::ollama::{OllamaConfig, OllamaModel};
1306
1307 // OpenAI-compatible providers: use OpenAICompatible with provider presets
1308 // e.g. OpenAICompatibleConfig::fireworks(api_key, model)
1309 #[cfg(feature = "openai")]
1310 pub use crate::model::openai_compatible::{OpenAICompatible, OpenAICompatibleConfig};
1311
1312 #[cfg(feature = "bedrock")]
1313 pub use crate::model::bedrock::{BedrockClient, BedrockConfig};
1314
1315 #[cfg(feature = "azure-ai")]
1316 pub use crate::model::azure_ai::{AzureAIClient, AzureAIConfig};
1317
1318 // Tools
1319 #[cfg(feature = "mcp")]
1320 pub use crate::tool::McpToolset;
1321 #[cfg(feature = "tools")]
1322 pub use crate::tool::{
1323 BasicToolset, ExitLoopTool, FunctionTool, GoogleSearchTool, LoadArtifactsTool,
1324 UrlContextTool, WebSearchTool,
1325 };
1326
1327 // Skills
1328 #[cfg(feature = "skills")]
1329 pub use crate::skill::{SelectionPolicy, SkillInjector, SkillInjectorConfig, load_skill_index};
1330
1331 // Sessions
1332 #[cfg(feature = "sessions")]
1333 pub use crate::session::InMemorySessionService;
1334
1335 // Artifacts
1336 #[cfg(feature = "artifacts")]
1337 pub use crate::artifact::InMemoryArtifactService;
1338
1339 // Memory
1340 #[cfg(feature = "memory")]
1341 pub use crate::memory::InMemoryMemoryService;
1342
1343 // Runner
1344 #[cfg(feature = "runner")]
1345 pub use crate::runner::{Runner, RunnerConfig};
1346
1347 // Graph workflows
1348 #[cfg(feature = "graph")]
1349 pub use crate::graph::{END, GraphAgent, NodeOutput, Router, START, StateGraph};
1350
1351 // Realtime
1352 #[cfg(feature = "realtime")]
1353 pub use crate::realtime::{
1354 RealtimeAgent, RealtimeAgentBuilder, RealtimeConfig, RealtimeModel, RealtimeRunner,
1355 RealtimeSession,
1356 };
1357
1358 // Common re-exports
1359 pub use crate::anyhow::Result as AnyhowResult;
1360 pub use crate::async_trait;
1361 pub use std::sync::Arc;
1362
1363 // Convenience functions
1364 pub use crate::provider_from_env;
1365 #[cfg(all(feature = "agents", feature = "sessions", feature = "runner"))]
1366 pub use crate::run;
1367}