What an AI Agent Actually Is

An agent is a model given a goal, tools and permission to choose its own next step — which is what separates it from a chatbot or a fixed prompt chain.

An AI agent is a foundation model that has been given a goal, a set of tools it is allowed to call, and permission to decide for itself which tool to call next and when the job is done. The load-bearing word is decide. In ordinary generative AI you write the control flow and the model fills in text. In an agentic system the model writes the control flow at run time, and your code executes whatever it asks for.

Agents exist because a growing class of work cannot be scripted in advance. "Summarise this document" has one shape, so you can hard-code it. "Find out why this customer was charged twice and put it right" has a different shape every time: sometimes it is one lookup, sometimes it is four lookups, a refund and an email. Writing an if/else tree for every branch is impossible, so you hand the branching to the model.

The spectrum from prompt to agent

ApproachWho chooses the next stepTypical example
Single prompt callYou, at design timeClassify a support ticket into one of five labels
Prompt chainYou — a fixed sequenceExtract fields, then summarise, then translate
Deterministic workflow / routerYour code, branching on model outputA Step Functions Choice state on a predicted intent
AgentThe model, at run time, in a loop"Sort out this duplicate charge"

Where the real boundary sits

People argue about whether something "counts" as an agent. The useful test is simple: if you can draw the sequence of calls on a whiteboard before the request arrives, it is a workflow, not an agent. A chatbot that calls a weather API whenever the user mentions weather is a workflow with one conditional in it. An agent is a workflow whose graph is generated fresh for each request.

What an agent is not

  • Not a chatbot. A chatbot's job is the conversation. An agent's job is a task in an external system; the conversation is optional, and plenty of agents run headless from a queue.
  • Not RAG. Retrieval-augmented generation adds knowledge to a single call. That makes the answer better informed; it does not let the model act. An agent may use RAG as one of its tools.
  • Not a synonym for tool use. One model call that returns one function call, which your code executes and returns to the user, is function calling. It becomes agentic when the result feeds back in and the model gets another turn.

When an agent is the right answer

Reach for an agent when all of these hold: the number and order of steps genuinely varies per request; the task needs to read or change state in real systems; there is a way to check the work, either automatically or by a human; and a wrong step is recoverable. If any of those is missing, something simpler will be cheaper, faster and easier to test — and knowing that is exactly what the exam probes.

Example

Example · python
import boto3

# 1) NOT an agent - one call, control flow owned by you.
bedrock = boto3.client("bedrock-runtime")
resp = bedrock.converse(
    modelId="anthropic.claude-3-5-sonnet-20240620-v1:0",
    messages=[{"role": "user", "content": [{"text": "Classify this ticket: 'charged twice'"}]}],
    inferenceConfig={"maxTokens": 64, "temperature": 0},
)
print(resp["output"]["message"]["content"][0]["text"])

# 2) An agent - one goal in, the model chooses the steps.
agent_rt = boto3.client("bedrock-agent-runtime")
stream = agent_rt.invoke_agent(
    agentId="AGENT123456",
    agentAliasId="TSTALIASID",
    sessionId="case-8891",           # groups turns into one conversation
    inputText="Customer 4471 says they were charged twice in May. Sort it out.",
    enableTrace=True,                # emit the reasoning/tool trace for audit
)
for event in stream["completion"]:
    if "chunk" in event:
        print(event["chunk"]["bytes"].decode(), end="")

When to use it

  • A telecoms support desk replaces a rigid IVR flow with an agent that can look up a bill, check an outage feed and raise a credit in whatever order the specific complaint requires.
  • A finance team keeps monthly close as a fixed Step Functions pipeline because every run does the same five things, and only adds an agent for the ad-hoc "why is this variance here?" investigations.
  • An internal DevOps assistant triages an alert by querying logs, metrics and recent deployments, deciding after each result whether it needs to dig further.

Discussion

  • Be the first to comment on this lesson.