Workflows2026年5月7日·1 分钟阅读

Inngest Agent Kit — Build AI Agents with Tools

Inngest Agent Kit gives typed multi-step agents with retry, state, tool use. Drops into Inngest jobs for durable, observable agent runs.

Agent 就绪

这个资产可以被 Agent 直接读取和安装

TokRepo 同时提供通用 CLI 命令、安装契约、metadata JSON、按适配器生成的安装计划和原始内容链接,方便 Agent 判断适配度、风险和下一步动作。

Needs Confirmation · 52/100策略:需确认
Agent 入口
任意 MCP/CLI Agent
类型
Skill
安装
Single
信任
信任等级:New
入口
Asset
通用 CLI 安装命令
npx tokrepo install 56ac925d-060c-4d74-9169-0593d6e87408

简介

Inngest Agent Kit 是在 Inngest 持久执行之上的类型化 agent 层。用 createAgent() 建 agent、给它工具、放进 inngest.createFunction() 跑 —— 自动重试、状态 checkpoint、可观测、子 agent 并行调用。适合需要扛崩溃、重试、超时的生产 agent。需要 Inngest 3.x 和 TypeScript 5+。装机时间 5 分钟。


定义 agent

import { createAgent, anthropic } from "@inngest/agent-kit";

const researchAgent = createAgent({
  name: "Researcher",
  description: "Searches the web and summarizes findings",
  model: anthropic({ model: "claude-3-5-sonnet-20241022" }),
  system: "You are a research assistant. Search aggressively, cite sources.",
  tools: [
    {
      name: "web_search",
      description: "Search the web",
      parameters: z.object({ query: z.string() }),
      handler: async ({ query }) => {
        return await fetch(`https://api.tavily.com/search?q=${query}`)
          .then(r => r.json());
      },
    },
  ],
});

在 Inngest function 里跑

inngest.createFunction(
  { id: "research" },
  { event: "research.requested" },
  async ({ event, step }) => {
    const { topic } = event.data;

    // 每个 agent step 是 checkpoint,扛崩溃
    const findings = await step.run("research", () =>
      researchAgent.run(`Research ${topic}`));

    return findings;
  },
);

Agent 网络

import { createNetwork } from "@inngest/agent-kit";

const network = createNetwork({
  agents: [researchAgent, writerAgent, editorAgent],
  defaultModel: anthropic({ model: "claude-3-5-haiku-20241022" }),
  router: ({ network, callCount }) => {
    if (callCount === 0) return researchAgent;
    if (network.state.kv.get("draft") === undefined) return writerAgent;
    return editorAgent;
  },
});

const final = await network.run("Write a 500-word brief on agent frameworks");

router 函数按 network 状态决定下一个 agent 跑哪个。用它建 supervisor-worker 模式或顺序流水线。


FAQ

Q: Inngest 免费吗? A: 免费 —— Inngest Apache-2.0 开源。Agent Kit 也开源。Inngest Cloud 有免费档(5 万次/月),付费档加并发和保留期。

Q: 为啥用 Agent Kit 不用裸 Inngest? A: 裸 Inngest function 适合通用后台任务。Agent Kit 加了类型化 agent 原语 —— 工具、系统 prompt、agent 网络 —— 不用自己撸。两者可以同项目混用。

Q: 能配 Anthropic 和 OpenAI 吗? A: 能 —— Agent Kit 自带 anthropic() / openai() / gemini() 适配器,以及任何 OpenAI 兼容端点(所以能接 LiteLLM Proxy 或 Together)。


🙏

来源与感谢

Built by Inngest. Licensed under Apache-2.0.

inngest/agent-kit — ⭐ Active

讨论

登录后参与讨论。
还没有评论,来写第一条吧。

相关资产