Introduction¶
The Agents package provides a minimal, composable foundation for building LLM-powered agents that reason and act through tool use.
At its core, an agent is a loop: send messages to an LLM, receive a response (possibly with tool calls), execute those tools, feed results back, and repeat until done.
Key Design Principles¶
- Immutable state -
AgentStateis a readonly value object. Every mutation returns a new instance. - Pluggable drivers - Swap between
ToolCallingDriver(native function calling) andReActDriver(Thought/Action/Observation) without changing your agent code. - Lifecycle hooks - Intercept any phase of execution to add guards, logging, or custom behavior.
- Testable by default -
FakeAgentDriverlets you script deterministic scenarios without LLM calls.
Package Structure¶
Core/ # AgentLoop, AgentState, tools, stop signals
Context/ # AgentContext, message compilers
Hooks/ # Lifecycle interceptors and guard hooks
Drivers/ # ToolCallingDriver, ReActDriver, FakeAgentDriver
Events/ # Agent event system
Exceptions/ # Domain exceptions