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 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 in v0.9.6

# 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

Release files for treeship-sdk 0.31.8

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.31.8
File Size Uploaded
treeship_sdk-0.31.8.tar.gz 35.9 kB Details

Built distribution (wheel)

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

Total release size: 63.7 kB

Release files / treeship_sdk-0.31.8.tar.gz

Download URL treeship_sdk-0.31.8.tar.gz
Size 35.9 kB
Tags Source
SHA-256 checksum
How to use checksums
19a5efb3c7e2e036fa0b19252a5e51aa922d6a4ea0f61ce11bb17bea585a8633
BLAKE2b-256 checksum
How to use checksums
9bae893549a4b1e06eb41b0e5bbc9ec831c0756c60b8a64fa8878082c45f63b4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.14

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

Download URL treeship_sdk-0.31.8-py3-none-any.whl
Size 27.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
73f40c70bec1eb74c8c1dba4f6be95cd03a2ec9fd18fc506f88b85e999c12421
BLAKE2b-256 checksum
How to use checksums
361c733d83c01ee0f076266be62f1a13584051dc5d33e0b21c6e45c2f92dced9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.14

Release history Release notifications | RSS feed

0.31.9

2 release files

This release

0.31.8 This release

2 release files

0.31.7

2 release files

0.31.6

2 release files

0.31.5

2 release files

0.31.4

2 release files

0.31.3

2 release files

0.31.2

2 release files

0.25.3

2 release files

0.25.2

2 release files

0.25.1

2 release files

0.25.0

2 release files

0.24.0

2 release files

0.21.0

2 release files

0.20.0

2 release files

0.19.1

2 release files

0.19.0

2 release files

0.15.0

2 release files

0.14.0

2 release files

0.13.0

2 release files

0.11.1

2 release files

0.11.0

2 release files

0.10.4

2 release files

0.10.3

2 release files

0.10.2

2 release files

0.10.0

2 release files

0.9.11

2 release files

0.9.10

2 release files

0.9.9

2 release files

0.9.8

2 release files

0.9.7

2 release files

0.9.6

2 release files

0.9.5

2 release files

0.9.4

2 release files

0.9.3

2 release files

0.9.2

2 release files

0.9.1

2 release files

0.9.0

2 release files

0.8.0

2 release files

0.7.2

2 release files

0.7.1

2 release files

0.7.0

2 release files

0.6.1

2 release files

0.6.0

2 release files

0.5.0

2 release files

0.4.0

2 release files

0.3.1

2 release files

0.3.0

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.1

2 release files

0.1.0

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