You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fix Claude Sonnet 4 streaming detection issue (#400)
Replace fragile usage_metadata-based logic with robust streaming detection
that checks multiple explicit streaming indicators.
**Problem:**
The original logic relied on `not adk_event.usage_metadata` to determine
if an event should be processed as streaming. This was fragile because
Claude models can include usage_metadata even in streaming chunks,
causing responses to disappear.
**Solution:**
Implement comprehensive streaming detection that checks:
- `partial` attribute (explicitly marked as partial)
- `turn_complete` attribute (live streaming completion status)
- `is_final_response()` method (final response indicator)
- `finish_reason` attribute (fallback for content without finish reason)
This ensures all streaming content is captured regardless of usage_metadata
presence, fixing compatibility with Claude Sonnet 4 and other models.
**Testing:**
✅ All 277 tests pass
✅ Streaming detection works across different model providers
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <[email protected]>
0 commit comments