AI agents that work in production
An agent is a program with a loop, not an employee. The hard part is not getting the model to call a tool. It is getting it to stop in time, do the right thing when something fails and leave a trail behind.
What an agent actually is
An agent is a program that gets a goal, chooses a tool, reads the result and continues until the goal is reached or a limit stops it. The model is part of the program. It is not the program.
That means normal software engineering applies. You need a clear task, an owner, a way to see what happened and a way to stop it. An agent you cannot stop is not a product.
Start with a narrow job
I would rather start with a job a person does for ten minutes every day than with an agent that runs the whole support desk. A narrow job can be measured, tested and improved. A broad job can only be discussed.
A good first job has a clear answer, a small number of systems and a natural end. Examples: sort incoming email into three categories, fetch order status and suggest a reply, or compile a weekly report from two systems.
Set limits before speed
An agent needs limits a person can explain. How many steps may it take? Which tools may it use? Which actions need approval? What happens when a tool returns an error?
I always set a maximum number of steps, a timeout and a list of allowed tools. Write steps require approval or an idempotency key. If the agent cannot solve the task, it should hand over, not retry forever.
- A maximum number of steps and a hard timeout.
- A tool list, with read and write tools kept apart.
- Approval for payments, email, bookings and deletions.
- A clear “I don’t know” path that reaches a person.
Log every step, not just the end
When an agent goes wrong, the final answer is rarely the problem. It is the step before: the wrong tool, the wrong parameter or a tool response that was misunderstood. So log every step with a trace id, the tool name, masked input and result status.
Log cost and time per step too. An agent that takes twelve calls where three would do is expensive even when the answer is right. The numbers make it easier to choose between a better prompt, a better tool and a simpler solution.
Evaluate with real cases
A demo with three examples says almost nothing. Collect 30–50 real cases from the business, with the answer an experienced person would give. Run the agent on them every time you change model, prompt or tool.
Measure more than whether the answer is correct. Measure whether the agent chose the right tool, asked when it should and stopped in time. Those things decide whether it can be trusted in daily work.
When not to build an agent
If the flow is known and does the same thing every time, ordinary automation is better. If the answer must be exact, a database query is better. If a person will review every step anyway, it is often the interface, not the agent, that needs improving.
An agent is right when the task needs judgement, when the number of paths is large and when a mistake can be detected or undone. Otherwise you are building something more expensive than the problem.
Related services
Read next
Questions and answers
What does an AI agent cost to build?
It depends on the number of systems and how much a person needs to approve. A narrow first flow can often be built in a few weeks. A broad system with many integrations takes longer and needs more testing.
Can the agent use our existing systems?
Yes, if the systems have an API or an export we can read. If not, we build a controlled path in rather than giving the agent free access to the database.
How do we know the agent will not do something stupid?
By limiting the tools, requiring approval for write steps and logging every call. We also test against real cases and keep a simple way to turn the flow off.