docs: add CanvasReasonerActivity for auto-inferring workflow connections
This commit is contained in:
@@ -965,6 +965,80 @@ Response returned
|
|||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
### CanvasReasonerActivity
|
||||||
|
|
||||||
|
Auto-suggest workflow connections using LLM reasoning. When you drop new activities onto the canvas, this activity analyzes them and suggests logical connections based on input/output compatibility and workflow patterns.
|
||||||
|
|
||||||
|
**Workflow Definition:**
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"id": "canvas-reason-1",
|
||||||
|
"type": "canvas-reasoner",
|
||||||
|
"label": "Auto-Connect Activities",
|
||||||
|
"data": {
|
||||||
|
"nodes": "{{ workflow.nodes }}",
|
||||||
|
"edges": "{{ workflow.edges }}",
|
||||||
|
"preserve_existing": true,
|
||||||
|
"auth_token": "{{ user.jwt_token }}"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
**Use Cases:**
|
||||||
|
- New nodes added to canvas → automatically suggest connections
|
||||||
|
- Validate workflow design → LLM reasoning explains connections
|
||||||
|
- Redesign workflow → suggest optimal activity sequence
|
||||||
|
- Data flow analysis → ensure proper input/output matching
|
||||||
|
|
||||||
|
**How It Works:**
|
||||||
|
1. Analyzes all node types and their configurations
|
||||||
|
2. Reviews existing edges (if preserving)
|
||||||
|
3. Uses reasoning model to infer logical connections
|
||||||
|
4. Returns suggested edges with confidence score
|
||||||
|
5. Includes reasoning explanation
|
||||||
|
|
||||||
|
**Output Example:**
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"suggested_edges": [
|
||||||
|
{"source": "clone-1", "target": "analyze-1"},
|
||||||
|
{"source": "analyze-1", "target": "security-scan-1"},
|
||||||
|
{"source": "security-scan-1", "target": "report-1"}
|
||||||
|
],
|
||||||
|
"reasoning": "Clone repository first, analyze code, perform security scan, generate report. Standard code review workflow.",
|
||||||
|
"confidence": 0.92
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
**Fields:**
|
||||||
|
- `nodes` (required): Canvas nodes to analyze
|
||||||
|
- `edges` (required): Current edges
|
||||||
|
- `preserve_existing` (optional, default true): Keep existing edges and only suggest new ones
|
||||||
|
- `auth_token` (optional): JWT for LLM reasoning calls
|
||||||
|
|
||||||
|
**Confidence Scores:**
|
||||||
|
- 0.9-1.0: High confidence (common patterns)
|
||||||
|
- 0.7-0.9: Medium confidence (reasonable connections)
|
||||||
|
- 0.5-0.7: Low confidence (multiple valid approaches)
|
||||||
|
- <0.5: Unsure (manual review recommended)
|
||||||
|
|
||||||
|
**Integration Example:**
|
||||||
|
```
|
||||||
|
User drops 3 new nodes on canvas
|
||||||
|
↓
|
||||||
|
Workflow calls CanvasReasonerActivity
|
||||||
|
↓
|
||||||
|
LLM analyzes: Clone → Analyze → Report
|
||||||
|
↓
|
||||||
|
Returns edges + reasoning
|
||||||
|
↓
|
||||||
|
Frontend updates canvas with suggested connections
|
||||||
|
↓
|
||||||
|
User approves/rejects suggestions
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
### Error Handling
|
### Error Handling
|
||||||
|
|
||||||
If LLM inference fails:
|
If LLM inference fails:
|
||||||
|
|||||||
Reference in New Issue
Block a user