Skip to content
PHP2Shell: The PHP Bug
Akshay Thakare

What Actually Makes an AI Agent

An agent is an LLM in a loop that chooses tools and acts on results. Here is the loop, the components and when you should not build one.

Agentic AIBeginner2 min readUpdated 11 Oct 2026

The core loop

A chatbot answers once. An agent runs a loop: decide → act with a tool → observe the result → decide again, until the goal is met or a limit is hit.

agent loop
  1. 1. Read

    Take in the goal, the conversation and any retrieved context.

  2. 2. Plan

    Decide the next step: answer directly or call a tool.

  3. 3. Act

    Call the tool — query a database, search docs, hit an API.

  4. 4. Check

    Read the result. Done? Answer. Not yet? Loop again.

A chatbot answers once. An agent repeats this loop — with limits on steps and tools — until the goal is met.

Components

ComponentPurposeExample
ModelReasoning and choosing actionsAny capable tool-calling LLM
ToolsDo things the model cannotSQL query, search, API call, file write
InstructionsRole, constraints, definition of done"Only read from the warehouse; never run DDL"
MemoryState across steps or sessionsConversation history, scratchpad, vector store
GuardrailsLimits and approvalsMax steps, allow-listed tools, human approval for writes

Workflow or agent?

Use a fixed workflow whenUse an agent when
Steps are known in advanceThe path depends on what is discovered
You need predictability and low costFlexibility is worth extra latency and cost
E.g. "summarise every new ticket"E.g. "investigate why yesterday's revenue dropped"

Many production systems are mostly workflows with an agentic step where judgment is needed.

Data engineering examples

  • Diagnose a failed pipeline: read logs, query the ledger, check source freshness, propose a fix
  • NL-to-SQL analyst: inspect schema, write a query, run it read-only, explain the result
  • Data quality triage: compare counts across layers and point to the first divergent stage

Finished this note?

Share