Skip to main content

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.

Project description

tidebase (Python SDK)

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, without moving execution into a new runtime.

Zero dependencies (stdlib only), Python 3.9+.

from tidebase import Tidebase

tide = Tidebase()  # reads TIDEBASE_URL (default http://localhost:7373) and TIDEBASE_API_KEY

def workflow(run, input):
    plan = run.step("plan", lambda: make_plan(input))
    sources = run.step("fetch-sources", lambda: fetch_sources(plan))

    run.state.set({"status": "writing", "progress": 0.7})

    decision = run.gate("approve-report", "Send the report to the customer?")
    if not decision.approved:
        raise RuntimeError("not approved")

    return run.step("write-report", lambda: write_report(sources))

tide.run("generate-report", workflow, run_id=run_id)

Re-invoke with the same run_id after a crash: completed steps return from their checkpoints instantly; only unfinished steps execute.

Surface

Call Does
tide.run(name, workflow, run_id=…, input=…) Create or resume a run
run.step(name, fn, side_effects=…, idempotency_key=…, retries=…) Checkpoint a unit of work; replays from storage on resume
run.state.set / patch / save / versions Live state + versioned history (snapshot = labeled version)
run.gate(name, prompt) Durable human approval; resolves exactly once
run.child(...) / run.fanout(name, children) Subagents as child runs, idempotent by edge name, durable join
run.usage.record(kind=…, input_tokens=…, cost_usd=…) Per-run token/cost ledger, no LLM proxy
tide.runs.create / get / list / recover / subscribe Run API + SSE event stream
tide.runs.attach(name, run_id=…, heartbeat_s=…) Session runs (v0.6): a RunSession holding the lease via background heartbeat, with complete() / fail() — for gateways, REPLs, multi-request runs
run.gates.begin(name, prompt) / run.gates.get(gate_id) Non-blocking gates (v0.6): begin is idempotent per name; retried callers converge on one decision
tidebase.verify_webhook_signature(body, header, secret) Verify signed recovery/channel webhooks

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.

Tests

Integration tests assert the durability invariants against a real server:

docker compose up -d postgres && pnpm server   # in the repo root
python3 -m unittest discover sdk-python/tests -v

Status

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).

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

tidebase-0.7.0.tar.gz (15.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

tidebase-0.7.0-py3-none-any.whl (14.2 kB view details)

Uploaded Python 3

File details

Details for the file tidebase-0.7.0.tar.gz.

File metadata

  • Download URL: tidebase-0.7.0.tar.gz
  • Upload date:
  • Size: 15.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.5.4

File hashes

Hashes for tidebase-0.7.0.tar.gz
Algorithm Hash digest
SHA256 bc78bb8843a28951a3b03fa81b9be0f5f9b0e391d1460cc3d1fdcb348026ec0b
MD5 011e2c60caf371b4dae29b4d05eed95b
BLAKE2b-256 3619fc60b1c1a7d2127af2b4c0801ddc3cafc0351f75a878ae712c0ad8b9e38e

See more details on using hashes here.

File details

Details for the file tidebase-0.7.0-py3-none-any.whl.

File metadata

  • Download URL: tidebase-0.7.0-py3-none-any.whl
  • Upload date:
  • Size: 14.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.5.4

File hashes

Hashes for tidebase-0.7.0-py3-none-any.whl
Algorithm Hash digest
SHA256 80bf2caffdf738b48bdaf3eec1220a4033edcc7d14c18ff2dc45ed51b175205c
MD5 82fae2d11ffc2859441f753302830425
BLAKE2b-256 59e4fbdd3cbcb7a2a0cfe2d4cd0719dfdf9029de97942ff085d1e2eeb92fdb96

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page