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.2.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.2.0-py3-none-any.whl (8.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: curb_sdk-0.2.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.2.0.tar.gz
Algorithm Hash digest
SHA256 872262f83f8e9f4f28a3cb0888eb07fa73f88d4b08e7a01dc6d1821948b021b5
MD5 06a7420482a868215878392ea0911267
BLAKE2b-256 a4cb1c26bd30bafa9f95a618f22f085cb3aeac3786635025b98f205e0c8e5161

See more details on using hashes here.

Provenance

The following attestation bundles were made for curb_sdk-0.2.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.2.0-py3-none-any.whl.

File metadata

  • Download URL: curb_sdk-0.2.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.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 991d6ad07ea7fefe39adc8348e64ed692ef5235a9c1e4e387e14664dcd973b6d
MD5 4faf232fd2ca8479d99c4c9d0c3fa220
BLAKE2b-256 801e9c3d53cd0eceb29f56cc9bf022d8cf92e9b7712efbe448a8fe1e6a590a76

See more details on using hashes here.

Provenance

The following attestation bundles were made for curb_sdk-0.2.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