tidebase 0.5.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.
- tidebase-0.5.0/.gitignore +6 -0
- tidebase-0.5.0/PKG-INFO +72 -0
- tidebase-0.5.0/README.md +55 -0
- tidebase-0.5.0/pyproject.toml +27 -0
- tidebase-0.5.0/src/tidebase/__init__.py +771 -0
- tidebase-0.5.0/src/tidebase/aio.py +263 -0
- tidebase-0.5.0/tests/test_integration.py +272 -0
tidebase-0.5.0/PKG-INFO
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: tidebase
|
|
3
|
+
Version: 0.5.0
|
|
4
|
+
Summary: Python SDK for Tidebase — the open-source checkpoint layer for AI agents. Wrap your steps, and failed runs resume from the last safe point, in your own Postgres.
|
|
5
|
+
Project-URL: Homepage, https://tidebase.dev
|
|
6
|
+
Project-URL: Repository, https://github.com/BlueprintLabIO/tidebase
|
|
7
|
+
Project-URL: Documentation, https://tidebase.dev/docs/
|
|
8
|
+
Author: BlueprintLab
|
|
9
|
+
License-Expression: Apache-2.0
|
|
10
|
+
Keywords: ai-agents,checkpoint,durable,human-in-the-loop,postgres,resume,workflow
|
|
11
|
+
Classifier: Development Status :: 3 - Alpha
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: Programming Language :: Python :: 3
|
|
14
|
+
Classifier: Topic :: Software Development :: Libraries
|
|
15
|
+
Requires-Python: >=3.9
|
|
16
|
+
Description-Content-Type: text/markdown
|
|
17
|
+
|
|
18
|
+
# tidebase (Python SDK)
|
|
19
|
+
|
|
20
|
+
Python SDK for [Tidebase](https://tidebase.dev) — the open-source checkpoint layer for AI agents: wrap your steps, and failed runs resume from the last safe point — in your own Postgres, without moving execution into a new runtime.
|
|
21
|
+
|
|
22
|
+
Zero dependencies (stdlib only), Python 3.9+.
|
|
23
|
+
|
|
24
|
+
```python
|
|
25
|
+
from tidebase import Tidebase
|
|
26
|
+
|
|
27
|
+
tide = Tidebase() # reads TIDEBASE_URL (default http://localhost:7373) and TIDEBASE_API_KEY
|
|
28
|
+
|
|
29
|
+
def workflow(run, input):
|
|
30
|
+
plan = run.step("plan", lambda: make_plan(input))
|
|
31
|
+
sources = run.step("fetch-sources", lambda: fetch_sources(plan))
|
|
32
|
+
|
|
33
|
+
run.state.set({"status": "writing", "progress": 0.7})
|
|
34
|
+
|
|
35
|
+
decision = run.gate("approve-report", "Send the report to the customer?")
|
|
36
|
+
if not decision.approved:
|
|
37
|
+
raise RuntimeError("not approved")
|
|
38
|
+
|
|
39
|
+
return run.step("write-report", lambda: write_report(sources))
|
|
40
|
+
|
|
41
|
+
tide.run("generate-report", workflow, run_id=run_id)
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
Re-invoke with the same `run_id` after a crash: completed steps return from their checkpoints instantly; only unfinished steps execute.
|
|
45
|
+
|
|
46
|
+
## Surface
|
|
47
|
+
|
|
48
|
+
| Call | Does |
|
|
49
|
+
|---|---|
|
|
50
|
+
| `tide.run(name, workflow, run_id=…, input=…)` | Create or resume a run |
|
|
51
|
+
| `run.step(name, fn, side_effects=…, idempotency_key=…, retries=…)` | Checkpoint a unit of work; replays from storage on resume |
|
|
52
|
+
| `run.state.set / patch / save / versions` | Live state + versioned history (snapshot = labeled version) |
|
|
53
|
+
| `run.gate(name, prompt)` | Durable human approval; resolves exactly once |
|
|
54
|
+
| `run.child(...)` / `run.fanout(name, children)` | Subagents as child runs, idempotent by edge name, durable join |
|
|
55
|
+
| `run.usage.record(kind=…, input_tokens=…, cost_usd=…)` | Per-run token/cost ledger, no LLM proxy |
|
|
56
|
+
| `tide.runs.create / get / list / recover / subscribe` | Run API + SSE event stream |
|
|
57
|
+
| `tidebase.verify_webhook_signature(body, header, secret)` | Verify signed recovery/channel webhooks |
|
|
58
|
+
|
|
59
|
+
External writes should declare `side_effects` and an `idempotency_key`; otherwise a final failure is classified `manual_review` instead of silently retrying — that's the [replay contract](https://tidebase.dev/docs/replay-contract-is-it-safe-to-rerun/).
|
|
60
|
+
|
|
61
|
+
## Tests
|
|
62
|
+
|
|
63
|
+
Integration tests assert the durability invariants against a real server:
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
docker compose up -d postgres && pnpm server # in the repo root
|
|
67
|
+
python3 -m unittest discover sdk-python/tests -v
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
## Status
|
|
71
|
+
|
|
72
|
+
Alpha, like the rest of Tidebase. The step input hash matches the TypeScript SDK for common JSON types, so both SDKs can drive the same run (caveat: floats like `1.0` hash differently between the two — avoid mixing SDKs on steps whose input contains them).
|
tidebase-0.5.0/README.md
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
# tidebase (Python SDK)
|
|
2
|
+
|
|
3
|
+
Python SDK for [Tidebase](https://tidebase.dev) — the open-source checkpoint layer for AI agents: wrap your steps, and failed runs resume from the last safe point — in your own Postgres, without moving execution into a new runtime.
|
|
4
|
+
|
|
5
|
+
Zero dependencies (stdlib only), Python 3.9+.
|
|
6
|
+
|
|
7
|
+
```python
|
|
8
|
+
from tidebase import Tidebase
|
|
9
|
+
|
|
10
|
+
tide = Tidebase() # reads TIDEBASE_URL (default http://localhost:7373) and TIDEBASE_API_KEY
|
|
11
|
+
|
|
12
|
+
def workflow(run, input):
|
|
13
|
+
plan = run.step("plan", lambda: make_plan(input))
|
|
14
|
+
sources = run.step("fetch-sources", lambda: fetch_sources(plan))
|
|
15
|
+
|
|
16
|
+
run.state.set({"status": "writing", "progress": 0.7})
|
|
17
|
+
|
|
18
|
+
decision = run.gate("approve-report", "Send the report to the customer?")
|
|
19
|
+
if not decision.approved:
|
|
20
|
+
raise RuntimeError("not approved")
|
|
21
|
+
|
|
22
|
+
return run.step("write-report", lambda: write_report(sources))
|
|
23
|
+
|
|
24
|
+
tide.run("generate-report", workflow, run_id=run_id)
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
Re-invoke with the same `run_id` after a crash: completed steps return from their checkpoints instantly; only unfinished steps execute.
|
|
28
|
+
|
|
29
|
+
## Surface
|
|
30
|
+
|
|
31
|
+
| Call | Does |
|
|
32
|
+
|---|---|
|
|
33
|
+
| `tide.run(name, workflow, run_id=…, input=…)` | Create or resume a run |
|
|
34
|
+
| `run.step(name, fn, side_effects=…, idempotency_key=…, retries=…)` | Checkpoint a unit of work; replays from storage on resume |
|
|
35
|
+
| `run.state.set / patch / save / versions` | Live state + versioned history (snapshot = labeled version) |
|
|
36
|
+
| `run.gate(name, prompt)` | Durable human approval; resolves exactly once |
|
|
37
|
+
| `run.child(...)` / `run.fanout(name, children)` | Subagents as child runs, idempotent by edge name, durable join |
|
|
38
|
+
| `run.usage.record(kind=…, input_tokens=…, cost_usd=…)` | Per-run token/cost ledger, no LLM proxy |
|
|
39
|
+
| `tide.runs.create / get / list / recover / subscribe` | Run API + SSE event stream |
|
|
40
|
+
| `tidebase.verify_webhook_signature(body, header, secret)` | Verify signed recovery/channel webhooks |
|
|
41
|
+
|
|
42
|
+
External writes should declare `side_effects` and an `idempotency_key`; otherwise a final failure is classified `manual_review` instead of silently retrying — that's the [replay contract](https://tidebase.dev/docs/replay-contract-is-it-safe-to-rerun/).
|
|
43
|
+
|
|
44
|
+
## Tests
|
|
45
|
+
|
|
46
|
+
Integration tests assert the durability invariants against a real server:
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
docker compose up -d postgres && pnpm server # in the repo root
|
|
50
|
+
python3 -m unittest discover sdk-python/tests -v
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
## Status
|
|
54
|
+
|
|
55
|
+
Alpha, like the rest of Tidebase. The step input hash matches the TypeScript SDK for common JSON types, so both SDKs can drive the same run (caveat: floats like `1.0` hash differently between the two — avoid mixing SDKs on steps whose input contains them).
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["hatchling"]
|
|
3
|
+
build-backend = "hatchling.build"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "tidebase"
|
|
7
|
+
version = "0.5.0"
|
|
8
|
+
description = "Python SDK for Tidebase — the open-source checkpoint layer for AI agents. Wrap your steps, and failed runs resume from the last safe point, in your own Postgres."
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
license = "Apache-2.0"
|
|
11
|
+
requires-python = ">=3.9"
|
|
12
|
+
authors = [{ name = "BlueprintLab" }]
|
|
13
|
+
keywords = ["ai-agents", "checkpoint", "durable", "workflow", "postgres", "resume", "human-in-the-loop"]
|
|
14
|
+
classifiers = [
|
|
15
|
+
"Development Status :: 3 - Alpha",
|
|
16
|
+
"Intended Audience :: Developers",
|
|
17
|
+
"Programming Language :: Python :: 3",
|
|
18
|
+
"Topic :: Software Development :: Libraries",
|
|
19
|
+
]
|
|
20
|
+
|
|
21
|
+
[project.urls]
|
|
22
|
+
Homepage = "https://tidebase.dev"
|
|
23
|
+
Repository = "https://github.com/BlueprintLabIO/tidebase"
|
|
24
|
+
Documentation = "https://tidebase.dev/docs/"
|
|
25
|
+
|
|
26
|
+
[tool.hatch.build.targets.wheel]
|
|
27
|
+
packages = ["src/tidebase"]
|