What are Workflows?
Workflows in Shannon are durable, stateful processes that orchestrate AI agents to complete complex tasks. Built on Temporal, they provide:- Durability: Workflows survive service restarts and failures
- Determinism: Can be replayed for debugging
- Visibility: Full execution history and state inspection
- Reliability: Automatic retries and error handling
Workflow Architecture
Cognitive Patterns
Shannon implements several proven cognitive patterns for different task types:Chain-of-Thought (CoT)
Sequential reasoning where each step builds logically on the previous one. Best for:- Mathematical problems
- Step-by-step analysis
- Linear workflows
Shannon automatically applies Chain-of-Thought reasoning for sequential mathematical and analytical tasks.
Tree-of-Thoughts (ToT)
Explores multiple solution paths simultaneously, evaluates them, and selects the best. Best for:- Design decisions
- Strategic planning
- Problems with multiple approaches
Shannon automatically applies Tree-of-Thoughts exploration for design and planning tasks with multiple solution paths.
ReAct (Reasoning + Acting)
Interleaves thinking and acting in loops, ideal for dynamic problem-solving. Best for:- Research tasks
- Debugging problems
- Adaptive workflows
Shannon automatically applies ReAct (Reasoning + Acting) for research and iterative discovery tasks.
Debate Pattern
Multiple agents argue different perspectives, then synthesize consensus. Best for:- Decision making
- Evaluating trade-offs
- Balanced analysis
Shannon automatically applies the Debate pattern for decision-making tasks requiring multiple perspectives.
Task Decomposition
For complex tasks, Shannon automatically decomposes them into subtasks:DAG (Directed Acyclic Graph) Execution
Parallel Execution: Subtasks without dependencies run in parallel, reducing latency. Example:Decomposition Strategy
Shannon analyzes tasks and creates execution plans internally. While the decomposition structure isn’t directly exposed in the SDK response, you can observe the workflow execution through events:- Subtasks run in parallel when no dependencies exist
- Synthesis task waits for all subtasks to complete
- Each subtask is assigned to specialized agents
Workflow Activities
Temporal workflows are composed of activities - discrete units of work:| Activity | Purpose |
|---|---|
| DecomposeTask | Analyzes task and creates subtasks |
| ExecuteAgent | Runs a single agent task |
| SynthesizeResults | Combines outputs from multiple agents |
| UpdateSessionResult | Persists session state and appends the assistant message to session history (fix 2025‑11‑05) |
| RecordQuery | Stores in vector memory |
| FetchSessionMemory | Retrieves relevant context |
Monitoring Workflows
Via Python SDK
Task decomposition happens internally in Shannon. Use event streaming to observe workflow execution in real-time.
Via Temporal UI
Visit http://localhost:8088 to see:- Workflow execution timeline
- Activity statuses
- Input/output payloads
- Error traces
- Replay history
Deterministic Replay
Shannon workflows are deterministic - they produce the same result when replayed with the same inputs. Use cases:- Debugging: Replay failed workflows to find bugs
- Testing: Validate code changes don’t break existing workflows
- Auditing: Understand exactly what happened
Workflow Configuration
Workflow behavior is configured via environment variables (examples):Error Handling
Workflows automatically handle failures:Retries
Retries
Activities retry automatically with exponential backoff:
Circuit Breakers
Circuit Breakers
If an LLM provider is failing, circuit breaker opens and routes to fallback:
Graceful Degradation
Graceful Degradation
If complex mode fails, automatically falls back to simpler execution.
Budget Exceeded
Budget Exceeded
Tasks halt immediately when budget limits are reached, preventing cost overruns.
Best Practices
1. Choose the Right Strategy
Match the cognitive strategy to your task:| Task Type | Recommended Strategy |
|---|---|
| Simple Q&A | DIRECT (Single agent) |
| Research | REACT (Web search + synthesis) |
| Analysis | DECOMPOSE (Break into parts) |
| Design | EXPLORATORY (ToT evaluation) |
2. Use Appropriate Mode
- simple: Direct execution, no overhead
- standard: Task decomposition, multi-agent
- complex: Full cognitive patterns (CoT, ToT, etc.)