What problem does it solve? Building production-grade AI chat agents on Trigger.dev involves complex operational concerns—session management, custom transports, durable sub-agents, human-in-the-loop flows, and context resilience—that go far beyond the basic chat.agent definition. This Skill provides the version-pinned reference and common-mistake guidance needed to implement these advanced patterns correctly. ## Core Features & Use Cases - Sessions & Transports: Work with the raw Sessions primitive (sessions / SessionHandle), custom chat transports, and the realtime wire protocol. - Durable Sub-Agents & HITL: Implement AgentChat, chat.stream.writer, human-in-the-loop tool flows, steering, actions, and background injection via chat.defer / chat.inject. - Resilience & Performance: Handle fast starts (preload, Head Start), context compaction, recovery boot, OOM, large payloads, and offline testing with mockChatAgent. - Use Case: You are building a chat agent that pauses for human approval mid-stream and resumes on continuation runs. This Skill tells you to leave the HITL tool execute-less, initialize chat.local in onBoot rather than onChatStart, and append follow-ups via the session input channel instead of re-POSTing session creation. ## Quick Start Ask the AI to load the trigger-chat-agent-advanced skill and help implement a human-in-the-loop approval flow for your Trigger.dev chat agent.