LangChain · the classic AgentExecutor
How orchestration works
AgentExecutor drives a single loop. On each turn it formats the prompt
(system + tools + scratchpad), calls the LLM, and hands the response to an
output parser. The parser produces either an AgentAction
(tool name + args) or an AgentFinish (final answer). Actions are executed,
the result becomes an Observation, and both get appended to the scratchpad before
the next iteration.
How it stops
On AgentFinish, on a tool marked return_direct, or when the
guardrail trips: max_iterations (default 15) or max_execution_time.
Mechanism
Single linear loop. Each step is recorded in intermediate_steps.
Tradeoffs
No native branching, parallelism, or human-in-the-loop primitives. Most net-new work has moved to LangGraph.