AI agent architecture that survives production
By Indian Software Developers. Published , 6 min read.
The demo version of an agent is an LLM in a loop with a list of tools. The production version is mostly everything around that loop.
Design the workflow before the prompt
Write down the states the conversation or task can be in and what must be true to move between them. A phone ordering agent, for example, should not be able to submit an order before the caller has confirmed it — and that rule belongs in code, not only in the prompt.
Give the model narrow, typed tools
A tool called run_sql is flexible and dangerous. A tool called add_item_to_order with a validated item ID and quantity is boring and safe. Validate every tool input on the server as if it came from an untrusted user.
Log everything and plan the hand-off
Store every model turn and tool call so you can replay failures. Decide in advance when the agent should stop and pass the conversation to a person, and make that path fast.
- Explicit states enforced in code
- Small set of validated tools
- Confirmation before irreversible actions
- Full audit log and replay
- Clear human escalation