Skip to main content
Agents use tools to take actions and interact with external systems. Tools are functions that an Agent can run to achieve tasks. For example: searching the web, running SQL, sending an email or calling APIs. You can use any python function as a tool or use a pre-built toolkit. The general syntax is:

Using a Toolkit

Phidata 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 libraries
Run 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 a get_top_hackernews_stories tool to an Agent.
hn_agent.py
Read more about:

Attributes

The following attributes allow an Agent to use tools