Skip to main content

CrewAI integration for Sardis - agent payment tools, pre-built agents, and task templates

Project description

sardis-crewai

CrewAI integration for Sardis -- the Payment OS for the Agent Economy.

Build multi-agent financial workflows where AI agents can make real payments, enforce spending policies, and maintain audit trails through the Sardis platform.

Installation

pip install sardis-crewai

Quick Start

Using Individual Tools

from sardis import SardisClient
from sardis_crewai import SardisPayTool, SardisCheckBalanceTool

client = SardisClient(api_key="sk_test_...")
wallet = client.wallets.create(name="my-agent", chain="base", policy="Max $100/day")

# Create tools
pay = SardisPayTool(client=client, wallet_id=wallet.wallet_id)
balance = SardisCheckBalanceTool(client=client, wallet_id=wallet.wallet_id)

# Use with any CrewAI agent
from crewai import Agent

agent = Agent(
    role="Buyer",
    goal="Purchase API credits",
    backstory="You buy software for the team.",
    tools=[pay, balance],
)

Using Pre-configured Agents

from sardis import SardisClient
from sardis_crewai import create_finance_agent, create_audit_agent
from sardis_crewai import create_payment_task, create_audit_task
from crewai import Crew

client = SardisClient(api_key="sk_test_...")
wallet = client.wallets.create(name="finance-bot", chain="base")

# Create agents with sensible defaults
finance = create_finance_agent(client=client, wallet_id=wallet.wallet_id)
auditor = create_audit_agent(client=client, wallet_id=wallet.wallet_id)

# Create tasks
pay_task = create_payment_task(
    agent=finance,
    recipient="openai.com",
    amount="25.00",
    purpose="Monthly API credits",
)
audit_task = create_audit_task(agent=auditor)

# Run the crew
crew = Crew(agents=[finance, auditor], tasks=[pay_task, audit_task])
result = crew.kickoff()

Multi-Agent Team with Group Budgets

from sardis import SardisClient
from sardis_crewai import (
    create_procurement_agent,
    create_audit_agent,
    create_bulk_payment_task,
    create_budget_review_task,
)
from crewai import Crew

client = SardisClient(api_key="sk_test_...")

# Create a shared group budget
group = client.groups.create(
    name="engineering",
    budget={"per_transaction": "200", "daily": "1000", "monthly": "30000"},
)

# Create wallets attached to the group
buyer_wallet = client.wallets.create(
    name="buyer", chain="base", group_id=group.group_id,
)
auditor_wallet = client.wallets.create(
    name="auditor", chain="base", group_id=group.group_id,
)

# Create agents
buyer = create_procurement_agent(
    client=client, wallet_id=buyer_wallet.wallet_id, group_id=group.group_id,
)
auditor = create_audit_agent(
    client=client, wallet_id=auditor_wallet.wallet_id, group_id=group.group_id,
)

# Define tasks
purchase_task = create_bulk_payment_task(
    agent=buyer,
    payments=[
        {"to": "openai.com", "amount": "30.00", "purpose": "API credits"},
        {"to": "anthropic.com", "amount": "25.00", "purpose": "API credits"},
        {"to": "github.com", "amount": "19.00", "purpose": "Copilot subscription"},
    ],
)
review_task = create_budget_review_task(agent=auditor, group_id=group.group_id)

crew = Crew(agents=[buyer, auditor], tasks=[purchase_task, review_task])
result = crew.kickoff()

Available Tools

Tool Description
SardisPayTool Execute payments with policy enforcement and audit logging
SardisCheckBalanceTool Check wallet balance, limits, and remaining budget
SardisCheckPolicyTool Validate payments against policy without executing
SardisSetPolicyTool Set spending policy from natural language description
SardisGroupBudgetTool Check shared group budget status across agents

Tool Factory

Use create_sardis_tools() to generate a tool set in one call:

from sardis_crewai import create_sardis_tools

# All tools (read + write)
tools = create_sardis_tools(client, wallet_id=wallet.wallet_id)

# Read-only tools (for audit agents)
tools = create_sardis_tools(client, wallet_id=wallet.wallet_id, read_only=True)

# With group budget monitoring
tools = create_sardis_tools(client, wallet_id=wallet.wallet_id, group_id="group_abc")

Pre-configured Agents

Agent Factory Role Capabilities
create_finance_agent() Finance Manager Full payment + policy + audit
create_procurement_agent() Procurement Specialist Vendor payments + budget checks
create_audit_agent() Financial Auditor Read-only balance + policy checks

All agent factories accept **agent_kwargs to override any crewai.Agent parameter.

Task Templates

Task Factory Purpose
create_payment_task() Single payment with pre-checks
create_bulk_payment_task() Batch payment execution
create_budget_review_task() Group budget status report
create_audit_task() Compliance audit of recent transactions
create_policy_setup_task() Configure policy from natural language

Simulation Mode

By default, Sardis runs in simulation mode -- all payments execute locally without real blockchain transactions. This is ideal for developing and testing CrewAI workflows:

# No API key needed for simulation
client = SardisClient()
wallet = client.wallets.create(name="test-agent", chain="base", initial_balance=1000)

To use production mode, provide a real API key and install sardis-sdk:

pip install sardis-sdk
client = SardisClient(api_key="sk_live_...")

Links

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sardis_crewai-1.1.0.tar.gz (9.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

sardis_crewai-1.1.0-py3-none-any.whl (4.0 kB view details)

Uploaded Python 3

File details

Details for the file sardis_crewai-1.1.0.tar.gz.

File metadata

  • Download URL: sardis_crewai-1.1.0.tar.gz
  • Upload date:
  • Size: 9.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.22 {"installer":{"name":"uv","version":"0.9.22","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for sardis_crewai-1.1.0.tar.gz
Algorithm Hash digest
SHA256 18f75063ee38fd407316b6d5f576f08e75d97cd3aa5f7b50d86790e90480d5d6
MD5 157059a1e2e56c42901860f96806ba43
BLAKE2b-256 27d6c15e70a7cff697452e5f4e8a7ba3b4ce67617ddd8a768c51ec3f60b660e4

See more details on using hashes here.

File details

Details for the file sardis_crewai-1.1.0-py3-none-any.whl.

File metadata

  • Download URL: sardis_crewai-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 4.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.22 {"installer":{"name":"uv","version":"0.9.22","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for sardis_crewai-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 cbcde5ee1837374d0b6454ca13fea9ea9861563a89a9cc2e5bd00ebf14462e04
MD5 87ed63d3551ae6b45872234f7cf3c46b
BLAKE2b-256 1497bfea3729a4b01c2854d6a33cb513bbc1da18ec66fedb81c52d31ce5deb7c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page