graph LR
Tool["Tool"]
FunctionTool["FunctionTool"]
function_tool["function_tool"]
FuncSchema["FuncSchema"]
function_schema["function_schema"]
Tool -- "is composed of" --> FunctionTool
FunctionTool -- "uses" --> FuncSchema
FunctionTool -- "is a type of" --> Tool
function_tool -- "calls" --> function_schema
function_tool -- "produces" --> FunctionTool
function_schema -- "produces" --> FuncSchema
FunctionTool -- "consumes" --> FuncSchema
The Tool Management subsystem is designed for the robust definition, creation, and schema management of external functionalities. The function_schema component is foundational, responsible for generating FuncSchema objects by analyzing Python functions. These FuncSchema objects are then utilized by FunctionTool to formally define its input parameters, ensuring type safety and clarity. The function_tool helper streamlines the developer experience by orchestrating the creation of FunctionTool instances, internally calling function_schema to handle the schema generation. Finally, all concrete tool implementations, such as FunctionTool, are unified under the Tool abstraction, providing a consistent and extensible interface for the broader AI agent orchestration framework. This structure ensures that tools are well-defined, easily creatable, and uniformly accessible to agents.
Serves as the abstract interface or union type for all supported tool implementations within the framework. It provides a unified way for agents to interact with diverse external functionalities.
Related Classes/Methods:
A concrete implementation of a tool that wraps a standard Python function, encapsulating its name, description, parameter schema, and asynchronous invocation logic. It's the primary mechanism for exposing Python functions as agent tools.
Related Classes/Methods:
A utility function (often used as a decorator) that simplifies the creation of FunctionTool instances. It automates the process of extracting metadata and generating the necessary schema from a given Python function.
Related Classes/Methods:
A data structure (dataclass) that holds the extracted and validated schema information for a Python function, including its name, description, and a Pydantic model representation of its parameters. This schema is crucial for tool introspection and validation.
Related Classes/Methods:
A core utility function responsible for analyzing a Python function's signature, type hints, and docstrings to automatically generate a FuncSchema object. It leverages Pydantic for robust and standardized schema creation.
Related Classes/Methods: