TechByteByByte
โ† Back to Blog

Agents & LLMs ยท 7 min read

AI Agents Don't Really 'Think.' So What Are They Actually Doing?

AI agents can search, use tools, change plans and take actions. Underneath the magic is a surprisingly understandable software loop.

TechByteByByte Editorial TeamUpdated September 6, 2026
Friendly AI agent surrounded by messages, tools, code and task controls

Ask a chatbot:

โ€œWhich flight should I take from Pune to Bengaluru?โ€

and it can give you advice.

Ask an AI agent:

โ€œFind suitable flights, compare them with my constraints, and prepare the best option for me.โ€

and something different can happen.

It may search.

It may inspect results.

It may reject an option.

It may call another tool.

It may update its plan.

It may stop and ask you a question.

From the outside, this can look remarkably like a little digital employee sitting inside the computer and thinking.

That mental model is useful for marketing.

It is terrible for understanding how agents actually work.

There is no tiny person inside the loop.

There is a language model surrounded by software.

And once you see the software loop, agents become much easier to understand.

Start with the thing that is not an agent

Imagine a normal LLM request:

User
  โ†“
"Explain gradient descent"
  โ†“
LLM
  โ†“
Text response

The model receives input and generates output.

That can be extremely capable.

But by itself, the model has not searched your calendar, queried a flight API, executed Python, changed a Jira ticket or sent an email.

Those are capabilities supplied by the application around the model.

This distinction matters.

An LLM is a model.

An AI application is software that uses a model.

An agent is an AI application in which the model is allowed to participate in deciding what action should happen next, often repeatedly.

Give the model a tool and the picture changes

Suppose our application exposes a function:

search_flights(origin, destination, date)

The model receives not only your request but also a description of that tool.

Conceptually:

USER:
Find flights from Pune to Bengaluru tomorrow.

AVAILABLE TOOL:
search_flights(origin, destination, date)

The model can produce a structured request meaning:

Call search_flights(
  origin="Pune",
  destination="Bengaluru",
  date="..."
)

Here is the important part:

The LLM did not call the airline.

Your software receives that structured tool request.

Your software validates it.

Your software calls the API.

Then your software gives the result back to the model.

User goal
   โ†“
LLM chooses tool
   โ†“
Application executes tool
   โ†“
Tool result
   โ†“
LLM sees result

That one distinction removes a lot of the mystery around agents.

Now add a loop

A single tool call is useful.

An agent becomes more interesting when the model can observe the result and decide what to do next.

Imagine the flight tool returns:

Flight A โ€” 06:10 โ€” โ‚น4,900
Flight B โ€” 09:30 โ€” โ‚น6,100
Flight C โ€” 18:20 โ€” โ‚น4,300

But your original request also said:

โ€œI need to reach before noon and I donโ€™t want a departure before 7 AM.โ€

The model can evaluate the tool result.

Flight A violates the departure constraint.

Flight C arrives too late.

Flight B remains.

Maybe the model now needs baggage information, so it requests another tool.

Goal
 โ†“
LLM
 โ†“
Choose action
 โ†“
Tool
 โ†“
Result
 โ†“
Update state
 โ†“
LLM
 โ†“
Choose next action
 โ†“
...
 โ†“
Stop

That loop is the heart of many agent architectures.

Anthropic describes autonomous agents in similarly simple terms: LLMs use tools based on environmental feedback in a loop. The sophistication comes from what the model can infer, which tools exist, what state is preserved and how the surrounding software controls execution.

So where does the apparent โ€œthinkingโ€ come from?

Several things are happening together.

1. The model can reason over the current situation

The model receives the goal, instructions, previous messages, tool results and other context.

It generates a useful next step based on that information.

2. Tools let it affect or inspect the outside world

A model that only generates text is limited to text.

Give the application tools and it can expose controlled capabilities such as:

search_web()
read_file()
query_database()
run_tests()
create_ticket()
send_email()

The agent feels more capable because the surrounding program gives the model ways to interact with an environment.

3. State lets the process continue across steps

The application needs to remember what has happened.

For our flight example, state might contain:

original goal
user constraints
flights already checked
tool results
selected candidate
current step
errors

Without state, each step would forget the work before it.

4. The loop creates adaptation

Traditional software often follows a path we wrote beforehand:

Step A
โ†’ Step B
โ†’ Step C

An agent can have a more dynamic path:

Goal
 โ†“
What should I do next?
 โ†“
Action
 โ†“
What happened?
 โ†“
What should I do now?

That ability to choose the next action based on what just happened creates much of the โ€œagenticโ€ feeling.

Agent vs workflow: the boundary that matters

Suppose we are processing an invoice.

We know the exact steps:

Read invoice
โ†’ Extract fields
โ†’ Validate fields
โ†’ Save to database
โ†’ Send confirmation

