Agent skill · triggerdotdev

trigger-chat-agent-advanced

Advanced and operational chat.agent capabilities for Trigger.dev, loaded on demand. Load this when working on the raw Sessions primitive (sessions / SessionHandle), a custom chat transport or the realtime wire protocol, durable sub-agents (AgentChat, chat.stream.writer), human-in-the-loop, steering, actions, background injection (chat.defer / chat.inject), fast starts (preload, Head Start via @trigger.dev/sdk/chat-server), context resilience (compaction, recovery boot, OOM, large payloads), chat.local run-scoped state, offline testing with mockChatAgent, or prerelease/version upgrades. For the everyday chat.agent({...}) definition and the useTriggerChatTransport happy path, use the trigger-authoring-chat-agent skill instead.

What it needs

About 8k tokens when loaded.

What this skill does

chat.agent: advanced and operational chat.agent is built on Sessions: a durable, task-bound, bi-directional I/O channel pair keyed on a stable externalId (e.g. chatId) that outlives any single run. This skill covers the layers beneath and around the everyday agent: the raw sessions API, server-side AgentChat, durable sub-agents, actions / background injection, fast starts, compaction and recovery, and the wire protocol for custom transports. Two chat namespaces are easy to confuse: the agent definition imports chat from @trigger.dev/sdk/ai; Head Start / Node-listener server entries import chat from @trigger.dev/sdk/chat-server. Setup Happy path: drive an agent from server-side code (task, webhook, or script) with AgentChat. sendMessage() triggers a run on the first call, then reuses it via input streams. ChatStream exposes text(), result() ({ text, toolCalls, toolResults }), messages() (UIMessage snapshots), and the raw .stream. Other methods: steer(text), stop(), sendRaw(uiMessages), sendAction(action), preload(), reconnect(). Core patterns 1. Raw Sessions for non-chat, bi-directional I/O Reach for sessions directly when the chat abstraction does not fit: agent inboxes, approval flows, server-to-server pipelines. sessions.start is idempotent on (env, externalId); externalId cannot start with session. sessions.open(id).in also has send, on(handler), peek, wait (suspends the run, only inside task.run()), and waitWithIdleTimeout. .out has append, pipe, writer, read, writeControl, and trimTo. List with sessions.list({ type, tag, status, ... }) (for await), mutate with sessions.update, end with sessions.close (terminal, idempotent). 2. Durable sub-agent as a streaming tool AgentChat inside an AI SDK tool() delegates to a durable sub-agent; its response streams as preliminary tool results. Give the tool a toModelOutput so the model sees a compact summary. …

How to use it

Reference it in AdaL, Claude Code, Cursor or any coding agent — nothing to install:

@skills triggerdotdev/trigger-chat-agent-advanced

View the source on GitHub

Browse the @skills marketplace