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.0.0.tar.gz (8.8 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.0.0-py3-none-any.whl (4.0 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for sardis_crewai-1.0.0.tar.gz
Algorithm Hash digest
SHA256 daea42f1a1f06ec3afcbbfbbae742696d5e5504d8c171b602a5c4f4429ca8fb3
MD5 f0f7693012f62dfb9ce74107deedf71d
BLAKE2b-256 2e4e788388c9fab16f05a8f8dca6a842a923fb33cec0dfe0b1c82930280b8114

See more details on using hashes here.

File details

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

File metadata

  • Download URL: sardis_crewai-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 4.0 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-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ff71fbc1b4b57783776419525e9441fc0401b447d2736f96f38e63c1c3619ee4
MD5 ae39a30d7bb00c5d033464f2f14b4b0f
BLAKE2b-256 0875d594232613410434552d4665f5e8940ac059d6f8170bdf2a3f19b2ed8582

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