probeo-workflow-py 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- probeo_workflow_py-0.1.0/.github/workflows/ci.yml +35 -0
- probeo_workflow_py-0.1.0/.github/workflows/publish.yml +30 -0
- probeo_workflow_py-0.1.0/.gitignore +14 -0
- probeo_workflow_py-0.1.0/CHANGELOG.md +20 -0
- probeo_workflow_py-0.1.0/LICENSE +21 -0
- probeo_workflow_py-0.1.0/PKG-INFO +368 -0
- probeo_workflow_py-0.1.0/README.md +339 -0
- probeo_workflow_py-0.1.0/pyproject.toml +59 -0
- probeo_workflow_py-0.1.0/src/workflow/__init__.py +18 -0
- probeo_workflow_py-0.1.0/src/workflow/engine.py +334 -0
- probeo_workflow_py-0.1.0/src/workflow/py.typed +0 -0
- probeo_workflow_py-0.1.0/src/workflow/store.py +87 -0
- probeo_workflow_py-0.1.0/src/workflow/types.py +90 -0
- probeo_workflow_py-0.1.0/tests/__init__.py +0 -0
- probeo_workflow_py-0.1.0/tests/test_engine.py +505 -0
- probeo_workflow_py-0.1.0/tests/test_store.py +172 -0
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main]
|
|
6
|
+
pull_request:
|
|
7
|
+
branches: [main]
|
|
8
|
+
|
|
9
|
+
env:
|
|
10
|
+
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
|
|
11
|
+
|
|
12
|
+
jobs:
|
|
13
|
+
test:
|
|
14
|
+
runs-on: ubuntu-latest
|
|
15
|
+
|
|
16
|
+
strategy:
|
|
17
|
+
matrix:
|
|
18
|
+
python-version: ["3.10", "3.11", "3.12", "3.13"]
|
|
19
|
+
|
|
20
|
+
steps:
|
|
21
|
+
- uses: actions/checkout@v4
|
|
22
|
+
|
|
23
|
+
- name: Set up Python ${{ matrix.python-version }}
|
|
24
|
+
uses: actions/setup-python@v5
|
|
25
|
+
with:
|
|
26
|
+
python-version: ${{ matrix.python-version }}
|
|
27
|
+
|
|
28
|
+
- name: Install dependencies
|
|
29
|
+
run: pip install -e ".[dev]"
|
|
30
|
+
|
|
31
|
+
- name: Lint
|
|
32
|
+
run: ruff check src/ tests/
|
|
33
|
+
|
|
34
|
+
- name: Test
|
|
35
|
+
run: pytest
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
name: Publish to PyPI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
release:
|
|
5
|
+
types: [published]
|
|
6
|
+
|
|
7
|
+
jobs:
|
|
8
|
+
publish:
|
|
9
|
+
runs-on: ubuntu-latest
|
|
10
|
+
environment: pypi
|
|
11
|
+
permissions:
|
|
12
|
+
id-token: write
|
|
13
|
+
|
|
14
|
+
steps:
|
|
15
|
+
- uses: actions/checkout@v4
|
|
16
|
+
|
|
17
|
+
- uses: actions/setup-python@v5
|
|
18
|
+
with:
|
|
19
|
+
python-version: "3.12"
|
|
20
|
+
|
|
21
|
+
- name: Install build tools
|
|
22
|
+
run: pip install build
|
|
23
|
+
|
|
24
|
+
- name: Build
|
|
25
|
+
run: python -m build
|
|
26
|
+
|
|
27
|
+
- name: Publish to PyPI
|
|
28
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
29
|
+
with:
|
|
30
|
+
attestations: false
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## 0.1.1 (2026-03-28)
|
|
4
|
+
|
|
5
|
+
### Added
|
|
6
|
+
|
|
7
|
+
- Expanded test suite (30 tests: engine, store)
|
|
8
|
+
- "See Also" cross-links to related packages
|
|
9
|
+
- GitHub Actions CI (Python 3.10-3.13 matrix) and publish workflow
|
|
10
|
+
|
|
11
|
+
## 0.1.0 (2026-03-27)
|
|
12
|
+
|
|
13
|
+
- Initial release
|
|
14
|
+
- Workflow engine with concurrent and collective step modes
|
|
15
|
+
- FileStore for filesystem persistence with immutable step outputs
|
|
16
|
+
- Per-item concurrency with asyncio semaphore
|
|
17
|
+
- Retry with exponential backoff
|
|
18
|
+
- Resume-after-crash via write-once step outputs
|
|
19
|
+
- Resource injection and progress callbacks
|
|
20
|
+
- Abort signal support
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 probeo
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,368 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: probeo-workflow-py
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Stage-based pipeline engine for AI workloads. Zero dependencies. Code decides what happens. AI does the work.
|
|
5
|
+
Project-URL: Homepage, https://github.com/probeo-io/workflow-py
|
|
6
|
+
Project-URL: Repository, https://github.com/probeo-io/workflow-py
|
|
7
|
+
Project-URL: Issues, https://github.com/probeo-io/workflow-py/issues
|
|
8
|
+
Author-email: Probeo <dev@probeo.io>
|
|
9
|
+
License-Expression: MIT
|
|
10
|
+
License-File: LICENSE
|
|
11
|
+
Keywords: agent,concurrency,llm,orchestration,pipeline,workflow
|
|
12
|
+
Classifier: Development Status :: 3 - Alpha
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
15
|
+
Classifier: Programming Language :: Python :: 3
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
20
|
+
Classifier: Topic :: Software Development :: Libraries
|
|
21
|
+
Classifier: Typing :: Typed
|
|
22
|
+
Requires-Python: >=3.10
|
|
23
|
+
Provides-Extra: dev
|
|
24
|
+
Requires-Dist: mypy>=1.13; extra == 'dev'
|
|
25
|
+
Requires-Dist: pytest-asyncio>=0.24; extra == 'dev'
|
|
26
|
+
Requires-Dist: pytest>=8.0; extra == 'dev'
|
|
27
|
+
Requires-Dist: ruff>=0.8; extra == 'dev'
|
|
28
|
+
Description-Content-Type: text/markdown
|
|
29
|
+
|
|
30
|
+
# workflow-py
|
|
31
|
+
|
|
32
|
+
Stage-based pipeline engine for AI workloads. Zero dependencies. Code decides what happens. AI does the work.
|
|
33
|
+
|
|
34
|
+
Most AI pipelines are linear: fetch data, analyze it, enrich it, summarize it. Some stages call LLMs. Some don't. The control flow is deterministic even when AI is involved. You don't need a graph framework for that.
|
|
35
|
+
|
|
36
|
+
workflow-py gives you per-item concurrency, retry with backoff, filesystem persistence, and resume-after-crash. No graph theory. No dependency tree. No framework lock-in.
|
|
37
|
+
|
|
38
|
+
## Install
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
pip install workflow-py
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## Quick Start
|
|
45
|
+
|
|
46
|
+
```python
|
|
47
|
+
import asyncio
|
|
48
|
+
from dataclasses import dataclass
|
|
49
|
+
from typing import Any
|
|
50
|
+
|
|
51
|
+
from anymodel import AnyModel
|
|
52
|
+
from workflow import Workflow, WorkflowOptions, WorkItem
|
|
53
|
+
from workflow.types import StepContext
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
@dataclass
|
|
57
|
+
class Analyze:
|
|
58
|
+
name: str = "analyze"
|
|
59
|
+
mode: str = "concurrent"
|
|
60
|
+
|
|
61
|
+
async def run(self, url: Any, ctx: StepContext) -> Any:
|
|
62
|
+
ai = ctx.resources["ai"]
|
|
63
|
+
# fetch page content (use httpx, aiohttp, etc.)
|
|
64
|
+
html = await fetch_page(url)
|
|
65
|
+
result = await ai.chat(
|
|
66
|
+
model="anthropic/claude-sonnet-4-20250514",
|
|
67
|
+
messages=[{"role": "user", "content": f"Summarize this page:\n\n{html[:5000]}"}],
|
|
68
|
+
)
|
|
69
|
+
return {"title": url, "summary": result.message.content}
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
async def main():
|
|
73
|
+
urls = ["https://example.com/page1", "https://example.com/page2"]
|
|
74
|
+
results = await (
|
|
75
|
+
Workflow(base_dir=".pipeline")
|
|
76
|
+
.resource("ai", AnyModel(api_key="your-key"))
|
|
77
|
+
.step(Analyze())
|
|
78
|
+
.run(
|
|
79
|
+
[WorkItem(id=f"page-{i}", data=url) for i, url in enumerate(urls)],
|
|
80
|
+
WorkflowOptions(concurrency=10, max_retries=2),
|
|
81
|
+
)
|
|
82
|
+
)
|
|
83
|
+
print(results)
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
asyncio.run(main())
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
## Use Cases
|
|
90
|
+
|
|
91
|
+
### Content pipeline with anymodel-py
|
|
92
|
+
|
|
93
|
+
Crawl pages, extract content with an LLM, generate SEO metadata. Each stage is a step. LLM calls happen inside steps, not as routing decisions.
|
|
94
|
+
|
|
95
|
+
```python
|
|
96
|
+
import asyncio
|
|
97
|
+
from dataclasses import dataclass
|
|
98
|
+
from typing import Any
|
|
99
|
+
|
|
100
|
+
from anymodel import AnyModel
|
|
101
|
+
from workflow import Workflow, WorkflowOptions, WorkItem
|
|
102
|
+
from workflow.types import StepContext
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
@dataclass
|
|
106
|
+
class Crawl:
|
|
107
|
+
name: str = "crawl"
|
|
108
|
+
mode: str = "concurrent"
|
|
109
|
+
|
|
110
|
+
async def run(self, url: Any, ctx: StepContext) -> Any:
|
|
111
|
+
html = await fetch_page(url)
|
|
112
|
+
return {"url": url, "html": html}
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
@dataclass
|
|
116
|
+
class Extract:
|
|
117
|
+
name: str = "extract"
|
|
118
|
+
mode: str = "concurrent"
|
|
119
|
+
|
|
120
|
+
async def run(self, page: Any, ctx: StepContext) -> Any:
|
|
121
|
+
ai = ctx.resources["ai"]
|
|
122
|
+
result = await ai.chat(
|
|
123
|
+
model="anthropic/claude-sonnet-4-20250514",
|
|
124
|
+
messages=[{
|
|
125
|
+
"role": "user",
|
|
126
|
+
"content": f"Extract the main content from this HTML. "
|
|
127
|
+
f"Return JSON with title, description, and bodyText.\n\n{page['html'][:8000]}",
|
|
128
|
+
}],
|
|
129
|
+
)
|
|
130
|
+
import json
|
|
131
|
+
return {**page, "content": json.loads(result.message.content)}
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
@dataclass
|
|
135
|
+
class GenerateMeta:
|
|
136
|
+
name: str = "generate-meta"
|
|
137
|
+
mode: str = "concurrent"
|
|
138
|
+
|
|
139
|
+
async def run(self, page: Any, ctx: StepContext) -> Any:
|
|
140
|
+
ai = ctx.resources["ai"]
|
|
141
|
+
result = await ai.chat(
|
|
142
|
+
model="openai/gpt-4o-mini",
|
|
143
|
+
messages=[{
|
|
144
|
+
"role": "user",
|
|
145
|
+
"content": f"Write an SEO meta description (under 160 chars) for this content:\n\n"
|
|
146
|
+
f"Title: {page['content']['title']}\n\n{page['content']['bodyText'][:2000]}",
|
|
147
|
+
}],
|
|
148
|
+
)
|
|
149
|
+
return {**page, "meta": result.message.content}
|
|
150
|
+
|
|
151
|
+
|
|
152
|
+
async def main():
|
|
153
|
+
urls = ["https://example.com/page1", "https://example.com/page2"]
|
|
154
|
+
pipeline = (
|
|
155
|
+
Workflow(base_dir=".content-pipeline")
|
|
156
|
+
.resource("ai", AnyModel(api_key="your-key"))
|
|
157
|
+
.step(Crawl())
|
|
158
|
+
.step(Extract())
|
|
159
|
+
.step(GenerateMeta())
|
|
160
|
+
)
|
|
161
|
+
results = await pipeline.run(
|
|
162
|
+
[WorkItem(id=f"page-{i}", data=url) for i, url in enumerate(urls)],
|
|
163
|
+
WorkflowOptions(
|
|
164
|
+
concurrency=5,
|
|
165
|
+
max_retries=2,
|
|
166
|
+
on_progress=lambda p: print(f"{p.completed}/{p.total} ({p.current_step})"),
|
|
167
|
+
),
|
|
168
|
+
)
|
|
169
|
+
print(results)
|
|
170
|
+
|
|
171
|
+
|
|
172
|
+
asyncio.run(main())
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
### Research pipeline with anyserp-py + anymodel-py
|
|
176
|
+
|
|
177
|
+
Search the web for a topic, fetch the top results, analyze them with an LLM, then produce a collective summary.
|
|
178
|
+
|
|
179
|
+
```python
|
|
180
|
+
import asyncio
|
|
181
|
+
from dataclasses import dataclass
|
|
182
|
+
from typing import Any
|
|
183
|
+
|
|
184
|
+
from anymodel import AnyModel
|
|
185
|
+
from anyserp import AnySerp
|
|
186
|
+
from workflow import Workflow, WorkflowOptions, WorkItem
|
|
187
|
+
from workflow.types import StepContext
|
|
188
|
+
|
|
189
|
+
|
|
190
|
+
@dataclass
|
|
191
|
+
class Search:
|
|
192
|
+
name: str = "search"
|
|
193
|
+
mode: str = "concurrent"
|
|
194
|
+
|
|
195
|
+
async def run(self, query: Any, ctx: StepContext) -> Any:
|
|
196
|
+
serp = ctx.resources["serp"]
|
|
197
|
+
results = await serp.search(query=query, num=5)
|
|
198
|
+
return {"query": query, "results": results.organic}
|
|
199
|
+
|
|
200
|
+
|
|
201
|
+
@dataclass
|
|
202
|
+
class AnalyzeResults:
|
|
203
|
+
name: str = "analyze"
|
|
204
|
+
mode: str = "concurrent"
|
|
205
|
+
|
|
206
|
+
async def run(self, data: Any, ctx: StepContext) -> Any:
|
|
207
|
+
ai = ctx.resources["ai"]
|
|
208
|
+
snippets = "\n".join(f"{r['title']}: {r['snippet']}" for r in data["results"])
|
|
209
|
+
result = await ai.chat(
|
|
210
|
+
model="anthropic/claude-sonnet-4-20250514",
|
|
211
|
+
messages=[{
|
|
212
|
+
"role": "user",
|
|
213
|
+
"content": f'Analyze these search results for "{data["query"]}". '
|
|
214
|
+
f"What are the key themes and findings?\n\n{snippets}",
|
|
215
|
+
}],
|
|
216
|
+
)
|
|
217
|
+
return {**data, "analysis": result.message.content}
|
|
218
|
+
|
|
219
|
+
|
|
220
|
+
@dataclass
|
|
221
|
+
class Summarize:
|
|
222
|
+
name: str = "summarize"
|
|
223
|
+
mode: str = "collective"
|
|
224
|
+
|
|
225
|
+
async def run(self, items: Any, ctx: StepContext) -> Any:
|
|
226
|
+
ai = ctx.resources["ai"]
|
|
227
|
+
analyses = "\n\n".join(f"## {i['data']['query']}\n{i['data']['analysis']}" for i in items)
|
|
228
|
+
result = await ai.chat(
|
|
229
|
+
model="anthropic/claude-sonnet-4-20250514",
|
|
230
|
+
messages=[{
|
|
231
|
+
"role": "user",
|
|
232
|
+
"content": f"Synthesize these research analyses into a single brief:\n\n{analyses}",
|
|
233
|
+
}],
|
|
234
|
+
)
|
|
235
|
+
return [{"id": i["id"], "summary": result.message.content} for i in items]
|
|
236
|
+
|
|
237
|
+
|
|
238
|
+
async def main():
|
|
239
|
+
queries = ["Python async patterns", "LLM orchestration frameworks"]
|
|
240
|
+
pipeline = (
|
|
241
|
+
Workflow(base_dir=".research")
|
|
242
|
+
.resource("ai", AnyModel(api_key="your-openrouter-key"))
|
|
243
|
+
.resource("serp", AnySerp(provider="serper", api_key="your-serper-key"))
|
|
244
|
+
.step(Search())
|
|
245
|
+
.step(AnalyzeResults())
|
|
246
|
+
.step(Summarize())
|
|
247
|
+
)
|
|
248
|
+
results = await pipeline.run(
|
|
249
|
+
[WorkItem(id=f"query-{i}", data=q) for i, q in enumerate(queries)],
|
|
250
|
+
WorkflowOptions(concurrency=3),
|
|
251
|
+
)
|
|
252
|
+
print(results)
|
|
253
|
+
|
|
254
|
+
|
|
255
|
+
asyncio.run(main())
|
|
256
|
+
```
|
|
257
|
+
|
|
258
|
+
### Batch processing with resume
|
|
259
|
+
|
|
260
|
+
Process 10,000 items. If it crashes at item 6,000, restart and it picks up where it left off. FileStore writes are immutable. Completed steps are never re-run.
|
|
261
|
+
|
|
262
|
+
```python
|
|
263
|
+
import asyncio
|
|
264
|
+
from workflow import Workflow, WorkflowOptions, WorkItem
|
|
265
|
+
|
|
266
|
+
pipeline = (
|
|
267
|
+
Workflow(
|
|
268
|
+
id="batch-2026-03-28", # Fixed ID enables resume
|
|
269
|
+
base_dir=".batch-data",
|
|
270
|
+
)
|
|
271
|
+
.step(fetch_step)
|
|
272
|
+
.step(transform_step)
|
|
273
|
+
.step(enrich_step)
|
|
274
|
+
)
|
|
275
|
+
|
|
276
|
+
# First run: processes all 10,000
|
|
277
|
+
await pipeline.run(items, WorkflowOptions(concurrency=20))
|
|
278
|
+
|
|
279
|
+
# Crashes at item 6,000. Restart:
|
|
280
|
+
# Items 1-6,000 are skipped (outputs exist on disk).
|
|
281
|
+
# Items 6,001-10,000 are processed.
|
|
282
|
+
await pipeline.run(items, WorkflowOptions(concurrency=20))
|
|
283
|
+
```
|
|
284
|
+
|
|
285
|
+
## Concepts
|
|
286
|
+
|
|
287
|
+
- **Step** -- a named unit of work with a `run()` method. Each step declares a `mode`:
|
|
288
|
+
- `concurrent` -- runs per-item, many in parallel (up to the concurrency limit)
|
|
289
|
+
- `collective` -- waits for all items, runs once with the full set (useful for summarization, aggregation)
|
|
290
|
+
- **Workflow** -- chains steps together. Supports resource injection, progress callbacks, and abort signals.
|
|
291
|
+
- **FileStore** -- filesystem persistence with immutable write-once outputs. Enables resume after crash.
|
|
292
|
+
|
|
293
|
+
## API
|
|
294
|
+
|
|
295
|
+
### `Workflow(*, id=None, store=None, base_dir=".workflow")`
|
|
296
|
+
|
|
297
|
+
| Option | Type | Default | Description |
|
|
298
|
+
|---|---|---|---|
|
|
299
|
+
| `id` | `str` | auto-generated | Workflow run identifier. Use a fixed ID to enable resume. |
|
|
300
|
+
| `store` | `WorkflowStore` | `FileStore` | Persistence backend |
|
|
301
|
+
| `base_dir` | `str` | `".workflow"` | Base directory for `FileStore` |
|
|
302
|
+
|
|
303
|
+
### `.resource(name, value)`
|
|
304
|
+
|
|
305
|
+
Register a shared resource available to all steps via `ctx.resources`.
|
|
306
|
+
|
|
307
|
+
### `.step(step)`
|
|
308
|
+
|
|
309
|
+
Add a step to the pipeline. Steps run in the order they are added.
|
|
310
|
+
|
|
311
|
+
### `await .run(items, options?)`
|
|
312
|
+
|
|
313
|
+
Run all items through the pipeline. Returns a list of `ItemState` objects.
|
|
314
|
+
|
|
315
|
+
| Option | Type | Default | Description |
|
|
316
|
+
|---|---|---|---|
|
|
317
|
+
| `concurrency` | `int` | `5` | Max parallel items for concurrent steps |
|
|
318
|
+
| `max_retries` | `int` | `2` | Retry attempts per item per step (exponential backoff) |
|
|
319
|
+
| `on_progress` | `Callable` | `None` | Progress callback |
|
|
320
|
+
| `signal` | `asyncio.Event` | `None` | Cancellation signal (set the event to abort) |
|
|
321
|
+
|
|
322
|
+
### `await .run_one(item, options?)`
|
|
323
|
+
|
|
324
|
+
Run a single item through the full pipeline. Returns one `ItemState`.
|
|
325
|
+
|
|
326
|
+
### `FileStore`
|
|
327
|
+
|
|
328
|
+
Filesystem-backed store. Step outputs are immutable. Once written, never overwritten. Safe to resume after interruption.
|
|
329
|
+
|
|
330
|
+
### `StepContext`
|
|
331
|
+
|
|
332
|
+
Every step receives a context object:
|
|
333
|
+
|
|
334
|
+
| Property | Type | Description |
|
|
335
|
+
|---|---|---|
|
|
336
|
+
| `item_id` | `str` | Current item's ID |
|
|
337
|
+
| `resources` | `dict[str, Any]` | Shared resources registered via `.resource()` |
|
|
338
|
+
| `log` | `Logger` | Logger scoped to this item + step |
|
|
339
|
+
| `get_cache` | `async (step_name) -> Any` | Read a previous step's cached output |
|
|
340
|
+
| `signal` | `asyncio.Event` | Cancellation signal |
|
|
341
|
+
|
|
342
|
+
## Why not LangGraph?
|
|
343
|
+
|
|
344
|
+
LangGraph is for agent orchestration. Cyclic graphs where an LLM decides what to do next. That's the right tool when you need non-deterministic routing.
|
|
345
|
+
|
|
346
|
+
But most AI workloads are pipelines. Items flow through stages. Some stages call LLMs. The control flow is deterministic. For that, LangGraph adds complexity without value:
|
|
347
|
+
|
|
348
|
+
| | workflow-py | LangGraph |
|
|
349
|
+
|---|---|---|
|
|
350
|
+
| Dependencies | 0 | 23 packages, 53 MB |
|
|
351
|
+
| Mental model | Steps in order | Nodes, edges, state reducers, graphs |
|
|
352
|
+
| Concurrency | Per-item with limits | Fan-out via Send pattern |
|
|
353
|
+
| Persistence | FileStore (filesystem) | Checkpointer (Postgres, memory) |
|
|
354
|
+
| Resume | Immutable step outputs | Checkpoint after every node |
|
|
355
|
+
| Lock-in | None | Requires langchain-core (12 MB) |
|
|
356
|
+
|
|
357
|
+
## See Also
|
|
358
|
+
|
|
359
|
+
| Package | Description |
|
|
360
|
+
|---|---|
|
|
361
|
+
| [@probeo/workflow](https://github.com/probeo-io/workflow) | TypeScript version of this package |
|
|
362
|
+
| [workflow-go](https://github.com/probeo-io/workflow-go) | Go version of this package |
|
|
363
|
+
| [anymodel-py](https://github.com/probeo-io/anymodel-py) | Unified LLM router for Python |
|
|
364
|
+
| [anyserp-py](https://github.com/probeo-io/anyserp-py) | Unified SERP API router for Python |
|
|
365
|
+
|
|
366
|
+
## License
|
|
367
|
+
|
|
368
|
+
MIT
|