Agent Loop
The pattern: agent execution as a state machine, not a loop-and-pray. Nodes are typed functions (plan, call-tool, observe, decide). Edges are conditional transitions. State is a typed object that flows. Any state can be restored and re-run. Every transition emits a span.
The trade-off: explicitness vs. agility. A naive while True: prompt, tool_call, observe loop is fast to write and impossible to debug. The state-machine framing is more upfront work but yields an agent you can replay, trace, and reason about. “Sometimes works” becomes “I know exactly where it failed.”
Deepens in Year 5 Phase 26: Agent Development — LangGraph implementation of the query-helper agent is the worked example. Phase 28: AIOps and services/aiops/ are where the pattern carries production weight.
Related patterns
- tool-use-as-capability — what the nodes call.
- prompt-as-program — how the planner node is authored and gated.
- rag-as-pattern — common retrieval node inside an agent graph.
- Phase 27: MCP — standardizes the tool contract the loop calls into.