Agent with Tools
Give a local LlamaCpp agent WebSearchTools and print its response to a web-search query.
Code
"""Run `uv pip install ddgs` to install dependencies."""
from agno.agent import Agent
from agno.models.llama_cpp import LlamaCpp
from agno.tools.websearch import WebSearchTools
agent = Agent(
model=LlamaCpp(id="ggml-org/gpt-oss-20b-GGUF"),
tools=[WebSearchTools()],
markdown=True,
)
agent.print_response("Whats happening in France?")Usage
Set up your virtual environment
uv venv --python 3.12
source .venv/bin/activateStart the llama.cpp server
Follow the installation steps, then start the server:
In a dedicated terminal, start an installed llama.cpp server:
llama-server -hf ggml-org/gpt-oss-20b-GGUF --ctx-size 0 --jinja -ub 2048 -b 2048For a source build, run ./build/bin/llama-server from the llama.cpp directory with the same arguments. The command downloads and loads the GGUF model and serves http://127.0.0.1:8080/v1. Keep it running. Use a second terminal in your example directory, activate your Python environment there, and run the client steps below.
Install dependencies
uv pip install -U openai ddgs agnoRun Agent
Save the code above as tool_use.py, then run:
python tool_use.py