CrewAI Integration

CrewAI + Skalor

Give your CrewAI agents a fiduciary spending budget. Only the agents you choose get payment tools. Every dollar is tracked, gated, and auditable.

Why Skalor + CrewAI

Selective access

Only give the spending tool to agents that need it. Analysts and writers stay read-only.

Budget enforcement

Daily limits and per-transaction caps prevent runaway spending in autonomous crews.

Full audit trail

Every payment includes a reason (KYA). See exactly which agent spent what and why.

Quickstart

1

Install dependencies

pip install skalor-sdk crewai crewai-tools
2

Set environment variables

.env
export SKALOR_AGENT_ID="your-agent-uuid"
export SKALOR_API_KEY="zc_your_key_here"
export OPENAI_API_KEY="sk-..."

Get credentials from the Dashboard.

3

Build a crew with a spending agent

crew.py
from crewai import Agent, Task, Crew
from skalor.skalor_tool import SkalorPaymentTool

# 1. Create the Skalor fiduciary tool
skalor_tool = SkalorPaymentTool()

# 2. Create an agent with spending ability
researcher = Agent(
    role="Market Research Analyst",
    goal="Find and analyze market trends using paid data sources",
    backstory="""You are a senior market analyst with a budget for
    premium data. When you encounter a paid API (HTTP 402), use
    the request_fiduciary_clearance tool to get payment authorization.
    After approval, retry with the clearance_headers.""",
    tools=[skalor_tool],
    verbose=True,
)

# 3. Define a task
research_task = Task(
    description="""Research the current state of the AI payments market.
    Use paid data APIs if needed — your spending is governed by the
    Skalor fiduciary firewall (5 gates, budget limits, audit trail).""",
    expected_output="A detailed market analysis report",
    agent=researcher,
)

# 4. Run the crew
crew = Crew(
    agents=[researcher],
    tasks=[research_task],
    verbose=True,
)

result = crew.kickoff()
print(result)

The researcher agent has the SkalorPaymentTool. When it hits a paid API, the tool handles authorization through the 5 fiduciary gates automatically.

Multi-Agent Crew

The key pattern: give the spending tool only to the agents that need it. Other agents in the crew operate without financial access.

multi_agent_crew.py
from crewai import Agent, Task, Crew
from skalor.skalor_tool import SkalorPaymentTool

skalor_tool = SkalorPaymentTool()

# Agent 1: Researcher — has a spending budget
researcher = Agent(
    role="Data Researcher",
    goal="Gather premium market data from paid APIs",
    backstory="""You source data from premium APIs. When an API returns
    HTTP 402 Payment Required, use request_fiduciary_clearance to get
    payment authorization. Every dollar is tracked in the audit trail.""",
    tools=[skalor_tool],
    verbose=True,
)

# Agent 2: Analyst — no spending ability (no tool)
analyst = Agent(
    role="Senior Analyst",
    goal="Synthesize research data into actionable insights",
    backstory="""You analyze data provided by the research team.
    You do not have spending authorization — focus on analysis.""",
    verbose=True,
)

# Agent 3: Writer — no spending ability
writer = Agent(
    role="Report Writer",
    goal="Produce a polished executive summary",
    backstory="""You write clear, concise reports for the C-suite.
    Use the data and analysis provided by your colleagues.""",
    verbose=True,
)

# Tasks chain: research -> analyze -> write
gather_data = Task(
    description="Fetch market data from premium APIs for Q2 analysis",
    expected_output="Raw market data and trends",
    agent=researcher,
)

analyze_data = Task(
    description="Analyze the gathered data and identify key trends",
    expected_output="Analysis with 3 key insights",
    agent=analyst,
)

write_report = Task(
    description="Write an executive summary of the analysis",
    expected_output="1-page executive summary in markdown",
    agent=writer,
)

crew = Crew(
    agents=[researcher, analyst, writer],
    tasks=[gather_data, analyze_data, write_report],
    verbose=True,
)

result = crew.kickoff()
print(result)

Architecture: Researcher (has budget) → Analyst (read-only) → Writer (read-only). Only the researcher can trigger payments. The analyst and writer never see or handle funds.

Configuration

Factory function

Use create_skalor_tool() for explicit configuration:

factory.py
from skalor.skalor_tool import create_skalor_tool

# Use the factory function for cleaner initialization
tool = create_skalor_tool(
    agent_id="550e8400-e29b-41d4-a716-446655440000",
    api_key="zc_live_abc123def456...",
)

# Assign to specific agents
researcher = Agent(
    role="Researcher",
    tools=[tool],
    ...
)

Pre-flight budget check

Check the budget before kicking off a crew to avoid mid-run failures:

preflight.py
from skalor import Client

# Check budget before running a crew
zc = Client(api_key="zc_your_key_here")
budget = zc.check_budget()

print(f"Remaining budget: ${budget.remaining_usd}")
print(f"Max single payment: ${budget.max_single_payment_usd}")

if budget.remaining_usd < 1.0:
    print("Warning: Low budget — crew may hit spending limits")

5 Fiduciary Gates

Every payment goes through 5 gates. Autonomous crews are protected from overspending.

  1. Kill Switch — Is the agent active?
  2. Vendor Allowlist — Is this vendor authorized?
  3. Per-Tx Limit — Within single-payment policy?
  4. Daily Budget — Under the daily cap?
  5. Human-in-the-Loop — Needs CFO sign-off?
Learn more about gates