trigger-agents
БесплатноБез исполняемых скриптовНе проверенAI agent patterns with Trigger.dev - chat.agent, Sessions, AI Prompts, Trigger Agent Skills, orchestration, parallelization, routing, evaluator-optimizer, and…
от majiayu000★ 31 звезда на GitHubОб этом скилле
AI Agent Patterns with Trigger.dev
Build production-ready AI agents using Trigger.dev's durable execution.
Trigger.dev 4.5 Agent Surfaces
Use the new 4.5 agent primitives when they match the shape of the work:
Need to... → Use
────────────────────────────────────────────────────────────
Build a durable AI SDK chat UI → chat.agent
Resume one stream across run swaps → Sessions
Version and dashboard-override prompts → AI Prompts
Bundle procedural instructions/scripts → Trigger Agent Skills
Run parallel local agent worktrees → Dev branches
Durable chat agents
For AI chat surfaces backed by the Vercel AI SDK, prefer chat.agent over a
hand-rolled API route. A chat agent is one long-lived Trigger.dev task per
conversation, keyed by chat id, with durable session streams for refresh,
redeploy, crash, idle, and reconnect behavior.
import { chat } from "@trigger.dev/sdk/ai";
import { streamText, stepCountIs } from "ai";
import { anthropic } from "@ai-sdk/anthropic";
export const myChat = chat.agent({
id: "my-chat",
run: async ({ messages, signal }) => {
return streamText({
// Spread first: this wires prompt, compaction, steering, skills,
// background injection, and telemetry into the AI SDK call.
...chat.toStreamTextOptions(),
model: anthropic("claude-sonnet-4-5"),
messages,
abortSignal: signal,
stopWhen: stepCountIs(15),
});
},
});
Frontend integration uses useTriggerChatTransport from
@trigger.dev/sdk/chat/react and passes that transport to useChat. Do not
build a parallel streaming protocol unless useTriggerChatTransport cannot fit
the product surface.
import { useChat } from "@ai-sdk/react";
import { useTriggerChatTransport } from "@trigger.dev/sdk/chat/react";
import type { myChat } from "@/trigger/chat";
export function Chat() {
const transport = useTriggerChatTransport<typeof myChat>({
task: "my-chat",
accessToken: ({ chatId }) => mintChatAccessToken(chatId),
startSession: ({ chatId, clientData }) =>
startChatSession({ chatId, clientData }),
});
const { messages, sendMessage, stop, status } = useChat({ transport });
}
Sessions
Use the raw sessions API when the interaction is not quite chat-shaped but
still needs durable bidirectional streaming across runs. A Session is the stable
identity; runs can suspend, crash, upgrade, or be replaced while .in and .out
continue under the same external id.
import { sessions, task } from "@trigger.dev/sdk";
export const inboxAgent = task({
id: "inbox-agent",
run: async (payload: { sessionId: string }) => {
const session = sessions.open(payload.sessionId);
while (true) {
const next = await session.in.wait<{ text: string }>({ timeout: "1h" });
if (!next.ok) return;
await session.out.append({ type: "reply", text: `echo: ${next.output.text}` });
}
},
});
AI Prompts
Use prompts.define() when prompt text or model choice should be versioned on
deploy and optionally overridden from the Trigger.dev dashboard. Resolve the
prompt in a lifecycle hook, store it with chat.prompt.set(), then let
chat.toStreamTextOptions() apply the system prompt, model/config, and
telemetry.
import { prompts } from "@trigger.dev/sdk";
import { chat } from "@trigger.dev/sdk/ai";
import { createProviderRegistry, streamText, stepCountIs } from "ai";
import { anthropic } from "@ai-sdk/anthropic";
import { z } from "zod";
const registry = createProviderRegistry({ anthropic });
const systemPrompt = prompts.define({
id: "my-chat-system",
model: "anthropic:claude-sonnet-4-5",
variables: z.object({ name: z.string() }),
content: "You are a helpful assistant for {{name}}.",
});
export const myChat = chat.agent({
id: "my-chat",
onChatStart: async ({ clientData }) => {
chat.prompt.set(await systemPrompt.resolve({ name: clientData.name }));
},
run: async ({ messages, signal }) => {
return streamText({
...chat.toStreamTextOptions({ registry }),
messages,
abortSignal: signal,
stopWhen: stepCountIs(15),
});
},
});
Trigger Agent Skills
Use Trigger Agent Skills for reusable folders of instructions plus optional
scripts/references/assets that a chat.agent loads on demand. Skills are
developer-authored code bundled into the deploy image; never accept skill paths
from untrusted input.
import { skills } from "@trigger.dev/sdk";
import { chat } from "@trigger.dev/sdk/ai";
import { streamText } from "ai";
import { anthropic } from "@ai-sdk/anthropic";
const pdfSkill = skills.define({
id: "pdf-processing",
path: "./skills/pdf-processing",
});
export const docsChat = chat.agent({
id: "docs-chat",
onChatStart: async () => {
chat.skills.set([await pdfSkill.local()]);
},
run: async ({ messages, signal }) => {
return streamText({
...c
Установить trigger-agents в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл trigger-agents?
AI agent patterns with Trigger.dev - chat.agent, Sessions, AI Prompts, Trigger Agent Skills, orchestration, parallelization, routing, evaluator-optimizer, and human-in-the-loop. Use when building LLM-powered tasks that need durable AI chat, parallel workers, approval gates, tool calling, or multi-step agent workflows.
Как установить скилл trigger-agents?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл trigger-agents запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
theme-factory
Toolkit for styling artifacts with a theme. These artifacts can be slides, docs, reportings, HTML landing pages, etc. There are 10 pre-set themes with…
от Anthropicaccess
Manage Discord channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
от Anthropicconfigure
Set up the Discord channel — save the bot token and review access policy. Use when the user pastes a Discord bot token, asks to configure Discord, asks "how…
от Anthropicaccess
Manage iMessage channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
от Anthropic