Agent with Tools
Give a Groq agent web search and article extraction tools.
Attach WebSearchTools and Newspaper4kTools so the agent can research a topic and write it up.
Code
from agno.agent import Agent
from agno.models.groq import Groq
from agno.tools.newspaper4k import Newspaper4kTools
from agno.tools.websearch import WebSearchTools
agent = Agent(
model=Groq(id="openai/gpt-oss-120b"),
tools=[WebSearchTools(), Newspaper4kTools()],
description="You are a senior NYT researcher writing an article on a topic.",
instructions=[
"For a given topic, search for the top 5 links.",
"Then read each URL and extract the article text, if a URL isn't available, ignore it.",
"Analyse and prepare an NYT worthy article based on the information.",
],
markdown=True,
add_datetime_to_context=True,
)
agent.print_response("Simulation theory", stream=True)Usage
Set up your virtual environment
uv venv --python 3.12
source .venv/bin/activateSet your API key
export GROQ_API_KEY=xxxInstall dependencies
uv pip install -U groq ddgs newspaper4k lxml_html_clean agnoRun Agent
Save the code above as tool_use.py, then run:
python tool_use.py