Skip to main content

chronos-gateway

The Python client for Chronos Gateway: AI agents change your Postgres only through checked, approved merges. Each agent task is a run for one tenant, working in its own copy of your data; its merge lands when your rules allow it, or waits for a person to approve it. Standard library only, Python 3.9+.

pip install chronos-gateway
from chronos_gateway import Gateway

gw = Gateway("https://gateway.example.com", key=os.environ["CHRONOS_GATEWAY_KEY"])
with gw.run(tenant=user.org_id, intent="clean up duplicate leads", end_user=user.id) as run:
    agent.tools = run.openai_tools()          # or run.mcp_server() for MCP clients
    agent.invoke(task)
    result = run.propose()
if result.held:
    link = gw.approval(run.id, end_user=user.id)   # show link.html (the <chronos-approve> widget) to the user
  • AsyncGateway runs the same calls for asyncio code.
  • A person approves a part (gw.approve(run.id, only_keys=["leads/7"])), or a link only one person, signed in, can use (gw.approval(run.id, approver="bo@acme.com")).
  • A held run whose reads changed since it began raises GatewayError with code reads_changed (its body says what changed); a person who decides to merge it anyway: gw.approve(run.id, skip_read_check=True).
  • The rules, keys and masks: policy / set_policy, keys / create_key / revoke_key, masks / set_masks; events(last=20) for what happened lately.
  • run.undo(preview=True) shows what undoing a merged run would put back; run.undo() puts it back.
  • run.child(intent, may_change="leads.stage") delegates part of the work to a sub-agent: a run of its own, its world forked from this one's, merging into it; run.children() lists them. The parent proposes once they are done.
  • run.propose(evidence=[{"kind": "ticket", "uri": "...", "sha256": "...", "note": "..."}]) keeps what the change rests on with the run, for whoever approves it. gw.effects() lists effects the gateway delivered.
  • chronos_gateway.adapters: the run's tools for LangChain and LangGraph, the Claude Agent SDK, the OpenAI Agents SDK, CrewAI (crewai_tools(run): query, changes, propose) and Pydantic AI (pydantic_ai_toolset() with deps=pydantic_ai_deps(run)); and ChronosCheckpointSaver(MemorySaver(), run), a LangGraph checkpointer that records each checkpoint on the run (a checkpoint of its world, lg-<id>, where the engine lets the run's agent make one, and always in the run's metadata). Each needs its framework installed; none is imported until asked.
  • A pytest fixture, chronos_run: a run discarded after the test (set CHRONOS_GATEWAY_URL, CHRONOS_GATEWAY_KEY and CHRONOS_GATEWAY_TENANT).
  • verify_signature checks a webhook delivery's Chronos-Signature.

The gateway itself is chronos-gateway, which you run beside your Postgres (or link to Chronos Cloud).

Metadata

Release files for chronos-gateway 0.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for chronos-gateway 0.3.0
File Size Uploaded Provenance Actions
chronos_gateway-0.3.0.tar.gz 18.9 kB Without provenance Details for chronos_gateway-0.3.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for chronos-gateway 0.3.0
File Interpreter ABI Platform Actions
chronos_gateway-0.3.0-py3-none-any.whl Python 3 none any Details for chronos_gateway-0.3.0-py3-none-any.whl

Total release size: 32.8 kB

Release files / chronos_gateway-0.3.0.tar.gz

Download URL chronos_gateway-0.3.0.tar.gz
Size 18.9 kB
Tags Source
SHA-256 checksum
How to use checksums
a01f1c7bfccf4b33f45ced1e7127cd5c057e7ec36cd60da2cc3f79ede2564d9b
BLAKE2b-256 checksum
How to use checksums
c9e79e2e47c243fa87cdd5e8c1c496b45b37b2c068ecdd4d5fea60f23cb777d9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.8 {"installer":{"name":"uv","version":"0.11.8","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / chronos_gateway-0.3.0-py3-none-any.whl

Download URL chronos_gateway-0.3.0-py3-none-any.whl
Size 13.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a7b7cedcd7790147e0574e6cda960dc147414f118defd580971183ad7407d096
BLAKE2b-256 checksum
How to use checksums
8803f2943af92a231a809154610d6c63ce9c12290108245bbfb8b95717752366
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.8 {"installer":{"name":"uv","version":"0.11.8","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Security for chronos-gateway 0.3.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page