# Agent

An LLM running in a loop with tools. It decides which tool to call, looks at the result, and decides again until the goal is done.

AI developers · Part 04: Agents · Card 1 of 11 · Last updated 2026-10-13

## Analogy

A while-loop with opinions. You hand it a goal and a toolbox instead of a step-by-step script.

## In an agent

This is the whole definition. Everything else in this part is details of the loop and when to use it.

## Practice

### Flashcards

- **What is an agent?** An LLM in a loop with tools that decides its own next step.
- **Interview: what is an AI agent?** An LLM in a loop with tools. It picks the next tool at runtime from the results so far, until the goal is met.

### Interview questions

**What is an AI agent?**

- An LLM running in a loop with access to tools.
- It decides at runtime which tool to call, looks at the result, and continues until the goal is met.
- Example: DevPilot lists open PRs on its own, then fetches reviews only for the stale ones.

## Questions people ask

### What is an AI agent in simple terms?

An AI agent is a language model running in a loop with tools. You give it a goal instead of a script. It decides which tool to call, looks at the result, and decides again, until the goal is done or a step limit stops it. The model chooses the steps; your code runs them.

### Do I need a framework to build an AI agent in JavaScript?

No. A basic agent is a for loop around a chat completion call with tools, about thirty lines of TypeScript. Frameworks like LangGraph help later with branches, saved state and approvals. Building the plain loop first makes those frameworks much easier to understand and debug.

## Related concepts

- [The agent loop](https://studyvisually.com/learn/tech/ai-developers/agents/agent-loop)
- [The model plans the steps](https://studyvisually.com/learn/tech/ai-developers/agents/model-plans-the-steps)
- [Stop conditions](https://studyvisually.com/learn/tech/ai-developers/agents/stop-conditions)
- [Who decides the next step](https://studyvisually.com/learn/tech/ai-developers/llm-basics/ai-levels)

Web page: https://studyvisually.com/learn/tech/ai-developers/agents/agent
Study this card in the app: https://studyvisually.com/app/learn?category=ai-developers&card=agent
