What Are AI Agents?
How agent loops, tools and approvals work, where autonomy helps, and the failure modes to design around before giving an agent real permissions.
Prerequisites
- • Basic familiarity with LLMs and prompts
- • Understanding of APIs or software workflows helps
What you will learn
- Describe the plan-act-observe loop
- Identify which tools and permissions an agent actually needs
- Design human approval gates for consequential actions
An agent is a loop with tools
A basic AI assistant responds once. An agent can plan, call tools, observe the result and decide what to do next. The loop continues until the task is complete, a budget is exhausted, or a human intervenes.
The important parts are not the model alone. They are:
- Tools: search, database queries, file access, email, ticketing, code execution.
- State: what the agent remembers between steps.
- Policy: what it may do, what needs approval and what is forbidden.
- Observability: logs of every action and decision.
- Stopping conditions: time, cost, step count and failure limits.
Start with a workflow, not an agent
Many “agent” use cases are better as deterministic workflows. If the steps are known, code them. Use an agent only when the path genuinely depends on intermediate observations.
For example, “summarise every invoice email” is a workflow. “Investigate why this invoice does not match the purchase order, checking the PO, receipt, vendor record and prior invoices” may benefit from an agent loop.
Permission design
Split actions into three buckets:
- Allowed: read-only lookups, draft creation in a sandbox.
- Approval required: sending email, issuing refunds, changing records, deploying code.
- Forbidden: deleting data, changing permissions, moving money, accessing unrelated systems.
An agent should not be able to grant itself new permissions. Credentials should be scoped to the task and stored outside the prompt.
Failure modes
- Goal drift: the agent optimises a proxy metric and ignores the real goal.
- Prompt injection: content from a web page or document tells the agent to do something else.
- Cascading errors: one wrong lookup poisons every later step.
- Silent success: the agent reports completion without verifying the outcome.
- Runaway cost: the loop keeps calling expensive tools.
The minimum viable agent
Start with one tool, a narrow task, a small step limit and a human approval gate. Log every action. Evaluate on a set of real cases. Expand only after the failure modes are understood.
The goal is not maximum autonomy. It is useful automation with a blast radius you can contain.
Exercises
Do these before moving on. Reading is not the same as being able to apply it.
Exercise 1
Map an agent
Choose a repetitive task and draw the loop: input, plan, tools, observation, output, approval. Mark every action that changes external state.
Exercise 2
Write a permission policy
For that agent, list allowed, approval-required and forbidden actions.
References
Finished this tutorial? Continue with a guided path.
Browse learning paths →