convex-agent

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese
<!-- GENERATED from convex-agents content/capabilities/agent.json — do not edit by hand. -->
<!-- 由convex-agents content/capabilities/agent.json生成 — 请勿手动编辑。 -->

Add an AI agent / RAG backend

添加AI Agent/RAG后端

Install @convex-dev/agent for durable threads, message history, tool-calls, and vector search/RAG — the backend for an in-app AI agent.
安装@convex-dev/agent以获得持久线程、消息历史记录、工具调用以及向量搜索/RAG功能——这是应用内AI Agent的后端解决方案。

Workflow

工作流程

  1. Install @convex-dev/agent + add to convex.config.ts.
  2. Define the agent (model, tools, instructions); store the LLM key via the
    env
    micro power.
  3. Create threads + stream messages; persist history in Convex.
  4. For RAG: embed docs into a vector index and retrieve in the tool.
  1. 安装@convex-dev/agent并添加至convex.config.ts。
  2. 定义Agent(模型、工具、指令);通过
    env
    微功能存储LLM密钥。
  3. 创建线程并流式传输消息;在Convex中持久化历史记录。
  4. 针对RAG:将文档嵌入向量索引并在工具中检索。

Rules

规则

  • Keep the LLM API key in Convex env (use the
    env
    micro power), never client-side.
  • Run model calls in actions ('use node' if the SDK needs it).
  • Persist threads/messages in Convex for durability + reactivity.
  • 将LLM API密钥保存在Convex环境变量中(使用
    env
    微功能),绝不要放在客户端。
  • 在actions中运行模型调用(如果SDK需要,使用'use node')。
  • 在Convex中持久化线程/消息以实现耐用性和响应性。