trigger-chat-agent-advanced

Implements advanced Trigger.dev chat.agent patterns including sessions, sub-agents, and human-in-the-loop.

Updated Sep 19, 2026
One-click install
npx skills add https://github.com/paramcodes/autobro --skill trigger-chat-agent-advanced-paramcodes
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: trigger-chat-agent-advanced
Source: https://github.com/paramcodes/autobro/tree/main/.cursor/skills/trigger-chat-agent-advanced
Command: npx skills add https://github.com/paramcodes/autobro --skill trigger-chat-agent-advanced-paramcodes

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires @trigger.dev/sdk.

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.

Frequently Asked Questions about trigger-chat-agent-advanced

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I send a follow-up message to a Trigger.dev chat session?▼

Append to the session's input channel by POSTing to /realtime/v1/sessions/{id}/in/append with a message payload. Re-POSTing POST /api/v1/sessions silently drops basePayload.message because basePayload is trigger config, not a channel.

How to implement human-in-the-loop tools in a Trigger.dev chat agent?▼

Declare the HITL tool without an execute function so streamText does not call it immediately. The frontend supplies the answer via addToolOutput plus sendAutomaticallyWhen, and the tool must also be declared on chat.agent({ tools }) so toModelOutput re-applies every turn.

Why does chat.local crash with 'can only be modified after initialization'?▼

This happens when chat.local is initialized in onChatStart, which is skipped on continuation runs. Initialize it in onBoot instead so run() always finds it initialized.

What token should I use to subscribe to Trigger.dev session streams?▼

Use the publicAccessToken from the session create response body, which is session-scoped. The x-trigger-jwt response header is run-scoped and cannot subscribe to .in or .out channels.

Why does my chat stream throw ChatChunkTooLargeError?▼

A single tool-output-available record over roughly 1 MiB throws ChatChunkTooLargeError. Persist large outputs to your store first, write the row, then emit only an id on the stream.

When should I use chat.defer in a Trigger.dev chat agent?▼

Reserve chat.defer for analytics, audit, and cache warming. Do not use it for the message-history write, because a mid-stream refresh would read an empty array; await that write inline before the model streams.