adk-agent 0.6.0

Agent implementations for Rust Agent Development Kit (ADK-Rust, LLM, Custom, Workflow agents)
Documentation
//! # adk-agent
#![allow(clippy::result_large_err)]
//!
//! Agent implementations for ADK (LLM, Custom, Workflow agents).
//!
//! ## Overview
//!
//! This crate provides ready-to-use agent implementations:
//!
//! - [`LlmAgent`] - Core agent powered by LLM reasoning
//! - [`CustomAgent`] - Define custom logic without LLM
//! - [`SequentialAgent`] - Execute agents in sequence
//! - [`ParallelAgent`] - Execute agents concurrently, with optional [`SharedState`](adk_core::SharedState) coordination
//! - [`LoopAgent`] - Iterate until exit condition
//! - [`ConditionalAgent`] - Branch based on conditions
//!
//! ## What's New in 0.6.0
//!
//! - **`ParallelAgent::with_shared_state()`**: Opt-in builder method that creates a fresh
//!   [`SharedState`](adk_core::SharedState) per `run()` invocation, enabling sub-agents to
//!   exchange data via `set_shared`/`get_shared`/`wait_for_key` through the context chain.
//! - **`AgentToolContext` delegation**: Tools executed by `LlmAgent` now have access to
//!   `shared_state()` via the context chain, enabling tool-level coordination in parallel workflows.
//! - **Tool confirmation**: `LlmAgentBuilder::require_tool_confirmation()` and
//!   `require_tool_confirmation_for_all()` for human-in-the-loop tool authorization.
//!
//! ## Quick Start
//!
//! ```rust,no_run
//! use adk_agent::LlmAgentBuilder;
//! use std::sync::Arc;
//!
//! // LLM Agent requires a model (from adk-model)
//! // let agent = LlmAgentBuilder::new("assistant")
//! //     .description("Helpful AI assistant")
//! //     .model(Arc::new(model))
//! //     .build()?;
//! ```
//!
//! ## Workflow Agents
//!
//! Combine agents for complex workflows:
//!
//! ```rust,ignore
//! // Sequential: A -> B -> C
//! let seq = SequentialAgent::new("pipeline", vec![a, b, c]);
//!
//! // Parallel: A, B, C simultaneously
//! let par = ParallelAgent::new("team", vec![a, b, c]);
//!
//! // Loop: repeat until exit
//! let loop_agent = LoopAgent::new("iterator", vec![worker]).with_max_iterations(10);
//! ```
//!
//! ## Guardrails (optional)
//!
//! Enable the `guardrails` feature for input/output validation:
//!
//! ```rust,ignore
//! use adk_agent::{LlmAgentBuilder, guardrails::{GuardrailSet, ContentFilter, PiiRedactor}};
//!
//! let input_guardrails = GuardrailSet::new()
//!     .with(ContentFilter::harmful_content())
//!     .with(PiiRedactor::new());
//!
//! let agent = LlmAgentBuilder::new("assistant")
//!     .input_guardrails(input_guardrails)
//!     .build()?;
//! ```

pub mod compaction;
mod custom_agent;
pub mod guardrails;
mod llm_agent;
pub mod tool_call_markup;
mod workflow;

pub use adk_core::AfterToolCallbackFull;
pub use adk_core::Agent;
pub use adk_core::OnToolErrorCallback;
pub use compaction::LlmEventSummarizer;
pub use custom_agent::{CustomAgent, CustomAgentBuilder};
pub use guardrails::GuardrailSet;
pub use llm_agent::{DEFAULT_MAX_ITERATIONS, DEFAULT_TOOL_TIMEOUT, LlmAgent, LlmAgentBuilder};
pub use tool_call_markup::{normalize_content, normalize_option_content};
pub use workflow::{
    ConditionalAgent, DEFAULT_LOOP_MAX_ITERATIONS, LlmConditionalAgent, LlmConditionalAgentBuilder,
    LoopAgent, ParallelAgent, SequentialAgent,
};