datarekha

What agentic AI means

An agent is an LLM that can act, not just answer. Here's what that actually involves — and how it changes the engineering.

5 min read Beginner Agentic AI Lesson 1 of 71

What you'll learn

  • The minimum-viable definition of "agent"
  • Anthropic's workflows vs agents distinction — and why it matters
  • The five workflow patterns plus the agent shape itself
  • When you need an agent vs. a single LLM call

Before you start

A customer emails: “I never got my refund — I expected it three weeks ago.” To answer, your system has to look up the order, check the refund status in Stripe, read the policy, maybe ping the billing team, and then write a reply. A single LLM call can’t do any of that — it can only produce text. An agent (in the software sense: a program that perceives its environment and acts on it) is an LLM that can also do something with that text — call a function, look something up, write a file, ask a human, call another agent — and then continue the conversation with the result.

The simplest agent loop is:

1. LLM receives a prompt.
2. LLM responds with EITHER a final answer OR a tool call.
3. If it's a tool call -> run the tool -> feed the result back to step 1.
4. Repeat until the LLM produces a final answer.

That’s the whole structural change. Everything else — frameworks, patterns, observability — is just managing this loop well.

the agent loop — run a tool, feed the result back, repeatpromptLLMplans next steptool callrun toolresultfeed result back → repeatno tool callfinal answer ✓
TryThe agent loop

Watch an LLM reason, call a tool, read the result — and repeat

Pick a task, then hit Run (or Step through it). The loop is always the same: reasontool callobserve → reason again … until the model decides it has enough to answer. That loop, some tools, and a stopping condition — that's the whole idea.

promptWhat's the weather in Tokyo, and should I bring an umbrella?
FinalanswerReasonthinkTool callactObserveresult
0/ 5 steps0 tool calls
Stops when the model returns an answer instead of a tool call — or hits the 12-step guard.
agent tracenot started
Press Run or Step to watch the loop fill in, turn by turn.
speed

Workflows vs agents (the distinction that matters)

Anthropic’s Building Effective Agents draws a line that’s now the standard vocabulary:

  • Workflows — LLMs and tools are orchestrated through predefined code paths. The shape of the system is fixed by your code; the LLM fills in the blanks. Predictable, easy to debug, cheap.
  • Agents — the LLM dynamically directs its own process and tool usage. The shape of each run is decided by the model. Flexible, but harder to reason about, more expensive, fails in more ways.

The thesis: start with the simplest solution that works. A single prompt beats a workflow. A workflow beats an agent. Reach for agentic autonomy only when the task genuinely needs unbounded steps and the model has to decide what’s next from real feedback.

Workflow — fixed code pathyou decide the steps; the LLM fills the blanksClassifyLookup orderCompose replySendEscalate humanPredictable, debuggable, cheap.Steps are knowable in advance.Agent — LLM-driven loopthe LLM decides the next step from real feedbackLLMplans next actionRun toolwhatever the LLM pickedResult back to LLMuntil LLM emits a final answer

Same task, two shapes. Workflows freeze the DAG in code; agents let the LLM pick each next step. The contrast is the lesson — start workflow, escalate to agent only when the task genuinely demands it.

The five workflow patterns plus the agent

Most production “agent” systems are actually one of these workflow shapes:

1. Prompt chaining

Decompose a task into a fixed sequence of LLM calls — each call processes the previous output. Add programmatic gates between steps. Good when sub-tasks are clear and accuracy benefits from focus (e.g. outline then draft then polish).

2. Routing

Classify the input, then dispatch to a specialized prompt or model. Good when inputs fall into distinct categories that benefit from different handling (e.g. refund queries vs. technical support).

3. Parallelization

Run multiple LLM calls concurrently. Two flavours: sectioning splits the task into independent parts; voting runs the same task many times and aggregates (majority vote, average, ranking). Good for speedups or for higher-confidence outputs.

4. Orchestrator-workers

A central LLM dynamically decomposes the task and delegates sub-tasks to worker LLMs, then synthesizes the results. Use when the sub-tasks aren’t knowable up front.

5. Evaluator-optimizer

One LLM generates, another evaluates, you iterate until the evaluator approves (or a budget runs out). Good when criteria are clear and iteration measurably improves quality (translation, code, structured extraction).

…and then “the agent”

