Dev.to
7/27/2026

The original title is "TIL - Choosing Between Code, an LLM Call, and an AI Agent"
Original: TIL - Choosing Between Code, an LLM Call, and an AI Agent
Short summary
A practical walkthrough building four endpoints of increasing complexity—from a stateless LLM call to a multi-tool agent—in plain Go without frameworks. The author discovers that an AI agent is just a loop: send messages plus tool schemas, execute tool requests, append results, repeat. The hard parts (idempotency, sagas, circuit breakers, authz boundaries) map directly to existing distributed systems patterns, with the key difference being that the orchestrator—the model—is now the least reliable component.
- •AI agents are tool-calling loops: same endpoint, same model, ~150 lines of extra code
- •Agent challenges map to known distributed systems patterns like sagas and circuit breakers
- •Key insight: the model as orchestrator is the least reliable component in the system
Generated with AI, which can make mistakes.
Is this a good recommendation for you?



