Skip to main content

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:

  1. Go to app.composio.dev → Tools → Import OpenAPI
  2. Upload openapi.yaml from this package (find it at packages/sardis-composio/openapi.yaml or after install at $(pip show sardis-composio | grep Location | awk '{print $2}')/sardis_composio/../../openapi.yaml)
  3. Set your X-API-Key authentication in Composio's credential manager
  4. The following actions will be available:
    • executePayment — POST /v2/wallets/{wallet_id}/transfer
    • getBalance — GET /v2/wallets/{wallet_id}/balance
    • checkPolicy — 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/

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)

Source distribution for sardis-composio 1.0.0
File Size Uploaded
sardis_composio-1.0.0.tar.gz 7.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for sardis-composio 1.0.0
File Interpreter ABI Platform
sardis_composio-1.0.0-py3-none-any.whl Python 3 none any Details

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

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files

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