Lab4 Tools
Arize Agent Mastry Course: Tools
In this lab, we will explore the concept of tools, which are external functions or APIs that extend an agent’s capabilities beyond basic language understanding. Tools allow agents to access real-time information, perform calculations, query databases, and interact with specialized systems.
Dedicated tools are important because they enable agents to provide accurate, context-aware, and actionable responses instead of relying only on general reasoning. By connecting an agent to focused data sources or APIs, we can significantly improve the quality, relevance, and reliability of its outputs.
We will build on our existing agent from previous labs and focus on improving its tools. In particular, we will enhance their functionality with more targeted APIs to help the agent deliver stronger, more grounded answers.
Set up
Let's redefine the tools our agent uses
Instead of relying on a general search API, we can define dedicated API requests so that each tool delivers more precise and relevant results.
To enhance the performance of our essential_info tool, we’ll integrate specialized APIs: a weather API for real-time conditions and Wikipedia Search for accurate, up-to-date contextual information.
These functions are marked with decorators to ensure they are explicitly traced during the agent’s execution.
Define and Run Agent
We define and run the agent just as we did in the first lab. The key difference lies in the quality of the output, which improves thanks to the richer, more accurate information our tool can now retrieve.
View the trace in Arize! You can see the API calls nested under each tool span.
