- Home
- Skills
- Andrelandgraf
- Fullstackrecipes
- Resumable Ai Streams
resumable-ai-streams_skill
- TypeScript
8
GitHub Stars
1
Bundled Files
2 months ago
Catalog Refreshed
4 months ago
First Indexed
Readme & install
Copy the install command, review bundled files from the catalogue, and read any extended description pulled from the listing source.
Installation
Preview and clipboard use veilstrat where the catalogue uses aiagentskills.
npx veilstrat add skill andrelandgraf/fullstackrecipes --skill resumable-ai-streams- SKILL.md543 B
Overview
This skill adds automatic stream recovery to AI chat flows using WorkflowChatTransport, start/resume API endpoints, and a useResumableChat hook. It provides a production-ready pattern and step-by-step guide for building resilient, resumable AI response streams in TypeScript full-stack apps. The goal is to make streamed responses recoverable after network interruptions with minimal client changes.
How this skill works
The system wraps the chat transport with WorkflowChatTransport to track stream state and checkpoints. Server endpoints expose start and resume operations so the client can request continued streaming from the last known checkpoint. On the client, useResumableChat manages local state, reconnection logic, and replaying or resuming partial responses automatically. Together these pieces let the app continue an interrupted response stream without re-running the entire generation.
When to use it
- Building chat or assistant UIs that rely on streamed model outputs and need reliability.
- Supporting flaky mobile or low-bandwidth networks where interruptions are common.
- Reducing compute and cost by resuming long-running generations instead of restarting.
- Implementing server-authoritative recovery and audit trails for conversational state.
- Deploying production AI features where UX expectations require seamless recovery.
Best practices
- Track lightweight checkpoints frequently to minimize re-generation on resume.
- Keep resume tokens short-lived and rotate them for security and abuse control.
- Design the resume API to be idempotent so repeated resume calls are safe.
- Expose clear client-side signals (loading, resumed, failed) so UI can react.
- Log stream lifecycle events for observability and postmortem debugging.
Example use cases
- A chat assistant on mobile that transparently resumes responses after signal loss.
- A long-form content generation tool that continues a partially streamed draft.
- Customer support bots that maintain transcript continuity across reconnects.
- Multi-step workflows where each step’s output is streamed and must be recoverable.
- Internal tooling that replays partial streams for auditing and QA.
FAQ
No. Checkpointing and server-side resume logic continue from the last committed state to avoid re-running previously generated tokens.
Is the hook framework-specific?
The provided useResumableChat hook is TypeScript-focused and integrates easily with common React stacks, but the recovery pattern can be adapted to other front-end frameworks.