Skip to content

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:

  1. Click "+ Create New Table"
  2. Name it: "Contacts"
  3. Description: "Customer contact information"
  4. Click "Create Table"

Add some columns:

  • name (Text) - Customer name
  • email (Text) - Email address
  • phone (Text) - Phone number
  • company (Text) - Company name

Add a few test contacts:

NameEmailPhoneCompany
John Smithjohn@example.com555-0100Acme Corp
Jane Doejane@techco.com555-0101TechCo
Bob Wilsonbob@startup.io555-0102Startup Inc
NameEmailPhoneCompany
John Smithjohn@example.com555-0100Acme Corp
Jane Doejane@techco.com555-0101TechCo
Bob Wilsonbob@startup.io555-0102Startup 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:

  1. Go back to your "Customer Conversations" table
  2. Click on your "AI Answer" column header β†’ "Configure"
  3. Scroll to "Tools" section
  4. Click "+ Add Tool"
  5. 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

A clear name your AI will use to call this tool

Your AI will search the "Contacts" table when it needs to look up information.

name
email
company

AI will search these columns to find matching records

name
email
phone
company

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:

  1. Go to your "Customer Conversations" table
  2. Click "+ Add Row"
  3. 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:

1
πŸ€”

AI reads the question

βœ“
2
πŸ”

AI decides to use the search_contacts tool

...
3
⚑

Tool searches the Contacts table

...
4
βœ…

Tool returns: "John Smith, john@example.com, 555-0100, Acme Corp"

...
5
πŸ’¬

AI generates response

...

πŸŽ‰ Your agent just used a tool! It searched your database and provided accurate information.

πŸ’‘ What Just Happened?

Your AI agent:

  1. Understood the question required looking up data
  2. Chose the right tool (search_contacts)
  3. Executed the search automatically
  4. 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:

  1. In your "Customer Conversations" table
  2. Click "+ Add Column"
  3. Choose "Send Email" (find it under "Talk to Customers")
  4. Name it: notify_sales
  5. Label it: "Notify Sales Team"

Configure the email:

  • To: sales@yourcompany.com

  • Subject: "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!

Set Dependency:

  • This column should run AFTER ai_response is 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:

  1. Edit your "AI Answer" column configuration
  2. 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:

  1. Click "+ Add Row"
  2. 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"

1

AI Response Column

⏳ Waiting
2

Notify Sales Column

⏳ Waiting

Waiting for AI response to complete...

πŸ’‘ 🎯 Full Automation Achieved!

Now you have a complete automated flow:

  1. Customer asks for quote
  2. AI responds helpfully
  3. Sales team gets notified automatically
  4. 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:

  1. Test search tool works correctly
  2. Test email tool sends properly
  3. 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 issues
  • search_orders - Look up order status
  • create_ticket - Log new issues
  • notify_support_team - Alert team for urgent cases

Sales Assistant ​

  • search_contacts - Find customer records
  • check_inventory - Verify product availability
  • calculate_quote - Price calculation tool
  • notify_sales - Send leads to sales team

Order Processing ​

  • validate_address - Check shipping address
  • check_stock - Verify inventory
  • create_shipment - Generate shipping label
  • send_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

πŸ€”
1

AI reads the message

Understands what the customer needs

🧠
2

AI decides which tool to use

Matches the need to available tools

"They want to know if we have their email β†’ use search_contacts"
πŸ”§
3

AI prepares tool parameters

Extracts relevant data from the message

Pulls "john@example.com" from the question
⚑
4

Tool executes

Searches the Contacts table

Returns results
πŸ’¬
5

AI uses results

Incorporates the data into its response

"Yes, I found John Smith with that email..."

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

  1. Create a "Support Tickets" table
  2. Add a "Create Ticket" column in your conversations table
  3. Configure your AI to create a ticket when:
    • Customer reports a problem
    • Issue can't be resolved immediately
  4. 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 β†’

Built with VitePress