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 concurrentlyLoopAgent- Iterate until exit conditionConditionalAgent- Branch based on conditions
§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", worker, 10);§Guardrails (optional)
Enable the guardrails feature for input/output validation:
ⓘ
use adk_agent::{LlmAgentBuilder, guardrails::{GuardrailSet, ContentFilter, PiiRedactor}};
let input_guardrails = GuardrailSet::new()
.add(ContentFilter::harmful_content())
.add(PiiRedactor::new());
let agent = LlmAgentBuilder::new("assistant")
.input_guardrails(input_guardrails)
.build()?;Re-exports§
pub use guardrails::GuardrailSet;pub use tool_call_markup::normalize_content;pub use tool_call_markup::normalize_option_content;
Modules§
- guardrails
- Guardrail integration for LlmAgent
- tool_
call_ markup - XML-based tool call markup parsing.
Structs§
- Conditional
Agent - Conditional agent runs different sub-agents based on a condition
- Custom
Agent - Custom
Agent Builder - LlmAgent
- LlmAgent
Builder - 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