Welcome to Hatch Academy

Browse lessons below for video tutorials on everything from
setting up your account to building your AI agents.

4.3 - Decision Tree

How to Build Your AI Agent’s Decision Tree in Hatch

Your Decision Tree is the roadmap behind your AI agent’s conversations. It tells your agent what to say, when to say it, and how to handle every possible outcome. With a well-built decision tree, your AI can confidently guide leads, book appointments, and hand off to your team when needed.

Why the Decision Tree Matters

The decision tree acts as the guiding script for your AI agent. It ensures consistent, on-brand communication by defining:

  • The flow of the conversation
  • How the AI handles different responses or scenarios
  • When to hand off to your human team

Step 1: Choose and Assign Campaigns

  1. From your Hatch workspace, go to the Campaigns section.

  2. Select the campaign you want your AI agent to handle (e.g., Speed to Lead, Estimate Follow-Ups, Nurture, etc).

  3. Assign your AI agent to the chosen campaign.

Tip: Assigning campaigns ensures your agent only manages the right types of conversations, keeping interactions organized and efficient.

 

Step 2: Create Your Script

Each AI script includes four key sections:

  1. Persona – Defines who your AI is (tone, personality, communication style).

  2. Goal – Clarifies what the conversation is trying to achieve.

  3. Instructions – Outlines how your AI should guide the conversation.

  4. Additional considerations – Specifies any unique cases or exceptions.

Step 3: Generate Script Instructions Automatically

To make script creation fast and easy:

  1. Click the 💬 icon at the bottom-right of your screen.

  2. Select Generate Instructions.

  3. Type your prompt — for example:

    “Give me an AI agent script for a speed-to-lead campaign with the goal of engaging leads about their project request and getting them set up with a booked appointment.”


  4. Hatch will automatically generate a script template.

  5. Review, edit, and customize the template to fit your business and tone perfectly.

Step 4: Add Outcome Commands

Every AI script must include commands that tell your AI what to do when a conversation reaches an outcome.

The Three Required Commands:
  • Success: The conversation achieved its goal (e.g., appointment booked).

  • Bailout: A human CSR should take over (e.g., customer asks for a call or specific pricing).

  • Discard: The lead opted out or is no longer interested.

Examples:
  • If a customer requests a phone call → your AI can respond,
    “Someone from our team will reach out soon!” and then end the conversation with a bailout.

  • If a customer reports an emergency → use the same bailout command to ensure immediate human follow-up.

You decide which scenarios your AI handles automatically, and which should always go to your team.

Step 5: Use Commands to Reference  Knowledge Data

Commands also allow your AI to access stored knowledge and personalize conversations.

Here’s how:

  1. Type a backslash (\) inside your script.

  2. Choose a knowledge command from the dropdown.

  3. For example, to reference a customer’s first name:
    • Type \
    • Select KnowledgeCustomer DataFirst Name

  4. Click Save to apply changes.

This enables your AI to use existing customer data naturally—without asking for information you already have.

Step 6: Test Your Decision Tree

Before going live:

  1. Open your AI agent environment.

  2. Run test conversations to simulate real interactions.

  3. Observe how your AI responds and adjusts to different outcomes.

  4. Continue testing until it behaves exactly how you want.

Everything you add to your decision tree saves automatically, so you can safely test and refine in real time.

Step 7: Add Additional Considerations

Use this section to handle unique or edge-case scenarios, such as:

  • Handling urgent requests differently
  • Escalating messages based on keywords
  • Customizing responses by service type

You decide how much your AI should handle on its own versus when to hand things off to your human team.

You’re all set!

Your decision tree is now complete! It serves as the core logic of your AI agent—guiding conversations, managing outcomes, and personalizing responses through knowledge data.