Tools
Tools enable tambo to interact with your application's apis, agents, and other server-side functionality.
Tools enable tambo to interact with your application's data and functionality. They provide a type-safe way to extend the AI's capabilities with custom business logic. Tambo will call these tools and use their outputs to help decide how to respond to a message, what component to show, and what data to fill the component with.
To make use of tools, we will:
- Add tools by defining them and registering them with tambo
- Associate tools with components, so tambo know which tools to focus on when using a given component
Adding a Tool
Registering a Tool using React Hooks:
Associating Tools with Components
Once tambo has decided on a component to use in response to a message, it will use the registered tools if it has decided that extra external data is needed to fill the component properly. To tell tambo which tools to consider for a given component, we need to associate the tools with the component. A tool can be associated with multiple components.
During component definition:
If you already have the tool functionality defined when you register your components, you can pass the tool directly to the component definition.
Using React Hooks:
If you define your tool functionality sometime after registering your components, you can use the addToolAssociation
hook to associate the tool with the component.