Skip to main content

How to build your first AI agent in Retool

Overview

Build your first AI agent in Retool with this step-by-step guide. You'll create a meeting prep assistant while learning patterns that apply to any autonomous workflow.

AI agents represent a new approach to automation. They autonomously decide what actions to take, which tools to use, and when their work is complete. Unlike chatbots that only answer questions or workflows that follow fixed scripts, agents complete tasks end-to-end. This shift from AI assistance to AI action unlocks entirely new categories of automation.

Read along to learn how to build a meeting prep agent that researches upcoming meetings, gathers information about attendees, and sends briefings automatically. This practical example demonstrates the core patterns for building real-world AI agent systems.

What makes AI agents different from AI workflows

Retool offers three approaches to AI automation, each suited to different problems:

AI workflow example

AI workflows are workflows that use AI within a predefined process. For example, the first step in a workflow could monitor an email inbox for new messages while the second step uses an LLM to read the message and draft a response. The third step could alert the inbox owner to approve and send the message.

Agentic workflow example

Agentic workflows are workflows that let AI make control flow decisions at certain points, but you still define the overall structure. Consider a workflow that monitors an email inbox for new messages. When a message arrives, an LLM reads it and decides whether it's a billing question, a technical support issue, or a sales inquiry. Based on that decision, the workflow routes the message to the appropriate team. The LLM determines the path, but you've defined all three possible routes in advance.

AI agents example

AI agents autonomously make decisions. You give them a goal, and they decide which tools to use, in what order, and when the task is complete.

What are AI agents good at?

Agents excel at open-ended tasks where the path to completion isn't predetermined. For our meeting prep example, the agent needs to decide what information is relevant for each meeting, how deeply to research each attendee, and when it has gathered sufficient context. For a deeper comparison of workflows vs. agents, see our complete guide.

Building blocks of an AI agent

Now that you understand when to use agents, let's look at how they're constructed. Every Retool agent consists of four core components that work together to enable autonomous action

Instructions

Instructions define your agent's purpose and behavior. They tell the agent who it is, what it should do, and when to consider its work complete. Well-crafted instructions are imperative (using direct commands), specific about success criteria, and ordered by priority—earlier rules outrank later ones if there's a conflict.

Tools

Tools are the actions your agent can take—querying databases, calling APIs, searching the web, or sending emails. Unlike traditional automations where the builder defines what functions execute at each stage, agents decide which tools to use and when based on their instructions and the task at hand. This autonomous tool selection is what makes agents adaptable to varying situations.

Models

Model is the LLM that powers the agent's reasoning. Retool integrates with models from OpenAI, Anthropic, and other providers. Different models offer different trade-offs between reasoning capability, speed, and cost.

Triggers

Triggers determine how the agent is invoked—via chat interface for testing, email for automated processing, embedded in apps through the Agent Chat component, or programmatically through workflows (a schedule trigger that runs your agent every morning at 7 AM, for example).

Step-by-step: How to build a meeting prep agent

With these fundamentals in place, let's build a functional agent. We'll configure each component and see how they work together to create an autonomous system that researches meetings and delivers briefings without human intervention.

Step 1: Create your agent

Navigate to your Retool organization and select the Agents tab. Click + Agent, select Start from scratch, and click Create.

Name your agent Meeting Prep Assistant with the description Researches upcoming meetings and sends preparation briefings.

Learn page image

Step 2: Write clear behavioral instructions

In the Configuration tab's Instructions field, define your agent's behavior:

You are a meeting preparation assistant. Your job is to research upcoming meetings and provide comprehensive briefings.

When given a date or time range:

1. Retrieve upcoming meetings from the calendar

2. For each meeting with external attendees:

- Research each attendee and their company

- Look for recent news about their company

- Identify relevant background context

3. Compile findings into a structured briefing

4. Send the briefing to {{ current_user.email }}

Format your briefing email as follows:

Subject: Meeting Prep for [Date]

For each meeting:

**Meeting**: [Title]

**When**: [Time]

**Attendees**: [List]

**Key Context**:

- Background on attendees and their roles

- Recent company news or developments

- Relevant talking points

Keep summaries concise and actionable. If a meeting is internal-only (all attendees from the same domain), note it but skip detailed research.

Always send the final briefing to {{ current_user.email }}.
Learn page image

Best practices for writing agent instructions

  • Write imperatively with direct verbs ("Retrieve" not "You should try to retrieve")
  • Order rules by priority—earlier rules outrank later ones
  • Be specific about success criteria ("Consider the task complete when you have sent the briefing email")
  • Keep instructions under 1,000 tokens
  • Use embedded expressions like {{ current_user.email }} and {{ timezone }} for dynamic context

Step 3: Select your model, adjust Temperature, set Max iterations

In the Model dropdown, select your model of choice. For this tutorial, we’re choosing Claude 3.7 Sonnet.

You can adjust Temperature (0 = predictable, 1 = creative) and Max iterations (default 50 cycles) in Advanced settings. For most agents, default settings work well.

Step 4: Add tools

Click Add Tool and select these core tools for our example:

  • Get Calendar Events (connect your Google Calendar)
  • Search Web (for researching attendees)
  • Send Email (for delivering briefings)

