Skip to main content
Delegrity

Python SDK

Propose actions and read results from Python.

Availability: shared with design partners as a package. Not published to a public registry yet. Requires Python 3.11 or later.

import delegrity
from delegrity import DelegrityClient

client = DelegrityClient(
    base_url="https://your-delegrity-address/v1",
    token_provider=workload_identity.current_access_token,
    agent_id="00000000-0000-4000-8000-00000000a9e7",
    session_id="00000000-0000-4000-8000-0000000051c2",
)

proposal = client.rest.submit(
    request_id="request-rest-0001",
    tool_name="update_supplier_contact",
    arguments={
        "supplier_id": "SUP-1042",
        "contact_channel": "EMAIL",
        "contact_value": "payments@example.test",
        "reason": "Update remittance contact",
    },
    instruction="Update supplier contact",
)

settled = client.wait_for_result(proposal.request_id, timeout_seconds=60)
if not delegrity.is_terminal(settled):
    ...  # still awaiting approval, dispatch or reconciliation
client.close()

What it protects

  • HTTPS only, redirects off, and responses capped at 1 MiB.
  • Arguments are checked against the registered contract before any network call.
  • Retries reuse the exact same bytes and idempotency key.
  • Exceptions never include the token or raw response.

Pass token_provider so short-lived tokens can rotate. Don't log or store the value.

View as Markdown