curva-ai
The Python package for Curva, which gives typed decisions with calibrated probabilities from any LLM. The SDK uses the standard library only.
pip install curva-ai
On Linux, macOS and Windows the wheel also contains the curva server binary, so there is nothing else to install. Set one model key of any provider (GEMINI_API_KEY, OPENROUTER_API_KEY, OPENAI_API_KEY, ANTHROPIC_API_KEY, AWS_BEARER_TOKEN_BEDROCK, GROQ_API_KEY, ...), exported or in a .env file, and decide:
import curva
d = curva.decide("I was charged twice for order A-104, please refund me",
{"team": ["billing", "technical"], "refund": "Asks for a refund?", "order": str})
print(d.team, d.refund, d.order) # billing True A-104
d["team"].confidence # how sure, from 0 to 1
The first curva.decide starts a private server for this Python process and stops it when Python exits. Curva picks a small, fast model of the provider whose key it finds; set CURVA_MODEL to choose one. Pictures, PDFs, recordings and cameras go through the same call: images=["photo.jpg"], sources="contracts" (after curva.library("contracts").add("contract.pdf")), assets={"call": Asset.audio("call.wav")}, and for event in curva.watch("clip.mp4").
For every option, curva.local() returns the client behind it:
import curva
from curva import Choice, Noul
client = curva.local() # starts `curva serve` on a free localhost port; it stops when Python exits
d = client.decide(
state={"ticket": "Charged twice, refund please"},
questions={
"team": Choice("Which team?", ["billing", "technical"]),
"refund": Noul("Asks for a refund"),
},
)
d["team"].choice, d["team"].confidence, d["refund"].noul
curva.local(model=..., db=...) passes your environment to the server. Decisions and calibration are kept in ~/.curva/curva.db unless you pass db=, and the server's warnings and errors in server.log next to it. Use it as with curva.local() as client: to stop the server at the end of the block.
Already running a server (curva serve, Docker)? Point a client at it instead:
from curva import Curva
client = Curva("http://localhost:7777") # or CURVA_BASE_URL; CURVA_API_KEY for auth
client.system_one(state=..., questions=...) and Choice(instructions=..., criteria={...}) are accepted as aliases.
Other calls: feedback(d.id, key, label), calibration(key), audit(), models(), drift(key, weeks=8), health(). A Score answer knows its level names, so d["mood"].level is the most likely one. d.request_id is the server's x-request-id header (None if it sends none), for matching server logs.
Curva(timeout=30.0, max_retries=3, retry_statuses=(429, 500, 502, 503, 504), headers={...}): retries honour Retry-After, and headers are sent with every request.
Async and batches
from curva import AsyncCurva
async with AsyncCurva("http://localhost:7777") as client: # same arguments and methods as Curva
d = await client.decide(state, questions)
results = await client.decide_many([(state1, questions), (state2, questions)], concurrency=8)
decide_many returns decisions in input order. With return_exceptions=True a failed item holds its error instead of raising the first one; other keyword arguments (project=, model=, ...) go to every call.
AsyncCurva stays dependency-free by running the blocking client in a worker thread per in-flight request (asyncio.to_thread). That is fine up to hundreds of concurrent calls; the default executor runs at most min(32, cpus + 4) at once and queues the rest.
Route a prompt, and never crash on a failed model
r = curva.route(prompt, {"small-fast": "short questions, lookups", "large-reasoning": "hard reasoning, long code"},
default="large-reasoning", min_confidence=0.7)
r.model, r.confidence # which of your models should answer, and how sure Curva is
d = curva.decide(ticket, {"team": ["billing", "technical"]}, fallback={"team": "billing"})
d.fallback # True when no model could answer and "billing" is your fallback
c = curva.check({"tool": "refund", "amount": 500}, "Refunds above $200 need a manager's approval.")
c.verdict, c.allowed # "block", False: check an agent's action against your policy
g = curva.guard(user_message) # prompt injection, personal data, toxicity
g.verdict # "allow", "review" or "block"
Errors
Every error is a CurvaError with status, type and message (status 0 = server unreachable). Catch a subclass for one case:
| Class | Status |
|---|---|
AuthError |
401 |
InvalidRequestError |
400, 422 |
NotFoundError |
404 |
RateLimitError |
429, with retry_after in seconds |
ModelError |
502, 504 |
A reply that is not JSON, such as a proxy's error page, raises CurvaError with type invalid_response.
Run the tests
The tests use pytest; the SDK itself needs nothing beyond the standard library. From sdk/python:
python3 -m venv .venv && .venv/bin/pip install pytest pytest-cov # the package's `dev` extra
.venv/bin/python -m pytest -m "not e2e" # unit tests, no server, about 10 s
.venv/bin/python -m pytest # plus end-to-end against a real `curva serve`
.venv/bin/python -m pytest --cov=curva --cov-report=term-missing # line coverage of src/curva
End-to-end tests (marker e2e) run the server with a stand-in model, so they need no key and cost nothing. They use the binary in CURVA_BIN, or build it with cargo build -p curva (into CARGO_TARGET_DIR when set). The older end-to-end files read target/debug/curva unless CURVA_BIN is set, so set it when you build elsewhere. Tests marked live call a real provider through the server at CURVA_BASE_URL and run only with CURVA_LIVE=1.
© 2026 Tarkova Private Limited. All rights reserved. Free to use under the Curva Free License (the LICENSE file in this package); Curva and the Curva logo are trademarks of Tarkova Private Limited.
Metadata
Release files for curva-ai 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distributions (wheels)
| File | Actions Reset | |||
|---|---|---|---|---|
| curva_ai-0.1.0-py3-none-win_amd64.whl | Python 3 | none | Windows x86-64 | Details for curva_ai-0.1.0-py3-none-win_amd64.whl |
| curva_ai-0.1.0-py3-none-manylinux_2_28_x86_64.whl | Python 3 | none | Linux glibc 2.28+ x86-64 | Details for curva_ai-0.1.0-py3-none-manylinux_2_28_x86_64.whl |
| curva_ai-0.1.0-py3-none-manylinux_2_28_aarch64.whl | Python 3 | none | Linux glibc 2.28+ ARM64 | Details for curva_ai-0.1.0-py3-none-manylinux_2_28_aarch64.whl |
| curva_ai-0.1.0-py3-none-macosx_11_0_arm64.whl | Python 3 | none | macOS 11.0+ ARM64 | Details for curva_ai-0.1.0-py3-none-macosx_11_0_arm64.whl |
| curva_ai-0.1.0-py3-none-macosx_10_12_x86_64.whl | Python 3 | none | macOS 10.12+ x86-64 | Details for curva_ai-0.1.0-py3-none-macosx_10_12_x86_64.whl |
| curva_ai-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for curva_ai-0.1.0-py3-none-any.whl |
Total release size: 40.9 MB
Release files / curva_ai-0.1.0-py3-none-win_amd64.whl
| Download URL | curva_ai-0.1.0-py3-none-win_amd64.whl |
|---|---|
| Size | 8.5 MB |
| Tags | Python 3 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
f728c1f223a99555103f952bb0c8dafac1a2029a94705a6caba896a0b572853d
|
|
BLAKE2b-256 checksum How to use checksums |
2cf39ff94f38df8162786ad80068f24b5b508b977057eda9a2c5c7329e923a8d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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 Dec 2, 2026.
Transparency logRelease files / curva_ai-0.1.0-py3-none-manylinux_2_28_x86_64.whl
| Download URL | curva_ai-0.1.0-py3-none-manylinux_2_28_x86_64.whl |
|---|---|
| Size | 8.5 MB |
| Tags | Linux glibc 2.28+ x86-64 Python 3 |
|
SHA-256 checksum How to use checksums |
4677bedc76be8caa21280afc526bfe1609a4b3f5fe5bf2687fbe3ca21363c188
|
|
BLAKE2b-256 checksum How to use checksums |
8b86673abfa7fe4a5da008b0cc2a96934e0519f51da21d869c27c247c253b71b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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 Dec 2, 2026.
Transparency logRelease files / curva_ai-0.1.0-py3-none-manylinux_2_28_aarch64.whl
| Download URL | curva_ai-0.1.0-py3-none-manylinux_2_28_aarch64.whl |
|---|---|
| Size | 8.0 MB |
| Tags | Linux glibc 2.28+ ARM64 Python 3 |
|
SHA-256 checksum How to use checksums |
1bdadd65545e2f536dd97a1884d929e6ec3015a016d9f092e2f0b556cc06deb1
|
|
BLAKE2b-256 checksum How to use checksums |
f4e22486bb200ffb2293f4ac3c6533b243c8f46ebe6897c3550a06d4aadded62
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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 Dec 2, 2026.
Transparency logRelease files / curva_ai-0.1.0-py3-none-macosx_11_0_arm64.whl
| Download URL | curva_ai-0.1.0-py3-none-macosx_11_0_arm64.whl |
|---|---|
| Size | 7.7 MB |
| Tags | Python 3 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
bb87c8f32d24edec90f43fe9e902bba7f095387de847117351ac233ba0a7f094
|
|
BLAKE2b-256 checksum How to use checksums |
08867e9789d73272c3df59ed6dd9b8ec065176de5763c279b41dfba2daf34d72
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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 Dec 2, 2026.
Transparency logRelease files / curva_ai-0.1.0-py3-none-macosx_10_12_x86_64.whl
| Download URL | curva_ai-0.1.0-py3-none-macosx_10_12_x86_64.whl |
|---|---|
| Size | 8.2 MB |
| Tags | Python 3 macOS 10.12+ x86-64 |
|
SHA-256 checksum How to use checksums |
f9777f93e06dfd35d6647554ec214ecadc2c2c0dd265ab62a903a355f9726d40
|
|
BLAKE2b-256 checksum How to use checksums |
1d06322c00bde3a037b25e28308424b849e59987721541ee3a1782b800a0c493
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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 Dec 2, 2026.
Transparency logRelease files / curva_ai-0.1.0-py3-none-any.whl
| Download URL | curva_ai-0.1.0-py3-none-any.whl |
|---|---|
| Size | 62.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a9e49ba1144e82e84f0bc77240ece1e9a1eb66defa214271fe05920e60de620d
|
|
BLAKE2b-256 checksum How to use checksums |
b5fce8bab2203d2371ddc8824732b536b6e28f0f12ed42bb9dd3a54ff51f08c5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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 Dec 2, 2026.
Transparency logSecurity for curva-ai 0.1.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.
Full provenance
All 6 files in this release have been uploaded with provenance metadata.
Attestation for curva_ai-0.1.0-py3-none-win_amd64.whl
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 Dec 2, 2026.
Transparency logA 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.