Overview
Shannon uses Temporal for workflow orchestration, providing production-grade durability, crash recovery, and observability. Temporal ensures that even if Shannon crashes or is interrupted, the pentest can resume from where it left off without re-running completed agents.Why Temporal?
Penetration tests can run for 1-2 hours and cost $30-50 in API fees. Traditional orchestration approaches would force you to start over from scratch if anything goes wrong. Temporal solves this through:Durable Execution
Workflow state is persisted to a database. If the worker crashes, it can resume from the last checkpoint.
Automatic Retries
Transient errors (rate limits, network issues) are automatically retried with exponential backoff.
Queryable State
Check workflow progress in real-time without waiting for completion.
Event History
Complete audit trail of every step taken, enabling debugging and compliance.
Architecture
Core Concepts
Workflows
Workflows contain the orchestration logic - what order to run agents, how to handle failures, when to run in parallel. File:src/temporal/workflows.ts
Workflows must be deterministic - they can’t make random choices or call external APIs directly. That’s why actual work happens in Activities.
Activities
Activities perform non-deterministic work like API calls, file I/O, or running agents. They can fail and be retried. File:src/temporal/activities.ts
- Provide heartbeat signals (“I’m still alive”)
- Classify errors as retryable vs non-retryable
- Delegate actual work to services
Queries
Queries allow you to inspect workflow state without waiting for completion:Retry Strategies
Shannon implements intelligent retry logic with three presets:- Production (Default)
- Subscription
- Testing
Optimized for production API usage with generous retry windows:Timeline:
- Attempt 1: Immediate
- Attempt 2: +5 minutes
- Attempt 3: +10 minutes
- Attempt 4: +20 minutes
- Attempt 5: +30 minutes
- … up to 50 attempts
Non-Retryable Errors
Some errors should never be retried because they’re permanent:- AuthenticationError: Invalid API key
- PermissionError: Insufficient permissions
- InvalidRequestError: Malformed request
- RequestTooLargeError: Prompt exceeds model limits
- ConfigurationError: Invalid config file
- InvalidTargetError: Target URL unreachable
- ExecutionLimitError: Hit model context window limit
Crash Recovery
Temporal’s durable execution means Shannon can recover from crashes:Scenario 1: Worker Crash
If the worker container crashes mid-pentest:Scenario 2: Network Interruption
If network connection to Anthropic API is lost:- Activity throws retryable error
- Temporal automatically retries with exponential backoff
- When network recovers, activity completes successfully
Scenario 3: API Rate Limit
If you hit Anthropic rate limits:- Error classified as
BillingError(retryable) - Temporal backs off for 5-30 minutes (production) or 5-6 hours (subscription)
- Once rate limit resets, activity resumes
Workspace Resume
Shannon extends Temporal’s crash recovery with workspace resume, allowing you to manually resume interrupted pentests:How It Works
State Restoration
Shannon:
- Loads session.json to see which agents completed
- Restores git workspace to checkpoint
- Cleans up any incomplete deliverables
- Starts new workflow, skipping completed agents
Resume Example
Observability
Temporal provides multiple ways to monitor Shannon:Temporal Web UI
Access athttp://localhost:8233:

- Real-time workflow status
- Event history (complete audit trail)
- Stack traces for failures
- Query execution
- Workflow search and filtering
CLI Tools
Audit Logs
Shannon maintains its own audit logs inaudit-logs/{workspace}/:
Workflow State Machine
State Definitions:- Running: Workflow actively executing agents
- Retry: Activity failed with retryable error, waiting for retry interval
- Completed: All 13 agents completed successfully
- Failed: Encountered non-retryable error or exceeded max retries
- Terminated: User stopped workflow (Ctrl+C or
./shannon stop)
Temporal Client
The CLI interacts with Temporal through the client: File:src/temporal/client.ts
Worker Configuration
The worker polls for tasks and executes them: File:src/temporal/worker.ts
Data Flow
Best Practices
Use Named Workspaces
Use Named Workspaces
Named workspaces make resume easier:
Monitor Progress
Monitor Progress
Check progress periodically instead of waiting for completion:
Configure Retry Presets
Configure Retry Presets
Match retry strategy to your Anthropic plan:Pay-as-you-go: Default (production) preset is fineSubscription plan: Use subscription preset
Clean Up Old Workspaces
Clean Up Old Workspaces
Workspaces accumulate over time:
Troubleshooting
Workflow Not Starting
Workflow Not Starting
Symptoms:
./shannon start hangs or failsSolutions:- Check if Temporal is running:
docker compose ps - Check Temporal health:
curl http://localhost:8233 - View Temporal logs:
docker compose logs temporal - Restart Temporal:
./shannon stop && ./shannon start ...
Worker Not Picking Up Tasks
Worker Not Picking Up Tasks
Symptoms: Workflow shows as “Running” but no progressSolutions:
- Check worker logs:
./shannon logs - Check worker status:
docker compose ps worker - Restart worker:
docker compose restart worker
Resume Not Working
Resume Not Working
Symptoms: Resume starts agents from beginningSolutions:
- Verify workspace name:
./shannon workspaces - Check session.json exists:
cat audit-logs/{workspace}/session.json - Verify URL matches: Compare URL in session.json with resume command
- Check git repository is clean:
git statusin target repo
Activity Timeout
Activity Timeout
Symptoms: Activity fails with “heartbeat timeout”Cause: Agent took longer than 60 minutes without sending heartbeatSolutions:
- Check if agent is actually stuck (logs)
- Increase heartbeat timeout in workflow config (not recommended)
- Resume workflow - it will retry the agent
Next Steps
Workspaces & Resume
Complete guide to workspace management and resume
Configuration
Configure retry strategies for your Anthropic plan
Troubleshooting
Common issues and solutions
Architecture
Understand Shannon’s overall architecture
