Skip to main content

treeship-sdk

Python SDK for Treeship -- portable trust receipts for agent workflows.

Install

pip install treeship-sdk

Requires the treeship CLI binary in PATH:

curl -fsSL https://www.treeship.dev/install | sh
treeship init

Usage

from treeship_sdk import Treeship

ts = Treeship()

# Attest an action
result = ts.attest_action(actor="agent://my-agent", action="tool.call")
print(result.artifact_id)  # art_abc123...

# Attest a decision (LLM reasoning)
ts.attest_decision(
    actor="agent://analyst",
    model="claude-opus-4",
    tokens_in=8432,
    tokens_out=1247,
    summary="Contract looks standard.",
    confidence=0.91,
)

# Attest an approval
approval = ts.attest_approval(
    approver="human://alice",
    description="approve payment max $500",
    allowed_actions=["payments.charge"],   # a scope is required
    max_uses=1,
)
print(approval.nonce)  # binding token; replay enforcement is package-local (no distributed single-use across machines yet)

# Attest with approval binding
ts.attest_action(
    actor="agent://executor",
    action="stripe.charge.create",
    approval_nonce=approval.nonce,
)

# Verify
result = ts.verify("art_abc123")
print(result.outcome)  # "pass"

# Push to Hub
push = ts.hub_push("art_abc123")
print(push.hub_url)  # https://treeship.dev/verify/art_abc123

# Wrap a command
result = ts.wrap("npm test", actor="agent://ci")
print(result.artifact_id)

API

Method Returns Description
attest_action(actor, action, ...) ActionResult Sign an action receipt
attest_approval(approver, description, allowed_actions=..., ...) ApprovalResult Sign a scoped approval with nonce
attest_handoff(from_actor, to_actor, artifacts) ActionResult Sign a handoff receipt
attest_decision(actor, model, ...) ActionResult Sign a decision receipt
verify(artifact_id) VerifyResult Verify an artifact chain
hub_push(artifact_id) PushResult Push artifact to the configured Hub
wrap(command, actor) ActionResult Wrap a shell command

How it works

The SDK calls the treeship CLI binary via subprocess. All signing happens in the Rust binary. The Python SDK is a thin wrapper.

License

Apache-2.0

Metadata

Release files for treeship-sdk 0.32.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 treeship-sdk 0.32.0
File Size Uploaded Provenance Actions
treeship_sdk-0.32.0.tar.gz 35.9 kB Without provenance Details for treeship_sdk-0.32.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for treeship-sdk 0.32.0
File Interpreter ABI Platform Actions
treeship_sdk-0.32.0-py3-none-any.whl Python 3 none any Details for treeship_sdk-0.32.0-py3-none-any.whl

Total release size: 63.8 kB

Release files / treeship_sdk-0.32.0.tar.gz

Download URL treeship_sdk-0.32.0.tar.gz
Size 35.9 kB
Tags Source
SHA-256 checksum
How to use checksums
b253f3c35e257b348a5927373dbecd727b4f485e4952304112207f8c0a81c6c8
BLAKE2b-256 checksum
How to use checksums
48c8c49a48afb923fc7a13f6fea7c5ccd784c8d6d6cb390a420ffe3003b85667
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.15

Release files / treeship_sdk-0.32.0-py3-none-any.whl

Download URL treeship_sdk-0.32.0-py3-none-any.whl
Size 27.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5ac89dff6f3e1d082580010d8a4e6dd8904fb446f3ba74f7b4acf73c171ec0db
BLAKE2b-256 checksum
How to use checksums
2b31849032397713dc4f68524caaae9abc64ad58e5334a54ac2da94346cb1c4e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.15

Security for treeship-sdk 0.32.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.

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

0.32.0 This release

2 release files No provenance

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