L0Reviewed 2026-07-19

AI agents

Systems that loop: observe, decide, act with tools, and repeat toward a goal.

What you'll learn

  • Define an agent as an observe–decide–act loop around a language model.
  • Contrast single-shot chat with multi-step autonomous workflows.
  • Name risks: runaway loops, tool misuse, and untested side effects.

In plain English

An AI agent is not a new kind of brain—it is usually a language model wrapped in a loop. The system reads the situation (messages, tool results, files), decides what to do next, acts (often by calling a tool or writing a command), then looks again.

That loop continues until the job is done, a limit is hit, or a human stops it. Email triage, research assistants, and coding bots are common agent shapes.

How it works

The orchestrator keeps state: conversation history, plan notes, tool outputs. Each cycle appends new information to the prompt (or structured context) and asks the model for the next move—natural language, JSON tool call, or finish signal.

Reliability comes from engineering: permissions on tools, step caps, logging, and evaluation suites—not from calling it an “agent.”

Minimal agent loop—observe state, ask model, act, repeat until done or max steps.
python
def run_agent(task, max_steps=5):
    state = {"task": task, "observations": [], "done": False}

    for step in range(max_steps):
        # Observe: everything the model should see this turn
        observation = {
            "step": step,
            "task": state["task"],
            "prior_observations": state["observations"],
        }

        # Decide: LLM chooses next action (stubbed)
        action = decide(observation)  # e.g. call LLM with tools schema

        # Act: execute tool or produce final answer
        result = act(action)

        state["observations"].append({"action": action, "result": result})

        if action.get("type") == "finish":
            state["done"] = True
            return result

    return {"error": "max steps reached", "state": state}

# decide/act would call your model + tool handlers in a real system

Going deeper

Agents overlap with classical AI planning and reinforcement learning—the LLM replaces hand-written policies for choosing actions, but search, graphs, and explicit planners still help on structured tasks.

Human-in-the-loop checkpoints are a feature, not a failure: approve purchases, publishes, or database writes before the loop continues.

Common misconceptions

Agents are fully autonomous general AI workers.
Most are scripted loops with an LLM policy, brittle outside tested scenarios.
More tools always make agents smarter.
Extra tools increase error surface; curate tools and permissions deliberately.
If the model plans well once, it is production-ready.
Agents need regression evals across tasks, failures, and tool edge cases.

Key facts

  • Agents combine an LLM with a control loop and environment interactions.
  • Each cycle updates state with observations from tools or the world.
  • Termination requires explicit stop conditions or step limits.
  • Tool permissions define what real-world effects are possible.
  • Evaluation must cover multi-step trajectories, not single replies.

Sources used

These free resources informed this page. ANN writes original explainers; we do not copy course text behind paywalls.

Also explore AI companies, Live Feed, and Weekly Brief.