Skip to content

Commit 38e827b

Browse files
fix(docs): new router (#2755)
* fix(docs): new router * update image
1 parent 1f5e8a4 commit 38e827b

File tree

2 files changed

+34
-21
lines changed

2 files changed

+34
-21
lines changed

apps/docs/content/docs/en/blocks/router.mdx

Lines changed: 34 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@ import { Callout } from 'fumadocs-ui/components/callout'
66
import { Tab, Tabs } from 'fumadocs-ui/components/tabs'
77
import { Image } from '@/components/ui/image'
88

9-
The Router block uses AI to intelligently route workflows based on content analysis. Unlike Condition blocks that use simple rules, Routers understand context and intent.
9+
The Router block uses AI to intelligently route workflows based on content analysis. Unlike Condition blocks that use simple rules, Routers understand context and intent. Each route you define creates a separate output port, allowing you to connect different paths to different downstream blocks.
1010

1111
<div className="flex justify-center">
1212
<Image
1313
src="/static/blocks/router.png"
14-
alt="Router Block with Multiple Paths"
14+
alt="Router Block with Multiple Route Ports"
1515
width={500}
1616
height={400}
1717
className="my-6"
@@ -32,21 +32,23 @@ The Router block uses AI to intelligently route workflows based on content analy
3232

3333
## Configuration Options
3434

35-
### Content/Prompt
35+
### Context
3636

37-
The content or prompt that the Router will analyze to make routing decisions. This can be:
37+
The context that the Router will analyze to make routing decisions. This is the input data that gets evaluated against your route descriptions. It can be:
3838

3939
- A direct user query or input
4040
- Output from a previous block
4141
- A system-generated message
42+
- Any text content that needs intelligent routing
4243

43-
### Target Blocks
44+
### Routes
4445

45-
The possible destination blocks that the Router can select from. The Router will automatically detect connected blocks, but you can also:
46+
Define the possible paths that the Router can take. Each route consists of:
4647

47-
- Customize the descriptions of target blocks to improve routing accuracy
48-
- Specify routing criteria for each target block
49-
- Exclude certain blocks from being considered as routing targets
48+
- **Route Title**: A name for the route (e.g., "Sales", "Support", "Technical")
49+
- **Route Description**: A clear description of when this route should be selected (e.g., "Route here when the query is about pricing, purchasing, or sales inquiries")
50+
51+
Each route you add creates a **separate output port** on the Router block. Connect each port to the appropriate downstream block for that route.
5052

5153
### Model Selection
5254

@@ -66,35 +68,46 @@ Your API key for the selected LLM provider. This is securely stored and used for
6668

6769
## Outputs
6870

69-
- **`<router.prompt>`**: Summary of the routing prompt
70-
- **`<router.selected_path>`**: Chosen destination block
71+
- **`<router.context>`**: The context that was analyzed
72+
- **`<router.selectedRoute>`**: The ID of the selected route
73+
- **`<router.selected_path>`**: Details of the chosen destination block
7174
- **`<router.tokens>`**: Token usage statistics
7275
- **`<router.cost>`**: Estimated routing cost
7376
- **`<router.model>`**: Model used for decision-making
7477

7578
## Example Use Cases
7679

7780
**Customer Support Triage** - Route tickets to specialized departments
81+
7882
```
79-
Input (Ticket) → Router → Agent (Engineering) or Agent (Finance)
83+
Input (Ticket) → Router
84+
├── [Sales Route] → Agent (Sales Team)
85+
├── [Technical Route] → Agent (Engineering)
86+
└── [Billing Route] → Agent (Finance)
8087
```
8188

8289
**Content Classification** - Classify and route user-generated content
90+
8391
```
84-
Input (Feedback) → Router → Workflow (Product) or Workflow (Technical)
92+
Input (Feedback) → Router
93+
├── [Product Feedback] → Workflow (Product Team)
94+
└── [Bug Report] → Workflow (Technical Team)
8595
```
8696

8797
**Lead Qualification** - Route leads based on qualification criteria
98+
8899
```
89-
Input (Lead) → Router → Agent (Enterprise Sales) or Workflow (Self-serve)
100+
Input (Lead) → Router
101+
├── [Enterprise] → Agent (Enterprise Sales)
102+
└── [Self-serve] → Workflow (Automated Onboarding)
90103
```
91104

92-
93105
## Best Practices
94106

95-
- **Provide clear target descriptions**: Help the Router understand when to select each destination with specific, detailed descriptions
96-
- **Use specific routing criteria**: Define clear conditions and examples for each path to improve accuracy
97-
- **Implement fallback paths**: Connect a default destination for when no specific path is appropriate
98-
- **Test with diverse inputs**: Ensure the Router handles various input types, edge cases, and unexpected content
99-
- **Monitor routing performance**: Review routing decisions regularly and refine criteria based on actual usage patterns
100-
- **Choose appropriate models**: Use models with strong reasoning capabilities for complex routing decisions
107+
- **Write clear route descriptions**: Each route description should clearly explain when that route should be selected. Be specific about the criteria.
108+
- **Make routes mutually exclusive**: When possible, ensure route descriptions don't overlap to prevent ambiguous routing decisions.
109+
- **Include an error/fallback route**: Add a catch-all route for unexpected inputs that don't match other routes.
110+
- **Use descriptive route titles**: Route titles appear in the workflow canvas, so make them meaningful for readability.
111+
- **Test with diverse inputs**: Ensure the Router handles various input types, edge cases, and unexpected content.
112+
- **Monitor routing performance**: Review routing decisions regularly and refine route descriptions based on actual usage patterns.
113+
- **Choose appropriate models**: Use models with strong reasoning capabilities for complex routing decisions.
-22.8 KB
Loading

0 commit comments

Comments
 (0)