Agents

AI agent

An AI agent selects and executes actions toward a goal using observed state.

GoalModel chooses an actionTool runsModel reads the resultFinish when doneuntil done
An AI agent selects and executes actions toward a goal using observed state. Values shown in the worked visual are illustrative unless the labels state otherwise.

How it works

The agent loop connects model decisions to tools and an environment. Reliability depends on state handling, permissions, stopping rules, and verification.

A concrete example

Illustrative: inspect 12 files, edit 2, run 3 checks, then stop when all checks pass.

Do not confuse it with Chatbot

a chatbot returns messages; an agent can take consequential actions through tools.

Study the full lesson