Building and Controlling Conversation Flow for Your Assistants

Blocks is being deprecated in favor of Workflows. We recommend using Workflows for all new development as it provides a more powerful and flexible way to structure conversational AI. We’re working on migration tools to help transition existing Blocks implementations to Workflows.

Steps are the core building blocks that dictate how conversations progress in a bot interaction. Each Step represents a distinct point in the conversation where the bot performs an action, gathers information, or decides where to go next. Think of Steps as checkpoints in a conversation that guide the flow, manage user inputs, and determine outcomes.

Features

  • Output: The data or response expected from the step, as outlined in the block’s outputSchema.
  • Input: The data necessary for the step to execute, defined in the block’s inputSchema.
  • Destinations: This can be determined by a simple linear progression or based on specific criteria, like conditions or rules set within the Step. This enables dynamic decision-making, allowing the assistant to choose the next Step depending on what happens during the conversation (e.g., user input, a specific value, or a condition being met).

Example

1 {
2 "type": "handoff",
3 "name": "get_user_order",
4 "input": {
5 "name": "John Doe",
6 "email": "[email protected]"
7 },
8 "destinations": [
9 {
10 "type": "step",
11 "stepName": "confirm_order",
12 "conditions": [
13 {
14 "type": "model-based",
15 "instruction": "If the user has provided an order"
16 }
17 ]
18 }
19 ],
20 "block": {
21 "name": "ask_for_order",
22 "type": "conversation",
23 "inputSchema": {
24 "type": "object",
25 "required": ["name", "email"],
26 "properties": {
27 "name": { "type": "string", "description": "The customer's name" },
28 "email": { "type": "string", "description": "The customer's email" }
29 }
30 },
31 "instruction": "Greet the customer and ask for their name and email. Then ask them what they'd like to order.",
32 "outputSchema": {
33 "type": "object",
34 "required": ["orders", "name"],
35 "properties": {
36 "orders": {
37 "type": "string",
38 "description": "The customer's order, e.g., 'burger with fries'"
39 },
40 "name": {
41 "type": "string",
42 "description": "The customer's name"
43 }
44 }
45 }
46 }
47}
Built with