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
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
sardis_composio-1.0.0.tar.gz
(7.4 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file sardis_composio-1.0.0.tar.gz.
File metadata
- Download URL: sardis_composio-1.0.0.tar.gz
- Upload date:
- Size: 7.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/6.2.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5eef5696d36437d900bb807076f12ed28ed12fc34a33b4caa1a9ba1ca4175e85
|
|
| MD5 |
3e5db9b99a93b52c944317a5c1b6c7a5
|
|
| BLAKE2b-256 |
c83fb4e09074f2fdf7b98f186be961e6cb4df3717db0cbdbdc443c1fbc1c7509
|
File details
Details for the file sardis_composio-1.0.0-py3-none-any.whl.
File metadata
- Download URL: sardis_composio-1.0.0-py3-none-any.whl
- Upload date:
- Size: 4.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/6.2.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5ad1634ac79a611aaa30b299d59c96d505f112d35ebd71843d6df517595ed06a
|
|
| MD5 |
f23f7325e2d26419b44a2fe7542f6717
|
|
| BLAKE2b-256 |
e547392523a82c122b58ffcf55905c0428af3b055e2d80502d0fb7c696885130
|