THE SHORT ANSWER

An AI agent combines a model with instructions, tools, state and control logic. For each step it interprets the current goal, selects an action, receives an observation from the environment, verifies progress and either continues, asks for help or stops. The surrounding software executes tools and enforces permissions; the model does not act by magic.

The OpenSkool agent loop

Use one backbone throughout this module: GOAL → UNDERSTAND → CHOOSE → ACT → OBSERVE → VERIFY → CONTINUE / STOP. The loop is useful because it separates a model's proposal from an action in the world and from the evidence that follows.

What happens in one agent cycle
StageSystem questionPossible result
GOALWhat outcome is requested?A bounded objective and success rule
UNDERSTANDWhat is known, missing or constrained?Relevant state and uncertainty
CHOOSEWhich allowed next step best advances the goal?A response, tool request or question
ACTCan the proposed step be executed safely?The host runs or refuses the action
OBSERVEWhat changed?A tool result or environment state
VERIFYDid the step work and remain within bounds?Evidence, error or approval request
CONTINUE / STOPIs another step justified?Proceed, escalate, fail or finish

Evidence & context: Anthropic

A model is only one part of the system

Instructions shape decisions; tools define possible actions; the environment contains the files, services or people affected; state records what has happened; and control logic restricts what may happen next. A stopping condition can be a verified outcome, a maximum number of attempts, a budget, a deadline or a required human decision.

In function calling, a model can return a structured request naming a function and its arguments. Application code validates and executes that request, then returns the result. This distinction matters: generating a tool call is a proposal; trusted software still decides whether and how to carry it out.

Evidence & context: OpenAI Developers

Control the loop from four directions

Controls around every loop
ControlQuestionDesign response
CAPABILITYCan the system perform this step reliably?Use evaluated models and well-defined tools
PERMISSIONIs it allowed to perform this step?Restrict scopes and separate read from write
COSTIs another step worth its resources and delay?Use budgets, bounded retries and routing
HUMAN OVERSIGHTMust a person decide or approve?Place review before consequential actions

Illustrative example: prepare a meeting

An agent receives the goal of proposing meeting times. It reads permitted calendars, identifies missing time-zone information, asks the user, selects three options and drafts an invitation. It does not send the invitation until the user approves the recipients and time. It then observes the calendar result and stops only after the event exists once.

Sources & further reading

  1. Building effective agents

    Anthropic. A provider's engineering taxonomy of agents and workflows, not a universal industry definition. We use the conceptual distinction, not its changing product recommendations.

  2. Function calling

    OpenAI Developers. Official documentation for model-selected function calls. The application, not the model, executes custom functions and must validate arguments, permissions and results.

  3. Generative Artificial Intelligence Profile (NIST AI 600-1)

    NIST. Risk-management guidance, including confabulation. It does not establish a universal error rate.

Examples and exercises are illustrative unless attributed to a source. No independent expert review is claimed.

A correction, a counterexample or an experience worth sharing?

Join the conversation ↗