# AI Agents

Canonical: https://aimastermindlab.com/glossary/agents

---
AI agents are LLM-powered systems that can autonomously plan, use tools, and take multi-step actions to complete complex goals. Unlike a simple chatbot, an agent can browse the web, write and execute code, call APIs, and adapt its approach based on intermediate results.

## What are AI Agents?

An AI agent is a system in which an LLM acts as the reasoning engine, deciding what actions to take to achieve a user-specified goal. Unlike a single-turn chat interaction, agents operate in a **plan → act → observe → adapt** loop, using tools to interact with external systems.

## Core Agent Components

- **LLM (the "brain")** — Plans actions, interprets results, decides next steps.
- **Tools** — Functions the LLM can call: web search, code execution, APIs, file system, database queries.
- **Memory** — Short-term (conversation context) and long-term (vector store of past interactions).
- **Orchestration** — The loop that feeds tool outputs back to the LLM as context.

## Agent Architectures

- **ReAct (Reason + Act)** — The LLM alternates between reasoning steps and tool calls.
- **Plan-and-Execute** — First plan all steps, then execute them sequentially.
- **Multi-agent** — Multiple specialised agents collaborate, each with a defined role.
- **Self-refine** — The agent critiques and revises its own outputs iteratively.

## Popular Agent Frameworks

- **LangChain / LangGraph** — Most mature ecosystem; LangGraph for stateful multi-agent flows.
- **CrewAI** — Role-based multi-agent orchestration with a clean API.
- **AutoGen (Microsoft)** — Multi-agent with built-in code execution.
- **LlamaIndex Workflows** — Event-driven agent workflows with strong document capabilities.

## Challenges

Agents introduce reliability challenges: they can take wrong actions, get stuck in loops, and are hard to debug. Robust agents need careful tool design, validation layers, and human-in-the-loop checkpoints for high-stakes tasks.

## Example

A coding agent given the task 'add a login page to my app' plans the steps (analyse existing code, design the page, write the component, write tests, update routing), executes each step using a code editor tool, runs the tests, and iterates until all tests pass — without a human intervening.
---

Source: https://aimastermindlab.com/glossary/agents — AI Mastermind Lab (https://aimastermindlab.com)
