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-0.1.0.tar.gz (10.6 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-0.1.0-py3-none-any.whl (11.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: sardis_crewai-0.1.0.tar.gz
  • Upload date:
  • Size: 10.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for sardis_crewai-0.1.0.tar.gz
Algorithm Hash digest
SHA256 36352ba47d9d005bfc5f56d58c38804c69f7fe2a53f14118d95cd5e5a886c2c9
MD5 d7c1b8260385bd4acc6218d743efc790
BLAKE2b-256 e21a4c6c5d9c81ff38493bc649ce150d2d43db43fccab2a854b87561a015ad86

See more details on using hashes here.

File details

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

File metadata

  • Download URL: sardis_crewai-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 11.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for sardis_crewai-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3fccd6e83b510fd21476d99d704f1e4ece92679f08fb187b1cf3df893a6fb916
MD5 d846cdd712b532d4404b3fda6d0738d6
BLAKE2b-256 c4dc1a34b9c874f5c7e6ebdf57caf35fc7c1509fe87eb074aa0b999595696dd1

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