Expand description
Agent system for building autonomous LLM applications.
Provides core abstractions and implementations for agents.
§Core Concepts
- Agent: Responsible for planning, deciding what action to execute next.
- AgentExecutor: Responsible for execution loop (plan -> act -> observe).
- Tool: Callable tools that agents can invoke.
§Execution Flow
Input question
|
Agent.plan() -> AgentAction or AgentFinish
|
If Action: execute tool -> get observation
|
Add to intermediate_steps
|
Loop until AgentFinish returnedRe-exports§
pub use executor as base;pub use orchestrator as orchestration;pub use adapter::AgentEventRunnable;pub use adapter::AgentRunnable;pub use adapter::OrchestratorRunnable;pub use adaptive_rag::AdaptiveRAG;pub use adaptive_rag::AdaptiveRAGError;pub use adaptive_rag::AdaptiveRAGResult;pub use adaptive_rag::RagDecision;pub use approval::AllowAll;pub use approval::ApprovalDecision;pub use approval::ApprovalHandler;pub use builder::AgentBuilder;pub use cache::MemoryCache;pub use cache::ResponseCache;pub use crag::CRAGError;pub use crag::CRAGResult;pub use crag::CorrectiveRAGAgent;pub use deep_research::Citation;pub use deep_research::DeepResearchAgent;pub use deep_research::ResearchError;pub use deep_research::ResearchReport;pub use executor::estimate_step_tokens;pub use executor::AgentError;pub use executor::AgentExecutor;pub use executor::BaseAgent;pub use executor::BudgetConfig;pub use executor::BudgetExceeded;pub use executor::CompactionConfig;pub use executor::CompactionStrategy;pub use executor::CompactionTrigger;pub use function_calling::FunctionCallingAgent;pub use handoffs::HandoffManager;pub use hooks::AgentHook;pub use hooks::ApprovalHook;pub use hooks::CompletionAction;pub use hooks::CompletionContext;pub use hooks::CompletionResult;pub use hooks::ContentFilterHook;pub use hooks::ErrorAction;pub use hooks::HookError;pub use hooks::LoggingHook;pub use hooks::PromptInjectionHook;pub use hooks::StreamAction;pub use hooks::TokenBudgetHook;pub use hooks::ToolCallAction;pub use hooks::ToolCallContext;pub use hooks::ToolResultContext;pub use memory_extractor::LlmMemoryExtractor;pub use orchestrator::parse_review_verdict;pub use orchestrator::review_envelope;pub use orchestrator::task_adapter;pub use orchestrator::FanOutFanIn;pub use orchestrator::Orchestrator;pub use orchestrator::ReviewOrchestrator;pub use orchestrator::ReviewVerdict;pub use orchestrator::RunContext;pub use orchestrator::SequentialPipeline;pub use orchestrator::TaskAdapter;pub use plan_execute::PlanExecuteAgent;pub use plan_execute::PlanExecuteError;pub use policy::ToolPolicy;pub use policy::ToolRisk;pub use react::ReActAgent;pub use resume::FileResumeStore;pub use resume::MemoryResumeStore;pub use resume::PendingApproval;pub use resume::ResumeError;pub use resume::ResumeStore;pub use retry::RetryConfig;pub use streaming::agent_sse_frames;pub use streaming::encode_sse_frame;pub use streaming::sse_event_name;pub use streaming::sse_event_payload;pub use streaming::AgentEventStream;pub use streaming::AgentSseRequest;pub use streaming::AgentStreamEvent;pub use streaming::SseFrame;pub use streaming::SseOptions;pub use streaming::StreamingFunctionCallingAgent;pub use streaming::ToolCallState;pub use task::AgentTask;pub use types::AgentAction;pub use types::AgentFinish;pub use types::AgentOutput;pub use types::AgentStep;pub use types::ToolInput;
Modules§
- adapter
- AgentRunnable adapter - bridges AgentExecutor to the Runnable trait.
- adaptive_
rag - Adaptive RAG implementation.
- approval
- Approval gate (§4.2): asynchronous approval gate before tool execution.
Implement
ApprovalHandlerand inject it viaAgentExecutor::with_approval; off by default. Approval gate (§4.2): asynchronous approval gate before tool execution. - builder
- AgentBuilder — create an Agent in 3 lines
- cache
- LLM result cache (P2-1)
- crag
- Corrective RAG (CRAG) Agent.
- deep_
research - Deep Research Agent: multi-round research with sub-topic decomposition, parallel search, and comprehensive report synthesis with citations.
- executor
- Agent base traits and executor implementation.
- function_
calling - Function calling based agent module.
- handoffs
- Handoffs multi-agent handoff
- hooks
- Agent Hook/Middleware system for composable lifecycle interception.
- memory_
extractor - B4 (v0.22.4): LLM-backed semantic-memory extractor turning a completed turn
into durable
lc_memory::MemoryItems. B4 (v0.22.4): LLM-backedlc_memory::MemoryExtractor. - metrics
- Agent execution metrics (P1-5)
- orchestrator
- Common trait for high-level orchestrators (P1-1)
- plan_
execute - Plan-Execute Agent: plan - execute - replan
- policy
- Tool permission tiering + sandbox gate (P2-9).
- react
- ReAct Agent implementation
- resume
- Cross-process resume (§4.2 approval/budget gate): suspend-state persistence +
recovery. The framework writes/clears checkpoints (
ResumeStore) around approvals; a new process inspects viaAgentExecutor::pending_approvaland resumes viaAgentExecutor::resume. Off by default (noResumeStore⇒ no serialization; existing behavior unchanged). Cross-process resume (§4.2 approval/budget gate): suspend-state persistence + recovery. - retry
- Retry helpers for LLM calls.
- streaming
- Streaming Tool Calls
- task
- Explicit agent task definition (P2-5)
- types
- Agent related type definitions
Structs§
- Agent
Metrics - Aggregated metrics for a single agent execution.