Spend7

Spend control for CrewAI crews making payments

Where the check goes

A crew is where per-agent caps earn their keep. Several agents share one budget and one set of credentials, so 'the researcher may spend $20 a day and the buyer $200' is a distinction the crew itself has no way to enforce. Give each agent a distinct agentId and the caps do the enforcing.

Setup

python
from crewai.tools import BaseTool
import os, requests


class GuardedPaymentTool(BaseTool):
    name: str = "pay_merchant"
    description: str = "Pay a merchant. Refused if it breaches the crew's spend policy."
    agent_id: str  # distinct per crew member: this is what the cap binds to

    def _run(self, merchant: str, amount_cents: int) -> str:
        verdict = requests.post(
            "https://spend7.com/api/v1/risk-check",
            headers={"Authorization": f"Bearer {os.environ['SPEND7_API_KEY']}"},
            json={
                "intent": {
                    "agentId": self.agent_id,
                    "amountMinor": amount_cents,
                    "currency": "USD",
                    "merchantId": merchant,
                    "rail": "other",
                }
            },
            timeout=5,
        ).json()

        if verdict["decision"] != "allow":
            caps = [c for c in verdict["caps"] if c["breached"]]
            return (
                f"Refused ({verdict['decision']}): {verdict['summary']}. "
                + (f"Cap breached: {caps[0]['limit']['scope']}." if caps else "")
            )

        settle(merchant, amount_cents)
        return "Paid."

Or use MCP

CrewAI loads MCP servers through crewai-tools' MCPServerAdapter. Point it at the Spend7 server and the crew gets risk_check, get_spend_limits and list_transactions as ordinary tools, useful for a manager agent that needs to reason about remaining budget before delegating work.

MCP server setup →

Questions

Can different agents in one crew have different budgets?
Yes, and that is the point of the agent-scoped cap. Give each crew member its own agentId and configure a cap per agent; a global cap on top bounds the crew as a whole. Every applicable cap is evaluated, so the tightest one binds.
How do I stop one agent draining the shared budget?
Set an agent-scoped daily cap for each member and a global cap for the crew. The response shows every cap that was evaluated with how much of it is used, so a manager agent can see the headroom before delegating rather than discovering it on a denial.
Does this work when the crew runs unattended overnight?
That is when it matters most. Velocity, retry-loop and off-hours signals are built for exactly the unattended case, where nobody is watching a burst develop.
LangChain OpenAI Agents SDK Spend limits →