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

# 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

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

  <Step title="Set your Portkey API key">
    <CodeGroup>
      ```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"
      ```
    </CodeGroup>
  </Step>

  <Step title="Install dependencies">
    ```bash theme={null}
    uv pip install -U portkey-ai openai ddgs agno
    ```
  </Step>

  <Step title="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`.
  </Step>

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

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