The maximally flexible shape: an LLM in a loop with tools. The model picks the next action, runs it via a tool, reads the result, and decides again. This is the right answer when steps can’t be enumerated in advance and the model needs ground-truth feedback to plan.

When do you actually need an agent?

You don’t need an agent when:

  • A single LLM call answers the question.
  • The task is purely transformation (summarize, translate, classify).
  • You can do it with a rules-based pipeline plus one LLM step.

You do need an agent when:

  • The model needs current information (search, database).
  • The model needs to compute something exactly (calculator, code).
  • The model needs to act in the world (send email, update record).
  • The task requires multiple decisions where each depends on the previous result.

The first two are tool use with a single LLM-tool-LLM cycle. The last two need a multi-step loop.

The frameworks you’ll see

There are four major frameworks covered in this section:

FrameworkFromStrength
LangChainLangChainEasiest entry point, huge ecosystem
LangGraphLangChainExplicit state machines — ideal for complex flows
MS Agent Framework (MAF)MicrosoftAzure-first, replaces AutoGen and Semantic Kernel
Google ADKGoogleGemini-first, deploys onto Google Cloud easily

They all do roughly the same things; the choice usually comes down to which cloud you’re on and whether your team prefers declarative or imperative code.

What’s hard about agents

The honest answer: evaluating them. A single LLM call has one input and one output — easy to test. An agent has a loop, side effects, and non-deterministic intermediate states. Building good evals for agents is a discipline of its own (covered in the design patterns lesson).

You’ll also fight:

  • Latency: 3–10 LLM calls per agent run is normal.
  • Cost: same — multiply by the number of users.
  • Reliability: tools fail, models hallucinate tool calls, JSON parsing breaks.

These are all solvable, but they’re real engineering work. You’ll notice that an agent is mostly plumbing — the LLM is a small part.

In one breath

  • An agent is an LLM that can act, not just answer — it loops: respond with a final answer or a tool call, run the tool, feed the result back, repeat.
  • Workflows orchestrate LLMs through predefined code paths; agents let the LLM direct its own process — start simple and escalate only when the task genuinely demands it.
  • Most production “agents” are really one of five workflow patterns — prompt chaining, routing, parallelization, orchestrator-workers, evaluator-optimizer — plus the open loop itself.
  • You need a real agent only when steps can’t be enumerated in advance and the model must plan each next action from real feedback.
  • An agent is mostly plumbing (loop, tool dispatch, context, stop conditions); the hard part is evaluating it, and “multi-agent” is rarely the right default.

Quick check

Quick check

0/3
Q1A user types 'translate this paragraph to French'. Workflow, agent, or single LLM call?
Q2Which scenario most genuinely needs a full agent loop (not a workflow)?
Q3Why does Anthropic's 'Building Effective Agents' recommend starting with workflows?

Next

The next lessons go through the design patterns above in detail, then into each framework, starting with LangChain.

Sign in to track your progress

Completed lessons, your XP, level, and streak save to your account — it's free and takes a few seconds.

Practice this in an interview

All questions
What is an AI agent, and how does it differ from a single LLM call?

An agent is an LLM placed in a loop where it reasons, chooses and calls tools or actions, observes the results, and repeats until a goal is met, rather than producing one response and stopping. The key differences are autonomy, tool use, memory and state, and multi-step control flow driven by the model's own decisions.

What is tool use or function calling in LLMs, and how do you design good tools for an agent?

Function calling lets an LLM output a structured request to invoke an external function with arguments, which the runtime executes and feeds back, enabling agents to act in the world. Good tool design uses clear names and descriptions, minimal well-typed parameters, narrow single-purpose scope, least privilege, and informative error messages so the model can choose and call them reliably.

How do function/tool calling and LLM agents work at a high level?

Tool calling extends the LLM's output space to include structured function invocations. The model emits a JSON object naming a tool and its arguments; the runtime executes the tool and feeds the result back as a new message. An agent is a loop that repeats this cycle — observe, think, act — until the task is complete or a stopping condition is met.

What prompt engineering techniques should every LLM practitioner know?

The core toolkit is: system prompts (role and constraints), few-shot examples (format and tone anchoring), chain-of-thought (step-by-step reasoning), and output constraints (JSON schema, stop sequences). Combining these predictably closes the gap between a capable base model and a production-ready feature.

Related lessons

Explore further

Skip to content