Framework integrations
Wherever your agent decides to spend, the check belongs one line before it: inside the tool that moves the money, after the arguments are known.
Wrap the payment tool, not the agent. A LangChain agent decides to pay inside a tool call, so the check belongs in that tool's function body, before the transfer and after the arguments are known. Putting it in a callback handler is too late on the ones that matter: by the time on_tool_end fires the money has moved.
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.
The SDK has a guardrail concept, and a payment check is a natural fit for it: the guardrail runs, the tripwire fires, the run halts. Use a guardrail when you want the run to stop outright on a deny, and a wrapped function tool when you want the model to see the refusal and re-plan inside its budget.
Using something else? The MCP server works with any client that speaks MCP, and the JSON API is one POST.