Tool Use: Integrating External Tools
Tool use in rtrvr.ai allows you to integrate with external tools and services, extending the functionality of the AI agent. Using the @
notation, you can embed tool calls directly in your prompts, seamlessly incorporating the results into your workflow. This allows you to automate complex tasks by leveraging APIs and other external functionalities.
Core Concepts
Tool use allows rtrvr.ai to invoke external tools to perform tasks or gather information, expanding its capabilities. Here are the core concepts:
- →The
@
Notation: Use the@
symbol followed by the tool name (e.g.,@queryDatabase()
,@sendSlackMessage()
). - →Direct Tool Calls: You can directly call pre-defined tools using this notation in your prompt.
- →LLM-Driven Calls: rtrvr.ai can also use the LLM to decide which tools to call and what parameters to pass based on your natural language request.
- →On the Fly Tool Generation: rtrvr.ai can dynamically create new tools by retrieving API keys from websites and immediately using them in your workflow.
- →Integration: The output of these tool calls is fed back into the AI model, allowing it to take actions or provide you with richer responses.
On the Fly Tool Generation
One of rtrvr.ai's most powerful features is the ability to create and use tools dynamically during a session. The AI agent can:
How It Works
- →Navigate to API documentation or developer pages
- →Retrieve API keys or credentials
- →Create a custom tool based on the API
- →Immediately use the tool in your workflow
Example: HubSpot Integration
Prompt: "Go to my HubSpot Developer Page, show and retrieve my API key, create a tool to upload contacts to HubSpot, and then find my most recent LinkedIn connections and upload them to HubSpot."
What happens:
- →rtrvr.ai navigates to your HubSpot Developer Page
- →Locates and retrieves your API key
- →Creates a custom
@uploadToHubSpot()
tool using the API documentation - →Navigates to LinkedIn to find your recent connections
- →Uses the newly created tool to upload the contacts to HubSpot
This powerful capability means you're not limited to pre-built integrations - rtrvr.ai can create custom tools for any service with an API!
Examples of Tool Use
Direct Tool Calls
- →
"Get the latest stock price for AAPL using @getStockPrice(symbol='AAPL')"
Calls thegetStockPrice
tool to fetch the real time stock price and integrates into the workflow. - →
"Query my database for sales data with @queryDatabase(query='SELECT * FROM sales WHERE date > last_month')"
Calls thequeryDatabase
tool to retrieve information from the database using given SQL query. - →
"Send a Slack message with summary of this page: @sendSlackMessage(channel='#general', message='summary')"
Calls thesendSlackMessage
tool to send the summary of the page to the given slack channel.
LLM-Driven Tool Calls
- →
"Send a Slack message with the summary of this page"
The LLM can decide to call the@sendSlackMessage()
tool and use page summary as context. - →
"Get today's weather for New York and send it to me on Slack"
The LLM can decide to use a@getWeather()
tool to get weather info, and@sendSlackMessage()
tool to share the weather to the user.
Dynamic Tool Creation Examples
- →
"Go to my Stripe dashboard, get my API key, and create a tool to list all my recent transactions"
Creates a custom Stripe tool and uses it to fetch transaction data. - →
"Navigate to my Airtable API docs, retrieve my credentials, create a tool to add records, then extract data from this webpage and add it to my Airtable base"
Dynamically creates an Airtable integration and uses it for data extraction and storage. - →
"Find the SendGrid API documentation, get my API key from my account, create an email sending tool, and send a summary of today's meetings to my team"
Creates a custom email tool and uses it to send meeting summaries.
How to Use Tools
Using Existing Tools
- →Identify the Tool: Decide which tool you need to use to perform your task.
- →Include in the Prompt: Include the tool call in your prompt using the
@
notation. - →Specify Parameters: If needed, provide the necessary parameters for the tool (e.g.,
@tool(param1='value1', param2='value2')
)
Creating Tools On the Fly
- →Describe Your Goal: Tell rtrvr.ai what you want to achieve with a specific service.
- →Provide Access: Ensure you're logged into the service or have credentials available.
- →Let rtrvr.ai Handle It: The agent will navigate to get API keys, understand the API, create the tool, and use it.
Best Practices for On the Fly Tool Generation
- →Be Specific: Clearly describe what you want the tool to do
- →Ensure Authentication: Make sure you're logged into the service before starting
- →Provide Context: If the API has specific requirements, mention them in your prompt
- →Test First: For complex integrations, test with a small dataset first
Advanced Use Cases
Multi-Service Workflows
"Go to my CRM, retrieve my API key, create a tool to fetch contacts. Then go to my email marketing platform, get that API key, create a tool to create campaigns. Finally, create a campaign for all contacts tagged as 'new leads'."
This creates multiple tools on the fly and chains them together for a complete workflow.
Data Synchronization
"Navigate to both my Notion and Google Sheets API pages, retrieve the necessary credentials, create tools for both, then sync my project data from Notion to a new Google Sheet."
Dynamically creates integration tools for multiple services and performs data synchronization.
Custom Analytics
"Go to my analytics dashboard, get the API key, create a tool to fetch visitor data, then combine it with the sales data from my Shopify store (get that API key too) and generate a conversion report."
Creates multiple analytical tools and combines data from different sources.