Treeship for Claude Commerce Agents
Signed, offline-verifiable receipts for every tool call in anthropics/commerce-agents, on all three of its runtimes.
The reference draws its own boundary in docs/safety.md: the approval surface, payment,
and log hygiene are "what a deployment owns". This package is what a deployment adds for
the record of what happened. It records; it does not gate. The reference's provenance
gates, caps, and host approval still decide what runs.
What it does
commerce_common.execution.BaseToolExecutor.execute is the one method every tool call
passes through on the Messages API, the Agent SDK, and Managed Agents. TreeshipExecutorMixin
overrides it:
- a signed intent receipt before dispatch: tool, SHA-256 of the canonical arguments, session tag;
- the tool, exactly as the reference runs it;
- a signed result receipt: status (
ok,blockedwith the gate's name,error), SHA-256 of the result text, event types, timing.
Each receipt names its parent, so a session reads intent → result → intent → result … from
the Treeship session's root, and treeship verify walks it as one chain. A held call is a
signed refusal, not a missing receipt.
Never written: the arguments, the result text (fenced third-party content on the reference), or the commerce session id (the request credential). The receipt carries the same twelve-hex session tag the reference's own log lines use, so an operator holding the id can correlate and a reader cannot.
Install
# from a clone of anthropics/commerce-agents, with its venv active
pip install -r requirements.txt # their seven packages (unregistered on PyPI)
pip install treeship-sdk
pip install "treeship-commerce @ git+https://github.com/zerkerlabs/treeship.git#subdirectory=integrations/commerce-agents" # PyPI publication follows the next release
curl -fsSL https://treeship.dev/install | sh && treeship init
Use
from treeship_sdk import Treeship
from treeship_commerce import TreeshipReceipts, attach, receipted
from treeship_commerce.lifecycle import close_session, start_session
from shopping_agent.executor import ShoppingToolExecutor
ts = Treeship()
root = start_session(ts, name="storefront:acme", actor="agent://shopping")
executor = receipted(ShoppingToolExecutor)(backend=..., config=..., skills=..., session=..., state=..., memory=...)
attach(executor, TreeshipReceipts(ts, actor="agent://shopping", session_id=session.session_id, parent_id=root))
# ... the runtime calls executor.execute(...) as it always did ...
close_session(ts, summary="...") # seals a .treeship package; `treeship session report` publishes it
All three runtimes construct executors themselves through executor_class
(ShoppingAgent, ShoppingToolset, the MCP server's build_server). Give
receipted() a recorder factory and each executor gets its own recorder on
its first tool call:
ReceiptedShopping = receipted(ShoppingToolExecutor, recorder=lambda ex: TreeshipReceipts(
ts, actor="agent://shopping", session_id=ex._session.session_id, parent_id=root))
Same for MerchantToolExecutor.
Recording never breaks the agent path: a receipt that cannot be written warns once, is
counted in TreeshipReceipts.dropped, and later results say intent_recorded: false where
the intent is missing. Nothing is invented. TREESHIP_DISABLE=1 turns recording off.
Demo
TREESHIP_BIN=... python -m treeship_commerce.demo
Runs the reference's shopping executor over the retail mock with no model and no API key:
a search, a product read, an add, an add the provenance gate holds, a checkout hand-off.
Prints every receipt id, seals the session, and shows the treeship verify command.
What this does not do (yet)
- Approvals. The merchant
apply_changegate checks a mark the host sets. Turning that mark into a signed, single-use Treeship approval (nonce echoed by the apply receipt, enforced by the Approval Use Journal) is the next piece. - Checkout hand-off receipt. Signing the cart digest and hosted-checkout URL digest at
checkout_handoff, chained to the host's order placement. - Prove the work is correct. A receipt is evidence of what ran and what the gates decided. It does not make a wrong answer right.
Tests
TREESHIP_BIN=/path/to/treeship python -m pytest
Six cases on a real isolated ship and the real retail mock: chain order and linkage, a held
call signed as blocked with its gate, digests-only content, recording failure leaving the
tool untouched, TREESHIP_DISABLE, and attach refusing an executor that would record
nothing.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
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_commerce-0.28.0.tar.gz.
File metadata
- Download URL: treeship_commerce-0.28.0.tar.gz
- Upload date:
- Size: 16.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
02ca4163630487ab26dc56c59c1786c94379d294f58c3ce48fd86fc68bdb7ffb
|
|
| MD5 |
6de8953ad500c8fd11ea9a72f4cb4f1d
|
|
| BLAKE2b-256 |
908fed874bea554e46028cde2ebcb34e09c5e6d04471e96b4d1f438eccb910f4
|
Provenance
The following attestation bundles were made for treeship_commerce-0.28.0.tar.gz:
Publisher:
release.yml on zerkerlabs/treeship
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
treeship_commerce-0.28.0.tar.gz -
Subject digest:
02ca4163630487ab26dc56c59c1786c94379d294f58c3ce48fd86fc68bdb7ffb - Sigstore transparency entry: 2744485597
- Sigstore integration time:
-
Permalink:
zerkerlabs/treeship@4528402c75038a12a503c8a6a94151a34f5d5eb5 -
Branch / Tag:
refs/tags/v0.28.0 - Owner: https://github.com/zerkerlabs
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@4528402c75038a12a503c8a6a94151a34f5d5eb5 -
Trigger Event:
push
-
Statement type:
File details
Details for the file treeship_commerce-0.28.0-py3-none-any.whl.
File metadata
- Download URL: treeship_commerce-0.28.0-py3-none-any.whl
- Upload date:
- Size: 12.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5cb9134e1e913d7450a7d426dfeccd5c9adaadeecd5d7ea17d26475c7edde85d
|
|
| MD5 |
4aed203a35ef8f0082aef6139d278124
|
|
| BLAKE2b-256 |
56b0167dfc2896458479b5351bcc68e32508be2ca75056a20dfa75d5ef2e5af4
|
Provenance
The following attestation bundles were made for treeship_commerce-0.28.0-py3-none-any.whl:
Publisher:
release.yml on zerkerlabs/treeship
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
treeship_commerce-0.28.0-py3-none-any.whl -
Subject digest:
5cb9134e1e913d7450a7d426dfeccd5c9adaadeecd5d7ea17d26475c7edde85d - Sigstore transparency entry: 2744485648
- Sigstore integration time:
-
Permalink:
zerkerlabs/treeship@4528402c75038a12a503c8a6a94151a34f5d5eb5 -
Branch / Tag:
refs/tags/v0.28.0 - Owner: https://github.com/zerkerlabs
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@4528402c75038a12a503c8a6a94151a34f5d5eb5 -
Trigger Event:
push
-
Statement type: