Skip to main content

Nodra Python SDK

Protect consequential Python AI-agent actions with Nodra's deterministic authorization gateway.

Install

pip install nodra-agent-sdk

The distribution name is nodra-agent-sdk; the Python import is nodra.

Quick start

import os
from nodra import Nodra

nodra = Nodra(
    base_url=os.environ["NODRA_BASE_URL"],
    credential=os.environ["NODRA_CREDENTIAL"],
    timeout_seconds=8,
    max_retries=2,
)

finance = nodra.protect("finance-agent")

decision = finance.authorize(
    resource_id="stripe",
    action="payments.submit",
)

if decision["decision"] == "allow":
    submit_payment()

if decision["decision"] == "require-approval":
    print("Waiting for human approval:", decision["authorizationEventId"])

Record evidence

finance.intent(
    "stripe",
    "payments.submit",
    decision="allow",
)

result = submit_payment()

finance.result(
    "stripe",
    "payments.submit",
    decision="allow",
    executed=True,
    outcome="succeeded",
)

Automatic approval continuation

A protected Python runtime can wait for the reviewer and resume without a human copying a token:

final_decision = finance.authorize_and_wait(
    resource_id="stripe",
    action="payments.submit",
    timeout_seconds=300,
    poll_interval_seconds=1.5,
)

if final_decision["decision"] == "allow":
    submit_payment()

The runtime generates the one-time token locally, claims the approved authorization idempotently, and consumes it through Nodra. Plaintext approval tokens are not stored by Nodra.

Low-level wait_for_approval() and execute_approved() methods remain available when an application needs explicit control of the workflow.

Error handling

from nodra import NodraError

try:
    finance.authorize("stripe", "payments.submit")
except NodraError as error:
    print(error.code, error.status, error.request_id, error.retryable)

Security

  • Keep NODRA_CREDENTIAL in server-side secret storage.
  • Never embed it in browser/mobile code.
  • Every request is HMAC signed with a timestamp and nonce.
  • Safe authorization/event requests use bounded retries.
  • One-time approved execution never retries automatically.
  • Nodra remains fail-closed when the gateway cannot authorize an action.

Release files for nodra-agent-sdk 0.1.0

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

Source distribution (sdist)

Source distribution for nodra-agent-sdk 0.1.0
File Size Uploaded
nodra_agent_sdk-0.1.0.tar.gz 5.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for nodra-agent-sdk 0.1.0
File Interpreter ABI Platform
nodra_agent_sdk-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 11.8 kB

Release files / nodra_agent_sdk-0.1.0.tar.gz

Download URL nodra_agent_sdk-0.1.0.tar.gz
Size 5.5 kB
Tags Source
SHA-256 checksum
How to use checksums
4355a84268785d321234c0449eacc16c04d941f32f78821e215d8b1bbb24c1f5
BLAKE2b-256 checksum
How to use checksums
188d7841df8733b4075faa80767d905ae013e9c5668fa033233814209e928bb8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Sep 27, 2026.

Transparency log

Release files / nodra_agent_sdk-0.1.0-py3-none-any.whl

Download URL nodra_agent_sdk-0.1.0-py3-none-any.whl
Size 6.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9c7f4f51f5f445feaba0977ea1be0283ebee7acbf785d60ebdb6537a8d712875
BLAKE2b-256 checksum
How to use checksums
39944ac41d3cea0bc1ce19083613e1180a818d9f558a03d3e64e3c636656ab32
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Sep 27, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

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