从写代码,到创作下一幕

探索 字节跳动 - 火山方舟 的 AI 编程与视频创作活动。

火山方舟 Agent Plan 与 Coding Plan 活动,价格 ¥9.9 起

Agent Plan & Coding Plan

一站体验多款热门模型,为 AI 编程与智能体开发提供更多选择。新用户可联系(微信: goo_lvyouyou)免费体验 9.9 agent plan。

查看套餐优惠
Seedance 2.5 视频创作活动:30 秒视频、多模态参考、局部编辑

Seedance 2.5

让创意,跃然成片。探索 30 秒视频、多模态参考与局部编辑,把脑海中的画面变成下一支作品。

探索视频创作

模型能力

多智能体

查看 Markdown

实时多智能体研究使 Grok 能够编排多个实时协作的 AI 智能体,执行深入的多步骤研究任务。各智能体专注于研究的特定方面(搜索网络、分析数据、综合发现),共同给出全面且来源充分的答案。


概览

多智能体研究不止于单轮工具调用;它会协调一组专业智能体,以便:

  • 搜索和收集同时从多个来源收集信息

  • 分析并交叉验证不同领域的发现

  • 汇总带有引用和支持证据的全面答案

  • 迭代实时迭代研究,并根据中间发现优化结果


开始使用

要使用实时多智能体研究,请在 API 请求中将 grok-4.20-multi-agent 指定为模型名称。该模型专门针对编排多个协作完成研究任务的智能体进行了优化。

import { xai } from "@ai-sdk/xai";
import { generateText } from "ai";

const { text } = await generateText({
  model: xai.responses("grok-4.20-multi-agent"),
  prompt:
    "Research the latest breakthroughs in quantum computing and summarize the key findings.",
  tools: {
    web_search: xai.tools.webSearch(),
    x_search: xai.tools.xSearch(),
  },
});

console.log(text);

多智能体的工作原理

向多智能体模型发送请求时,系统会启动多个智能体,围绕你的查询进行讨论和协作。每个智能体都会贡献自己的视角、推理和发现。指定的 主智能体负责汇总讨论并向你呈现最终答案。

支持的模型

  • grok-4.20-multi-agent

内置工具支持

SpaceXSI 提供了一组可在请求中启用的内置工具,用于处理常见任务,例如web_search、x_search、code_execution、collections_search。请查看此文档了解更多信息。

在请求中启用这些工具后,服务端会执行智能体循环,根据你的查询在服务端调用工具,直至生成最终答案。

输出行为

只有主智能体的 工具调用 和 最终响应 会返回给用户。所有子智能体状态,包括中间推理、工具调用和输出,都会加密;只有当 xAI SDK 中的 use_encrypted_content设置为True时才包含在响应中。这样可以让默认响应保持简洁、聚焦,同时仍允许你为多轮对话保留完整的多智能体上下文。


配置

可以配置在一个请求中协作的智能体数量。可用的两种配置是4 个智能体和16 个智能体。更多智能体可开展更深入、更全面的研究,但会增加 token 用量和延迟。

SDK / API参数4 个智能体16 个智能体
xAI SDKagent_count416
OpenAI SDKreasoning.effort"low"或"medium""high"或"xhigh"
Vercel AI SDKreasoningEffort"low"或"medium""high"或"xhigh"
REST APIreasoning.effort"low"或"medium""high"或"xhigh"

最适合:快速研究和范围明确的查询可使用 4 个智能体;深度研究和复杂的多方面主题可使用 16 个智能体。

4 个智能体配置

import { xai } from "@ai-sdk/xai";
import { generateText } from "ai";

const { text } = await generateText({
  model: xai.responses("grok-4.20-multi-agent"),
  prompt: "What are the key differences between TCP and UDP?",
  providerOptions: {
    xai: { reasoningEffort: "low" },
  },
});

console.log(text);

16 个智能体配置

import { xai } from "@ai-sdk/xai";
import { generateText } from "ai";

