Temporal-backed workflow runtime for Claude Code skills
Project description
sagaflow
Run durable agent workflows that outlive your session.
The problem
Multi-agent skills for code review, debugging, and research spawn parallel subagents and thread their output back together through ad-hoc file-based state machines. When the session crashes — or a subagent wedges silently for hours — that state fragments, retries are brittle prose inside markdown, and there's no visibility into what's still in flight. Rolling a durable execution layer per skill duplicates a lot of work that Temporal already solves.
Quick start
pip install sagaflow
temporal server start-dev &
export ANTHROPIC_API_KEY=sk-ant-...
sagaflow launch hello-world --name alice --await
# → hello, alice
A DONE entry also lands in ~/.sagaflow/INBOX.md and fires a desktop notification. Kill your terminal mid-run and re-launch: the workflow resumes from the last completed activity.
Install
pip install sagaflow
Requirements:
- Python 3.11+
- Temporal CLI running locally:
brew install temporal && temporal server start-dev - An Anthropic API key:
export ANTHROPIC_API_KEY=sk-ant-...
Optional: set ANTHROPIC_BASE_URL to route through any Anthropic-compatible proxy (Bedrock, a local model gateway, etc.).
Usage
Launch and wait for the result
sagaflow launch hello-world --name alice --await
Fire and forget; check the inbox later
sagaflow launch hello-world --name alice
sagaflow inbox
# [2026-04-22 14:33:22] hello-world-20260422-143322 DONE hello-world hello, alice
sagaflow dismiss hello-world-20260422-143322
Diagnose a broken setup
sagaflow doctor
# [OK] temporal
# [OK] transport
# [WARN] worker: no worker polling; will auto-spawn on launch
# [OK] hook
How it works
sagaflow launch <skill> --await
│
▼
preflight → auto-install SessionStart hook
→ auto-spawn worker daemon if none running
→ submit workflow to Temporal (localhost:7233)
│
▼
worker daemon polls task queue "sagaflow"
runs @workflow.defn → executes activities:
• write_artifact (file I/O)
• spawn_subagent (Anthropic SDK or `claude -p`)
• emit_finding (INBOX + desktop notify)
│
▼
4-layer result-surfacing safety net:
1. --await completion → caller prints
2. ~/.sagaflow/INBOX.md (append-only)
3. SessionStart hook → next Claude Code session surfaces unread
4. desktop notification (osascript / notify-send)
If the worker crashes mid-run, the next sagaflow launch auto-spawns a fresh one and Temporal resumes from the last completed activity.
Writing a new skill
See docs/SKILL-TEMPLATE.md. The minimal skill is skills/hello_world/ (~100 lines), which exercises every framework surface without importing anything skill-specific from the framework core.
Development
git clone https://github.com/npow/sagaflow
cd sagaflow
python -m venv .venv && source .venv/bin/activate
pip install -e ".[dev]"
ruff check sagaflow tests skills
mypy sagaflow
pytest
# Opt-in end-to-end tests (require live Temporal + real Anthropic access)
SAGAFLOW_E2E=1 pytest
License
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file sagaflow-0.1.0.tar.gz.
File metadata
- Download URL: sagaflow-0.1.0.tar.gz
- Upload date:
- Size: 27.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b42c7307decd225143f3242529ae791101bd728c207e514b5201f9c94f0cbae1
|
|
| MD5 |
50bdcc585f4634e86be69663e473e14a
|
|
| BLAKE2b-256 |
6c300b01fd9d7951098ea0f443212f67ff454750418c86c57153708efea9b2e8
|
Provenance
The following attestation bundles were made for sagaflow-0.1.0.tar.gz:
Publisher:
publish.yml on npow/sagaflow
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
sagaflow-0.1.0.tar.gz -
Subject digest:
b42c7307decd225143f3242529ae791101bd728c207e514b5201f9c94f0cbae1 - Sigstore transparency entry: 1357951259
- Sigstore integration time:
-
Permalink:
npow/sagaflow@3e16d5f27378eeba407a98de86993c3b21bf0df4 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/npow
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@3e16d5f27378eeba407a98de86993c3b21bf0df4 -
Trigger Event:
release
-
Statement type:
File details
Details for the file sagaflow-0.1.0-py3-none-any.whl.
File metadata
- Download URL: sagaflow-0.1.0-py3-none-any.whl
- Upload date:
- Size: 22.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5d1ca77eb8c9c2d75b3d4fdbba29e14b253aff0a94a7f2b85a29c6de31d0bbc4
|
|
| MD5 |
bf7643e466fb8d8071d27f442cdfea96
|
|
| BLAKE2b-256 |
5a6fafd481efba540a06fe5d7b757088e0c5bd7ff2b0eec89836a7413f722378
|
Provenance
The following attestation bundles were made for sagaflow-0.1.0-py3-none-any.whl:
Publisher:
publish.yml on npow/sagaflow
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
sagaflow-0.1.0-py3-none-any.whl -
Subject digest:
5d1ca77eb8c9c2d75b3d4fdbba29e14b253aff0a94a7f2b85a29c6de31d0bbc4 - Sigstore transparency entry: 1357951425
- Sigstore integration time:
-
Permalink:
npow/sagaflow@3e16d5f27378eeba407a98de86993c3b21bf0df4 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/npow
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@3e16d5f27378eeba407a98de86993c3b21bf0df4 -
Trigger Event:
release
-
Statement type: