What problem does it solve?
Building a durable AI chat backend with Trigger.dev involves subtle wiring—spreading chat.toStreamTextOptions(), declaring typed tools, minting public tokens server-side, and connecting the React transport—where small omissions silently break compaction, steering, and stop behavior.
Core Features & Use Cases
- Correct run-loop wiring: Enforces spreading ...chat.toStreamTextOptions() first in streamText so compaction, mid-turn steering, background injection, and telemetry actually work.
- Server action setup: Guides implementation of chat.createStartSessionAction and auth.createPublicToken so browser clients never see the secret key.
- Frontend transport: Connects useChat to useTriggerChatTransport for the React side of the chat session.
- Use Case: When migrating a plain AI SDK streamText route to chat.agent, load this Skill to avoid pitfalls like tools dropped on later turns, Stop not aborting generation, or chat.local initialization crashes.
Quick Start
Ask the AI to build a Trigger.dev chat agent backend with typed tools and wire it to a React useChat hook using this skill's guidance.