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
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
Synthesis Templates
Synthesis templates control how Shannon formats final output after all agents complete their work. These Go templates live inconfig/templates/synthesis/ and are rendered by the Orchestrator before returning results.
Available Templates
| Template | Purpose |
|---|---|
normal_default.tmpl | Default for non-research tasks |
research_comprehensive.tmpl | Detailed research reports |
research_concise.tmpl | Brief research summaries |
research_with_facts.tmpl | Research with fact-based citations |
domain_analysis_digest.tmpl | Domain analysis format |
swarm_default.tmpl | Swarm multi-agent output |
test_bullet_summary.tmpl | Bullet-point test format |
Base Contract
All synthesis templates inherit behavioral rules from_base.tmpl:
Citation Handling
Citation Handling
- When CitationAgent is enabled: no inline
[n]citations in synthesis — Citation Agent adds them separately - When CitationAgent is disabled: use inline
[n]matching theAvailableCitationslist
Temporal References
Temporal References
The
CurrentDate field is injected into every template, enabling “as of” statements for time-sensitive content.Structured Artifacts
Structured Artifacts
Templates must preserve structured artifacts (tables, code blocks, JSON) — never flatten them to prose.
Source Sections
Source Sections
Templates should not include a “Sources” section. The system appends source citations automatically.
Template Data
Every synthesis template receives aSynthesisTemplateData struct with the following fields:
Selecting a Synthesis Template
The Orchestrator selects synthesis templates based on the task type and configuration:- Via Task Context
- Via Workflow Template
If no
synthesis_style is specified, Shannon automatically selects research_comprehensive for research tasks and normal_default for all others.Example Workflows
Shannon ships with 8 example workflow templates inconfig/workflows/examples/. These serve as ready-to-use starting points and reference implementations.
Workflow Catalog
| Template | Description | Nodes | Pattern |
|---|---|---|---|
simple_analysis.yaml | Quick summarization | 2 | Sequential (intake + summarize) |
research_summary.yaml | Multi-stage research | 4 | Sequential with degradation |
research_summary_enterprise.yaml | Enterprise research | 4+ | Sequential with large models |
market_analysis.yaml | Market research | 3+ | Sequential with tools |
market_analysis_playbook.yaml | Market playbook variant | 3+ | Playbook-driven |
complex_dag.yaml | Multi-parallel DAG | 5+ | DAG with fan-out/fan-in |
parallel_dag_example.yaml | Parallel execution demo | 4+ | DAG with parallel branches |
parallel_items_example.yaml | Batch item processing | 3+ | Parallel items |
YAML Structure Reference
All example workflows follow this structure:Pattern Degradation
Example workflows demonstrate Shannon’s automatic degradation behavior when resources are constrained:Learning Router
When enabled, the Learning Router automatically selects workflow templates based on query similarity to past successful executions. This eliminates the need for callers to specify a template explicitly.Next Steps
Custom Tools
Add tools for your templates
Extending Shannon
Other extension methods
Configuration
Environment and YAML config
Architecture
Understanding Shannon’s design