sardis-composio
Sardis payment tools for Composio's tool marketplace. Gives AI agents policy-controlled access to real payments via Sardis.
Install
pip install sardis-composio
Quick Start
Python
from sardis_composio import sardis_pay, sardis_check_balance, sardis_check_policy
# Check balance before paying
balance = sardis_check_balance(token="USDC")
print(f"Balance: ${balance['balance']} | Remaining limit: ${balance['remaining']}")
# Dry-run policy check
policy = sardis_check_policy(amount=49.99, merchant="vendor.example.com")
if policy["allowed"]:
# Execute payment
result = sardis_pay(amount=49.99, merchant="vendor.example.com", purpose="SaaS renewal")
print(f"Payment {result['status']}: {result['tx_id']}")
Environment Variables
SARDIS_API_KEY=sk_... # Your Sardis API key
SARDIS_WALLET_ID=wallet_... # Agent wallet ID
API keys and wallet IDs can also be passed directly to each function.
Tools
| Function | Description |
|---|---|
sardis_pay(amount, merchant, purpose) |
Execute a policy-controlled payment |
sardis_check_balance(token) |
Get wallet balance and remaining spend limit |
sardis_check_policy(amount, merchant) |
Dry-run a payment against spending policy |
sardis_pay
result = sardis_pay(
amount=49.99,
merchant="vendor.example.com",
purpose="SaaS subscription", # optional, default: "Payment"
api_key="sk_...", # optional, falls back to env var
wallet_id="wallet_...", # optional, falls back to env var
)
# {"success": True, "status": "APPROVED", "tx_id": "tx_...", "amount": 49.99, ...}
sardis_check_balance
result = sardis_check_balance(token="USDC")
# {"success": True, "balance": 500.0, "remaining": 200.0, "token": "USDC"}
sardis_check_policy
result = sardis_check_policy(amount=100.0, merchant="shop.com")
# {"allowed": True, "reason": "Allowed: $100.0 to shop.com", "balance": 500.0, "remaining": 200.0}
Composio Import (OpenAPI)
Import the Sardis API into Composio using the bundled OpenAPI spec:
- Go to app.composio.dev → Tools → Import OpenAPI
- Upload
openapi.yamlfrom this package (find it atpackages/sardis-composio/openapi.yamlor after install at$(pip show sardis-composio | grep Location | awk '{print $2}')/sardis_composio/../../openapi.yaml) - Set your
X-API-Keyauthentication in Composio's credential manager - The following actions will be available:
executePayment— POST /v2/wallets/{wallet_id}/transfergetBalance— GET /v2/wallets/{wallet_id}/balancecheckPolicy— POST /v2/payments/policy-check
Using with an AI Framework
# Example: LangChain + Composio
from composio_langchain import ComposioToolSet
toolset = ComposioToolSet(api_key="<composio-key>")
tools = toolset.get_tools(actions=["executePayment", "getBalance", "checkPolicy"])
# Example: Direct SARDIS_TOOLS dict (no Composio required)
from sardis_composio import SARDIS_TOOLS
# Pass to any agent framework that accepts a dict of callables
agent_tools = SARDIS_TOOLS
Development
uv sync
uv run pytest tests/
Links
Metadata
Release files for sardis-composio 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| sardis_composio-1.0.0.tar.gz | 7.4 kB | Without provenance | Details for sardis_composio-1.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| sardis_composio-1.0.0-py3-none-any.whl | Python 3 | none | any | Details for sardis_composio-1.0.0-py3-none-any.whl |
Total release size: 12.2 kB
Release files / sardis_composio-1.0.0.tar.gz
| Download URL | sardis_composio-1.0.0.tar.gz |
|---|---|
| Size | 7.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5eef5696d36437d900bb807076f12ed28ed12fc34a33b4caa1a9ba1ca4175e85
|
|
BLAKE2b-256 checksum How to use checksums |
c83fb4e09074f2fdf7b98f186be961e6cb4df3717db0cbdbdc443c1fbc1c7509
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.7
|
Release files / sardis_composio-1.0.0-py3-none-any.whl
| Download URL | sardis_composio-1.0.0-py3-none-any.whl |
|---|---|
| Size | 4.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
5ad1634ac79a611aaa30b299d59c96d505f112d35ebd71843d6df517595ed06a
|
|
BLAKE2b-256 checksum How to use checksums |
e547392523a82c122b58ffcf55905c0428af3b055e2d80502d0fb7c696885130
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.7
|
Security for sardis-composio 1.0.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.