Module 1: Agent Fundamentals

Decision Framework: Code vs Single LLM vs Agent

How to objectively evaluate whether your user experience requires an agentic state loop or a simpler, deterministic function.

When engineering intelligent software, defaulting to an autonomous agent is often an anti-pattern. Autonomous loops incur compounding non-determinism, latency penalties, and token consumption.

The Architecture Matrix

Choose the simplest architecture that completely fulfills the product requirement:

Tier Pattern Typical Latency Cost per 1k runs Determinism
Tier 1 Deterministic Code < 5ms $0.00 100%
Tier 2 Structured LLM Extraction 400ms – 1.2s $0.20 – $1.50 97–99%
Tier 3 Chained Linear Pipeline 1.5s – 4.0s $1.00 – $5.00 92–95%
Tier 4 Autonomous Tool-Calling Agent 5.0s – 45.0s $10.00 – $60.00 80–92%

Evaluation Criteria

1. Known vs Unknown State Transitions

  • If every possible state transition can be modeled with a directed acyclic graph (DAG), write deterministic workflow code (e.g. Temporal, Inngest, or plain TypeScript).
  • If intermediate steps depend on dynamically discovered environmental data (e.g. reading a schema, writing a query, encountering an error, adjusting the query), use an agent.

2. Failure Recovery Boundaries

Can the model safely attempt and fail a tool call without human intervention?

  • Safe: Reading files, querying vector embeddings, executing dry-run tests.
  • Unsafe: Deleting cloud infrastructure, sending external emails, updating live billing records.

Next Steps

Explore the compounding probabilities in Cost & Risk Trade-offs.

Was this page helpful?
Powered by IndieFounder