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.6.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.6.0-py3-none-any.whl (14.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: tidebase-0.6.0.tar.gz
  • Upload date:
  • Size: 15.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for tidebase-0.6.0.tar.gz
Algorithm Hash digest
SHA256 8f2d68a711feacb358aaf771e625bf539f9ce460ad07c6f10e02d32f64646e4d
MD5 b0e6a4fa0b0ab68f7a92cb6434662f67
BLAKE2b-256 de4343d21316e4fed5b6bc468073809476f286be7cd46fdd9c2fdaa5ea21cc61

See more details on using hashes here.

File details

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

File metadata

  • Download URL: tidebase-0.6.0-py3-none-any.whl
  • Upload date:
  • Size: 14.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for tidebase-0.6.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2a8e626eef5b352cd08dc657855083703ccd0a61e766edf291a728eb0eee3e83
MD5 28da81a1708628b10b17731e4180f2e6
BLAKE2b-256 acf1e5bb3d8a743d3860b6f751ca9a8343b6552f9d550e12132302fbd696fae4

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