Per-agent, per-call, per-user, per-tenant cost attribution in CrewAI agents — without rewriting your code, without adding a proxy to the request path.
The problem
CrewAI is great at what it does, but production-grade cost tracking is bring-your-own. Most teams discover this when the first production incident hits, the first OpenAI bill arrives, or the first auditor asks for evidence.
Specifically:
- Crew-level cost easily runs 5-10× single-agent cost — opaque without tooling
- Role-based access control isn't enforced — any agent can call any tool
- Long task chains can drift without continuous evaluation
How Prefactor solves it
Prefactor wraps your CrewAI Crew and adds cost tracking as a runtime layer. Specifically:
- find the workflow eating your OpenAI budget
- catch loops before the bill
- bill internal teams for AI usage
- decide which agent to migrate to a cheaper model
- quantify savings from a prompt change
Install and integrate
pip install prefactor-crewai
from crewai import Crew
from prefactor import Prefactor
pf = Prefactor(api_key="pf_live_...")
crew = pf.wrap(Crew(agents=[...], tasks=[...]), crew_id="research-crew")
Specific use cases
- Find the workflow eating your openai budget
- Catch loops before the bill
- Bill internal teams for ai usage
- Decide which agent to migrate to a cheaper model
- Quantify savings from a prompt change
FAQ
Does this add latency? Per-span instrumentation adds ~2-5ms. Telemetry ships asynchronously. No synchronous network call in the agent's hot path unless you enable blocking policy enforcement.
Can I configure this per-agent? Yes. Cost Tracking settings are per-agent — different agents can have different policies, sampling rates, retention, etc.
Is this compatible with other observability tools? Yes. Prefactor exports OpenTelemetry; works alongside Datadog, Langfuse, LangSmith, and others.
Related
Start free
[Get started free →] [Book a demo →]