Files
crewAI/lib
Devin AI 3702a47bfe feat: add graceful cancellation support (aclose/cancel) for streaming outputs
Implements aclose() and cancel() methods on CrewStreamingOutput and
FlowStreamingOutput to allow callers to abort in-flight streaming and
release resources promptly (e.g. when an HTTP client disconnects).

- Add aclose() async method for async streaming contexts
- Add cancel() sync method for sync streaming contexts
- Add is_cancelled property to check cancellation state
- Update create_async_chunk_generator to support cancel events
- Update create_chunk_generator to support cancel thread events
- Add comprehensive tests for cancellation scenarios

Closes #5312

Co-Authored-By: João <joao@crewai.com>
2026-04-07 09:39:51 +00:00
..