Symptom
TokenCalcHandler.log_success_event accepts a response whose usage is a dictionary, increments successful_requests, and leaves prompt, completion, total, and cached-prompt counters at zero.
Evidence what you'll see
- The report's snippet passes
{"usage": {"prompt_tokens": 12, "completion_tokens": 3, "total_tokens": 15, "prompt_tokens_details": {"cached_tokens": 4}}}.process.get_summary()then shows the token counters still at zero andsuccessful_requestsat 1. - The issue says this is the callback accumulator only.
BaseLLM's internal tracker already accepts dictionaries throughUsageMetrics.from_provider_dict.
Why it happens
The handler counted token fields only as attributes. A dictionary usage value has none of those attributes. Pull request 8171 reuses UsageMetrics.from_provider_dict for dictionary payloads and feeds the existing TokenProcess counters.
Affected versions
Python 3.13.12, macOS arm64, repository lockfile dependencies, main at aa5f2acd9b. The linked issue does not name a released crewAI version in the body. Tag 1.15.28 does not contain pull request 8171.
Fix steps
0 of 2 done
Your check marks stay in this browser only.
How to check it worked
- After
callback.log_success_event({}, {"usage": {"prompt_tokens": 12, "completion_tokens": 3, "total_tokens": 15, "prompt_tokens_details": {"cached_tokens": 4}}}, 0, 0),process.get_summary()records those four counts andsuccessful_requests1.
If it still fails
- Tag
1.15.28does not contain pull request 8171. - The linked issue does not claim every Crew or Flow total is affected. Empty usage and a missing process stay unchanged.
Sources and credit
Summarized in our own words from these public reports. Credit goes to their authors.
Provided as is, without warranty. Try changes in a non-production environment and back up first. Security-related steps: verify against the official docs. Terms · Request removal or attribution change
Hit an error we don't cover? Submit it