← All insightsAI

Building AI agents with guardrails, not vibes

CodeWizard Engineering · 29 June 2025 · 3 min read · Intermediate

An 'agent' is just an LLM that can call tools in a loop. That is powerful and dangerous in equal measure. The difference between a useful agent and a liability is not the model - it is the guardrails around it.

Give tools narrow, typed interfaces

python
def refund(order_id: str, amount_cents: int) -> str:
    """Refund up to 5000 cents. Larger refunds require human approval."""
    if amount_cents > 5000:
        return queue_for_human_approval(order_id, amount_cents)
    return payments.refund(order_id, amount_cents)

The four choices that make an agent safe

  • A named owner responsible for the business outcome
  • Least-privilege tools - it can only do what it is scoped to do
  • Human approval for anything irreversible (money, prod, customer data)
  • A log of every action for audit and debugging
python
# log every tool call for an audit trail
log.info('agent_action', tool=tool_name, args=args, user=ctx.user, approved=approved)
An agent is a workflow with accountability. Remove the accountability and you have not automated the work - you have hidden it.

Start with one workflow, give the agent the smallest possible set of guarded tools, and keep a human in the loop for consequential actions. Expand scope only as trust is earned.

Like where this is going?

Get hands-on help from the engineers who write these posts.

Book a free consult