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

# vLLM Tool Use

> Add web search tools to a vLLM agent and stream responses sync and async.

```python tool_use.py theme={null}
"""Build a Web Search Agent using xAI."""

import asyncio

from agno.agent import Agent
from agno.models.vllm import VLLM
from agno.tools.websearch import WebSearchTools

# ---------------------------------------------------------------------------
# Create Agent
# ---------------------------------------------------------------------------

agent = Agent(
    model=VLLM(
        id="NousResearch/Nous-Hermes-2-Mistral-7B-DPO", top_k=20, enable_thinking=False
    ),
    tools=[WebSearchTools()],
    markdown=True,
)

# ---------------------------------------------------------------------------
# Run Agent
# ---------------------------------------------------------------------------
if __name__ == "__main__":
    # --- Sync ---
    agent.print_response("Whats happening in France?")

    # --- Sync + Streaming ---
    agent.print_response("Whats happening in France?", stream=True)

    # --- Async + Streaming ---
    asyncio.run(agent.aprint_response("Whats happening in France?", stream=True))
```

## Run the Example

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

**1. Install dependencies**

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

**2. Export your vLLM API key**

```bash Mac/Linux theme={null}
export VLLM_API_KEY="your_vllm_api_key_here"
```

```bash Windows theme={null}
$Env:VLLM_API_KEY="your_vllm_api_key_here"
```

**3. Install vLLM**

Install vLLM in the environment that will serve the model:

```bash theme={null}
uv pip install -U vllm
```

**4. Start vLLM**

Serve the model used by this example with automatic tool calling enabled:

```bash theme={null}
vllm serve NousResearch/Nous-Hermes-2-Mistral-7B-DPO --enable-auto-tool-choice --tool-call-parser hermes
```

**5. Run the example**

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

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

Full source: [cookbook/90\_models/vllm/tool\_use.py](https://github.com/agno-agi/agno/blob/v3.0.4/cookbook/90_models/vllm/tool_use.py)


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