---
title: "AI 代理"
description: "学习如何使用 AI 工具包构建 AI 代理。"
canonical_url: "https://tiptap.zhcndoc.com/content-ai/capabilities/ai-toolkit/agents"
---

# AI 代理

学习如何使用 AI 工具包构建 AI 代理。

AI 代理可以与其环境交互以完成复杂任务。AI 工具包包含[内置工具](https://tiptap.zhcndoc.com/content-ai/capabilities/ai-toolkit/agents/tools.md)，允许您的 AI 阅读、编辑和评论文档。

通过 AI 工具包，您可以构建具有广泛功能的代理：

[AI 代理聊天机器人
了解更多 →构建一个可以通过聊天阅读和编辑文档的对话式 AI 代理。](https://tiptap.zhcndoc.com/content-ai/capabilities/ai-toolkit/agents/ai-agent-chatbot.md)

[审查变更
了解更多 →使用装饰标记或跟踪更改预览并批准 AI 生成的更改。](https://tiptap.zhcndoc.com/content-ai/capabilities/ai-toolkit/agents/review-changes.md)

[工具流式传输
了解更多 →实时流式传输工具调用，实时查看变更过程。](https://tiptap.zhcndoc.com/content-ai/capabilities/ai-toolkit/agents/streaming.md)

[添加评论
了解更多 →赋予您的 AI 代理读取、撰写和编辑评论的能力。](https://tiptap.zhcndoc.com/content-ai/capabilities/ai-toolkit/agents/comments.md)

[多文档处理
了解更多 →构建一个可以同时编辑多个 Tiptap 文档的 AI 代理。](https://tiptap.zhcndoc.com/content-ai/capabilities/ai-toolkit/agents/multi-document.md)

[选区感知
了解更多 →让 AI 了解编辑器中选定的内容。](https://tiptap.zhcndoc.com/content-ai/capabilities/ai-toolkit/agents/selection-awareness.md)

[架构感知
了解更多 →使您的 AI 模型理解自定义节点、标记及属性。](https://tiptap.zhcndoc.com/content-ai/capabilities/ai-toolkit/agents/schema-awareness.md)

## 可用工具

AI 工具包提供了针对流行 AI 提供商库（如 Vercel AI SDK、LangChain.js、OpenAI 和 Anthropic）的[工具定义](https://tiptap.zhcndoc.com/content-ai/capabilities/ai-toolkit/agents/tools.md)。

当您将这些工具定义添加到 AI 代理时，AI 模型可以生成工具调用，随后通过 `executeTool` 方法执行。这使得 AI 能够根据用户请求读取、编辑和操作文档。

## AI 代理与工作流程的区别

在 AI 代理中，AI 模型可以从一组工具中选择以完成任务。而[工作流程](https://tiptap.zhcndoc.com/content-ai/capabilities/ai-toolkit/workflows.md)则仅允许 AI 模型执行单一操作，例如生成编辑内容或重写文档。

总体而言，工作流程比 AI 代理工具更简单且实现更快。然而，AI 代理更为灵活，适用于执行更复杂的任务。
