Expand description
§adk-agent
Agent implementations for ADK (LLM, Custom, Workflow agents).
§Overview
This crate provides ready-to-use agent implementations:
LlmAgent- Core agent powered by LLM reasoningCustomAgent- Define custom logic without LLMSequentialAgent- Execute agents in sequenceParallelAgent- Execute agents concurrently, with optionalSharedStatecoordinationLoopAgent- Iterate until exit conditionConditionalAgent- Branch based on conditionsTeamSpec- Validate and compile a portable team from existing agents
§What’s New in 0.6.0
ParallelAgent::with_shared_state(): Opt-in builder method that creates a freshSharedStateperrun()invocation, enabling sub-agents to exchange data viaset_shared/get_shared/wait_for_keythrough the context chain.AgentToolContextdelegation: Tools executed byLlmAgentnow have access toshared_state()via the context chain, enabling tool-level coordination in parallel workflows.- Tool confirmation:
LlmAgentBuilder::require_tool_confirmation()andrequire_tool_confirmation_for_all()for human-in-the-loop tool authorization.
§Quick Start
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:
ⓘ
// 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:
ⓘ
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()?;Re-exports§
pub use compaction::LlmEventSummarizer;pub use guardrails::GuardrailSet;pub use team::BlackboardHistoryPolicy;pub use team::BlackboardPolicy;pub use team::BlackboardSchedule;pub use team::BlackboardSpec;pub use team::BlackboardTransition;pub use team::CircuitBreakerPolicy;pub use team::CompiledBlackboardTeam;pub use team::CompiledTeam;pub use team::RelationshipApprovalPolicy;pub use team::RelationshipFailureStrategy;pub use team::RelationshipKind;pub use team::RelationshipPolicy;pub use team::ResolvedTeamMember;pub use team::StaticTeamAgentRegistry;pub use team::TEAM_EDGE_ID_KEY;pub use team::TEAM_EXECUTION_STATE_KEY;pub use team::TEAM_ROOT_INVOCATION_KEY;pub use team::TeamAgentDescriptor;pub use team::TeamAgentHealth;pub use team::TeamAgentRegistry;pub use team::TeamArchitectureTemplate;pub use team::TeamBudget;pub use team::TeamContextPolicy;pub use team::TeamEdgeExecution;pub use team::TeamError;pub use team::TeamExecutionAnalysis;pub use team::TeamExecutionSnapshot;pub use team::TeamExecutionStatus;pub use team::TeamExecutionUsage;pub use team::TeamFailurePolicy;pub use team::TeamHistoryPolicy;pub use team::TeamLifecycleContext;pub use team::TeamLifecycleDecision;pub use team::TeamLifecycleHook;pub use team::TeamLifecycleOutcome;pub use team::TeamLifecyclePhase;pub use team::TeamManagerBranch;pub use team::TeamMemberSpec;pub use team::TeamPolicy;pub use team::TeamRegistryRequirement;pub use team::TeamRelationship;pub use team::TeamReplayError;pub use team::TeamResumePlan;pub use team::TeamResumePolicy;pub use team::TeamRuntimeError;pub use team::TeamSpec;pub use team::TeamStateMergePolicy;pub use team::TeamTerminationPolicy;pub use team::WorkflowArchitectureTemplate;pub use team::analyze_team_execution;pub use team::validate_team_replay;pub use tool_call_markup::normalize_content;pub use tool_call_markup::normalize_option_content;
Modules§
- compaction
- LLM-based event summarizer for context compaction.
- guardrails
- Guardrail integration for LlmAgent
- team
- Portable, validated multi-agent team composition.
- tool_
call_ markup - XML-based tool call markup parsing.
Structs§
- Conditional
Agent - Rule-based conditional routing agent.
- Custom
Agent - An agent with a user-defined async handler function.
- Custom
Agent Builder - Builder for constructing a
CustomAgent. - LlmAgent
- An LLM-powered agent that orchestrates tool calls and sub-agent delegation.
- LlmAgent
Builder - Builder for constructing an
LlmAgentwith all configuration options. - LlmConditional
Agent - LLM-based intelligent conditional routing agent.
- LlmConditional
Agent Builder - Builder for constructing an
LlmConditionalAgent. - Loop
Agent - Loop agent executes sub-agents repeatedly for N iterations or until escalation
- Parallel
Agent - Parallel agent executes sub-agents concurrently
- Sequential
Agent - Sequential agent executes sub-agents once in order
Constants§
- DEFAULT_
LOOP_ MAX_ ITERATIONS - Default maximum iterations for LoopAgent when none is specified. Prevents infinite loops from consuming unbounded resources.
- DEFAULT_
MAX_ ITERATIONS - Default maximum number of LLM round-trips (iterations) before the agent stops.
- DEFAULT_
TOOL_ TIMEOUT - Default tool execution timeout (5 minutes).
Traits§
- Agent
- The fundamental trait for all ADK agents.
Functions§
- extract_
typed - Extract a typed value from agent events.
Type Aliases§
- After
Tool Callback Full - Rich after-tool callback that receives the tool, arguments, and response.
- OnTool
Error Callback - Callback invoked when a tool execution fails (after retries are exhausted).