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 a local toolkit, not a public-catalog listing.

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={"local_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 list of 17: groceries, household, dining, travel, software, office_supplies, shopping, transport, entertainment, health, supplies, materials, equipment, fuel, services, shipping, repairs.
  • The amount paid is required. complete_purchase needs completed_amount_minor — what was actually paid, in cents. Sealgraf seals it as the amount the agent reported; it does not see or move the payment itself.
  • No verification link. This package does not create a shareable check link or a receipt view. Its tools return the sealed receipt record; the owner views and shares receipts in their Sealgraf account.

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 ../BUILD-RECORD.md for run evidence).

Metadata

Release files for sealgraf-composio 0.1.1

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.1
File Size Uploaded Provenance Actions
sealgraf_composio-0.1.1.tar.gz 14.9 kB Without provenance Details for sealgraf_composio-0.1.1.tar.gz

Built distribution (wheel)

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

Total release size: 29.1 kB

Release files / sealgraf_composio-0.1.1.tar.gz

Download URL sealgraf_composio-0.1.1.tar.gz
Size 14.9 kB
Tags Source
SHA-256 checksum
How to use checksums
a082ef84993d1fc44293817c5b4c41923798227dcf03df55c822cf33305c21d2
BLAKE2b-256 checksum
How to use checksums
9c965cbef51ed507013ab1403033b19fb75b3440beee234b60bc228f17ba5609
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.7

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

Download URL sealgraf_composio-0.1.1-py3-none-any.whl
Size 14.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9084bb0c357be01a7b178533d8d0e8d940a9edb7eb4651bddd615e8a12ee0c49
BLAKE2b-256 checksum
How to use checksums
a0a17c1cfba921aa74c3eff7f827a4c0b42a308d3aaa2d3fad76e654bd18dc0b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.7

Security for sealgraf-composio 0.1.1

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.1 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