Legend
Legend (/legend) chains agents and tools in a DAG (directed acyclic graph) for multi-step automation. This guide covers building, tools and approval, execution and observability.
flowchart LR
A[Trigger] --> B[Agent]
B --> C{Condition}
C -->|true| D[HTTP / Lore]
C -->|false| E[Agent]
D --> F[End]
E --> F
Overview
| Single agent | Legend workflow |
|---|---|
| One input → one output | Multiple steps, branches and validation |
| Chat with authorized tools | Agentic tool use with toolsets per node |
| Conversation context | Data between steps using {{node_id.output}} |
Execution
With USE_TEMPORAL, workflows without approval or condition nodes run durably. Others execute in-process. Both paths save node results; see AI orchestration.
Build a DAG
- Use New, or Templates (Starter workflow, Support triage, Content pipeline).
- Click or drag palette nodes onto the canvas.
- Drag an output port to another node's input port.
- Select a node and configure it in NODE INSPECTOR.
- Save; every save creates a revision.
| Node | Source | Behavior |
|---|---|---|
| Trigger | Flow palette | Single entry; passes initial input |
| Agent | Flow palette | Runs a saved agent or inline prompt; LLM PROVIDER (Claude/Gemini), MODEL TIER, MCP TOOLSETS, Require approval |
| Condition | Logic palette | Activates the true or false branch |
| Check | Logic palette | Stops with an error if validation rules fail |
| HTTP | Integration palette | GET/POST/PUT with SSRF protection; first 256 KB of response |
| Code | Integration palette | One sandboxed expression using input, vars; no scripts or loops |
| Lore | Integration palette | Search by LORE SLUG, TOP-K, pass results onward |
| Prompt | Template/import | Inline LLM node without a library agent |
| Mission | Import/API | Output a saved mission prompt |
| Guild | Import/API | Chain pooled agents in join order |
| End | Template/bridge/import | Workflow output |
Structure rules
Exactly one start, at least one End, maximum 20 nodes and 30 edges, no cycles. There is no End in the palette; use a template, Guild Master bridge or import. An Agent node needs a saved-agent binding; Guild Master-created flows include it.
Condition — IF/ELSE branching
Conditions provide deterministic decisions rather than relying on an LLM prompt.
flowchart LR
A[Research agent] --> C{Condition}
C -->|true| B[Write report]
C -->|false| D[Report error]
B --> E[End]
D --> E
| Field | Operator | Value | Meaning |
|---|---|---|---|
input |
contains |
error |
Previous output contains “error” |
input |
not_empty |
(empty) | Output is not empty |
{{researcher.output}} |
equals |
yes |
Research output equals “yes” |
- Operators:
contains,not_contains,equals,not_equals,not_empty,is_empty, case-insensitive. - Multiple rules use AND; no rules means false.
- Select outgoing edges and set LABEL to
trueorfalse. - The unselected branch is skipped.
- Check uses the same rules but stops the run instead of branching.
Variable templates
Agent/prompt nodes reference earlier output with {{node_id.output}} or {{node_id}}:
node_id is the referenced node ID. This syntax also works in HTTP URLs/bodies, Lore queries and condition fields. JSON-body values are escaped. Text without {{ remains unchanged.
Canvas edge interactions
Draw: drag output to input; nearby ports snap. Esc cancels.
Select: click near an edge to open CONNECTION, set LABEL, Add condition, or Delete connection.
Delete: Delete or Backspace removes the selected node or edge.
View: mouse wheel, pinch, +/−, Fit to canvas. The toolbar includes grid visibility, snapping and layers. Undo / Redo restores or reapplies recent changes.
Tools, permissions and approval
MCP TOOLSETS: attach one or more OpenAPI, native MCP or Lore toolsets to a Claude Agent node. The model calls tools and reads results, up to five rounds per node; then it produces a final answer without more tools.
flowchart LR
M[Model] -->|call| T[Toolset tool]
T -->|result| M
M -->|enough information| O[Output]
Agent-specific permissions
Agent nodes use only granted toolsets and platform defaults. Configure TOOLS / PERMISSIONS in Card Editor. Unbound Prompt nodes use toolsets visible to the wallet. Calls follow each toolset's own quota.
Require approval (HITL) pauses at the node with Awaiting. In Observability, Approve & continue resumes or Reject fails the run. Waiting does not deduct credits. Approval workflows execute in-process.
Lore context: relevant knowledge from a bound agent's Lore is added before its node runs; see Lore.
Execute
- Choose Execute; the workflow is saved first.
- Enter initial input in the dialog.
- Observability opens; the run also appears in Tale.
The toolbar displays an estimated credit cost.
Credits
Balance is checked before starting. Credits are deducted only on successful completion, not for a failed run.
| Node | Cost |
|---|---|
| Claude Agent/Prompt | Haiku 1 ⚡ · Sonnet 3 ⚡ · Opus 10 ⚡ |
| Gemini Agent/Prompt | 1 ⚡ |
| Guild | 1 ⚡ per pooled agent |
| Lore | 1 ⚡ |
Execution is limited to 20 requests per minute per wallet. See Credits.
Import, publish and versions
Import: paste n8n, Flowise or Langflow JSON, or upload a .json file up to 2 MB. Analyze previews mappings. Unmapped nodes become Unsupported placeholders that pass input through and can be manually connected. Dify import is available through the API.
Publish: provide a name/description and select Public to list in Discover → Workflows; Private removes it.
Versions: Version history opens snapshots; Compare versions shows structural differences.
Observability
/legend/observability/:id shows each node's execution. The header includes workflow, run ID and status; counters show Duration, Credits spent, Steps done. TIMELINE lists DONE/FAILED, duration and output/error per node. Approval nodes show Approve & continue / Reject.
flowchart LR
A[Node 1: done] --> B[Node 2: done]
B --> C[Node 3: failed]
C -. resume .-> C2[Retry node 3]
Resume after failure
A failed run can resume using saved completed-node outputs instead of restarting, up to three times per run. This is API-only: POST /api/v1/user/legend/executions/:execId/resume.
Next step
Connect external tools with Toolsets; manage service registrations and tokens in Connectors.