Skip to main content

keelson-finance

Keelson for Python (import keelson). Your agent asks the user for a mandate, the user signs it with a passkey, and every purchase is checked by two TEEs before PayPal captures it. Each purchase comes with an Alibi you can verify offline.

Runs on the PayPal sandbox and Arbitrum Sepolia: no real money moves. Python 3.11 or later.

Install

pip install keelson-finance
keelson login

To work on the SDK from this repository: uv run --project packages/sdk-python keelson login.

keelson login signs you in in your browser and saves the sign-in to ~/.config/keelson/credentials.json, the same file the TypeScript SDK uses.

Quickstart

from keelson import Keelson, quote, verify_alibi

keelson = Keelson()  # signed in with `keelson login`
why = "I buy one pair of Pace Lite running shoes, size 10, at RunFast on the PayPal sandbox, and nothing else."
req = keelson.mandates.request(name="Quickstart", reason=why, per_purchase="$100", total="$100", until="1h")
print(f"Approve with your passkey: {req.approval_url}")
mandate = keelson.mandates.wait_for_approval(req.id)
q = quote([{"productUrl": "https://store.keelson.finance/products/pace-lite", "size": "10", "qty": 1}])
seen = {**q["sources"], "observation": "Pace Lite, size 10, $99.00."}
sealed = keelson.evidence.seal(mandate_id=mandate.id, sources=seen)
signed = keelson.purchases.countersign(mandate=mandate, evidence_root=sealed["evidenceRoot"], cart=q["cart"])
report = verify_alibi(keelson.alibis.retrieve(keelson.purchases.wait_for(signed.purchase_id).id))
print(f"Bought {signed.purchase_id}. Alibi: {report['verdict']}")  # verified-offline

AsyncKeelson is the same client for asyncio: every method is awaited.

Methods, errors and retries

The same as the TypeScript SDK, in snake_case: mandates.request, mandates.wait_for_approval, mandates.request_change, mandates.list, mandates.check, requests.retrieve, evidence.seal, purchases.countersign, purchases.wait_for, purchases.retrieve, alibis.retrieve, alibis.receipt, alibis.pdf, alibis.verify_remote, events.stream, operators.link, operators.grade, operators.announce_run. Every POST carries an Idempotency-Key kept across retries. A lost countersign raises OutcomeUnknownError: never send it again, call purchases.wait_for(err.request_id).

An operator closing mandates with its own key installs keelson-finance[operator] and sets KEELSON_CLIENT_ID, KEELSON_CLIENT_SECRET and KEELSON_AGENT_KEY.

Agent frameworks

from keelson.adapters.openai_agents import openai_agents_tools  # pip install keelson-finance[openai-agents]
from keelson.adapters.langchain import langchain_tools  # pip install keelson-finance[langchain]
from keelson.adapters.claude_agent_sdk import keelson_mcp_server  # pip install keelson-finance[claude-agent-sdk]

Verifying an Alibi

verify_alibi(bytes) runs the same verifier as https://verify.keelson.finance through keelson-verify (Node.js 20 or later), so Python and TypeScript give the same verdict for the same bytes.

License

Apache-2.0

Metadata

Release files for keelson-finance 0.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for keelson-finance 0.1.2
File Size Uploaded Provenance Actions
keelson_finance-0.1.2.tar.gz 219.3 kB Without provenance Details for keelson_finance-0.1.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for keelson-finance 0.1.2
File Interpreter ABI Platform Actions
keelson_finance-0.1.2-py3-none-any.whl Python 3 none any Details for keelson_finance-0.1.2-py3-none-any.whl

Total release size: 268.3 kB

Release files / keelson_finance-0.1.2.tar.gz

Download URL keelson_finance-0.1.2.tar.gz
Size 219.3 kB
Tags Source
SHA-256 checksum
How to use checksums
c723216dd07fde7fd3d6f7d2611b4c0ec7fca7f9cc9924429f59443c26201747
BLAKE2b-256 checksum
How to use checksums
216ef71f7a9b36544bd5d3cbc6e955901e9a44dd5a8c1dc8a28add95ce071c0f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.7 {"installer":{"name":"uv","version":"0.13.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / keelson_finance-0.1.2-py3-none-any.whl

Download URL keelson_finance-0.1.2-py3-none-any.whl
Size 49.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
91aa99a03909c8205b6af201d44964816b9f54a981d32e1fbd61b0f870bad7ba
BLAKE2b-256 checksum
How to use checksums
e35437e51308d16e24e5dba65c0ee8f142ec24eca13f18c5fe8c2d7e55b796d9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.7 {"installer":{"name":"uv","version":"0.13.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for keelson-finance 0.1.2

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.

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