Tools are how agents interact with the world. Without tools, agents can only reason—they can't take action. The power of agents comes from their ability to autonomously select which tools to use based on the situation. When you ask your meeting prep agent to research tomorrow's meetings, it determines that it needs to:

    1.
  1. Call Get Calendar Events to retrieve the meetings
  2. 2.
  3. For each meeting, call Search the Web to research attendees
  4. 3.
  5. Finally, call Send Email to deliver the briefing

You don't specify this sequence—the agent figures it out based on its instructions and the tools available.

Best practices for selecting agent tools

LLMs perform best with 1-10 tools. Too many tools cause confusion as the agent struggles to determine which tool is appropriate. If you find yourself adding dozens of tools, consider whether workflows or multiple agents might be better suited for parts of your process.

Core tools are prebuilt by Retool for common tasks like email, calendar access, and web search. All the tools we’re using in this tutorial are prebuilt.

Custom tools let you create functions that query your databases or call your APIs using Function Logic—you can use the Function Generator to build these by @mentioning your resources. Workflows and other agents can also serve as tools, enabling complex multi-agent systems where specialized agents handle specific subtasks.

For the Get Calendar Events tool, click to expand it and connect your Google Calendar resource. If you haven't connected Google Calendar yet, click Add new resource to authenticate.

Learn page image

Step 5: Deploy your agent

Click Deploy at the top of the Configuration tab. Select Major version, add a description like "Initial deployment", and click Deploy.

Deploying creates a versioned release of your agent's configuration. This versioning system lets you experiment safely—if a change degrades performance, you can always revert to a previous version from the version history dropdown.

Step 6: Test in chat

Select the Chats tab and message your agent with a request to prepare you for your meetings tomorrow:

Can you prepare a briefing for my meetings tomorrow?

You'll see:

  • Tool chips showing which tools were called
  • Thoughts displaying the agent's reasoning
  • Parameters and Results for each tool execution

The agent will retrieve your calendar events, research attendees, and send you a briefing email.

Learn page image

Troubleshooting errors with Logs

If something looks off or you encounter an error, check the Logs tab. It shows detailed execution steps including timestamps, tool calls, the agent's reasoning, and any errors to help you troubleshoot unexpected behavior.

Step 7: Iterate and improve

Based on testing, refine your agent to handle edge cases and improve reliability. You might discover that your agent needs more specific guidelines—like "Prioritize recent news from the last 30 days" or "Keep each attendee summary to 2-3 sentences maximum." These refinements come from observing how your agent behaves with real data.

Return to the Configuration tab to edit instructions, adjust tool configurations, or add new capabilities. If the core tools don't meet your needs, create custom tools using Function Logic to query your internal databases or call your company's APIs. Like a tool that pulls contact history from your CRM to give your agent richer context, for example.

After making changes, deploy a new version. Use Minor version for feature additions or significant instruction changes, Patch for bug fixes and small tweaks. Version history lets you revert if a change degrades performance—click the version dropdown next to your agent name to roll back.

How to make agents production-ready

Getting an agent working in chat is just the beginning. Production agents need reliable triggers, comprehensive monitoring, and systematic evaluation to ensure they perform consistently at scale.

Set automated invocation

While the chat interface is great for testing, production agents often benefit from automated triggers. Use the Invoke Agent block in Retool Workflows with a schedule trigger to run your agent automatically. For example, trigger your meeting prep agent every morning at 7 AM.

Monitor and evaluate

The Monitor page tracks token usage, costs, run success rates, and execution times. Click into specific runs to see the full execution path—every tool call, every reasoning step, and every decision point. This visibility is crucial for understanding agent behavior in production. Otherwise, analyzing agent performance is next to impossible.

Learn page image

The Evals tab lets you create test datasets and reviewers to systematically validate agent behavior. Build test cases with sample inputs and expected outputs, then run your agent against these cases to measure performance. You can use programmatic reviewers that check for specific strings or formats, or LLM-as-judge reviewers that evaluate whether outputs meet quality standards. Run evals before deploying changes to catch regressions early.

Compare agent versions side-by-side to see how instruction changes or tool modifications impact performance. This data-driven approach to agent development replaces guesswork with measurable improvement.

Security and permissions

Agents inherit Retool's permission system. They can only access tools you explicitly provide, and those tools respect your existing security policies by default. For sensitive operations, add human approval steps before execution.

Best practices for building AI agents in Retool

Building a functional agent is one thing—building one that performs reliably in production is another. These patterns will help you design agents that are maintainable, debuggable, and cost-effective.

Start focused

Build single-purpose agents rather than trying to handle everything at once. Specialized agents are easier to test, debug, and maintain.

Design tools carefully

Each tool should do exactly one thing. Use clear names and descriptions—the agent decides which tool to use based on these. Always use typed parameters.

Plan for failures

Include fallback policies in instructions. "If you can't find information, note that in the briefing rather than skipping the meeting."

Monitor costs

Agents consume tokens unpredictably. Track spending from day one and set max iteration limits to prevent runaway costs.

Test extensively

Chat with your agent constantly during development. Test edge cases, missing data scenarios, and failure modes before deploying.

What's next

You've built an agent that autonomously researches meetings and takes action across multiple systems. This same pattern—instructions, tools, reasoning, and execution—applies to countless business processes. The key is identifying repeatable tasks that require judgment, adaptation, and multi-step reasoning.

The infrastructure is ready. The tools exist. The question is: what repetitive, judgment-heavy work will you hand off to agents first?

Need an agent that finds meeting times on people’s calendars, makes sense of your data warehouse, or fights chargeback fraud? Whatever it is, start building today.