The shape: a tool that carries attribution
# the boundary: a tool that uses wk.chat() for the actual LLM round trip,
# so every turn any agent takes is logged with the end user attached
def make_llm_tool(user):
def run(messages):
result = wk.chat(openai_client, {
"model": "gpt-5.4-mini",
"messages": messages,
"user_id": user.id,
"feature": "research-crew",
"plan": user.plan,
})
return result.choices[0].message.content
return runComplete setup, including how this slots into a crew’s agents and tasks, in docs/integrations/crewai. The principle matches the LangChain boundary pattern: the framework orchestrates above, attribution attaches where the call actually happens.
Why crews are the highest variance cost surface you can ship
- Multiplication: agents times turns times resent context. The compounding from conversation math applies per agent, simultaneously.
- Variance: the same crew on two inputs can differ 10x in round trips depending on how quickly it converges, which makes averages useless and per run visibility essential, the agent budgeting problem from AI agent cost control.
- The loop risk: a crew re-planning in circles is the canonical runaway, and it burns at machine speed. Velocity detection (default 50,000 tokens per user in 5 minutes) exists for exactly this signature, per the runaway flow, and the cap check before every round trip guarantees a ceiling either way.
What the dashboard shows after a crew run
Each round trip is a row: model, tokens, cost, the user, the crew’s feature label. Rolled up, you get what a crew run truly costs per user, which crews are expensive per feature, and margin against what the user pays, the numbers that decide whether an agentic feature can live on your pricing, per the heavy tail audit. Costs are recomputed server side at current rates (methodology), so a month of crew runs is arithmetic you can trust, not client estimates.
FAQ
How do I track CrewAI costs per user?
Route the crew’s LLM round trips through a tool or boundary that calls wk.chat() on the underlying client, with the end user’s id, a feature label for the crew, and their plan attached. Every round trip any agent in the crew triggers then logs individually, with cost recomputed server side, and rolls up per user in the dashboard. The complete working code is in the CrewAI integration docs.
Why do CrewAI costs need per call tracking specifically?
Because crews multiply calls invisibly: several agents, each taking multiple turns, each turn resending accumulated context. A single crew kickoff can be dozens of round trips, and the variance between a crew that converges in 5 steps and one that wanders for 40 is enormous. Aggregate billing shows you the month; per call attribution shows you which user’s crew run cost what, while it is happening.
Can Weckr stop a crew that gets stuck in a loop?
Two mechanisms: velocity detection alerts when any user burns past the threshold (50,000 tokens in 5 minutes by default), which is precisely the stuck crew signature, and spending caps block or downgrade the user’s calls once their monthly budget is exceeded, checked before every round trip. An agent loop with a cap has a ceiling; one without has an invoice.
Does wrapping interfere with how CrewAI orchestrates agents?
No. The wrap sits below the orchestration, at the point where a round trip actually reaches the provider, and returns the provider response unchanged. CrewAI’s planning, delegation, and tool use behave identically; the only difference is that every round trip now carries attribution and passes the cap check.
Where is the full CrewAI integration documented?
useweckr.com/docs/integrations/crewai has the complete Python setup, including a tool that routes LLM round trips through wk.chat() so every agent turn is logged. It follows the same boundary principle as the LangChain integration, with crew specific details worked out.
Keep reading
Ship the crew with a meter and a ceiling
Agentic features are worth shipping and dangerous to ship blind. Full code in the CrewAI docs, free for 50,000 requests a month, and the per user cost view your crews will fill is on the demo.