---
title: "Agent"
type: "glossary term"
url: "https://aifordevs.org/glossary#agent"
markdown: "https://aifordevs.org/glossary/agent.md"
publisher: "AI for Devs"
license: "https://aifordevs.org/reuse"
attribution: "Credit AI for Devs and link to https://aifordevs.org/glossary#agent"
---

# Agent

An agent is a program that calls a model in a loop, runs the tools the model requests, and feeds the results back until a stop condition ends the loop. The tools and the stop condition set what the agent can do.

Each pass sends the accumulated history, so cost and latency grow with every turn. Anthropic's guide describes agents as LLMs using tools based on environmental feedback in a loop, and it recommends a stopping condition such as a maximum iteration count. The same guide advises finding the simplest solution possible and adding complexity only when needed.

## Example

Asked to fix failing tests, an agent runs npm test, reads two files, edits one, reruns the tests, and then returns text with no tool call. That run takes four turns.

## Source

[Anthropic, Building effective agents (2024)](https://www.anthropic.com/research/building-effective-agents)

## Related terms

- [Agent loop](https://aifordevs.org/glossary#agent-loop)
- [Agentic AI](https://aifordevs.org/glossary#agentic-ai)
- [Tool calling](https://aifordevs.org/glossary#tool-calling)
- [MCP](https://aifordevs.org/glossary#mcp)
- [A2A](https://aifordevs.org/glossary#a2a)

## Read the article

[What is an AI agent? The loop in code, and where it fails](https://aifordevs.org/articles/what-is-an-ai-agent)

## Cite this term

AI for Devs. "Agent." https://aifordevs.org/glossary#agent

- Page: https://aifordevs.org/glossary#agent
- Markdown: https://aifordevs.org/glossary/agent.md
- Reuse: Quote or summarize with a link to this page. Terms: https://aifordevs.org/reuse
- Publisher: AI for Devs
