← All news

News / Learn / AI agents

What is an AI agent?

You'll be able to explain what an AI agent is and tell it apart from a plain chatbot.

An AI agent is a program that uses a language model to pursue a goal. It decides what step to take next, uses tools to act, and checks the results. A chatbot answers one message at a time. An agent keeps working toward an end result across many steps.

Many products now ask a model to do a job, not just answer a question. Booking a meeting, fixing a bug, or pulling data from several sources all take several steps. Knowing what an agent is helps you decide when you need one and when a simpler design will do. It also shapes the cost, speed, and risk of what you build.

At its core, an agent is a loop. You give a language model a goal, a set of instructions, and a list of tools it may call. The model reads the goal and the history so far. It then either answers or picks a tool and supplies the inputs for it. Your code runs that tool and returns the result to the model.

The model reads the new result and decides the next step. This repeats until the model decides the goal is met, or until a limit you set stops the run. The model does not act on the world directly. Your code does, using the tools you wrote.

The model's choices are what make it an agent. A fixed script always runs the same steps in the same order. An agent chooses its steps based on what it sees. That flexibility is useful for open-ended work, but it also makes the behavior harder to predict.

Tools are the bridge to the outside world. A tool might search a database, send an email, or read a file. Each tool has a name, a description, and inputs. The model uses those descriptions to decide when to call a tool. Clear tool descriptions usually lead to better choices.

A minimal loop in pseudocode. The model either returns a final answer or requests a tool. Your code runs the tool and feeds the result back.

def run_agent(goal, tools, call_model, max_steps=10):
    messages = [{"role": "user", "content": goal}]
    for _ in range(max_steps):
        reply = call_model(messages, tools)
        if reply["type"] == "final":
            return reply["text"]
        # The model asked for a tool
        name = reply["tool"]
        args = reply["arguments"]
        result = tools[name](**args)
        messages.append({"role": "assistant", "content": reply["raw"]})
        messages.append({"role": "tool", "name": name, "content": str(result)})
    return "Stopped: step limit reached."

A short sketch to show the idea. Check the official docs of the tool you use.

  • Calling any chatbot an agent Ask whether the system chooses its own next step and uses tools to act. If it only replies to each message, it is a chatbot.
  • Forgetting the step limit Always cap the number of steps. Without a cap, a confused agent can loop and run up cost or cause repeated side effects.
  • Vague tool descriptions Write each tool's name and description as if explaining it to a new hire. The model relies on them to choose correctly.
  • Giving the model more tools than it needs Start with a few tools that cover the task. More tools add confusion and make wrong choices more likely.

Read about tool calling and structured output to see how the model's requests are formatted. Then study the agent loop in detail, including how results and errors get fed back.

Is an agent the same as a model?

No. The model is the component that decides what to do next. The agent is the full system: the model, its instructions, its tools, and the loop that connects them.

Do I always need an agent?

No. If your task has fixed steps, ordinary code with one model call is simpler, cheaper, and easier to test. Use an agent when the steps depend on what the model finds along the way.

Does an agent learn from each run?

Not by default. Unless you build memory into the system, each run starts fresh. The model only knows what is in its current input.

Can an agent act without my approval?

Only if you let it. You decide which tools exist and whether some actions need a person to confirm first. Put human checks on actions that cannot be undone.

Written with AI by CapyLaunch. Spotted a mistake? Email hello@capylaunch.com.