const { text } = await generateText({
  model: xai.responses("grok-4.20-multi-agent"),
  prompt:
    "Analyze the design trade-offs in modern programming languages: compare Rust's ownership model, Go's simplicity philosophy, and Haskell's pure functional approach. Cover memory safety, concurrency, developer productivity, and ecosystem maturity.",
  providerOptions: {
    xai: { reasoningEffort: "high" },
  },
});

console.log(text);

常见模式

不使用内置工具

多智能体无需任何内置工具也能工作,各智能体完全依靠共同的知识和推理协作生成响应。

import { xai } from "@ai-sdk/xai";
import { generateText } from "ai";

const { text } = await generateText({
  model: xai.responses("grok-4.20-multi-agent"),
  prompt:
    "Compare the major approaches to distributed consensus in computer science: Paxos, Raft, and Byzantine fault tolerance. Analyze the trade-offs in safety guarantees, performance, and implementation complexity.",
});

console.log(text);

多轮对话

与其他模型一样,多智能体研究可以使用previous_response_id进行多轮对话。你可以提出后续问题来完善或扩展之前的研究结果,智能体会使用先前上下文给出更有针对性的答案。

包含可复用函数和代码示例的完整多轮对话模式,请参阅串联对话。


价格

无论是主智能体和子智能体消耗的所有 token 都会计费,包括输入 token、输出 token 和推理 token。同样,任何智能体发出的所有服务器端工具调用,无论由主智能体还是子智能体发出,都会计入工具用量并相应收费。

由于多个智能体可能并行运行,且每个智能体都能独立调用工具,单个多智能体请求消耗的 token 和工具调用可能远多于标准的单智能体请求。你可以通过响应中的usage和server_side_tool_usage字段监控用量。

详细价格信息请参阅价格页面和工具价格页面。


多智能体提示指南

要充分发挥多智能体研究的能力,首先要合理组织请求。以下模式效果良好:

明确设置范围和深度

不要提出宽泛问题,应明确告诉智能体需要覆盖哪些维度:

Text

❌  "Tell me about electric vehicles."
✅  "Compare the top 3 EV manufacturers by battery technology, range, charging infrastructure, and 2025 sales projections."

要求结构化输出

当你要求有组织、结构清晰的响应时,多智能体研究表现尤为出色:

Text

✅  "Research the pros and cons of microservices vs monolithic architecture. Present your findings as a comparison table with categories: scalability, complexity, deployment, and team size requirements."

指定来源或视角

引导智能体使用你重视的证据类型:

Text

✅  "Analyze the environmental impact of large language model training, citing recent academic papers and industry reports from 2024-2025."

将复杂研究拆成对话

对于深度主题,先从宽泛问题开始,再通过 follow-up 逐步缩小范围,而不是将所有内容塞进一个 prompt:

Text

Turn 1: "What are the leading approaches to carbon capture technology?"
Turn 2: "Which of those has the best cost-per-ton economics today?"
Turn 3: "What are the main engineering challenges preventing that approach from scaling?"

在相关时提供上下文

如果研究基于已有知识或特定约束,请在 prompt 中提供这些上下文:

Text

✅  "I'm building a fintech app targeting Southeast Asian markets. Research the regulatory requirements for digital payments in Singapore, Indonesia, and the Philippines."

限制

  • 仅公开主智能体输出:仅返回主智能体的输出,包括工具调用和响应内容。子智能体状态会加密,并且仅在启用use_encrypted_content时包含,请参阅输出行为了解详情。

  • 不支持客户端或自定义工具:多智能体模型变体目前不支持客户端工具(function calling)和自定义工具。我们支持一组内置工具(例如web_search、x_search)和 remote MCP tools。请参阅我们的内置工具文档了解更多详情。

  • 不支持 Chat Completions API:多智能体模型不支持 OpenAI Chat Completions API。请改用xAI SDK或Responses API。

  • max_tokens不受支持:当前多智能体模型变体不支持max_tokens参数。


最后更新:2026 年 10 月 10 日