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

# CrewAI Instantiation Performance Evaluation

> Demonstrates agent instantiation benchmarking with CrewAI.

```python crewai_instantiation.py theme={null}
"""
CrewAI Instantiation Performance Evaluation
===========================================

Demonstrates agent instantiation benchmarking with CrewAI.
"""

from typing import Literal

from agno.eval.performance import PerformanceEval
from crewai.agent import Agent
from crewai.tools import tool


# ---------------------------------------------------------------------------
# Create Benchmark Tool
# ---------------------------------------------------------------------------
@tool("Tool Name")
def get_weather(city: Literal["nyc", "sf"]):
    """Use this to get weather information."""
    if city == "nyc":
        return "It might be cloudy in nyc"
    elif city == "sf":
        return "It's always sunny in sf"
    else:
        raise AssertionError("Unknown city")


tools = [get_weather]


# ---------------------------------------------------------------------------
# Create Benchmark Function
# ---------------------------------------------------------------------------
def instantiate_agent():
    return Agent(
        llm="gpt-4o",
        role="Test Agent",
        goal="Be concise, reply with one sentence.",
        tools=tools,
        backstory="Test",
    )


# ---------------------------------------------------------------------------
# Create Evaluation
# ---------------------------------------------------------------------------
crew_instantiation = PerformanceEval(func=instantiate_agent, num_iterations=1000)

# ---------------------------------------------------------------------------
# Run Evaluation
# ---------------------------------------------------------------------------
if __name__ == "__main__":
    crew_instantiation.run(print_results=True, print_summary=True)
```

## Run the Example

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

  <Step title="Install dependencies">
    ```bash theme={null}
    uv pip install -U agno crewai memory-profiler
    ```
  </Step>

  <Step title="Run the example">
    Save the code above as `crewai_instantiation.py`, then run:

    ```bash theme={null}
    python crewai_instantiation.py
    ```
  </Step>
</Steps>

Full source: [cookbook/09\_evals/performance/comparison/crewai\_instantiation.py](https://github.com/agno-agi/agno/blob/main/cookbook/09_evals/performance/comparison/crewai_instantiation.py)
