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

From this repository, before the package is on PyPI: 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.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 keelson-finance 0.1.1
File Size Uploaded Provenance Actions
keelson_finance-0.1.1.tar.gz 218.7 kB Without provenance Details for keelson_finance-0.1.1.tar.gz

Built distribution (wheel)

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

Total release size: 267.4 kB

Release files / keelson_finance-0.1.1.tar.gz

Download URL keelson_finance-0.1.1.tar.gz
Size 218.7 kB
Tags Source
SHA-256 checksum
How to use checksums
e82a6eec63c7cfe89eef44cc9c663c5b53ad6267f1edf694685f2d137fcfca78
BLAKE2b-256 checksum
How to use checksums
524fa1545a34012661977321c0e70e6cfd3acb837d8db8a1aba8f3e876c72af0
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.1-py3-none-any.whl

Download URL keelson_finance-0.1.1-py3-none-any.whl
Size 48.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8edc3c434261e2819833b4cd049b8515ca4c26c5e5a1e99a6f2749b1f41499cf
BLAKE2b-256 checksum
How to use checksums
5904b534348b30dc403a7e551f5db94c624eccdfaf2d7991a1ccf7d132332286
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.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.

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