Skip to main content
All agents inherit from BaseAgent and implement a single method:
Orchestrators and AgentTool call astream() on sub-agents, yielding AGENT_MESSAGE and TOOL_RESPONSE events throughout execution.

LlmAgent

The primary agent. Uses LangChain BaseChatModel with a manual tool-call loop.

Dynamic instructions

The instructions parameter accepts either a plain string or an instruction provider - a callable that receives a ReadonlyContext and returns a string:

ReActAgent

A structured-reasoning variant that forces the LLM to emit explicit thought steps via with_structured_output() before acting. Extends LlmAgent - supports instructions, planner, callbacks, and all other LlmAgent features.
Custom instructions are appended to the built-in ReAct system prompt under an “Additional instructions” section. Planners work the same way - their output is appended after the instructions. Yields events with types: AGENT_START -> AGENT_MESSAGE (thoughts/actions) -> TOOL_RESPONSE (observations) -> … -> AGENT_MESSAGE (final answer) -> AGENT_END.