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

# Multi-Model Metrics

> When an agent uses a MemoryManager, each manager's model calls are tracked under separate detail keys in metrics.details.

```python multi_model_metrics.py theme={null}
"""
Multi-Model Metrics
=============================

When an agent uses a MemoryManager, each manager's model calls
are tracked under separate detail keys in metrics.details.

This example shows the "model" vs "memory_model" breakdown.
"""

from agno.agent import Agent
from agno.db.postgres import PostgresDb
from agno.memory.manager import MemoryManager
from agno.models.openai import OpenAIChat
from rich.pretty import pprint

# ---------------------------------------------------------------------------
# Create Agent
# ---------------------------------------------------------------------------
db = PostgresDb(db_url="postgresql+psycopg://ai:ai@localhost:5532/ai")

agent = Agent(
    model=OpenAIChat(id="gpt-5.6-luna"),
    memory_manager=MemoryManager(model=OpenAIChat(id="gpt-5.6-luna"), db=db),
    update_memory_on_run=True,
    db=db,
)

# ---------------------------------------------------------------------------
# Run Agent
# ---------------------------------------------------------------------------
if __name__ == "__main__":
    run_response = agent.run(
        "My name is Alice and I work at Google as a senior engineer."
    )

    print("=" * 50)
    print("RUN METRICS")
    print("=" * 50)
    pprint(run_response.metrics)

    print("=" * 50)
    print("MODEL DETAILS")
    print("=" * 50)
    if run_response.metrics and run_response.metrics.details:
        for model_type, model_metrics_list in run_response.metrics.details.items():
            print(f"\n{model_type}:")
            for model_metric in model_metrics_list:
                pprint(model_metric)
```

## Run the Example

<Snippet file="create-venv-step.mdx" />

**1. Install dependencies**

```bash theme={null}
uv pip install -U agno "psycopg[binary]" openai sqlalchemy
```

**2. Export your OpenAI API key**

```bash Mac/Linux theme={null}
export OPENAI_API_KEY="your_openai_api_key_here"
```

```bash Windows theme={null}
$Env:OPENAI_API_KEY="your_openai_api_key_here"
```

<Snippet file="run-pgvector-step.mdx" />

**3. Run the example**

Save the code above as `multi_model_metrics.py`, then run:

```bash theme={null}
python multi_model_metrics.py
```

Full source: [cookbook/02\_agents/14\_advanced/multi\_model\_metrics.py](https://github.com/agno-agi/agno/blob/v3.0.4/cookbook/02_agents/14_advanced/multi_model_metrics.py)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.