@convex-dev/agent

中文文档
0.7.9发布于 2026/10/29Apache-2.0TypeScriptES Module零依赖近 30 天下载 103.6万

Convex component for AI agents with persistent chat threads, tool calling, streaming, and RAG.

原始使用文档

Convex Agent Component

npm version

Build AI agents on Convex with persistent chat threads, tool calling, streaming, and RAG. Long-running agent workflows stay separate from the UI while clients keep reactive updates.

npm i @convex-dev/agent

AI Agents, built on Convex. Check out the docs here.

The Agent component manages threads and messages that agents can use in static or dynamic workflows.

  • Agents provide an abstraction for using LLMs to represent units of use-case-specific prompting with associated models, prompts, Tool Calls, and behavior in relation to other Agents, functions, APIs, and more.
  • Threads persist messages and can be shared by multiple users and agents (including human agents).
  • Streaming text and objects using deltas over websockets so all clients stay in sync efficiently, without http streaming. Enables streaming from async functions.
  • Conversation context is automatically included in each LLM call, including built-in hybrid vector/text search for messages in the thread and opt-in search for messages from other threads (for the same specified user).
  • RAG techniques are supported for prompt augmentation from other sources, either up front in the prompt or as tool calls. Integrates with the RAG Component, or DIY.
  • Workflows allow building multi-step operations that can span agents, users, durably and reliably.
  • Files are supported in thread history with automatic saving to file storage and ref-counting.
  • Debugging is enabled by callbacks, the agent playground where you can inspect all metadata and iterate on prompts and context settings, and inspection in the dashboard.
  • Usage tracking is easy to set up, enabling usage attribution per-provider, per-model, per-user, per-agent, for billing & more.
  • Rate limiting, powered by the Rate Limiter Component, helps control the rate at which users can interact with agents and keep you from exceeding your LLM provider's limits.

Read the associated Stack post here.

Powerful AI Apps Made Easy with the Agent Component Read the docs for more details.

Play with the example:

git clone https://github.com/convex/agent.git
cd agent
npm run setup
npm run dev

Found a bug? Feature request? File it here.

DeepWiki

版本与发布记录

@convex-dev/agent 共发布 170 个版本,首次发布于 2025/04/07;过去 12 个月发布了 22 个版本。

版本发布日期距今
0.7.9latest2026/10/2912 天前
0.7.82026/10/1526 天前
0.7.72026/10/081 个月前
0.7.62026/10/071 个月前
0.7.52026/10/071 个月前
0.7.42026/10/061 个月前

其他发布通道:beta → 0.6.0-beta.0,alpha → 0.7.0-alpha.0。

关于 @convex-dev/agent 的常见问题

@convex-dev/agent 是什么?

Convex component for AI agents with persistent chat threads, tool calling, streaming, and RAG.

如何安装 @convex-dev/agent?

在项目目录运行 npm install @convex-dev/agent,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:ai(^7.0.129)、convex(^1.46.0)、convex-helpers(^0.1.127)、@ai-sdk/provider(^4.0.0)、@ai-sdk/provider-utils(^5.0.0)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@convex-dev/agent 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@convex-dev/agent 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

@convex-dev/agent 需要什么版本的 Node.js?

package.json 的 engines 字段要求 Node.js >=22。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。

@convex-dev/agent 可以商用吗?

@convex-dev/agent 使用 Apache-2.0 许可。宽松许可:允许商业使用、修改和再分发,并附带明确的专利授权;分发时需保留许可与 NOTICE 文件,修改过的文件要注明改动。以上为概括,不构成法律意见,请以许可原文为准。

@convex-dev/agent 的下载量有多少?

根据 npm 官方下载统计,@convex-dev/agent 在 2026/10/11 – 2026/11/09 这 30 天内被下载 1,036,428 次,日均约 34,548 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@convex-dev/agent 还在维护吗?

最新版本 0.7.9 发布于 2026/10/29(12 天前);至今共发布 170 个版本,其中过去 12 个月发布了 22 个;首次发布于 2025/04/07。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。