Using a Toolkit
Agno provides many pre-built toolkits that you can add to your Agents. For example, let’s use the DuckDuckGo toolkit to search the web.You can find more toolkits in the Toolkits guide.
1
Create Web Search Agent
Create a file
web_search.py
web_search.py
2
Run the agent
Install librariesRun the agent
Writing your own Tools
For more control, write your own python functions and add them as tools to an Agent. For example, here’s how to add aget_top_hackernews_stories
tool to an Agent.
hn_agent.py
Attributes
The following attributes allow anAgent
to use tools
Parameter | Type | Default | Description |
---|---|---|---|
tools | List[Union[Tool, Toolkit, Callable, Dict, Function]] | - | A list of tools provided to the Model. Tools are functions the model may generate JSON inputs for. |
show_tool_calls | bool | False | Print the signature of the tool calls in the Model response. |
tool_call_limit | int | - | Maximum number of tool calls allowed for a single run. |
tool_choice | Union[str, Dict[str, Any]] | - | Controls which (if any) tool is called by the model. “none” means the model will not call a tool and instead generates a message. “auto” means the model can pick between generating a message or calling a tool. Specifying a particular function via {"type": "function", "function": {"name": "my_function"}} forces the model to call that tool. “none” is the default when no tools are present. “auto” is the default if tools are present. |
read_chat_history | bool | False | Add a tool that allows the Model to read the chat history. |
search_knowledge | bool | False | Add a tool that allows the Model to search the knowledge base (aka Agentic RAG). |
update_knowledge | bool | False | Add a tool that allows the Model to update the knowledge base. |
read_tool_call_history | bool | False | Add a tool that allows the Model to get the tool call history. |
Developer Resources
- View Cookbook