Playbooks are the heart of your agent’s conversational intelligence. They define how the agent responds to user inputs, what actions it can take, and how conversations flow from one topic to another.
A playbook is a structured set of instructions that guides the agent’s behavior in specific scenarios. Think of it as a conversational script with:
┌─────────────────────────────────┐
│ PLAYBOOK STRUCTURE │
├─────────────────────────────────┤
│ 1. Basic Information │
│ - Display Name │
│ - Goal Description │
├─────────────────────────────────┤
│ 2. Instructions │
│ - Hierarchical Steps │
│ - Conditional Logic │
│ - Tool/Playbook References │
├─────────────────────────────────┤
│ 3. Parameters │
│ - Input Parameters │
│ - Output Parameters │
├─────────────────────────────────┤
│ 4. References │
│ - Used Playbooks │
│ - Required Tools │
└─────────────────────────────────┘
Display Name
Goal
Example:
Goal: Guide customers through product discovery by understanding their
needs, showing relevant products, and helping them add items to cart.
Maintain a friendly, helpful tone while being efficient and accurate.
Instructions use markdown-style hierarchical lists to define conversation flow.
- Greet the user
- Ask what they're looking for
- If searching for products:
- Use ${TOOL:Natural Language Search Tool}
- Display results
- Ask if they want more details
- If checking order:
- Transfer to ${PLAYBOOK:Order Status Agent}
- Thank the user
Conditional Logic
- Understand user intent
- If product-related:
- Ask for specific preferences
- Search inventory
- If order-related:
- Get order number
- Check status
- If general question:
- Provide helpful information
- Offer to connect to support
Tool Integration
- Get user's search query
- Call ${TOOL:Product Search API} with query
- Process results:
- If products found:
- Display top 5 results
- Use ${TOOL:Render Product Card Tool}
- If no products:
- Apologize
- Suggest alternatives
Multi-step Flows
- Step 1: Collect Information
- Get user name
- Get email address
- Confirm contact details
- Step 2: Process Request
- Validate information
- Create support ticket
- Send confirmation
- Step 3: Follow Up
- Provide ticket number
- Explain next steps
- Offer additional help
Define data the playbook expects to receive:
Parameter | Type | Description | Example |
---|---|---|---|
firstName | string | Customer’s first name | “John” |
Customer’s email | “john@example.com” | ||
orderId | string | Order number | “ORD-12345” |
searchQuery | string | Product search terms | “blue running shoes” |
Define data the playbook will return:
Parameter | Type | Description | Example |
---|---|---|---|
productIds | array | Selected product IDs | [“P123”, “P456”] |
nextAction | string | Recommended next step | “checkout” |
satisfaction | number | User satisfaction score | 8.5 |
The playbook list provides comprehensive management capabilities:
One playbook must be designated as the “start” playbook:
Token count indicates playbook complexity:
Tips for optimization:
Tool References
${TOOL:toolName}
Playbook References
${PLAYBOOK:playbookName}
When transferring between playbooks:
Built-in error handling patterns:
- Try to process request
- If successful:
- Continue with next step
- If error:
- Apologize to user
- Offer alternatives
- Log error for review
Single Responsibility
Clear Naming
Modular Structure
Be Specific
User-Centric
Maintainable
Comprehensive Testing
Real-World Scenarios
Iterative Improvement
- Greet user warmly
- Introduce yourself and capabilities
- Ask how you can help
- Route to appropriate playbook based on response
- Understand search intent
- Gather requirements
- Execute search
- Present results
- Offer refinement options
- Confirm user intent
- Collect required information
- Validate data
- Process transaction
- Provide confirmation
- Understand issue
- Gather relevant details
- Attempt resolution
- Escalate if needed
- Follow up