Overview
Shannon’s template system enables deterministic, zero-token workflows for common patterns. Templates define structured workflows in YAML that execute without AI decomposition, providing significant cost savings for repeatable tasks.Zero Token Cost
Templates bypass LLM calls for workflow routing
Deterministic Execution
Predictable, repeatable workflow behavior
Budget Control
Per-node token limits with automatic degradation
DAG Support
Parallel execution with dependency management
When to Use Templates
Use templates when:- Workflows are repeatable with known structure
- You want to eliminate decomposition token costs
- Predictable execution order is required
- Budget control per workflow stage is needed
- Task structure is unknown or variable
- Complex reasoning about workflow design is needed
- One-off or highly dynamic tasks
Template Structure
Templates are YAML files with this structure:Core Fields
| Field | Type | Required | Description |
|---|---|---|---|
name | string | Yes | Unique workflow identifier |
version | string | Yes | Semantic version (e.g., “1.0.0”) |
description | string | No | Human-readable description |
defaults | object | No | Global settings for all nodes |
nodes | array | Yes | Workflow execution units |
edges | array | No | Explicit dependency connections |
Default Settings
Node Types
Shannon supports four node types for different execution patterns:Simple Nodes
Single-task execution with direct tool invocation.Cognitive Nodes
Complex reasoning with multi-step analysis.DAG Nodes
Parallel execution with internal task dependencies.Supervisor Nodes
Hierarchical task decomposition and coordination.Execution Strategies
Strategies define how nodes process tasks:| Strategy | Token Range | Description |
|---|---|---|
react | ~500-1500 | Tool-based reasoning with action cycles |
chain_of_thought | ~1500-3000 | Sequential step-by-step reasoning |
tree_of_thoughts | ~3000-8000 | Explores multiple reasoning branches |
reflection | ~1000-2000 | Self-evaluation and refinement |
debate | ~2000-4000 | Multi-perspective analysis |
Automatic Degradation
When budget constraints are reached, strategies degrade automatically:Creating Templates
1
Create Template File
Create a YAML file in
config/workflows/examples/ or your custom directory:2
Register Template Directory
Templates are loaded at startup via
InitTemplateRegistry:3
Restart Services
4
List Available Templates
Via gRPC:
Using Templates
Via HTTP Gateway
Via gRPC
Set
disable_ai: true to enforce template-only execution without AI fallback.Via Python SDK
Template Examples
Simple Analysis Workflow
Two-stage pipeline for quick summarization:Research Summary Workflow
Four-stage research pipeline with progressive reasoning:Parallel DAG Workflow
Complex workflow with parallel execution branches:Template Inheritance
Templates can inherit from parent templates usingextends:
Validation
Templates are validated at load time for:- YAML syntax correctness
- Required field presence
- DAG acyclicity (no circular dependencies)
- Budget hierarchy (node budgets ≤ agent budget)
- Tool registry existence
- Variable reference resolution
Best Practices
Keep Nodes Small and Focused
Keep Nodes Small and Focused
Each node should do one thing well:
Explicitly Allowlist Tools
Explicitly Allowlist Tools
Restrict tools per node for security and predictability:
Use Budget Degradation
Use Budget Degradation
Configure fallback strategies for cost control:
Use Inheritance for Common Patterns
Use Inheritance for Common Patterns
Extract shared defaults into base templates:
Version Your Templates
Version Your Templates
Use semantic versioning and specify version in requests:
Troubleshooting
Template Not Found
Template Not Found
Symptom:
template 'my_workflow' not foundSolutions:- Check template file exists in registered directory
- Verify YAML syntax:
yamllint config/workflows/examples/my_workflow.yaml - Restart orchestrator to reload templates
- Check orchestrator logs for load errors
Validation Errors
Validation Errors
Symptom:
Template validation failed: circular dependencySolutions:- Review
depends_onfields for cycles - Ensure DAG nodes have acyclic task dependencies
- Check
edgesdon’t create loops
Budget Exceeded
Budget Exceeded
Symptom: Node execution stops early or degrades unexpectedlySolutions:
- Increase
budget_maxfor affected nodes - Configure
degrade_tofor graceful fallback - Review total budget vs. sum of node budgets
Tools Not Available
Tools Not Available
Symptom:
tool 'my_tool' not registeredSolutions:- Verify tool is registered in tool registry
- Check tool name spelling in
tools_allowlist - Ensure LLM service has tool loaded