Skip to main content

ATB Python SDK

The ATB Python SDK writes tamper-evident audit bundles in the same format as the Go CLI; bundles written by the SDK are verifiable with atb verify.

Installation

pip install atb-sdk

Framework adapters are optional. Install only the integration you use, for example pip install 'atb-sdk[langchain]' or pip install 'atb-sdk[pageindex]'.

For a reproducible contributor checkout (CI uses the same pin file):

python -m pip install -r requirements-dev.txt
python -m pip install -e .[dev] --no-deps

Release tooling is intentionally separate in requirements-release.txt; it is not required for normal SDK development. CI-only Bandit dependencies are kept in requirements-security.txt.

Quick example

from atb import Bundle
from atb.event_types import (
    AI_MODEL_INVOKED_EVENT_TYPE,
    AI_REQUEST_RECEIVED_EVENT_TYPE,
)

bundle = Bundle()

bundle.append(
    AI_REQUEST_RECEIVED_EVENT_TYPE,
    {
        "request_id": "req-001",
        "actor_id_hash": "hash-user-01",
        "purpose_tag": "quickstart_demo",
    },
)

bundle.append(
    AI_MODEL_INVOKED_EVENT_TYPE,
    {
        "model_provider": "openai",
        "model_id": "gpt-4o-mini",
        "model_parameters_digest": "sha256-params-abc",
        "prompt_digest": "sha256-prompt-def",
    },
)

path = bundle.save("run.atb/bundle.atb")
bundle.verify()  # local hash-chain and supported signature checks
print(path)

Supported event types

Canonical constants live in atb/event_types_generated.py (generated from schemas/event.v1.json; do not edit by hand). ai.* and atb.* families are distinct wire types — for example ai.human.approval is not atb.human.approval, and ai.retrieval.executed is not atb.event.rag_retrieval.

Event type constant name Event type string
BUNDLE_MANIFEST_EVENT_TYPE atb.bundle.manifest
BUNDLE_ANCHOR_EVENT_TYPE atb.bundle.anchor
BUNDLE_SIGNATURE_EVENT_TYPE atb.bundle.signature
SNAPSHOT_EVENT_TYPE atb.snapshot
AI_REQUEST_RECEIVED_EVENT_TYPE ai.request.received
AI_RESPONSE_SENT_EVENT_TYPE ai.response.sent
AI_LLM_CALL_EVENT_TYPE ai.llm.call
AI_TOOL_EXEC_EVENT_TYPE ai.tool.exec
AI_CHAIN_RUN_EVENT_TYPE ai.chain.run
AI_POLICY_DECISION_EVENT_TYPE ai.policy.decision
AI_RETRIEVAL_EXECUTED_EVENT_TYPE ai.retrieval.executed
AI_MODEL_INVOKED_EVENT_TYPE ai.model.invoked
AI_MODEL_OUTPUT_EVENT_TYPE ai.model.output
RAG_INDEX_EVENT_TYPE atb.event.rag_index
RAG_RETRIEVAL_EVENT_TYPE atb.event.rag_retrieval
AI_ACTION_PRECOMMIT_EVENT_TYPE ai.action.precommit
AI_ACTION_EXECUTED_EVENT_TYPE ai.action.executed
AI_ACTION_COMMITTED_EVENT_TYPE ai.action.committed
AI_ACTION_ERROR_EVENT_TYPE ai.action.error
AI_HUMAN_APPROVAL_EVENT_TYPE ai.human.approval
AI_JOB_SCHEDULED_EVENT_TYPE ai.job.scheduled
AI_JOB_STARTED_EVENT_TYPE ai.job.started
AI_JOB_STEP_EVENT_TYPE ai.job.step
AI_JOB_COMPLETED_EVENT_TYPE ai.job.completed
DATA_EXPORT_PRECOMMIT_EVENT_TYPE data.export.precommit
DATA_EXPORT_EXECUTED_EVENT_TYPE data.export.executed
DATA_EXPORT_ERROR_EVENT_TYPE data.export.error
TOOL_CALL_EVENT_TYPE atb.tool.call
DATA_EXPORT_EVENT_TYPE atb.data.export
HUMAN_OVERRIDE_EVENT_TYPE atb.human.override
HUMAN_APPROVAL_EVENT_TYPE atb.human.approval
CAPTURE_SCOPE_EVENT_TYPE atb.capture.scope
CAPTURE_REJECTED_EVENT_TYPE atb.capture.rejected

