The chapter explains how the Agents SDK utilizes pre-built and custom tools, emphasizing the importance of clear documentation, structured input/output, and the use of JSON schema for precise parameter handling. It also introduces the concept of agents as tools, enabling multi-agent systems where agents can delegate tasks to specialized sub-agents, though this approach may increase token usage.
In this chapter of the Agents SDK course, the focus is on tools and how they are utilized within the framework. Tools in Agents SDK come in two main varieties: pre-built tools provided by OpenAI, such as web search, file search, and computer use tools, and custom tools that developers can define themselves. The pre-built tools require the use of OpenAI models and cannot be used with other providers. When creating an agent, tools are passed as a list of function tool objects, and it is recommended to use at least the mini model rather than the nano model for tool usage.
Custom tools are created using the function tool decorator, which converts a regular function into a tool that the language model (LM) can invoke. A key aspect of defining custom tools is providing a clear docstring that describes the tool’s purpose and instructions for the LM on when and how to use it. This description helps the LM understand the context and proper usage of the tool. Additionally, tools can have structured outputs defined via output classes, allowing the LM to return multiple pieces of information in a well-organized format, such as a response message and an explanation of the approach taken.
The course also covers how to define tools with input parameters using JSON schema. This allows developers to specify detailed descriptions for each parameter, indicate which parameters are required or optional, and validate inputs. This structured approach is particularly useful for more complex tools where precise input handling is necessary. The LM receives this schema information, enabling it to generate appropriate inputs when invoking the tool, improving the interaction’s accuracy and reliability.
A more advanced concept introduced is the use of agents as tools, where one agent can be provided as a tool to another agent. This enables multi-agent systems where a top-level orchestrator agent delegates tasks to specialized sub-agents, each with access to their own tools. Although the example given is simple—such as a multiply agent and a time-fetching agent—the approach can be extended to more complex workflows, like social media management or content generation. However, this method can be token-heavy due to the multiple layers of communication between agents.
In summary, this chapter provides a comprehensive overview of how to use both pre-built and custom tools within the Agents SDK, emphasizing the importance of clear documentation and structured input/output. It also introduces the concept of agents as tools to build multi-agent systems, highlighting both the potential and limitations of this approach. The knowledge gained here sets the foundation for creating more sophisticated and efficient agent-based applications in future chapters.