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
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.5.0.tar.gz (13.1 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.5.0-py3-none-any.whl (12.4 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for tidebase-0.5.0.tar.gz
Algorithm Hash digest
SHA256 072f27b0ba960f11b100fde6372af8814deac61c48028d91a852d0a33d4efe51
MD5 2db8646d106a0df0b817baa7092de0d1
BLAKE2b-256 240e9aa217f6ca39d3a6c3aa77b1470cd1474be6f0bafdd2595daa842770d62a

See more details on using hashes here.

File details

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

File metadata

  • Download URL: tidebase-0.5.0-py3-none-any.whl
  • Upload date:
  • Size: 12.4 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.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 46a0d25a6c37640b56e61b742a0182ef24fd0d6ca28fd7c1bd7d6101f916c470
MD5 3b53718ba0d2b802e9e41e888572cd4d
BLAKE2b-256 5f9deadc6b86dd7e927cd8806c652e50923d7a117d1ae24374ac5eda814666c0

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