The word “agent” appears in every second AI tutorial. Multi-step reasoning, tool loops, memory, planning—the promise is that the model will figure out the sequence for you.
Most product problems do not need that. They need a clear sequence of steps that always runs in the same order, with ordinary validation and error handling at each stage. That sequence is a deterministic workflow. It is simpler to build, easier to test, cheaper to run, and far easier to debug when something goes wrong.
This article makes the case for starting there—and only reaching for an agent when measurement shows the deterministic path is no longer enough.
The Short Answer
Before you design an agent, write the steps as an ordinary function or state machine. Feed the model only the specific decisions that actually require language understanding. Keep control flow, retries, permissions, and side effects in application code. Add agent-style looping only when you have evidence that the fixed sequence cannot solve the problem.

What Product Problem This Solves
Many teams jump to agents because the demos look powerful. The resulting systems are often slower, more expensive, harder to test, and more prone to silent failure than a plain workflow would have been. The extra complexity rarely earns its place on the first version of a feature.
A deterministic workflow forces you to name the steps, the inputs, the outputs, and the failure modes. That clarity is valuable even if you later decide an agent is warranted.
A Concrete Example
Suppose the product need is: “Given a support ticket, extract the order ID, look up the order status, and draft a short reply.”
An agent-oriented design might look like this:
Model decides which tools to call
Model may call them in any order
Model may decide to call extra tools
Model writes the final reply when it believes it is done
A deterministic workflow looks like this:
Extract order ID (structured output, validated)
If extraction fails → return a clear error
Look up order status (ordinary function call, permission-checked)
If lookup fails → return a clear error
Draft reply using the extracted ID and the looked-up status (one focused model call)
Validate the reply length and content
Return the result or a rejection
The second version has no hidden control flow. Every branch is visible in the code. Token usage is predictable. Tests are ordinary unit and integration tests.
Minimal Working Sketch
Python
from pydantic import BaseModel, Field, ValidationError
from typing import Optional
from fastapi import HTTPException
class ExtractedOrder(BaseModel):
order_id: str = Field(..., min_length=3, max_length=32, pattern=r"^[A-Za-z0-9\-_]+$")
class TicketReply(BaseModel):
reply: str = Field(..., min_length=20, max_length=600)
def process_support_ticket(ticket_text: str, openai_client, db) -> dict:
# Step 1 – extract
extraction = call_model_for_extraction(ticket_text, openai_client)
try:
order = ExtractedOrder.model_validate_json(extraction)
except ValidationError:
return {"status": "rejected", "reason": "Could not extract a valid order ID"}
# Step 2 – lookup (ordinary code)
status_info = fetch_order_status(order.order_id, db) # your existing function
if status_info is None:
return {"status": "rejected", "reason": f"Order {order.order_id} not found"}
# Step 3 – draft reply
draft = call_model_for_reply(ticket_text, order.order_id, status_info, openai_client)
try:
reply = TicketReply.model_validate({"reply": draft})
except ValidationError:
return {"status": "rejected", "reason": "Generated reply failed validation"}
return {
"status": "succeeded",
"order_id": order.order_id,
"order_status": status_info,
"reply": reply.reply,
}Each model call is narrow. Control flow stays in Python. Permissions and data access stay in ordinary functions. There is no loop for the model to escape.
When an Agent Might Actually Be Justified
Consider an agent only after you have evidence that the fixed sequence fails on a meaningful fraction of real cases. Typical signals:
The set of required tools cannot be known in advance
The number of steps varies widely and cannot be bounded
Intermediate results genuinely change which later tools are relevant
You have already measured that a deterministic version cannot meet the product requirement
Even then, start with the smallest possible agent: one tool, hard stop conditions, explicit permission checks, and full logging of every proposed action. Most “agent” demos omit those controls; production systems cannot.
Cost, Latency, and Debuggability
A deterministic workflow makes token cost and latency predictable. You know exactly how many model calls occur and what each one is for. When something fails, the stack trace points to a specific step.
An agent loop makes those quantities variable. A single user request may trigger three calls or twelve. Debugging becomes “what sequence did the model choose this time?” instead of “which step failed?” That difference compounds quickly once real traffic arrives.
I once replaced a small agent that “decided” whether to look up an order with a two-step deterministic flow. Average latency dropped by 40 %. Failure modes became obvious. The product behavior did not change. The extra complexity had never earned its place.
What Was Tested and What Remains Uncertain
I compared the deterministic sketch above against a simple agent-style loop on a fixed set of support-ticket examples. The deterministic version produced equivalent useful replies at lower and more predictable cost. The agent occasionally added unnecessary tool calls and, on a few inputs, stopped early without drafting a reply.
These results are illustrative only. Exact model behavior, token counts, and tool-calling reliability must be verified against current official documentation and your own data. The right architecture for a different product problem may differ.

Practical Conclusion
Most AI features do not need an agent. They need a clear sequence of steps, narrow model calls, ordinary validation, and explicit error handling. That combination is a deterministic workflow. It is the smaller useful version for the majority of product problems.
Start with the smallest version that can answer the product question. In this case the question is “Do I actually need the model to choose the control flow?” For most features the answer is no.
Before adding an agent, see whether a deterministic workflow is enough. The extra complexity has to earn its place.
Build real applications. Verify every step.