In this article
Compare sync and async hook transformations with synthetic string responses and inspect streaming exposure separately; a final-response hook is not every delivery boundary.
CrewAI 1.15.40, released on November 11, runs after_llm_call hooks on asynchronous calls that previously bypassed them in the LiteLLM-backed LLM class. The implementation targets string responses from streaming and non-streaming handlers. Applications using hooks for redaction or formatting should check the exact call path instead of assuming synchronous and asynchronous behavior already matches.
Use an unmistakable synthetic transformation
Register a harmless hook that replaces a unique marker and increments an observable invocation counter. Return the same fixed string through synchronous and asynchronous LLM calls. Assert the transformed result and count on both paths. This isolates hook execution from model behavior. A natural-language answer may look acceptable even when the hook never ran, so the fixture needs an output that cannot pass accidentally.
Identify the provider class and result type
The PR scopes the missing behavior to the LiteLLM-backed LLM class and string results; native provider classes already have their own hook paths. Record the actual class used by the application and include any non-string result shapes it consumes. Do not project a passing string fixture onto tool-call objects or provider adapters that follow different processing. The acceptance matrix should mirror the application’s concrete entry points.
Final transformation and streamed exposure differ
For streaming calls, capture both intermediate content delivered to the consumer and the final string returned by the handler. A hook applied after assembly does not by itself establish that earlier chunks were transformed before display. If the application relies on redaction, test its delivery boundary explicitly using synthetic markers. This is an application-level requirement; the release fixes async invocation without defining every frontend’s streaming policy.
Failures must remain observable
Make the hook fail in a controlled fixture and inspect the caller outcome, logs and committed task state. Verify the application does not silently accept the untransformed string as a completed result. Keep invocation counts for retries so an intended once-per-answer transformation is not duplicated by a wrapper. The useful adoption result is known hook behavior on the exact async path, with its transformation and failure semantics documented.
Sources
Related reading
Earn rental income from GPUs
Have idle GPUs or looking to fund AI infrastructure? Retrivium finds a rental platform, sets up the server and helps you assess income and costs with a pilot.