Skip to main content

curb-sdk (Python)

The enforcement point for tool calls — the thing a proxy fundamentally cannot do.

pip install curb-sdk

You need a running Curb control plane for this to do anything. The fastest way: docker compose -f docker-compose.release.yml up -d — see the quickstart.

from curb import Curb, PolicyViolation

curb = Curb(base_url="http://localhost:8090", api_key="dev-key")

@curb.guard_tool(name="delete_file", sensitivity="high")
def delete_file(path: str) -> None:
    os.remove(path)

with curb.run() as run_id:
    # Cost and loops are covered too if your LLM client points at the gateway:
    #   OpenAI(base_url="http://localhost:8080/v1", default_headers=curb.gateway_headers())
    curb.step()                 # enforces step_limit / time_limit
    try:
        delete_file("/tmp/x")   # ASK → held until a human clicks Approve
    except PolicyViolation as e:
        print("denied:", e, e.policy_id)

Behaviour that matters

Decision What happens
ALLOW the tool runs
DENY PolicyViolation is raised; the tool is never called
ASK execution is held until a human decides (long-poll)
THROTTLE waits retryAfterMs, then runs
  • Fail-safe. If the control plane is unreachable, or an approval runs out of time, the default is to deny (fail_mode="closed"). Set fail_mode="open" when availability matters more than protection.
  • run_id propagates automatically through contextvars, so nested tools never need it passed explicitly.

Tests

python -m venv .venv && .venv/bin/pip install -e ".[dev]"
.venv/bin/python -m pytest -q

Release files for curb-sdk 0.2.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 curb-sdk 0.2.0
File Size Uploaded
curb_sdk-0.2.0.tar.gz 8.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for curb-sdk 0.2.0
File Interpreter ABI Platform
curb_sdk-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 16.6 kB

Release files / curb_sdk-0.2.0.tar.gz

Download URL curb_sdk-0.2.0.tar.gz
Size 8.5 kB
Tags Source
SHA-256 checksum
How to use checksums
872262f83f8e9f4f28a3cb0888eb07fa73f88d4b08e7a01dc6d1821948b021b5
BLAKE2b-256 checksum
How to use checksums
a4cb1c26bd30bafa9f95a618f22f085cb3aeac3786635025b98f205e0c8e5161
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 11, 2026.

Transparency log

Release files / curb_sdk-0.2.0-py3-none-any.whl

Download URL curb_sdk-0.2.0-py3-none-any.whl
Size 8.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
991d6ad07ea7fefe39adc8348e64ed692ef5235a9c1e4e387e14664dcd973b6d
BLAKE2b-256 checksum
How to use checksums
801e9c3d53cd0eceb29f56cc9bf022d8cf92e9b7712efbe448a8fe1e6a590a76
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 11, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files

0.1.0

2 release files

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