Guides

AI agents: software that decides its next step

By Abdul Asim ·

The short answer

An AI agent is software that uses a language model to decide its own next step toward a goal: which tool to call, with which inputs, and when the job is finished. Your application runs each tool call, hands the result back to the model, and repeats until the goal is met or a limit stops it. If a program follows a path you wrote in advance, it is a workflow, not an agent.

What makes software an agent?

The idea is older than language models. In classic AI, a software agent is anything that senses its surroundings and acts on them in pursuit of a goal, and a thermostat qualifies. What changed is the decision maker. In an LLM agent, the model reads the situation in plain language and picks the action, so you stop hand-coding every branch.

Mechanically, it is a loop. Model vendors call the building block tool use or function calling: you describe each tool with a name and a JSON schema, the model replies with a structured request to call one, and your code runs it and sends the result back. OpenAI's function calling guide and Anthropic's tool use documentation both describe that same round trip. The model never touches your systems. Your code does, and that is where every control in a production agent lives.

  • Goal: a user request or a scheduled job that defines what done looks like.
  • Decision: the model reads the goal plus everything gathered so far and picks the next action.
  • Action: your runtime executes the call, such as a search, a SQL query, a ticket or an API write.
  • Observation: the result goes back into the context and the loop runs again.

Alternating reasoning with actions like this was set out in the ReAct paper in 2022, where a model switched between thinking steps and lookups against a Wikipedia API. Most agent frameworks today are variations on that loop. The guide to AI agent architecture breaks down each part that sits around it.

An agent I shipped, and what it actually decides

Definitions get clearer with a real system. For Permit Signal, permit and property records were spread across Socrata and ArcGIS datasets. I normalized and geocoded them into PostGIS, then gave the agent several ways to search: spatial lookup, semantic search, BM25 keyword matching and SQL.

The agent's real job is choosing between those. For example, a question about permits on one street would need a location filter and a structured query. A looser question about building activity in an area would lean on semantic search. The model picks the retrieval path and its filters, then writes the answer from the evidence that came back, with map pins and source links. That decision layer is what makes it agentic RAG rather than a fixed RAG pipeline that runs the same retrieval for every question. The reported usage is 1,797 users and roughly 480 messages a day.

Agents can be much smaller than that. The McKissock sales assistant answers product questions from retrieved company material, and its key tool creates a HubSpot support ticket when it cannot resolve a request. Deciding when to hand a conversation to a human is a genuine agent decision, even with one tool.

AI agent vs chatbot vs workflow

Most confusion about the term comes from three things that look the same from the outside. The difference is who decides the path.

ChatbotWorkflowAI agent
Who picks the next stepNobody, it replies onceYour code, fixed in advanceThe model, at run time
Tool callsNone, or one fixed lookupYes, in a set orderYes, chosen per request
Model calls per requestOneKnown in advanceVaries
PredictabilityHighHighLower, needs limits and evals
Good fitAnswers over known contentRepeatable jobs with known stepsRequests where the right path depends on the input

A workflow can call a language model at several stages and still not be an agent. If you are weighing the two for a business process, AI automation vs AI agents walks through that choice. My default is to use a workflow wherever the steps are known and spend agent autonomy only on the part that genuinely varies.

How is an AI agent different from agentic AI?

People use the two terms interchangeably, but they sit at different levels. An AI agent is a concrete thing: one system with a model, a set of tools and a loop. You can point at it, log it and test it. Agentic AI is the broader approach of building systems in which models plan and act with some autonomy over several steps. It names a design style and a product category, and it covers single agents, groups of agents and workflows that give a model a few bounded choices.

Put simply, the agent is the unit, and agentic AI is the set of architecture decisions around those units: how much autonomy to grant, how agents coordinate, which actions need human sign-off, and how the whole system gets evaluated. A system can be agentic without containing anything you would call a fully autonomous agent, for example a pipeline where a model only picks which branch runs next. The agentic AI hub covers that wider picture, and multi-agent systems covers what changes when several agents share the work.

Where AI agents fail in production

Every decision you hand the model is a place it can be wrong, and errors stack up across steps. If each step is right 95% of the time, a ten-step task comes out right only about 60% of the time. That arithmetic is why the failures below matter more for agents than for single calls.

  • Wrong tool or wrong arguments: the model picks a plausible tool with an invented filter value. Strict schema modes reject malformed calls, but a well-formed call with the wrong value still gets through.
  • Loops that never end: the agent keeps searching because nothing tells it the evidence is good enough. Cap steps, tokens and wall-clock time in code.
  • Too much power: an agent holding write access it does not need. OWASP lists this as Excessive Agency and recommends minimal tools, least-privilege permissions and human approval for high-impact actions.
  • Instructions hidden in data: retrieved documents and web pages can carry text that tries to redirect the agent. See prompt injection.
  • Silent quality drift: the agent still answers, just worse, and nobody notices until users do.

The fix is rarely a cleverer prompt. It is narrower tools, hard limits in the runtime, human review on risky actions, and evaluation that runs on every change.

When should you build an AI agent?

Build an agent when the right sequence of steps depends on the request and you cannot list the branches ahead of time. Skip it when a workflow would do, because the workflow will be cheaper, faster and easier to test. These are the checks I run with clients before anyone writes agent code:

  • Can you draw the whole flowchart on one page? Build a workflow.
  • Does the path change per request across several tools? An agent may earn its cost.
  • Are any actions irreversible, such as sending, paying or deleting? Put human approval in front of them.
  • Can you write 30 test cases with expected outcomes? If not, you are not ready to ship any kind of agent.

If your process passes that last check and you want it built with those controls from the first release, that is what my custom AI agentic system engagement covers. For the different kinds of agent you might end up with, read types of AI agents next.

Key takeaways

  • An AI agent is a model in a loop that chooses actions toward a goal, while your code executes them.
  • The test for an agent is who decides the path: if your code fixes it in advance, it is a workflow.
  • An AI agent is one system you can test. Agentic AI is the wider design approach that agents sit inside.
  • Production agents fail through wrong tool calls, runaway loops, excess permissions and injected instructions.
  • Start with the smallest tool list and the tightest limits that solve the problem, then widen only when evals show you need to.

Let's talk

Let's ship yours.

AI product, automation bottleneck, RAG use case, or operational workflow. Tell me what's slowing your team down, or what revenue you're leaving on the table.

Abdul Asim, AI / LLM Engineer