Agent step
Overview
The Agent step is Voiceflow's most powerful tool for creating intelligent, conversational AI agents. This guide will walk you through how to use this feature to build agents that can handle complex interactions, access knowledge base, follow customized paths, and execute functions—all within a single step.
Introduction to the Agent step
The Agent step provides a comprehensive solution for creating AI agents that can:
- Intelligently respond to user queries
- Search knowledge base for relevant information
- Follow specific conversation paths based on user intent
- Execute functions to interact with external services
To add an Agent step to your canvas:
- Look for the "Agent" option in the top left corner of the Voiceflow canvas
- Drag this step onto your canvas
- Choose an existing agent, create a new agent or search for community-created agents
Prompting Your Agent
Effective prompting is the foundation of a successful agent. The instructions you provide serve as the agent's "brain" and determine how it will interact with users:
- Clear Directives: Be specific about your agent's role and how it should respond in different scenarios
- Personality Design: Define your agent's tone, level of formality, and communication style
- Knowledge Parameters: Indicate what domain knowledge your agent should rely on and when it should search external resources
- Context Awareness: Include instructions for handling sensitive topics or escalating to human support when necessary
Learn more about crafting great prompts here
Good prompting helps your agent understand what information to prioritize, when to use the knowledge base, and how to respond to user queries in a consistent manner. Taking time to craft detailed, thoughtful instructions will dramatically improve your agent's performance and reduce the need for additional steps in your flow.
For example, instead of simply saying "This is a support agent," you might specify: "You are a friendly e-commerce support agent that helps customers with order tracking, returns, and account issues. Maintain a positive tone, offer proactive suggestions, and provide specific details when available."
Functions
Functions allow your agent to connect with external services and retrieve or update data. Based on the UI screenshot, configuring a function in an Agent Step involves several important components:
Function Configuration:
- Select Function: Choose from available functions in the dropdown menu
- LLM Description: This is critical - you need to tell the LLM when and how to use this function
Function Description:
The LLM Description
field is where you provide detailed instructions that help the LLM understand:
- When to call this function
- What the function does
- What information is needed to use it
For example, for an order lookup function:
LLM Description: "Use this function to retrieve a customer's order details from Shopify when they ask about their order status, delivery date, shipping address, or tracking information. This function requires a valid order ID to proceed. Only call this function when the customer explicitly mentions needing information about a specific order they've placed."
Input Variable Configuration:
For each input variable your function requires:
- Variable Name: Set a clear, descriptive name (shown as "orderID" in the UI example)
- Variable Description: Explain what this variable represents and how to collect it
- Default Value: Optionally provide a default value
Variable Description:
The description for each input variable helps the LLM understand:
- What information to collect
- How to validate it
- When to request it from the user
For example, for an Order ID variable:
LLM Variable Description: "This variable should contain the customer's order ID. Valid order IDs are 10-digit numbers that start with 'ORD-'. If the customer doesn't provide their order ID initially, ask them for it. If they don't know their order ID, ask if they have a confirmation email where they can find it."
Default Value: You can optionally set a default value, but for user-specific information like order IDs, this field is typically left empty.
Function Examples:
Order Lookup Function
Function Name: Get Order by ID
LLM Description: "Use this function to retrieve a customer's order details from Shopify when they ask about their order status, delivery date, shipping address, or tracking information. The function requires a valid order ID to proceed."Input Variable Name: orderID
LLM Variable Description: "The customer's order ID. This should be a 10-digit number that starts with 'ORD-'. Ask the customer to provide this number if they haven't already."
Inventory Check Function
Function Name: Check Product Availability
LLM Description: "Use this function when a customer asks if a product is in stock, available in a specific size or color, or when it might be back in stock. This function requires a product ID or SKU number to check availability."Input Variable Name: productSKU
LLM Variable Description: "The SKU or product ID of the item the customer is inquiring about. Valid SKUs are alphanumeric codes that typically start with 'P-' followed by numbers. If the customer mentions a product name but not the SKU, ask them for more specific information about which product they're interested in."
Paths
Paths allow your agent to handle specific conversation flows and take appropriate actions:
- Automatic Routing: The agent detects user intent and automatically routes to the appropriate path
- Variable Collection: You can require specific data to be collected before entering a path
- Seamless Integration: Paths work within natural conversation, without requiring specific commands
To create a path:
- Open your Agent step editor
- Add a new path with a descriptive name
- Define a description that explains when this path should be triggered
- Optionally add required variables that must be collected
- Connect the path to subsequent steps in your flow
Path Examples:
Order Return Path
Path Name: Process Order Return
LLM Description: "Trigger this path when the user wants to return an item they purchased, expresses dissatisfaction with their order, mentions that an item is defective, or asks about the return policy. The user might use phrases like 'I want to return', 'how do I send this back', 'my product is broken', or 'does this have a warranty'."Required Variable: orderID
LLM Variable Description: "This variable should contain the order ID that the customer wants to return. Valid order IDs are 10-digit numbers. If the user doesn't provide their order ID initially, ask them for it. Make sure to verify that the provided ID matches the expected format before proceeding with the return pr
This description helps the LLM understand exactly when to trigger the return process. It includes both direct mentions of returns and indirect signals of return intent, providing a comprehensive set of triggers for the path. The variable description ensures the agent knows how to collect and validate the required information before proceeding.
Promo Code Path
Path Name: Get a Promo Code
Description: "Trigger this path when the user asks for a promo code or a discount, or says things are too expensive. Look for phrases like 'do you have any discounts', 'that's too much money', 'any coupon codes', or 'how can I save on my order'."Required Variable: email
Variable Description: "The user's email address where we'll send promotional materials. Only accept inputs that follow a valid email format (contains @ symbol and appropriate domain extension). If the user is hesitant, explain that we need their email to deliver the promo code and track usage. Do not proceed with providing the discount code until a valid email is collected."
This description helps the LLM recognize when a user is seeking a discount, either directly or indirectly. The required variable description provides clear guidance on what constitutes a valid email address and how to handle user hesitation, ensuring you collect quality customer data before providing them with the promotional code.
Knowledge Base
When you enable knowledge base integration, your agent can automatically search for information it doesn't know:
- Automatic Queries: Your agent will search the knowledge base without requiring a separate search step
- Contextual Responses: The agent intelligently combines its built-in knowledge with information from your knowledge base
- Knowledge Weighting: You can adjust how much the agent relies on its built-in knowledge versus your knowledge base through the instructions
For example, if a user asks about a password reset but that information isn't in your knowledge base, the agent can provide general guidance. But when asked about email confirmation—which is in your knowledge base—it can provide specific, accurate information from your documentation.
The UI shows a toggle for "Access to knowledge base" which you can enable to give your agent the ability to search your knowledge base when needed, with option to update LLM description for more custom prompting.
Advanced Usage
For even more powerful implementations:
- Multiple Agent steps: Chain several Agent steps together for complex workflows
- Custom Functions: Develop your own functions to connect with any service your business uses
- Prompt Refinement: Continuously refine your agent's instructions based on conversation logs and user feedback
Updated 5 days ago