A graph, not a chain
The agent loops between reasoning and tool calls until it is actually done. A single-shot chain was half the code and could not re-plan.
Read the codeThe cheaper alternative
One LLM call per turn. Send the prompt, take the answer, render it.
The agent loop: ask, call a tool, wait, answer
What it would have cost
No re-planning after a tool returns something unexpected, and no memory between turns.
What the decision bought
A StateGraph with a ToolNode and a MemorySaver, so the agent loops until it is done and the conversation survives the turn.
Where it lives
OurStoryTime, lib/langgraph