Tutorial: Building Your First AI Agent β
2.3: Giving Your Agent Tools β
Your AI agent can now answer questions and reference your knowledge base. But what if it could DO thingsβsearch databases, send emails, create tickets? That's what tools are for!
What Are Tools? β
Think of it like this: Your AI agent is like a smart assistant with hands. Tools are what lets it actually take actions on your behalf.
π‘ What Tools Can Do
Tools let your agent:
- π Search databases - Find customer info, order status, product details
- π§ Send emails - Notify team members, follow up with customers
- π Create appointments - Schedule meetings automatically
- π« Create tickets - Log support requests in your system
- π Call APIs - Connect to any external service
Without tools, your agent can only TALK. With tools, it can ACT.
Example 1: Search Contacts Tool β
Scenario: A customer asks "Do you have my email address on file?"
Your agent needs to search your contacts database to answer. Let's set that up!
Step 1: Create a Contacts Table β
First, we need somewhere to store contacts. Let's create a second table:
- Click "+ Create New Table"
- Name it: "Contacts"
- Description: "Customer contact information"
- Click "Create Table"
Add some columns:
name(Text) - Customer nameemail(Text) - Email addressphone(Text) - Phone numbercompany(Text) - Company name
Add a few test contacts:
| Name | Phone | Company | |
|---|---|---|---|
| John Smith | john@example.com | 555-0100 | Acme Corp |
| Jane Doe | jane@techco.com | 555-0101 | TechCo |
| Bob Wilson | bob@startup.io | 555-0102 | Startup Inc |
| Name | Phone | Company | |
|---|---|---|---|
| John Smith | john@example.com | 555-0100 | Acme Corp |
| Jane Doe | jane@techco.com | 555-0101 | TechCo |
| Bob Wilson | bob@startup.io | 555-0102 | Startup Inc |
π‘ π‘ Real-World Use
In production, this table would be populated from your CRM, database, or imported from a CSV file. For now, manual entries work great for testing!
Step 2: Give Your Agent Access β
Now let's give your AI agent the ability to search this table:
- Go back to your "Customer Conversations" table
- Click on your "AI Answer" column header β "Configure"
- Scroll to "Tools" section
- Click "+ Add Tool"
- Select "Search Table"
Configure the tool:
- Tool Name:
search_contacts - Table to Search: Select "Contacts"
- Columns to Search: Select
name,email,company - Columns to Return: Select all columns
Configure Tool: Search Table
Set up how your AI searches data
Your AI will search the "Contacts" table when it needs to look up information.
AI will search these columns to find matching records
AI will receive these fields from matching records
Tool configured! π
Your AI can now search the Contacts table using the search_contacts tool.
Update your AI instructions:
Add this to your AI's instructions:
When a customer asks if you have their information on file,
use the search_contacts tool to look them up by email or name.Step 3: Test It! β
Let's see it in action:
- Go to your "Customer Conversations" table
- Click "+ Add Row"
- In the "Customer Question" field, type:
"Do you have john@example.com on file?"
Watch what happens:
AI Agent Using Tool in Real-Time
Watch the tool execution flow
Customer Question: "Do you have john@example.com on file?"
Status Updates:
AI reads the question
AI decides to use the search_contacts tool
Tool searches the Contacts table
Tool returns: "John Smith, john@example.com, 555-0100, Acme Corp"
AI generates response
π Your agent just used a tool! It searched your database and provided accurate information.
π‘ What Just Happened?
Your AI agent:
- Understood the question required looking up data
- Chose the right tool (
search_contacts) - Executed the search automatically
- Used the results to craft an informed response
This is way more powerful than just answering from knowledge!
Example 2: Send Email Tool β
Scenario: A customer requests a quote. Your agent should notify the sales team automatically.
Step 1: Add an Email Column β
Let's add a column that can send emails:
- In your "Customer Conversations" table
- Click "+ Add Column"
- Choose "Send Email" (find it under "Talk to Customers")
- Name it:
notify_sales - Label it: "Notify Sales Team"
Configure the email:
To:
sales@yourcompany.comSubject: "New Quote Request from [Customer Name]"
Body:
A customer has requested a quote: Question: [Their original message] AI Response: [What the AI said] Please follow up promptly!The system automatically fills in the customer's name, their question, and the AI's response!
Configure Send Email Column
Set up automated email notifications
Email sends after the AI has generated a response
Dynamic Placeholders Available:
β’ [Customer Name] - Customer's name
β’ [Their original message] - The customer question
β’ [What the AI said] - The AI's response
Email configured! π§
Emails will be sent automatically to sales@yourcompany.com when the AI generates a response.
Set Dependency:
- This column should run AFTER
ai_responseis filled - This ensures the AI has already responded before the email is sent
Step 2: Configure AI to Use the Tool β
Now teach your AI when to send emails:
- Edit your "AI Answer" column configuration
- Update the instructions:
You are a helpful customer service assistant.
When a customer asks for a quote or pricing information:
1. Provide a helpful initial response
2. Let them know the sales team will follow up shortly
Note: The system will automatically notify the sales team.Step 3: Test the Complete Flow β
Let's try it:
- Click "+ Add Row"
- Type in "Customer Question":
"I'd like a quote for your enterprise plan with 100 users"
Watch the magic:
Multi-Step Automation in Action
Watch the complete flow execute automatically
Customer Question: "I'd like a quote for your enterprise plan with 100 users"
AI Response Column
β³ WaitingNotify Sales Column
β³ WaitingWaiting for AI response to complete...
π‘ π― Full Automation Achieved!
Now you have a complete automated flow:
- Customer asks for quote
- AI responds helpfully
- Sales team gets notified automatically
- No manual work required!
This scales infinitelyβhandle 1 quote or 1,000 quotes with zero extra effort.
Common Tools You Can Add β
Search & Lookup
Search Tables
Find data in other tables
Lookup Order
Check order status
Find Customer
Retrieve customer info
Check Inventory
See product availability
Communication
Send Email
Notify team or customers
Send SMS
Text message notifications
Post to Slack
Alert team channels
Create Notification
In-app alerts
Data Creation
Create Row
Add data to tables
Create Ticket
Log support requests
Create Task
Add to to-do lists
Schedule Appointment
Book calendar slots
External Services
HTTP Request
Call any API
Run Custom Code
Execute JavaScript
Query Database
Direct database access
Call Webhook
Trigger external systems
Mix and match tools to create powerful workflows!
Combine multiple tools to automate complex processes. For example: search customer data, draft a personalized email, and send it automatically.
Best Practices for Tools β
1. Give Tools Clear Names β
Bad: tool1, helper, function
Good: search_contacts, notify_sales, create_support_ticket
Clear names help the AI understand when to use each tool.
2. Write Specific Instructions β
Tell your AI WHEN to use tools:
β "Use the search tool when needed"
β
"When a customer asks about their order, use search_orders
with their email address to find their order status"3. Test Each Tool Separately β
Before combining tools, test them individually:
- Test search tool works correctly
- Test email tool sends properly
- THEN combine them in workflows
4. Set Up Error Handling β
What if a tool fails? Configure fallback responses:
If search_contacts finds no results:
"I don't see that email in our system yet. Would you like to provide
your contact information so we can add you?"Real-World Tool Combinations β
Customer Support Agent β
search_tickets- Find past support issuessearch_orders- Look up order statuscreate_ticket- Log new issuesnotify_support_team- Alert team for urgent cases
Sales Assistant β
search_contacts- Find customer recordscheck_inventory- Verify product availabilitycalculate_quote- Price calculation toolnotify_sales- Send leads to sales team
Order Processing β
validate_address- Check shipping addresscheck_stock- Verify inventorycreate_shipment- Generate shipping labelsend_confirmation- Email customer
Understanding Tool Execution β
Here's what happens when your AI uses a tool:
Tool Execution Flow
What happens when your AI uses a tool
AI reads the message
Understands what the customer needs
AI decides which tool to use
Matches the need to available tools
AI prepares tool parameters
Extracts relevant data from the message
Tool executes
Searches the Contacts table
AI uses results
Incorporates the data into its response
This all happens automatically in seconds!
This all happens automatically in seconds!
When to Use Tools vs. Knowledge β
Use Knowledge Base for:
- β Answering policy questions
- β Explaining how things work
- β Providing instructions
- β Sharing information from documents
Use Tools for:
- β Looking up specific customer data
- β Checking real-time status
- β Taking actions (sending emails, creating records)
- β Searching structured data
Use Both Together: Your most powerful agents use knowledge for context and tools for actions!
What You've Learned β
By completing this section, you now know how to:
- β Add tools to your AI agent
- β Configure search tools to find data
- β Set up email tools for notifications
- β Combine tools for complete workflows
- β Write instructions that guide tool usage
- β Test and verify tool functionality
Your agent went from chatbot β action-taking assistant!
Try This Challenge β
Challenge: Create a support ticket tool
- Create a "Support Tickets" table
- Add a "Create Ticket" column in your conversations table
- Configure your AI to create a ticket when:
- Customer reports a problem
- Issue can't be resolved immediately
- Test it with: "I'm having trouble logging into my account"
Bonus: Add a notify_support_team email that sends when high-priority tickets are created!
Ready to make your agent's personality shine? Let's customize how it communicates!
Previous: Adding Knowledge
Continue to Section: Customizing Personality β