> ## Documentation Index
> Fetch the complete documentation index at: https://mcp-eval.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Agents

> Define agents via config or code: AgentSpec, Agent, AugmentedLLM, and factories; discovery and overrides.

<Note>
  **mcp-eval is built on [mcp-agent](https://mcp-agent.com)** — a simple, composable framework for building effective agents with Model Context Protocol using patterns from Anthropic's [Building Effective Agents](https://www.anthropic.com/research/building-effective-agents) guide.
</Note>

## Understanding mcp-agent

[mcp-agent](https://github.com/lastmile-ai/mcp-agent) provides the core agent infrastructure that powers mcp-eval's testing capabilities:

* **Simple & Composable**: Build agents using proven patterns like Parallel, Router, Evaluator-Optimizer, and Swarm workflows
* **Full MCP Support**: Agents can use any MCP tools, resources, and prompts from connected servers
* **Production-Ready**: The same agent patterns you test can be deployed to production
* **Model-Agnostic**: Works with OpenAI, Anthropic, and other LLM providers

Your test agents can leverage all of mcp-agent's sophisticated capabilities:

* Multi-server connections
* Complex workflow orchestration
* Human-in-the-loop interactions
* Durable execution with state management

Learn more:

* [mcp-agent Documentation](https://docs.mcp-agent.com)
* [mcp-agent Examples](https://github.com/lastmile-ai/mcp-agent/tree/main/examples) - Production-ready agent patterns
* [Building Effective Agents](https://www.anthropic.com/research/building-effective-agents) - Anthropic's guide

### Ways to define

* Config‑defined AgentSpec (root agents or discovered subagents)
* Programmatic AgentSpec
* Programmatic Agent instance
* Programmatic AugmentedLLM
* Factory (safe for parallel tests)

APIs: [config.py](https://github.com/lastmile-ai/mcp-eval/blob/main/src/mcp_eval/config.py), [core.py](https://github.com/lastmile-ai/mcp-eval/blob/main/src/mcp_eval/core.py)

### Decorator order

When combining, place `@with_agent(...)` above `@task(...)`.

### Discovery

Define AgentSpecs in `mcp-agent.config.yaml` or enable `subagents` search paths. Reference by name with `use_agent("SpecName")` or `@pytest.mark.mcp_agent("SpecName")`.

Examples: [agent\_definition\_examples.py](https://github.com/lastmile-ai/mcp-eval/blob/main/examples/mcp_server_fetch/agent_definition_examples.py)

#### Per‑Agent provider/model

Prefer attaching provider/model at the AgentSpec level if an agent should use a distinct model from global defaults.
