Skip to main content

Sealgraf for Composio

Four tools that give a Composio agent a spending conscience: check before buying, owner approval above the owner's own line, and a sealed receipt for every completed purchase.

Sealgraf (https://sealgraf.com) is a spend-approval service for agents. An agent checks a purchase before buying; the check is decided against limits the owner set in advance; a purchase above the owner's approval line waits for the owner to decide on Sealgraf's own surface; and when the purchase completes, the evidence is sealed into a receipt that neither the agent nor the owner can rewrite afterwards.

This package is a Composio local (custom) toolkit for the Python SDK — the current canonical custom-tool form (composio.experimental.Toolkit, Tool Router sessions). It runs in-process in your application, next to Composio's catalog tools. It is not a public-catalog listing; see ../RESEARCH.md for what that would take and why this package is the buildable artifact today.

The four tools

Inside a session they are exposed as LOCAL_SEALGRAF_*:

Tool What it does
LOCAL_SEALGRAF_CHECK_PERMISSION Ask before a purchase. Returns allow (with a single-use decision token), deny, or needs_human_approval with a preauth_id to resume later.
LOCAL_SEALGRAF_CLAIM_DECISION_TOKEN After the owner approves a waiting purchase in Sealgraf, claim its single-use decision token.
LOCAL_SEALGRAF_COMPLETE_PURCHASE Report the finished purchase; Sealgraf seals it into a receipt.
LOCAL_SEALGRAF_GET_RECEIPT Fetch state by exactly one id: a receipt id (reads GET /v1/receipts/{id} — the sealed receipt) or a preauth id (reads GET /v1/preauthorize/{id} — the check record and its current state). With neither id, lists recent receipts.

The spend loop an agent should follow:

check_permission ── allow ─────────────► buy ──► complete_purchase ──► sealed receipt
                 └─ needs_human_approval ─► (owner decides in Sealgraf)
                        ─► claim_decision_token ─► buy ─► complete_purchase
                 └─ deny ─► do not buy

Not the same as Composio's approvals / the HITL toolkit

Composio has an (experimental) session feature that can require the user's approval before chosen tools run, and its catalog carries a generic human-approval toolkit (hitl). Both are in-band, per-call prompts: a person sitting in the agent's client is asked "run this tool?", with no limits, no amounts, and nothing kept afterwards beyond a log line; "always approve" waives the rest of the session.

Sealgraf is different in kind:

  • Limits are set in advance. The owner pre-commits per-purchase and period caps, allowed categories, and an approval threshold (a "mandate"). Most checks are decided automatically against those limits — no human is paged for routine purchases.
  • Approval happens on Sealgraf's own surface, out-of-band from the agent session, and only the owner can give it: an agent key can never approve its own check (enforced server-side).
  • The subject is money, not tool calls: a specific amount, currency, category, and counterparty.
  • The output is a sealed receipt — the check, the decision (and who approved it), and the completion evidence, hash-chained so neither side can rewrite the record.

One line: Composio's approval asks "may this tool run?" in the moment; Sealgraf answers "was this purchase inside the owner's rules, who said yes when it wasn't, and where is the proof?" — before, during, and after the spend.

Setup

pip install sealgraf-composio     # or from this repo: pip install ./toolkit

Configuration is host-side, via environment — never tool arguments (tool arguments are chosen by the model and visible in prompts/logs; the key is a credential):

Variable Required Meaning
SEALGRAF_API_KEY yes An agent-scope Sealgraf API key, sent as the X-API-Key header. The key is bound server-side to one agent and mandate, which is how the tools can leave mandate_id, agent_id and currency unset.
SEALGRAF_BASE_URL no Default https://sealgraf.com. Point it at UAT or a local instance for testing.
SEALGRAF_TIMEOUT_SECONDS no Default 20. Every call has an explicit timeout.

Plus the usual Composio setup for the host app (COMPOSIO_API_KEY).

from composio import Composio
from sealgraf_composio import build_toolkit

composio = Composio()
session = composio.create(
    user_id="default",
    experimental={"custom_toolkits": [build_toolkit(composio)]},
)
tools = session.tools()   # handed to your agent framework as usual

See example_session.py for a runnable wiring, including direct session.execute(...) calls outside an agent loop.

Behaviour guarantees

  • Fail closed. A missing key, timeout, network error, non-2xx response, or malformed response raises an error and fails the tool run. A tool never returns anything that could be read as permission unless Sealgraf actually granted it.
  • needs_human_approval is a normal outcome, not an error. The result carries preauth_id and state: "pending_approval"; the agent pauses and resumes with claim_decision_token once the owner has decided. Only the agent key that ran the check can claim its token.
  • Idempotency. Pass idempotency_key to check_permission and a retried check returns the original record (replayed: true) instead of stacking a second reservation.
  • Amounts are integer minor units (cents) everywhere, matching Sealgraf's API. Categories are Sealgraf's closed enum of 14.

Development

python -m venv .venv && .venv/bin/pip install -e . pytest
cd ../tests && ../toolkit/.venv/bin/python -m pytest . -q

The test suite mocks all HTTP and asserts the exact requests against the production API contract (see ../RESEARCH.md for the contract and its code citations, and ../BUILD-RECORD.md for run evidence).

Metadata

Release files for sealgraf-composio 0.1.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 sealgraf-composio 0.1.0
File Size Uploaded Provenance Actions
sealgraf_composio-0.1.0.tar.gz 14.4 kB Without provenance Details for sealgraf_composio-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for sealgraf-composio 0.1.0
File Interpreter ABI Platform Actions
sealgraf_composio-0.1.0-py3-none-any.whl Python 3 none any Details for sealgraf_composio-0.1.0-py3-none-any.whl

Total release size: 28.1 kB

Release files / sealgraf_composio-0.1.0.tar.gz

Download URL sealgraf_composio-0.1.0.tar.gz
Size 14.4 kB
Tags Source
SHA-256 checksum
How to use checksums
7f1426be0b73eaa003f3afbad2cd4540f2351a3c0f4fe373dee47e458ed55df4
BLAKE2b-256 checksum
How to use checksums
de59a2388abd2d3aa5440f9c172832c0b7d0a334474e52eac5cb6b2a7719e8e6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.3

Release files / sealgraf_composio-0.1.0-py3-none-any.whl

Download URL sealgraf_composio-0.1.0-py3-none-any.whl
Size 13.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b5e7b5ca2cef8a2f14bfdba1d6196f315ff020827512976cbeae1a12d0067340
BLAKE2b-256 checksum
How to use checksums
4bdb514127ad6ef8d6686e51a7be9527467b5124b2e5316626d320e4e678ab2e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.3

Security for sealgraf-composio 0.1.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.1.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