1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
//! # Agent Development Kit (ADK) for Rust
//!
//! [](https://crates.io/crates/adk-rust)
//! [](https://docs.rs/adk-rust)
//! [](https://github.com/zavora-ai/adk-rust/blob/main/LICENSE)
//!
//! A flexible and modular framework for developing and deploying AI agents in Rust.
//! While optimized for Gemini and the Google ecosystem, ADK is model-agnostic,
//! deployment-agnostic, and compatible with other frameworks.
//!
//! ## Quick Start
//!
//! Create your first AI agent in minutes:
//!
//! ```ignore
//! use adk_rust::prelude::*;
//! use adk_rust::Launcher;
//! use std::sync::Arc;
//!
//! #[tokio::main]
//! async fn main() -> 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")
//! .instruction("You are a friendly assistant. Answer questions concisely.")
//! .model(Arc::new(model))
//! .build()?;
//!
//! // Run in interactive console mode
//! Launcher::new(Arc::new(agent)).run().await?;
//! Ok(())
//! }
//! ```
//!
//! ## Installation
//!
//! Add to your `Cargo.toml`:
//!
//! ```toml
//! [dependencies]
//! adk-rust = "0.3"
//! tokio = { version = "1.40", features = ["full"] }
//! dotenvy = "0.15" # For loading .env files
//! ```
//!
//! ### Feature Presets
//!
//! ```toml
//! # Standard (default) — agents, models, tools, sessions, runner, guardrails, auth
//! adk-rust = "0.4"
//!
//! # Full — standard + all stable specialist crates (graph, realtime, browser, eval, rag)
//! # Does NOT include experimental crates (code, sandbox, audio) — use `labs` for those
//! adk-rust = { version = "0.4", features = ["full"] }
//!
//! # Labs — standard + experimental crates (code, sandbox, audio)
//! adk-rust = { version = "0.4", features = ["labs"] }
//!
//! # Full + Labs — everything including experimental crates
//! adk-rust = { version = "0.4", features = ["full", "labs"] }
//!
//! # Minimal — just agents + Gemini + runner (fastest build)
//! adk-rust = { version = "0.4", default-features = false, features = ["minimal"] }
//!
//! # Custom — pick exactly what you need
//! adk-rust = { version = "0.4", default-features = false, features = [
//! "agents", "gemini", "tools", "sessions", "openai", "openrouter"
//! ] }
//! ```
//!
//! ## Agent Types
//!
//! ADK-Rust provides several agent types for different use cases:
//!
//! ### LlmAgent - AI-Powered Reasoning
//!
//! The core agent type that uses Large Language Models for intelligent reasoning:
//!
//! ```no_run
//! use adk_rust::prelude::*;
//! use std::sync::Arc;
//!
//! # async fn example() -> Result<()> {
//! let api_key = std::env::var("GOOGLE_API_KEY").map_err(|e| AdkError::config(e.to_string()))?;
//! let model = GeminiModel::new(&api_key, "gemini-2.5-flash")?;
//!
//! let agent = LlmAgentBuilder::new("researcher")
//! .description("Research assistant with web search")
//! .instruction("Search for information and provide detailed summaries.")
//! .model(Arc::new(model))
//! .tool(Arc::new(GoogleSearchTool::new())) // Add tools
//! .build()?;
//! # Ok(())
//! # }
//! ```
//!
//! ### Workflow Agents - Deterministic Pipelines
//!
//! For predictable, multi-step workflows:
//!
//! ```no_run
//! use adk_rust::prelude::*;
//! use std::sync::Arc;
//!
//! # async fn example() -> Result<()> {
//! # let researcher: Arc<dyn Agent> = todo!();
//! # let writer: Arc<dyn Agent> = todo!();
//! # let reviewer: Arc<dyn Agent> = todo!();
//! // Sequential: Execute agents in order
//! let pipeline = SequentialAgent::new(
//! "content_pipeline",
//! vec![researcher, writer, reviewer]
//! );
//!
//! // Parallel: Execute agents concurrently
//! # let analyst1: Arc<dyn Agent> = todo!();
//! # let analyst2: Arc<dyn Agent> = todo!();
//! let parallel = ParallelAgent::new(
//! "multi_analysis",
//! vec![analyst1, analyst2]
//! );
//!
//! // Loop: Iterate until condition met
//! # let refiner: Arc<dyn Agent> = todo!();
//! let loop_agent = LoopAgent::new("iterative_refiner", vec![refiner])
//! .with_max_iterations(5);
//! # Ok(())
//! # }
//! ```
//!
//! ### Multi-Agent Systems
//!
//! Build hierarchical agent systems with automatic delegation:
//!
//! ```no_run
//! use adk_rust::prelude::*;
//! use std::sync::Arc;
//!
//! # async fn example() -> Result<()> {
//! # let model: Arc<dyn Llm> = todo!();
//! # let code_agent: Arc<dyn Agent> = todo!();
//! # let test_agent: Arc<dyn Agent> = todo!();
//! let coordinator = LlmAgentBuilder::new("coordinator")
//! .description("Development team coordinator")
//! .instruction("Delegate coding tasks to specialists.")
//! .model(model)
//! .sub_agent(code_agent) // Delegate to sub-agents
//! .sub_agent(test_agent)
//! .build()?;
//! # Ok(())
//! # }
//! ```
//!
//! ## Tools
//!
//! Give your agents capabilities beyond conversation:
//!
//! ### Function Tools - Custom Operations
//!
//! Convert any async function into a tool:
//!
//! ```no_run
//! use adk_rust::prelude::*;
//! use adk_rust::serde_json::{json, Value};
//! use std::sync::Arc;
//!
//! async fn get_weather(_ctx: Arc<dyn ToolContext>, args: Value) -> Result<Value> {
//! let city = args["city"].as_str().unwrap_or("Unknown");
//! // Your weather API call here
//! Ok(json!({
//! "temperature": 72.0,
//! "conditions": "Sunny",
//! "city": city
//! }))
//! }
//!
//! # fn example() -> Result<()> {
//! let weather_tool = FunctionTool::new(
//! "get_weather",
//! "Get current weather for a city",
//! get_weather,
//! );
//! # Ok(())
//! # }
//! ```
//!
//! ### Built-in Tools
//!
//! Ready-to-use tools included with ADK:
//!
//! - [`GoogleSearchTool`](tool::GoogleSearchTool) - Web search via Google
//! - [`ExitLoopTool`](tool::ExitLoopTool) - Control loop termination
//! - [`LoadArtifactsTool`](tool::LoadArtifactsTool) - Access stored artifacts
//!
//! ### MCP Tools - External Integrations
//!
//! Connect to Model Context Protocol servers using the `rmcp` crate:
//!
//! ```ignore
//! use adk_rust::prelude::*;
//! use adk_rust::tool::McpToolset;
//! use rmcp::{ServiceExt, transport::TokioChildProcess};
//! use tokio::process::Command;
//!
//! # async fn example() -> Result<(), Box<dyn std::error::Error>> {
//! // Connect to an MCP server (e.g., filesystem, database)
//! let client = ().serve(TokioChildProcess::new(
//! Command::new("npx")
//! .arg("-y")
//! .arg("@anthropic/mcp-server-filesystem")
//! .arg("/path/to/dir")
//! )?).await?;
//!
//! let mcp_tools = McpToolset::new(client);
//!
//! // Add all MCP tools to your agent
//! # let builder: LlmAgentBuilder = todo!();
//! let agent = builder.toolset(Arc::new(mcp_tools)).build()?;
//! # Ok(())
//! # }
//! ```
//!
//! ## Sessions & State
//!
//! Manage conversation context and working memory:
//!
//! ```no_run
//! use adk_rust::prelude::*;
//! use adk_rust::session::{SessionService, CreateRequest};
//! use adk_rust::serde_json::json;
//! use std::collections::HashMap;
//!
//! # async fn example() -> Result<()> {
//! let session_service = InMemorySessionService::new();
//!
//! // Create a session
//! let session = session_service.create(CreateRequest {
//! app_name: "my_app".to_string(),
//! user_id: "user_123".to_string(),
//! session_id: None,
//! state: HashMap::new(),
//! }).await?;
//!
//! // Read state (State trait provides read access)
//! let state = session.state();
//! let config = state.get("app:config"); // Returns Option<Value>
//! # Ok(())
//! # }
//! ```
//!
//! ## Callbacks
//!
//! Intercept and customize agent behavior:
//!
//! ```no_run
//! use adk_rust::prelude::*;
//! use std::sync::Arc;
//!
//! # async fn example() -> Result<()> {
//! # let model: Arc<dyn Llm> = todo!();
//! let agent = LlmAgentBuilder::new("monitored_agent")
//! .model(model)
//! // Modify or inspect model responses
//! .after_model_callback(Box::new(|_ctx, response| {
//! Box::pin(async move {
//! println!("Model responded");
//! Ok(Some(response)) // Return modified response or None to keep original
//! })
//! }))
//! // Track tool usage
//! .before_tool_callback(Box::new(|_ctx| {
//! Box::pin(async move {
//! println!("Tool about to be called");
//! Ok(None) // Continue execution
//! })
//! }))
//! .build()?;
//! # Ok(())
//! # }
//! ```
//!
//! ## Artifacts
//!
//! Store and retrieve binary data (images, files, etc.):
//!
//! ```no_run
//! use adk_rust::prelude::*;
//! use adk_rust::artifact::{ArtifactService, SaveRequest, LoadRequest};
//!
//! # async fn example() -> Result<()> {
//! let artifact_service = InMemoryArtifactService::new();
//!
//! // Save an artifact
//! let response = artifact_service.save(SaveRequest {
//! app_name: "my_app".to_string(),
//! user_id: "user_123".to_string(),
//! session_id: "session_456".to_string(),
//! file_name: "sales_chart.png".to_string(),
//! part: Part::Text { text: "chart data".to_string() },
//! version: None,
//! }).await?;
//!
//! // Load an artifact
//! let loaded = artifact_service.load(LoadRequest {
//! app_name: "my_app".to_string(),
//! user_id: "user_123".to_string(),
//! session_id: "session_456".to_string(),
//! file_name: "sales_chart.png".to_string(),
//! version: None,
//! }).await?;
//! # Ok(())
//! # }
//! ```
//!
//! ## Deployment Options
//!
//! ### Console Mode (Interactive CLI)
//!
//! ```no_run
//! use adk_rust::prelude::*;
//! use adk_rust::Launcher;
//! use std::sync::Arc;
//!
//! # async fn example() -> Result<()> {
//! # let agent: Arc<dyn Agent> = todo!();
//! // Interactive chat in terminal
//! Launcher::new(agent).run().await?;
//! # Ok(())
//! # }
//! ```
//!
//! ### Server Mode (REST API)
//!
//! ```bash
//! # Run your agent as a web server
//! cargo run -- serve --port 8080
//! ```
//!
//! Provides endpoints:
//! - `POST /chat` - Send messages
//! - `GET /sessions` - List sessions
//! - `GET /health` - Health check
//!
//! ### Agent-to-Agent (A2A) Protocol
//!
//! Expose your agent for inter-agent communication:
//!
//! ```no_run
//! use adk_rust::server::{create_app_with_a2a, ServerConfig};
//! use adk_rust::AgentLoader;
//!
//! # async fn example() -> adk_rust::Result<()> {
//! # let agent_loader: std::sync::Arc<dyn AgentLoader> = todo!();
//! # let session_service: std::sync::Arc<dyn adk_rust::session::SessionService> = todo!();
//! // Create server with A2A protocol support
//! let config = ServerConfig::new(agent_loader, session_service);
//! let app = create_app_with_a2a(config, Some("http://localhost:8080"));
//!
//! // Run the server (requires axum dependency)
//! // let listener = tokio::net::TcpListener::bind("0.0.0.0:8080").await?;
//! // axum::serve(listener, app).await?;
//! # Ok(())
//! # }
//! ```
//!
//! ## Observability
//!
//! Built-in OpenTelemetry support for production monitoring:
//!
//! ```no_run
//! use adk_rust::telemetry::{init_telemetry, init_with_otlp};
//!
//! # fn example() -> Result<(), Box<dyn std::error::Error>> {
//! // Basic telemetry with console logging
//! init_telemetry("my-agent-service")?;
//!
//! // Or with OTLP export for distributed tracing
//! // init_with_otlp("my-agent-service", "http://localhost:4317")?;
//!
//! // All agent operations now emit traces and metrics
//! # Ok(())
//! # }
//! ```
//!
//! ## Architecture
//!
//! ADK-Rust uses a layered architecture for modularity:
//!
//! ```text
//! ┌─────────────────────────────────────────────────────────────┐
//! │ Application Layer │
//! │ Launcher • REST Server • A2A │
//! ├─────────────────────────────────────────────────────────────┤
//! │ Runner Layer │
//! │ Agent Execution • Event Streaming │
//! ├─────────────────────────────────────────────────────────────┤
//! │ Agent Layer │
//! │ LlmAgent • CustomAgent • Sequential • Parallel • Loop │
//! ├─────────────────────────────────────────────────────────────┤
//! │ Service Layer │
//! │ Models • Tools • Sessions • Artifacts • Memory │
//! └─────────────────────────────────────────────────────────────┘
//! ```
//!
//! ## Feature Flags
//!
//! | Feature | Description | Preset |
//! |---------|-------------|--------|
//! | `agents` | Agent implementations | standard |
//! | `models` | Model integrations | standard |
//! | `gemini` | Gemini model support | standard |
//! | `tools` | Tool system | standard |
//! | `skills` | Skill discovery | standard |
//! | `sessions` | Session management | standard |
//! | `artifacts` | Artifact storage | standard |
//! | `memory` | Semantic memory | standard |
//! | `runner` | Execution runtime | standard |
//! | `telemetry` | OpenTelemetry | standard |
//! | `guardrail` | Input/output validation | standard |
//! | `auth` | Access control | standard |
//! | `plugin` | Plugin system | standard |
//! | `server` | HTTP server + A2A | standard |
//! | `cli` | CLI launcher | standard |
//! | `graph` | Graph workflows | full |
//! | `browser` | Browser automation | full |
//! | `eval` | Agent evaluation | full |
//! | `realtime` | Voice/audio streaming | full |
//! | `rag` | RAG pipeline | full |
//! | `code` | Code execution | labs (experimental) |
//! | `sandbox` | Sandboxed execution | labs (experimental) |
//! | `audio` | Audio processing | labs (experimental) |
//!
//! ## Examples
//!
//! The [examples directory](https://github.com/zavora-ai/adk-rust/tree/main/examples)
//! contains working examples for every feature:
//!
//! - **Agents**: LLM agent, workflow agents, multi-agent systems
//! - **Tools**: Function tools, Google Search, MCP integration
//! - **Sessions**: State management, conversation history
//! - **Callbacks**: Logging, guardrails, caching
//! - **Deployment**: Console, server, A2A protocol
//!
//! ## Related Crates
//!
//! ADK-Rust is composed of modular crates that can be used independently:
//!
//! - [`adk-core`](https://docs.rs/adk-core) - Core traits and types
//! - [`adk-agent`](https://docs.rs/adk-agent) - Agent implementations
//! - [`adk-model`](https://docs.rs/adk-model) - LLM integrations
//! - [`adk-tool`](https://docs.rs/adk-tool) - Tool system
//! - [`adk-session`](https://docs.rs/adk-session) - Session management
//! - [`adk-artifact`](https://docs.rs/adk-artifact) - Artifact storage
//! - [`adk-runner`](https://docs.rs/adk-runner) - Execution runtime
//! - [`adk-server`](https://docs.rs/adk-server) - HTTP server
//! - [`adk-telemetry`](https://docs.rs/adk-telemetry) - Observability
// ============================================================================
// Core (always available)
// ============================================================================
/// Core traits and types.
///
/// Always available regardless of feature flags. Includes:
/// - [`Agent`] - The fundamental trait for all agents
/// - [`Tool`] / [`Toolset`] - For extending agents with capabilities
/// - [`Session`] / [`State`] - For managing conversation context
/// - [`Event`] - For streaming agent responses
/// - [`AdkError`] / [`Result`] - Unified error handling
pub use *;
// Re-export common dependencies for convenience
pub use anyhow;
pub use async_trait;
pub use futures;
pub use serde;
pub use serde_json;
pub use tokio;
// ============================================================================
// Component Modules (feature-gated)
// ============================================================================
/// Agent implementations (LLM, Custom, Workflow agents).
///
/// Provides the core agent types:
/// - [`LlmAgent`](agent::LlmAgent) - AI-powered agent using LLMs
/// - [`CustomAgent`](agent::CustomAgent) - Implement custom agent logic
/// - [`SequentialAgent`](agent::SequentialAgent) - Execute agents in sequence
/// - [`ParallelAgent`](agent::ParallelAgent) - Execute agents concurrently
/// - [`LoopAgent`](agent::LoopAgent) - Iterative execution until condition met
///
/// Available with feature: `agents`
/// Model integrations (Gemini, etc.).
///
/// Provides LLM implementations:
/// - [`GeminiModel`](model::GeminiModel) - Google's Gemini models
///
/// ADK is model-agnostic - implement the [`Llm`] trait for other providers.
///
/// Available with feature: `models`
/// Tool system and built-in tools.
///
/// Give agents capabilities beyond conversation:
/// - [`FunctionTool`](tool::FunctionTool) - Wrap async functions as tools
/// - [`GoogleSearchTool`](tool::GoogleSearchTool) - Web search
/// - [`ExitLoopTool`](tool::ExitLoopTool) - Control loop agents
/// - [`McpToolset`](tool::McpToolset) - MCP server integration
///
/// Available with feature: `tools`
/// AgentSkills parsing, indexing, and runtime injection helpers.
///
/// Provides:
/// - Skill file discovery from `.skills/`
/// - Frontmatter validation (`name`, `description`)
/// - Lexical skill selection
/// - Runner plugin helper for skill injection
///
/// Available with feature: `skills`
/// Session management.
///
/// Manage conversation context and state:
/// - [`InMemorySessionService`](session::InMemorySessionService) - In-memory sessions
/// - Session creation, retrieval, and lifecycle
/// - State management with scoped prefixes
///
/// Available with feature: `sessions`
/// Artifact storage.
///
/// Store and retrieve binary data:
/// - [`InMemoryArtifactService`](artifact::InMemoryArtifactService) - In-memory storage
/// - Version tracking for artifacts
/// - Namespace scoping
///
/// Available with feature: `artifacts`
/// Memory system with semantic search.
///
/// Long-term memory for agents:
/// - [`InMemoryMemoryService`](memory::InMemoryMemoryService) - In-memory storage
/// - Semantic search capabilities
/// - Memory retrieval and updates
///
/// Available with feature: `memory`
/// Agent execution runtime.
///
/// The engine that manages agent execution:
/// - [`Runner`](runner::Runner) - Executes agents with full context
/// - [`RunnerConfig`](runner::RunnerConfig) - Configuration options
/// - Event streaming and tool coordination
///
/// Available with feature: `runner`
/// HTTP server (REST + A2A).
///
/// Deploy agents as web services:
/// - REST API for chat interactions
/// - A2A (Agent-to-Agent) protocol support
/// - Web UI integration
///
/// Available with feature: `server`
/// Telemetry (OpenTelemetry integration).
///
/// Production observability:
/// - Distributed tracing
/// - Metrics collection
/// - Log correlation
///
/// Available with feature: `telemetry`
/// Graph-based workflow engine (LangGraph-inspired).
///
/// Build complex agent workflows with:
/// - [`StateGraph`](graph::StateGraph) - Graph builder with nodes and edges
/// - [`GraphAgent`](graph::GraphAgent) - ADK Agent integration
/// - [`Checkpointer`](graph::Checkpointer) - Persistent state for human-in-the-loop
/// - [`Router`](graph::Router) - Conditional edge routing helpers
/// - Cycle support with recursion limits
/// - Streaming execution modes
///
/// Available with feature: `graph`
/// Code execution substrate (experimental — `labs` preset).
///
/// First-class code execution for agents, Studio, and generated projects:
/// - [`CodeExecutor`](code::CodeExecutor) - Backend trait for execution
/// - [`ExecutionRequest`](code::ExecutionRequest) - Typed execution request
/// - [`ExecutionResult`](code::ExecutionResult) - Structured execution result
/// - [`SandboxPolicy`](code::SandboxPolicy) - Sandbox capability model
/// - [`Workspace`](code::Workspace) - Collaborative project context
///
/// Available with feature: `code`
/// Isolated code execution runtime (experimental — `labs` preset).
///
/// Provides the [`SandboxBackend`](sandbox::SandboxBackend) trait and built-in backends:
/// - [`ProcessBackend`](sandbox::ProcessBackend) - Subprocess execution with timeout and env isolation
/// - `WasmBackend` - In-process WASM execution via wasmtime (requires `wasm` feature)
/// - [`SandboxTool`](sandbox::SandboxTool) - Tool trait implementation for agent integration
///
/// Available with feature: `sandbox`
/// CLI launcher for running agents.
///
/// Quick way to run agents in console or server mode:
/// - [`Launcher`] - Main entry point for CLI apps
///
/// Available with feature: `cli`
pub use Launcher;
/// Real-time bidirectional streaming (voice, video).
///
/// Provides real-time audio/video streaming for voice-enabled agents:
/// - [`RealtimeAgent`](realtime::RealtimeAgent) - Agent with voice capabilities
/// - [`RealtimeRunner`](realtime::RealtimeRunner) - Session management and tool execution
/// - Multiple providers: OpenAI Realtime, Gemini Live
///
/// Available with feature: `realtime`
/// Browser automation (WebDriver).
///
/// Provides browser automation tools for agents:
/// - [`BrowserSession`](browser::BrowserSession) - WebDriver session management
/// - [`BrowserToolset`](browser::BrowserToolset) - Browser tools for agents
///
/// Available with feature: `browser`
/// Agent evaluation framework.
///
/// Test and validate agent behavior:
/// - [`Evaluator`](eval::Evaluator) - Run evaluation suites
/// - [`EvaluationConfig`](eval::EvaluationConfig) - Configure evaluation parameters
///
/// Available with feature: `eval`
/// Guardrails for safety and policy enforcement.
///
/// Validate agent inputs and outputs:
/// - [`GuardrailSet`](guardrail::GuardrailSet) - Collection of guardrails
/// - [`ContentFilter`](guardrail::ContentFilter) - Content safety filtering
///
/// Available with feature: `guardrail`
/// Authentication and access control.
///
/// Manage agent permissions and identity:
/// - [`Permission`](auth::Permission) - Permission definitions
/// - [`AccessControl`](auth::AccessControl) - Access control enforcement
///
/// Available with feature: `auth`
/// Agentic commerce and payment orchestration.
///
/// Provides protocol-neutral payment primitives and adapters for:
/// - ACP stable `2026-01-30`
/// - ACP experimental surfaces behind `acp-experimental`
/// - AP2 `v0.1-alpha` as of `2026-03-22`
///
/// Available with feature: `payments`
/// Plugin system for extending agent behavior.
///
/// Extensible callback architecture for agent lifecycle hooks:
/// - Plugin registration and discovery
/// - Before/after hooks for agent operations
///
/// Available with feature: `plugin`
/// Audio processing pipeline (experimental — `labs` preset).
///
/// Provides audio capabilities for agents:
/// - [`TtsProvider`](audio::TtsProvider) - Text-to-speech synthesis
/// - [`SttProvider`](audio::SttProvider) - Speech-to-text transcription
/// - [`AudioProcessor`](audio::AudioProcessor) - Audio effects processing
/// - `AudioPipeline` - Composable audio pipelines
/// - Cloud providers: ElevenLabs, OpenAI, Gemini, Cartesia, Deepgram, AssemblyAI
/// - Local inference: MLX (Apple Silicon), ONNX Runtime
///
/// Available with feature: `audio`
/// Retrieval-Augmented Generation (RAG) pipeline.
///
/// Modular RAG system with trait-based components:
/// - [`RagPipeline`](rag::RagPipeline) - Orchestrates ingest and query workflows
/// - [`RagTool`](rag::RagTool) - Agentic retrieval via `Tool` trait
/// - [`InMemoryVectorStore`](rag::InMemoryVectorStore) - Zero-dependency vector store
/// - Chunking strategies: fixed-size, recursive, markdown-aware
/// - Feature-gated backends: Gemini, OpenAI, Qdrant, LanceDB, pgvector
///
/// Available with feature: `rag`
/// Shared action node types for graph workflows.
///
/// Provides the type definitions for all 14 action node types:
/// - Trigger nodes (manual, webhook, schedule, event)
/// - Data nodes (HTTP, Set, Transform)
/// - Control flow nodes (Switch, Loop, Merge, Wait)
/// - Compute nodes (Code)
/// - Infrastructure nodes (Database)
/// - Communication nodes (Email, Notification, RSS, File)
///
/// Available with feature: `action`
pub use adk_action;
/// Anthropic API client types and HTTP client.
///
/// Direct access to the `adk-anthropic` crate for low-level Anthropic API usage:
/// - [`Anthropic`](anthropic_client::Anthropic) - HTTP client struct
/// - Wire types: `MessageCreateParams`, `Message`, `ContentBlock`, etc.
/// - Streaming: `MessageStreamEvent`, `ContentBlockDelta`
/// - Error handling: `Error` enum with typed variants
///
/// For high-level agent usage, prefer `adk-model`'s `AnthropicClient` instead.
///
/// Available with feature: `anthropic-client`
// ============================================================================
// Convenience Functions
// ============================================================================
/// Detect LLM provider from environment variables.
///
/// Checks environment variables in precedence order and returns the first
/// matching provider:
///
/// 1. `ANTHROPIC_API_KEY` → Anthropic (Claude)
/// 2. `OPENAI_API_KEY` → OpenAI
/// 3. `GOOGLE_API_KEY` → Gemini
///
/// # Errors
///
/// Returns [`AdkError`] when no supported environment variable is set.
///
/// # Example
///
/// ```rust,ignore
/// use adk_rust::provider_from_env;
/// use std::sync::Arc;
///
/// let model: Arc<dyn adk_rust::Llm> = provider_from_env()?;
/// ```
/// High-level single-turn agent invocation.
///
/// Creates an agent with the given instructions, sends the input, and returns
/// the text response. Uses [`provider_from_env`] to auto-detect the LLM provider.
///
/// This is the fastest way to get started with ADK — a single function call
/// that handles provider selection, session creation, agent building, and
/// execution.
///
/// # Arguments
///
/// * `instructions` - System instructions for the agent
/// * `input` - User input to send to the agent
///
/// # Returns
///
/// The agent's text response as a `String`.
///
/// # Errors
///
/// Returns [`AdkError`] when no supported environment variable is set, or
/// when agent execution fails.
///
/// # Example
///
/// ```rust,ignore
/// use adk_rust::run;
///
/// let response = run("You are a helpful assistant.", "What is 2 + 2?").await?;
/// println!("{response}");
/// ```
pub async
// ============================================================================
// Prelude
// ============================================================================
/// Convenience prelude for common imports.
///
/// Import everything you need with a single line:
///
/// ```
/// use adk_rust::prelude::*;
/// ```
///
/// This includes:
/// - Core traits: `Agent`, `Tool`, `Llm`, `Session`
/// - Agent builders: `LlmAgentBuilder`, `CustomAgentBuilder`
/// - Workflow agents: `SequentialAgent`, `ParallelAgent`, `LoopAgent`
/// - Models: `GeminiModel`
/// - Tools: `FunctionTool`, `GoogleSearchTool`, `McpToolset`
/// - Services: `InMemorySessionService`, `InMemoryArtifactService`
/// - Runtime: `Runner`, `RunnerConfig`
/// - Common types: `Arc`, `Result`, `Content`, `Event`