What problem does it solve?
This skill addresses the complexity of managing SSE event streams in Anthropic Managed Agents, preventing common issues like session hangs, lost events during reconnections, and incorrect handling of idle states.
Core Features & Use Cases
- Stream-First Ordering: Ensures event streams are initialized correctly to capture the full lifecycle of an agent turn.
- Idle-Break Logic: Provides a robust pattern for distinguishing between transient idle states (waiting for tools) and terminal session completion.
- Lossless Reconnection: Implements a history-consolidation pattern to recover events missed during network drops or deployment restarts.
- Use Case: Use this when building a production-grade orchestrator loop that requires high reliability, custom tool integration, and seamless recovery from connection interruptions.
Quick Start
Implement the event loop by initializing the session stream before sending the user message and applying the idle-break gate logic to handle tool calls and session termination.