Code
tool_use.py
Usage
1
Set up your virtual environment
2
Install Libraries
3
Start vLLM server
4
Set your API key
5
Run Agent
Save the code above as
tool_use.py, then run:Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
Run a vLLM agent with WebSearchTools asynchronously.
import asyncio
from agno.agent import Agent
from agno.models.vllm import VLLM
from agno.tools.websearch import WebSearchTools
agent = Agent(
model=VLLM(
id="NousResearch/Nous-Hermes-2-Mistral-7B-DPO", top_k=20, enable_thinking=False
),
tools=[WebSearchTools()],
markdown=True,
)
asyncio.run(agent.aprint_response("Whats happening in France?", stream=True))
Set up your virtual environment
uv venv --python 3.12
source .venv/bin/activate
uv venv --python 3.12
.venv\Scripts\activate
Install Libraries
uv pip install -U agno ddgs openai vllm
Start vLLM server
vllm serve NousResearch/Nous-Hermes-2-Mistral-7B-DPO \
--enable-auto-tool-choice \
--tool-call-parser hermes \
--dtype float16 \
--max-model-len 8192 \
--gpu-memory-utilization 0.9
Set your API key
export VLLM_API_KEY=xxx
Run Agent
tool_use.py, then run:python tool_use.py
Was this page helpful?