ExecutionAgent extends BaseAgent and is responsible for carrying out individual steps produced by a PlanningAgent. When tools are provided it automatically creates a LangGraph create_react_agent executor; without tools it falls back to the plain invoke() chain.
Import
Constructor
The LangChain chat model to use for execution.
A list of LangChain-compatible tool objects to bind to the agent. When this list is non-empty,
ExecutionAgent creates an internal agent_executor using LangGraph’s create_react_agent. When None or empty, the agent uses the plain prompt-chain path.Override the default system instruction. The built-in prompt reads:
Display name used in log messages. Inherited from
BaseAgent.Methods
execute_step
context is provided it is appended to the prompt so the agent can reason about prior results. When an agent_executor exists (tools were supplied) the method uses it; on failure it falls back to invoke().
A plain-English description of the step to execute (typically one element from
PlanningAgent.generate_plan()).Accumulated output from previously executed steps. Pass this to allow the agent to build on earlier results.
str — the agent’s output for this step.
When tools are present, the system prompt is prepended directly to the user message to maintain compatibility across all LangGraph versions. If
agent_executor.invoke() raises an exception the error is logged and the call falls through to the plain invoke() path.invoke (inherited)
See BaseAgent.invoke().