Do we need an agent?

Probably not.

A deterministic workflow is easier to test and control.

Now suppose the task is:

โ€œInvestigate why this production test started failing after yesterdayโ€™s deployment and propose a fix.โ€

We do not know in advance:

  • which files matter;
  • whether logs are needed;
  • whether a dependency changed;
  • which tests should run;
  • whether the first hypothesis will fail.

That is a better candidate for agentic behavior.

Anthropic makes a similar distinction between workflows, where LLMs and tools follow predefined code paths, and agents, where the model dynamically directs its own process and tool usage.

That distinction is more useful than calling every multi-step LLM application an โ€œagent.โ€

What about planning?

People often imagine planning as the model creating a perfect master plan and then executing it.

Real agent systems can be messier.

A model may form an initial plan:

1. Inspect failing test
2. Check recent diff
3. Reproduce failure
4. Find cause
5. Patch
6. Run tests

Then step 3 reveals something unexpected.

A good agent system should be able to update its approach.

This is why environment feedback matters.

The agent should not simply hallucinate that the fix worked.

It should obtain evidence:

run_tests()
    โ†“
3 tests still failing
    โ†“
Model sees failure
    โ†“
Try another fix

This feedback loop is one of the reasons coding is such a natural agent domain: tests, compilers and linters can provide concrete signals about whether a change worked.

Memory is not magic either

โ€œAgent memoryโ€ sounds mysterious until you break it down.

Some memory is simply current state.

Some is conversation history.

Some systems store summaries.

Some retrieve older information from databases.

Some maintain user preferences.

The model itself does not necessarily contain a permanent diary of everything it has ever done.

The application decides what to save, where to save it and what to retrieve later.

Past interaction
      โ†“
Store selected information
      โ†“
Database / memory store
      โ†“
Future request
      โ†“
Retrieve relevant memory
      โ†“
Add to model context

Again: model + software.

Where frameworks such as LangGraph fit

You can build an agent loop yourself.

But production systems quickly need answers to awkward questions:

  • Where is state stored?
  • What happens if a tool fails?
  • Can execution resume?
  • How do we branch?
  • Where do we ask for human approval?
  • How do we stop infinite loops?
  • How do we trace what happened?

Frameworks such as LangGraph help represent these execution flows explicitly.

They do not give the LLM magical agency.

They help engineers control the software around the model.

That is an important difference.

A coding agent makes the architecture visible

Consider a coding task:

โ€œAdd validation to the signup endpoint and update the tests.โ€

A coding agent may:

Read repository
     โ†“
Find signup endpoint
     โ†“
Inspect existing validation patterns
     โ†“
Edit implementation
     โ†“
Run tests
     โ†“
Observe failure
     โ†“
Edit test / implementation
     โ†“
Run tests again
     โ†“
Return diff for review

The model is important.

But so are:

  • filesystem tools;
  • shell execution;
  • Git;
  • test runner;
  • sandbox;
  • permissions;
  • state;
  • stopping rules;
  • human review.

In 2026, coding products increasingly expose exactly this kind of delegated workflow. GitHub documents coding agents that can be assigned issues, work asynchronously and open pull requests for human review. OpenAIโ€™s Codex app similarly emphasizes multiple agents working on repository tasks, with developers reviewing changes and diffs.

The visible product may say โ€œagent.โ€

Underneath, it is still a carefully controlled software system.

More autonomy also means more ways to fail

Every extra action creates another opportunity for error.

An agent can:

  • choose the wrong tool;
  • pass the wrong arguments;
  • misread a tool result;
  • repeat itself;
  • spend too much money;
  • expose sensitive information;
  • take an action that should have required approval.

Imagine a support agent that is allowed to issue refunds.

There is a huge difference between:

Model recommends:
"Refund โ‚น2,000"

and:

Model calls:
issue_refund(โ‚น2,000)

The second crosses from language into action.

That is why production agent engineering needs permissions, validation, audit logs, budgets, timeouts, guardrails and human approval for sensitive actions.

The most useful rule: use the least autonomy you need

If a normal function solves the problem, use the function.

If a deterministic workflow solves it, use the workflow.

If an LLM inside a fixed workflow solves it, stop there.

Use an agent when the path genuinely cannot be specified cleanly in advance and dynamic decision-making creates enough value to justify the additional cost and risk.

This is not anti-agent.

It is good engineering.

The takeaway

An AI agent is not a tiny digital person.

A useful mental model is:

An LLM operating inside a software loop, with state and controlled access to tools, repeatedly using feedback from the environment to decide what should happen next.

The model provides flexible decision-making.

The application provides tools, permissions, state, execution and safety.

Once you separate those responsibilities, agents stop looking like magic --- and start looking like software you can actually design.

Related learning

Sources

Continue reading