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
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
treeship_sdk-0.27.0.tar.gz
(33.1 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file treeship_sdk-0.27.0.tar.gz.
File metadata
- Download URL: treeship_sdk-0.27.0.tar.gz
- Upload date:
- Size: 33.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/7.0.0 CPython/3.12.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fc8fa9cfc4e60a4b72e6a5b011833f9f9939f7a2f83128f2f35ddd06f5ac48b2
|
|
| MD5 |
9d5da4f3922282b925047eb44ce3e394
|
|
| BLAKE2b-256 |
3c7eea23b58d7b2fb48704c24912c23f4714765ef64fbfa1aae8bc8154cd4c7d
|
File details
Details for the file treeship_sdk-0.27.0-py3-none-any.whl.
File metadata
- Download URL: treeship_sdk-0.27.0-py3-none-any.whl
- Upload date:
- Size: 26.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/7.0.0 CPython/3.12.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
515eb06cd63cec795cbe0efafd56d9a713920defcae9433f46039d45f2f34ff0
|
|
| MD5 |
eff275d33031fb86d6aef2c03ba45c6c
|
|
| BLAKE2b-256 |
87a5aebb7d75a87692023873528557f6b12805f91c42d1863dd338ca7fc3a5d1
|