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

Download files

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

Source Distribution

curb_sdk-0.1.0.tar.gz (8.5 kB view details)

Uploaded Source

Built Distribution

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

curb_sdk-0.1.0-py3-none-any.whl (8.1 kB view details)

Uploaded Python 3

File details

Details for the file curb_sdk-0.1.0.tar.gz.

File metadata

  • Download URL: curb_sdk-0.1.0.tar.gz
  • Upload date:
  • Size: 8.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for curb_sdk-0.1.0.tar.gz
Algorithm Hash digest
SHA256 dcda820f0461970681c0d1c78f62855bebc0e6d39d5ff2b6313f6018fc7871eb
MD5 0aa33ac069ddc5080aee242e05117d62
BLAKE2b-256 dfdb35e2c0b75b32cb0035e77e043e5d3a490ed338195ed6c848af4bc1dfd704

See more details on using hashes here.

Provenance

The following attestation bundles were made for curb_sdk-0.1.0.tar.gz:

Publisher: release.yml on itsnevu/Curb

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file curb_sdk-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: curb_sdk-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 8.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for curb_sdk-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 94b1f64d5b21c024443eb6f76034a2fdfce95668ae2a24f449165867fbeace37
MD5 1cc4d57a3f94276ea2144fbb595e0eaf
BLAKE2b-256 1a4b966d02605b605f1f5c747bf16e0cffc2f1b03e7fc2a826d98b2ad883064d

See more details on using hashes here.

Provenance

The following attestation bundles were made for curb_sdk-0.1.0-py3-none-any.whl:

Publisher: release.yml on itsnevu/Curb

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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