Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

underwrit-client

Integrate an agent runtime with an Underwrit data plane. Standard library only.

import os
from underwrit_client import Underwrit, Held

underwrit = Underwrit("http://127.0.0.1:8787", token=os.environ["UNDERWRIT_AGENT_TOKEN"])

with underwrit.session(agent="ops-assistant", environment="production",
                  intent="Restart api during incident 4417") as s:
    logs = s.call("k8s/get_k8s_logs", get_logs, pod="api-1")
    try:
        s.call("k8s/rollout_restart", restart, deployment="api", namespace="prod")
    except Held as h:
        park(h.decision["id"])            # a person answers in the console, then:
        s.resume(h.decision["id"], restart, deployment="api", namespace="prod",
                 verify=lambda r: {"status": "passed", "checks": [{"name": "rollout", "ok": True}]})
  • call() decides, runs the function, and records the outcome. It raises Held when the data plane says act: "hold" — enforcement on, verdict held or denied. In shadow mode nothing is raised and the verdict is still recorded.
  • resume() claims an approval with the same arguments immediately before executing. The claim is refused if the arguments or the stated preconditions changed, the approval expired, the policy now refuses it, or it was already used.
  • A TimeoutError from the wrapped function is recorded as uncertain, and the data plane will not let a retry overwrite that without reconcile=True.
  • verify= records what was observed afterwards, separately from whether the call succeeded.

The full routes are in the Underwrit README; this client adds nothing the service does not do.

Also

  • open_session(..., task_policy={...}) attaches a t=0 task policy; guarded(session, tool) wraps a function so every call goes through the session.
  • decide(..., signals={"taint": True, "risk": 80, "source": "my-classifier"}) lets an external classifier raise taint or risk; it can never lower them.
  • receipt(seq) returns the per-entry receipt (leaf index, tree size, root, inclusion proof, signed checkpoint) once a checkpoint covers the entry; Decision["receipt"] carries the chain position now.
  • 429 and 503 are retried with Retry-After (three times by default, capped at thirty seconds).
  • Held exposes id, verdict, budgeted, duplicate, quorum and risk.
  • decide(..., usage={"usd": 0.42}, delegation=["planner", "ops"], components={"model": "m-1"}) reports cost, the agents behind the call and what the agent is built from; the chain keeps names and digests only.
  • preview(tool, args, session=… | environment=…) asks the gate without recording anything; gates() lists its stages and codes.
  • verify(decision_id, "passed" | "failed" | "inconclusive") lands a verification after the outcome; verifications_due() and approval_load() need a reader's token.
  • compensate(decision_id, tool, args, reason=…) proposes an undo for a decision whose outcome is uncertain or whose verification failed. It always goes to a person; claim it once approved. It does not clear the original's scope hold.

Licence

MIT (see LICENSE). The Underwrit planes this client talks to are licensed separately.

Metadata

Release files for underwrit-client 0.4.1.dev25

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

Source distribution (sdist)

Source distribution for underwrit-client 0.4.1.dev25
File Size Uploaded Provenance Actions
underwrit_client-0.4.1.dev25.tar.gz 24.2 kB Without provenance Details for underwrit_client-0.4.1.dev25.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for underwrit-client 0.4.1.dev25
File Interpreter ABI Platform Actions
underwrit_client-0.4.1.dev25-py3-none-any.whl Python 3 none any Details for underwrit_client-0.4.1.dev25-py3-none-any.whl

Total release size: 55.7 kB

Release files / underwrit_client-0.4.1.dev25.tar.gz

Download URL underwrit_client-0.4.1.dev25.tar.gz
Size 24.2 kB
Tags Source
SHA-256 checksum
How to use checksums
08621e130a93fb5fe35925f9cc5655984020e75e3d8246c9021c7f851804e65f
BLAKE2b-256 checksum
How to use checksums
eb6baef026a286c01442da4539aaf143b35c4fbc523a5c1cb10b5cf87bcc74ca
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / underwrit_client-0.4.1.dev25-py3-none-any.whl

Download URL underwrit_client-0.4.1.dev25-py3-none-any.whl
Size 31.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f66af225e4f3b0a49da627ec93d83f1f05db77bdef64efbacba78a4219243467
BLAKE2b-256 checksum
How to use checksums
177dd9e435ff6967db0b8709f83b385ce63bc36e2f8700b8ba12a7f9af12a231
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Security for underwrit-client 0.4.1.dev25

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.

Release history Release notifications | RSS feed

This release
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