# AI Agents Quick Reference

## Agent = LLM + Tools + Loop

```
Observe → Think → Act → Observe (repeat)
```

## Tool Schema

```json
{
  "name": "tool_name",
  "description": "What it does (model uses this to decide)",
  "parameters": {
    "query": { "type": "string" },
    "top_k": { "type": "number", "default": 5 }
  }
}
```

## MCP

- **Model Context Protocol** — Standard for tool exposure
- Tools as MCP servers; any MCP client can use them
- [modelcontextprotocol.io](https://modelcontextprotocol.io)

## Planning Strategies

| Strategy | Approach |
|----------|----------|
| ReAct | Alternate reasoning + tool calls |
| CoT planning | Plan in text, then execute |
| Reflexion | Reflect on failures, retry |

## Memory

| Type | Scope |
|------|-------|
| Short-term | Current conversation (context) |
| Long-term | Vector DB, key-value across sessions |

## Safety Checklist

- [ ] Sandbox tools (limit file/network)
- [ ] Human-in-the-loop for sensitive actions
- [ ] Guardrails (input/output validation)
- [ ] Max iterations / rate limits

## Multi-Agent

- **Orchestrator** — Delegates, merges results
- **Specialists** — Focused tools and tasks

## One-Liners

- **Loop** — Observe, think, act, repeat.
- **Tools** — Define schema; model chooses and calls.
- **MCP** — Standard interface for tools.
- **Safety** — Sandbox, human approval, guardrails.
