# Agent Definitions & Taxonomy

What is an agent? A precise taxonomy for the agentic era.

---

## Definition

> **An AI Agent is a system that can perceive its environment, reason about goals, plan actions, and execute them autonomously to achieve objectives — with the ability to adapt based on feedback.**

### Minimal Viable Agent
```python
class Agent:
    def __init__(self, model, tools, memory, planner):
        self.model = model          # LLM for reasoning
        self.tools = tools          # Action space
        self.memory = memory        # State persistence
        self.planner = planner      # Decision-making

    def run(self, goal):
        while not goal.achieved:
            obs = self.perceive()
            plan = self.planner.plan(goal, obs, self.memory)
            action = self.decide(plan)
            result = self.execute(action)
            self.memory.update(result)
            goal = self.evaluate(goal, result)
```

---

## Autonomy Levels (Adapted from SAE J3016)

| Level | Name | Description | Human Role |
|---|---|---|---|
| **L0** | **Tool** | Single function call, no memory | Operator |
| **L1** | **Chain** | Fixed sequence of calls | Supervisor |
| **L2** | **Router** | Chooses from fixed tools/paths | Monitor |
| **L3** | **Planner** | Generates multi-step plans, executes | Approver |
| **L4** | **Autonomous Agent** | Plans, executes, adapts, recovers from failure | On-call |
| **L5** | **Self-Improving Agent** | Modifies own code/tools/memory to improve | Governor |

**Most production "agents" today are L2-L3.** True L4+ remains research.

---

## Agent Taxonomy

### By Architecture
| Type | Structure | Examples |
|---|---|---|
| **Single-Agent** | One LLM + tools + memory | ReAct, AutoGPT, coding assistants |
| **Multi-Agent** | Multiple specialized agents | AutoGen, CrewAI, MetaGPT |
| **Hierarchical** | Manager → workers → sub-workers | MetaGPT, AgentVerse |
| **Swarm** | Peer-to-peer, emergent coordination | OpenAI Swarm, AgentSwarm |
| **Hybrid** | Neural + symbolic (neurosymbolic) | Reflexion, ReWOO, ToT |

### By Interaction Model
| Type | Description |
|---|---|
| **Chat/Conversational** | Turn-based, human-in-loop |
| **Background/Async** | Long-running, event-driven |
| **Streaming/Real-time** | Token-by-token, low latency |
| **Batch/Offline** | Large-scale processing, eval |

### By Domain Specialization
| Category | Capabilities |
|---|---|
| **Generalist** | Broad tools, open-ended goals |
| **Specialist** | Domain tools, constrained ontology |
| **Coding** | Repo understanding, edit, test, CI |
| **Research** | Literature search, synthesis, experimentation |
| **Data** | SQL, visualization, statistical analysis |
| **Creative** | Writing, design, media generation |
| **Embodied** | Robotics, desktop control, game playing |

---

## Core Capabilities (The "Agentic" Checklist)

| Capability | Implementation | Maturity |
|---|---|---|
| **Perception** | Multimodal input (text, image, audio, structured) | High |
| **Reasoning** | CoT, ToT, GoT, self-consistency, program-of-thought | Medium-High |
| **Planning** | Task decomposition, dependency graphs, replanning | Medium |
| **Tool Use** | Function calling, MCP, code execution, browser | High |
| **Memory** | Short-term (context), long-term (vector, KG, episodic) | Medium |
| **Learning** | In-context, few-shot, fine-tuning, RLAIF | Low-Medium |
| **Self-Correction** | Reflection, verification, debugging loops | Medium |
| **Collaboration** | A2A protocols, delegation, negotiation | Low-Medium |
| **Safety** | Guardrails, containment, interpretability | Medium |

---

## Agent vs. Related Concepts

| Concept | Distinction |
|---|---|
| **LLM** | Static function: input → output; no memory, no tools |
| **Chain** | Fixed DAG of LLM calls; no dynamic decisions |
| **Workflow** | Deterministic orchestration; no LLM-driven branching |
| **RAG** | Retrieval + generation; no planning, no tools |
| **Agent** | **Dynamic**: perceives → reasons → acts → learns |

---

## Formal Models

### POMDP Formulation
Agent as Partially Observable Markov Decision Process:
- **States (S)**: World states (hidden)
- **Observations (O)**: What agent perceives
- **Actions (A)**: Tool calls, utterances
- **Transition (T)**: S × A → S (environment dynamics)
- **Observation (Z)**: S × A → O (sensor model)
- **Reward (R)**: S × A → ℝ (goal satisfaction)
- **Policy (π)**: O* → A (agent's strategy)

**Challenge**: State space infinite; solved via LLM as approximate policy/value function.

### Cognitive Architecture Map
```
Perception → Working Memory ←→ Long-term Memory
    ↓              ↓
Reasoning ←→ Planning → Action Selection → Execution
    ↓              ↓              ↓
Learning ←←←←←←←←←←←←←←←←←←←←←←←←←←←←←
```

---

## Evaluation Dimensions

| Dimension | Metrics |
|---|---|
| **Task Success** | Pass rate, completion %, quality score |
| **Efficiency** | Steps, tokens, latency, cost per task |
| **Robustness** | Failure recovery, edge case handling |
| **Alignment** | Instruction following, safety, values |
| **Generalization** | OOD tasks, new tools, novel environments |
| **Interpretability** | Traceability, rationale quality |

---

## Related Notes

- [[Foundations/LLM-Fundamentals.md]] — Underlying model capabilities
- [[Foundations/Core-Abstractions.md]] — Building blocks (tools, memory, planning)
- [[Architectures/Single-Agent-Patterns.md]] — ReAct, Plan-and-Execute, etc.
- [[Architectures/Multi-Agent-Patterns.md]] — Coordination, communication
- [[Evaluation/Agent-Benchmarks.md]] — SWE-bench, GAIA, AgentBench
- [[Frontiers/Self-Improving-Agents.md]] — L5 autonomy

---

*Sources: Russell & Norvig (AIMA), Wooldridge (Agent Theory), SAE J3016, Lilian Weng blog, LangChain/Autogen/CrewAI docs, ArXiv: "Generative Agents" (Park et al.), "ReAct" (Yao et al.), "AutoGPT" (Significant Gravitas), "MetaGPT" (Li et al.)*