Profile support

Bundle.verify() checks local hash-chain integrity and supported signature records. To evaluate ATB obligation profiles, incident findings, anchors, and the full verify.report.v1 contract, hand the same file to the Go CLI:

atb verify --bundle run.atb/bundle.atb --profile atb.profile.rag_answer

Bundle.load() rejects records above 16 MiB and defaults to 512 MiB and one million records per bundle. Use the max_bytes and max_records keyword arguments to choose lower limits for untrusted inputs.

Optional reviewer identity evidence

Oversight gates accept advanced, digest-only identity context:

from atb import ActionGateInput, IdentityEvidence

action = ActionGateInput(
    "deploy",
    "production/api",
    "release candidate",
    {"version": "2026.06"},
    identity_evidence=IdentityEvidence(
        identity_provider="https://idp.example",
        subject="reviewer@example",
        auth_context="mfa",
        assertion_type="jwt",
        assertion_digest="sha256:...",
    ),
)

Retain and verify the original assertion in your IdP/JWKS/PKI workflow. ATB hash-chains the supplied digest but does not authenticate the subject.

See the agent incident demo for an offline incident-forensics flow.

Optional Mortise custody

Mortise is a separate service; the SDK remains fully local without it. To lodge or remotely verify a completed bundle:

import os
from pathlib import Path

from atb import MortiseClient

client = MortiseClient(
    "https://mortise.example",
    token=os.environ["ATB_MORTISE_TOKEN"],
)
bundle = Path("run.atb/bundle.atb").read_bytes()
verification = client.verify_bundle(bundle)  # does not persist
receipt = client.ingest_bundle(bundle)  # WORM custody + signed receipt
assert client.verify_receipt(receipt)["verified"] is True
matches = client.receipts_by_hash(receipt["bundle_hash"])

The client rejects credential-bearing or non-HTTP(S) URLs, does not follow redirects, caps responses at 1 MiB, and validates the frozen custos.receipt.v1 wire identifier.

LangChain integration

For LangChain middleware guidance, see docs/integrations/.

Licence

MIT.

Metadata

Release files for atb-sdk 1.16.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 atb-sdk 1.16.0
File Size Uploaded
atb_sdk-1.16.0.tar.gz 78.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for atb-sdk 1.16.0
File Interpreter ABI Platform
atb_sdk-1.16.0-py3-none-any.whl Python 3 none any Details

Total release size: 143.0 kB

Release files / atb_sdk-1.16.0.tar.gz

Download URL atb_sdk-1.16.0.tar.gz
Size 78.3 kB
Tags Source
SHA-256 checksum
How to use checksums
ec5057e7af3f01568d34a0f495684b779716a5b4fbdbe7a1d0c5eb851ec05056
BLAKE2b-256 checksum
How to use checksums
145e45307379a2f1410d21bed0ab474abeab626796067531b6e5732c33827c24
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.13

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 14, 2026.

Transparency log

Release files / atb_sdk-1.16.0-py3-none-any.whl

Download URL atb_sdk-1.16.0-py3-none-any.whl
Size 64.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0528d2848b2f846f2e6281e29b7d17f17429d9278aa847c9ea748ff24198e5e3
BLAKE2b-256 checksum
How to use checksums
c6409dc4b950597a39d177d510edf229e1ec10b1366c6421272a62ca1c83253e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.13

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 14, 2026.

Transparency log

Release history Release notifications | RSS feed

1.18.1

2 release files

This release

1.16.0 This release

2 release files

1.15.4

2 release files

1.15.3

2 release files

1.14.5

2 release files

1.14.4

2 release files

1.9.0

2 release files

1.8.1

2 release files

1.8.0

2 release files

1.7.3

2 release files

1.7.2

2 release files

1.7.1

2 release files

1.7.0

2 release files

1.6.0

2 release files

1.5.1

2 release files

1.5.0

2 release files

1.4.0

2 release files

1.0.3

2 release files

1.0.2

2 release files

1.0.1

2 release files

1.0.0

2 release files

0.1.2

2 release files

0.1.1

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