Tool Use
Call web search from a SiliconFlow model with function-calling support.
Follow the current model-selection step below. The general capability statement in the preserved source does not establish that its model ID supports tools on your chosen endpoint.
"""Run `uv pip install duckduckgo-search` to install dependencies."""
from agno.agent import Agent
from agno.models.siliconflow import Siliconflow
from agno.tools.websearch import WebSearchTools
# ---------------------------------------------------------------------------
# Create Agent
# ---------------------------------------------------------------------------
"""
The current version of the siliconflow-chat model's Function Calling capability is stable and supports tool integration effectively.
"""
agent = Agent(
model=Siliconflow(id="openai/gpt-oss-120b"),
tools=[WebSearchTools()],
markdown=True,
)
agent.print_response("What happing in America?")
# ---------------------------------------------------------------------------
# Run Agent
# ---------------------------------------------------------------------------
if __name__ == "__main__":
passRun the Example
Set up your virtual environment
uv venv --python 3.12
source .venv/bin/activateInstall dependencies
uv pip install -U agno ddgs openaiExport your SiliconFlow API key
export SILICONFLOW_API_KEY="your_siliconflow_api_key_here"Select the SiliconFlow region and model
Use an API key from your global SiliconFlow account, matching the international endpoint. Add base_url="https://api.siliconflow.com/v1" to each Siliconflow(...) constructor in the saved file; the adapter default otherwise selects the .cn endpoint.
Replace the source model ID with a model enabled for your account and the example's required capabilities. For tool use, choose a currently supported function-calling model; for JSON output, check JSON mode support.
Run the example
Save the code above as tool_use.py, then run:
python tool_use.pyFull source: cookbook/90_models/siliconflow/tool_use.py