> ## 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.

# Agent with Tools

> Give a Portkey agent web search tools.

## Code

```python tool_use.py theme={null}
import asyncio
import os

from agno.agent import Agent
from agno.models.portkey import Portkey
from agno.tools.websearch import WebSearchTools

agent = Agent(
    model=Portkey(
        id="@your-provider-slug/gpt-5-nano",
        portkey_api_key=os.getenv("PORTKEY_API_KEY"),
    ),
    tools=[WebSearchTools()],
    markdown=True,
)

if __name__ == "__main__":
    # --- Sync ---
    agent.print_response("What are the latest developments in AI gateways?")

    # --- Sync + Streaming ---
    agent.print_response(
        "What are the latest developments in AI gateways?", stream=True
    )

    # --- Async ---
    asyncio.run(
        agent.aprint_response("What are the latest developments in AI gateways?")
    )

    # --- Async + Streaming ---
    asyncio.run(
        agent.aprint_response(
            "What are the latest developments in AI gateways?", stream=True
        )
    )
```

## Usage

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

**1. Set your Portkey API key**

```bash Mac/Linux theme={null}
export PORTKEY_API_KEY="your_portkey_api_key_here"
```

```bash Windows theme={null}
$Env:PORTKEY_API_KEY="your_portkey_api_key_here"
```

**2. Install dependencies**

```bash theme={null}
uv pip install -U portkey-ai openai ddgs agno
```

**3. Set the model ID**

Replace `@your-provider-slug/gpt-5-nano` with a model string from your [Portkey Model Catalog](https://portkey.ai/docs/product/model-catalog). Portkey model strings use the format `@provider_slug/model_name`.

**4. Run the agent**

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

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


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