Integrations / CrewAI
Launch and agentsExperimental
Run compute-heavy CrewAI tasks on Badgr
Give a CrewAI agent a tool that starts a capped Badgr job, so heavy steps run on a GPU and the result returns to the crew.
A setup guide only. Badgr has not tested this path, so expect to adjust it.
Why use Badgr for CrewAI
- Badgr interface
- Run
- Where CrewAI fits
- External orchestrator
- Why Badgr
- Agent compute tools
- A crew's heavy steps run on a GPU through one tool, and the crew's code does not change.
- The cost cap is set in the tool, so the agent cannot raise it.
- Each job returns output and a receipt, so you can see what the crew spent.
What you can do
- A crew whose researcher agent triggers a rendering or training step
- Run a test suite as a finite job from an agent
- Keep GPU spend bounded across many agent calls
Quickstart: A CrewAI tool that runs a capped job
import subprocess
from crewai.tools import tool
@tool("Run GPU job")
def run_gpu_job(command: str) -> str:
"""Run a command as a Badgr job with a $2 cap and return the end of its output."""
done = subprocess.run(
["badgr", "run", ".", "--cmd", command, "--max-cost", "2"],
capture_output=True, text=True, timeout=3600,
)
return (done.stdout or done.stderr)[-4000:]
# Pass run_gpu_job in the tools list of the agent that needs it.How it works
- 1.An agent decides a step needs a GPU
- 2.The tool runs the Badgr CLI with a cost cap
- 3.The job finishes and stops billing
- 4.The output goes back to the agent as the tool result
What you get
- Job output text returned to the agent
- Files from badgr artifacts <id>
- A receipt per job
Requirements
- A funded Badgr balance
- The Badgr CLI installed and logged in on the machine running the crew
- An existing CrewAI project
What it costs
- Each job is billed for its run time and bounded by --max-cost in the tool code.
- Many agents calling the tool can add up. Cap the number of calls in your crew.
See pricing for how billing works.
Proof
No tested run is recorded for this integration yet. A receipt and example output will be added here after a real run, not before.
Troubleshooting
Agent loops on the tool
Set max iterations on the agent and keep the per-job cap low.
Output too long
Return only the tail, as in the example, and save full output as artifacts.
Orphaned job after an error
Run badgr status and stop anything you did not mean to leave running with badgr down <id>.
Developer reference
Ready to start with CrewAI?
Every run or service has a spending limit you set before it starts.