AI Agents
Building Production AI Agents
A practical guide to moving from agent demos to systems with state, permissions, approvals, retries, and auditability.
8 min read29 June 2026Ubaith Sherif
Agent runtime
PlanToolsReviewAudit
Why agent demos fail in production
A useful agent is not only a prompt with tools. It needs durable state, a clear execution contract, access control, retries, and a way to explain what happened after the fact.
The moment an agent touches business workflows, the product needs approval checkpoints and traceability.
A production-friendly agent shape
A strong baseline separates orchestration, tools, policy, and user-visible audit logs.
type AgentRun = {
id: string;
workflowId: string;
status: "queued" | "running" | "awaiting_approval" | "completed" | "failed";
toolCalls: ToolCall[];
auditEvents: AuditEvent[];
};Approval loops
Human-in-the-loop design is a control surface for deciding where the agent can act and where business judgment is required.
Request
Plan
Tool call
Approval
Audit log
Action
Key takeaways
- State and auditability matter as much as model capability.
- Approval gates make autonomy safer and more useful.
- Agent products need operational dashboards, not only chat interfaces.