基于 reworkd/AgentGPT 开源项目
52 页 · Next.js + FastAPI + LangChain
第一部分:项目概览
第二部分:前后端架构
第三部分:Agent 核心
第四部分:工具与记忆
第五部分:工程实践
第六部分:总结
AgentGPT 是一个开源的 AI 智能体平台,允许用户在浏览器中创建和部署自主 AI Agent,无需编程即可配置自定义智能体。
核心特性
项目数据
2023 年 AI Agent 爆发期的标志性项目之一,AgentGPT 将自主 Agent 的能力带给了普通用户。
Before AgentGPT
AgentGPT 的创新
生态影响
前端
| 技术 | 用途 |
|---|---|
| Next.js 14 | React 框架 |
| TypeScript | 类型安全 |
| Tailwind CSS | 样式系统 |
| NextAuth.js | 认证 |
| Prisma Client | ORM 客户端 |
| Zustand | 状态管理 |
后端
| 技术 | 用途 |
|---|---|
| Python 3.11 | 运行时 |
| FastAPI | Web 框架 |
| LangChain | Agent 框架 |
| OpenAI SDK | GPT 调用 |
| Pinecone | 向量存储 |
| PostgreSQL | 关系数据库 |
AgentGPT 前端基于 Next.js 14 App Router,采用 React Server Components + Client Components 混合架构。
关键设计
状态管理
next/
├── src/
│ ├── app/ # App Router
│ │ ├── (auth)/ # 认证相关页面
│ │ │ ├── login/
│ │ │ └── register/
│ │ ├── (workspace)/ # 工作区页面
│ │ │ ├── agent/[id]/ # Agent 详情
│ │ │ └── new/ # 创建 Agent
│ │ ├── api/ # API 代理路由
│ │ ├── layout.tsx # 根布局
│ │ └── page.tsx # 首页
│ ├── components/ # 组件库
│ │ ├── agent/ # Agent 相关组件
│ │ ├── ui/ # 通用 UI 组件
│ │ └── layout/ # 布局组件
│ ├── stores/ # Zustand 状态
│ ├── hooks/ # 自定义 Hooks
│ ├── types/ # TypeScript 类型
│ └── utils/ # 工具函数
├── public/ # 静态资源
├── tailwind.config.ts
├── next.config.js
└── package.json
后端使用 FastAPI 构建,基于 LangChain 实现 Agent 核心,支持异步任务处理和流式响应。
架构特点
核心模块
platform/
├── reworkd_platform/
│ ├── __init__.py
│ ├── __main__.py # 入口
│ ├── settings.py # 配置(Pydantic BaseSettings)
│ ├── constants.py # 常量定义
│ ├── timer.py # 计时器
│ ├── logging.py # 日志配置
│ ├── web/
│ │ ├── application.py # FastAPI app 创建
│ │ ├── lifetime.py # 启动/关闭生命周期
│ │ └── api/
│ │ ├── v1/ # API v1 路由
│ │ │ ├── agent.py # Agent 相关 API
│ │ │ ├── auth.py # 认证 API
│ │ │ └── tool.py # 工具 API
│ │ └── router.py # 路由注册
│ ├── services/
│ │ ├── anthropic.py # Anthropic 集成
│ │ ├── aws/ # AWS 服务
│ │ ├── pinecone/ # 向量存储
│ │ ├── tokenizer/ # Token 计数
│ │ ├── security.py # 安全服务
│ │ └── oauth_installers.py
│ ├── db/ # 数据库模型
│ └── schemas/ # Pydantic schemas
├── pyproject.toml # Poetry 配置
├── Dockerfile
└── entrypoint.sh
AgentGPT 采用经典的 Thought → Action → Observation 循环,Agent 持续思考并执行直到任务完成。
class AgentExecutor:
"""AgentGPT 核心 Agent 执行器"""
def __init__(
self,
llm: BaseLanguageModel,
tools: list[BaseTool],
memory: BaseMemory,
max_iterations: int = 15,
):
self.llm = llm
self.tools = tools
self.memory = memory
self.max_iterations = max_iterations
async def execute(self, goal: str) -> AsyncIterator[AgentStep]:
"""执行 Agent 循环,流式返回每一步"""
context = await self._build_context(goal)
for i in range(self.max_iterations):
# 1. 思考:让 LLM 分析当前状态
thought = await self._think(context)
# 2. 判断是否完成
if thought.is_final_answer:
yield AgentStep(
type="final",
output=thought.output,
iterations=i + 1,
)
return
# 3. 行动:执行选中的工具
observation = await self._act(thought)
# 4. 更新上下文
context = self._update_context(
context, thought, observation
)
yield AgentStep(
type="action",
thought=thought,
observation=observation,
)
Thought(思考)
LLM 接收当前上下文,包括:
输出:推理链 + 行动决策
Observation(观察)
工具执行的结果被格式化后加入上下文,作为下一次 Thought 的输入。
Action(行动)
LLM 选择一个工具并生成参数:
{
"tool": "web_search",
"input": {
"query": "AgentGPT latest features"
}
}
终止条件
AgentGPT 通过 LangChain 的 BaseLanguageModel 接口抽象 LLM 调用,支持多个提供商无缝切换。
# settings.py - 模型配置
class Settings(BaseSettings):
openai_api_key: str = ""
openai_organization: str | None = None
openai_model: str = "gpt-4"
openai_temperature: float = 0.7
openai_max_tokens: int = 1000
# Token 限制
model_token_limit: int = 8192
class Config:
env_prefix = "" # 直接读取环境变量
# services/llm_factory.py
from langchain.chat_models import ChatOpenAI
def create_openai_llm(settings: Settings) -> ChatOpenAI:
"""创建 OpenAI LLM 实例"""
return ChatOpenAI(
model=settings.openai_model,
temperature=settings.openai_temperature,
max_tokens=settings.openai_max_tokens,
openai_api_key=settings.openai_api_key,
openai_organization=settings.openai_organization,
streaming=True, # 支持流式输出
)
# services/anthropic.py
from langchain.chat_models import ChatAnthropic
def create_anthropic_llm(settings: Settings) -> ChatAnthropic:
"""创建 Anthropic Claude LLM 实例"""
return ChatAnthropic(
model="claude-3-opus-20240229",
temperature=settings.anthropic_temperature,
max_tokens=settings.anthropic_max_tokens,
anthropic_api_key=settings.anthropic_api_key,
streaming=True,
)
# LLM 工厂 - 根据配置自动选择
def create_llm(settings: Settings) -> BaseLanguageModel:
"""根据配置创建对应的 LLM"""
if settings.model_provider == "openai":
return create_openai_llm(settings)
elif settings.model_provider == "anthropic":
return create_anthropic_llm(settings)
elif settings.model_provider == "azure":
return create_azure_llm(settings)
else:
raise ValueError(
f"Unknown provider: {settings.model_provider}"
)
工具是 AgentGPT 的"手脚",通过 LangChain BaseTool 标准接口实现,Agent 通过自然语言决策调用哪个工具。
from langchain.tools import BaseTool
from pydantic import BaseModel, Field
class SearchInput(BaseModel):
"""搜索工具的输入 Schema"""
query: str = Field(
description="搜索查询关键词"
)
num_results: int = Field(
default=5,
description="返回结果数量"
)
class WebSearchTool(BaseTool):
"""网页搜索工具"""
name = "web_search"
description = (
"用于在互联网上搜索信息。"
"输入搜索查询,返回相关网页结果。"
)
args_schema = SearchInput
def _run(self, query: str, num_results: int = 5) -> str:
"""同步执行搜索"""
return self._search(query, num_results)
async def _arun(
self, query: str, num_results: int = 5
) -> str:
"""异步执行搜索(Agent 使用此方法)"""
return await self._async_search(query, num_results)
| 工具名 | 功能 | 底层实现 | 用途场景 |
|---|---|---|---|
| web_search | 网页搜索 | DuckDuckGo / SerpAPI | 信息检索、事实查询 |
| web_browser | 网页浏览 | Selenium / Playwright | 读取网页内容、填表 |
| code_execution | 代码执行 | 沙箱 Python 解释器 | 计算、数据处理 |
| knowledge_graph | 知识图谱 | Pinecone 向量存储 | 长期记忆存取 |
| writing | 文本写入 | 文件系统 | 生成报告、保存结果 |
class WebSearchTool(BaseTool):
"""基于 DuckDuckGo 的网页搜索"""
name = "web_search"
description = "搜索互联网获取最新信息"
async def _arun(self, query: str) -> str:
# 使用 DuckDuckGo 搜索
async with aiohttp.ClientSession() as session:
params = {
"q": query,
"format": "json",
"no_html": 1,
}
async with session.get(
"https://api.duckduckgo.com/",
params=params
) as resp:
data = await resp.json()
# 格式化搜索结果
results = []
for item in data.get("RelatedTopics", [])[:5]:
if "Text" in item:
results.append(
f"- {item['FirstURL']}\n"
f" {item['Text']}"
)
return "\n".join(results) if results \
else "No results found."
class WebBrowserTool(BaseTool):
"""网页内容提取工具"""
name = "web_browser"
description = "浏览并提取网页内容"
async def _arun(self, url: str) -> str:
try:
# 获取网页内容
async with aiohttp.ClientSession() as s:
async with s.get(url, timeout=10) as r:
html = await r.text()
# 使用 BeautifulSoup 提取文本
soup = BeautifulSoup(html, "html.parser")
# 移除脚本和样式
for tag in soup(
["script", "style", "nav", "footer"]
):
tag.decompose()
text = soup.get_text(
separator="\n", strip=True
)
# 截断过长内容
return text[:4000] if len(text) > 4000 \
else text
except Exception as e:
return f"Error browsing {url}: {str(e)}"
class CodeExecutionTool(BaseTool):
"""安全的 Python 代码执行环境"""
name = "code_execution"
description = (
"在沙箱中执行 Python 代码。"
"可用于数学计算、数据分析。"
)
# 允许的模块白名单
ALLOWED_MODULES = {
"math", "json", "re", "datetime",
"collections", "statistics", "itertools",
}
async def _arun(self, code: str) -> str:
"""在受限环境中执行代码"""
# 限制可用模块
restricted_globals = {
"__builtins__": {
k: v for k, v in __builtins__.items()
if k in ("print", "len", "range",
"int", "float", "str", "list",
"dict", "set", "tuple", "abs",
"min", "max", "sum", "sorted")
},
**{
m: __import__(m)
for m in self.ALLOWED_MODULES
},
}
# 执行并捕获输出
stdout = StringIO()
with redirect_stdout(stdout):
exec(code, restricted_globals, {})
return stdout.getvalue() or "Code executed."
class KnowledgeGraphTool(BaseTool):
"""基于 Pinecone 的长期记忆工具"""
name = "knowledge_graph"
description = (
"存储和检索长期记忆。"
"可用于记住重要信息和经验。"
)
def __init__(self, pinecone_client, embedding_model):
super().__init__()
self.pinecone = pinecone_client
self.embeddings = embedding_model
self.index_name = "agent-memory"
self.namespace = "agent-v1"
async def _arun(self, command: str) -> str:
"""支持 store/retrieve 命令"""
if command.startswith("store:"):
content = command[6:].strip()
return await self._store(content)
elif command.startswith("retrieve:"):
query = command[9:].strip()
return await self._retrieve(query)
async def _store(self, content: str) -> str:
vector = await self.embeddings.aembed(content)
self.pinecone.Index(self.index_name).upsert(
vectors=[{
"id": str(uuid4()),
"values": vector,
"metadata": {"text": content}
}],
namespace=self.namespace,
)
return "Memory stored."
AgentGPT 使用 Pinecone 向量数据库实现长期记忆,Agent 可以跨会话存储和检索信息。
记忆架构
向量化流程
# services/pinecone/client.py
from pinecone import Pinecone
class MemoryStore:
"""Pinecone 向量记忆存储"""
def __init__(self, settings: Settings):
self.client = Pinecone(
api_key=settings.pinecone_api_key
)
self.index_name = settings.pinecone_index
self.dimension = 1536 # ada-002 维度
async def ensure_index(self):
"""确保索引存在"""
if self.index_name not in \
self.client.list_indexes().names():
self.client.create_index(
name=self.index_name,
dimension=self.dimension,
metric="cosine",
metadata_config={
"indexed": ["agent_id", "created_at"]
},
)
async def search(
self, query_vector: list, top_k: int = 5,
filter_dict: dict = None
) -> list[MemoryRecord]:
"""语义搜索相似记忆"""
index = self.client.Index(self.index_name)
results = index.query(
vector=query_vector,
top_k=top_k,
include_metadata=True,
filter=filter_dict,
)
return [
MemoryRecord(
id=m["id"],
text=m["metadata"]["text"],
score=m["score"],
)
for m in results["matches"]
]
# services/pinecone/memory.py
class AgentMemory:
"""Agent 记忆管理器"""
def __init__(
self,
store: MemoryStore,
embeddings: Embeddings,
agent_id: str,
):
self.store = store
self.embeddings = embeddings
self.agent_id = agent_id
async def save(self, text: str) -> str:
"""保存记忆到向量存储"""
vector = await self.embeddings.aembed(text)
record_id = str(uuid4())
self.store.upsert(
id=record_id,
values=vector,
metadata={
"text": text,
"agent_id": self.agent_id,
"created_at": datetime.utcnow().isoformat(),
},
)
return record_id
async def recall(
self, query: str, top_k: int = 3
) -> list[str]:
"""检索相关记忆"""
query_vector = \
await self.embeddings.aembed(query)
results = await self.store.search(
query_vector,
top_k=top_k,
filter_dict={"agent_id": self.agent_id},
)
return [r.text for r in results]
AgentGPT 使用 PostgreSQL 作为主数据库,通过 Prisma ORM(前端)和 SQLAlchemy(后端)操作。
// prisma/schema.prisma
datasource db {
provider = "postgresql"
url = env("DATABASE_URL")
}
generator client {
provider = "prisma-client-js"
}
model User {
id String @id @default(cuid())
email String @unique
name String?
image String?
emailVerified DateTime?
accounts Account[]
sessions Session[]
agents Agent[]
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
}
model Agent {
id String @id @default(cuid())
userId String
user User @relation(
fields: [userId], references: [id]
)
name String
goal String
model String @default("gpt-4")
settings Json @default("{}")
runs AgentRun[]
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
}
model AgentRun {
id String @id @default(cuid())
agentId String
agent Agent @relation(
fields: [agentId], references: [id]
)
status String // running/success/failed
steps Json // AgentStep[]
result String?
createdAt DateTime @default(now())
}
认证方案
NextAuth.js 处理前端认证:
后端 JWT 验证:
安全措施
# services/security.py
from passlib.context import \
CryptContext
pwd_context = CryptContext(
schemes=["bcrypt"],
deprecated="auto",
)
def verify_password(
plain: str, hashed: str
) -> bool:
return pwd_context.verify(
plain, hashed
)
def hash_password(
password: str
) -> str:
return pwd_context.hash(password)
| 方法 | 路径 | 功能 |
|---|---|---|
| POST | /api/v1/agents | 创建 Agent |
| GET | /api/v1/agents | 获取 Agent 列表 |
| GET | /api/v1/agents/{id} | 获取 Agent 详情 |
| POST | /api/v1/agents/{id}/run | 启动 Agent 执行 |
| POST | /api/v1/agents/{id}/stop | 停止 Agent |
| GET | /api/v1/agents/{id}/runs | 获取执行历史 |
| POST | /api/v1/auth/login | 用户登录 |
| POST | /api/v1/auth/register | 用户注册 |
| GET | /api/v1/auth/me | 获取当前用户 |
# web/api/v1/agent.py
from fastapi import WebSocket, WebSocketDisconnect
@router.websocket("/ws/agent/{agent_id}")
async def agent_websocket(
websocket: WebSocket,
agent_id: str,
current_user: User = Depends(
get_current_user_ws
),
):
await websocket.accept()
try:
# 验证 Agent 归属
agent = await verify_agent_owner(
agent_id, current_user.id
)
# 启动 Agent 并流式推送
async for step in agent_executor.execute(
agent.goal
):
await websocket.send_json({
"type": step.type,
"data": {
"thought": step.thought,
"action": step.action,
"observation": step.observation,
"iteration": step.iterations,
},
})
except WebSocketDisconnect:
logger.info("Client disconnected")
except Exception as e:
await websocket.send_json({
"type": "error",
"data": {"message": str(e)},
})
// stores/agentStore.ts
import { create } from 'zustand';
interface AgentState {
agents: Agent[];
currentAgent: Agent | null;
isRunning: boolean;
steps: AgentStep[];
// Actions
createAgent: (name: string, goal: string)
=> Promise<void>;
startRun: (agentId: string) => AsyncGenerator;
stopRun: () => void;
addStep: (step: AgentStep) => void;
}
export const useAgentStore = create<AgentState>(
(set, get) => ({
agents: [],
currentAgent: null,
isRunning: false,
steps: [],
createAgent: async (name, goal) => {
const res = await fetch('/api/agents', {
method: 'POST',
body: JSON.stringify({ name, goal }),
});
const agent = await res.json();
set((s) => ({
agents: [...s.agents, agent]
}));
},
startRun: async (agentId) => {
set({ isRunning: true, steps: [] });
const ws = new WebSocket(
`/ws/agent/${agentId}`
);
ws.onmessage = (e) => {
const step = JSON.parse(e.data);
set((s) => ({
steps: [...s.steps, step]
}));
};
},
})
);
核心组件
UI 设计理念
交互流程:创建 Agent → 配置目标和工具 → 点击运行 → 实时查看步骤 → 查看最终结果
AgentGPT 的 Prompt 设计是核心竞争力的关键,直接影响 Agent 的推理质量和工具选择准确性。
Prompt 组成
设计原则
SYSTEM_PROMPT = """
You are an autonomous AI agent. Your goal is to
achieve the user's objective using available tools.
## Available Tools
{tool_descriptions}
## Instructions
1. Analyze the current context and your goal
2. Choose the most appropriate tool to use
3. Provide the tool name and input arguments
4. If you have enough information, provide
the final answer
## Response Format
Respond ONLY with valid JSON:
{{
"thought": "Your reasoning process",
"tool": "tool_name or 'final'",
"input": {{ "key": "value" }} or null,
"output": "final answer if done"
}}
## Constraints
- You have {max_iterations} iterations
- Be concise and efficient
- Prioritize accuracy over speed
- Use tools to gather information before answering
"""
Token 预算
# services/tokenizer/counter.py
class TokenBudget:
"""Token 预算管理器"""
def __init__(
self,
model_limit: int = 8192,
reserve_output: int = 1000,
):
self.total = model_limit
self.reserve = reserve_output
self.available = model_limit \
- reserve_output
def allocate(self, parts: dict) -> dict:
"""按比例分配 Token"""
total_input = sum(parts.values())
return {
k: int(
self.available * v / total_input
)
for k, v in parts.items()
}
上下文裁剪
def trim_context(
messages: list[dict],
max_tokens: int,
counter: TokenCounter,
) -> list[dict]:
"""裁剪历史消息以适应 Token 限制"""
trimmed = []
total = 0
# 保留 System Prompt
trimmed.append(messages[0])
total += counter.count(messages[0])
# 从最新消息开始保留
for msg in reversed(messages[1:]):
cost = counter.count(msg)
if total + cost > max_tokens:
break
trimmed.insert(1, msg)
total += cost
return trimmed
# services/retry.py
from tenacity import (
retry,
stop_after_attempt,
wait_exponential,
retry_if_exception_type,
)
class AgentError(Exception):
"""Agent 执行错误基类"""
class LLMRateLimitError(AgentError):
"""LLM 速率限制"""
class ToolExecutionError(AgentError):
"""工具执行错误"""
@retry(
stop=stop_after_attempt(3),
wait=wait_exponential(
min=1, max=60, multiplier=2
),
retry=retry_if_exception_type(
(LLMRateLimitError, TimeoutError)
),
before_sleep=lambda _: logger.warning(
"Retrying after rate limit..."
),
)
async def call_llm_with_retry(
llm: BaseLanguageModel,
messages: list[dict],
) -> str:
"""带重试的 LLM 调用"""
try:
return await llm.apredict(messages=messages)
except RateLimitError as e:
raise LLMRateLimitError(
f"Rate limited: {e}"
) from e
并发控制
import asyncio
class ConcurrencyLimiter:
"""Agent 并发执行限制"""
def __init__(self, max_concurrent: int = 5):
self.semaphore = asyncio.Semaphore(
max_concurrent
)
self.active_tasks: dict[
str, asyncio.Task
] = {}
async def run_agent(
self, agent_id: str, goal: str
):
async with self.semaphore:
task = asyncio.current_task()
self.active_tasks[agent_id] = task
try:
async for step in \
executor.execute(goal):
yield step
finally:
del self.active_tasks[
agent_id
]
限流策略
优雅降级
# docker-compose.yml
version: "3.9"
services:
frontend:
build:
context: ./next
dockerfile: Dockerfile
ports:
- "3000:3000"
environment:
- NEXTAUTH_SECRET=${AUTH_SECRET}
- DATABASE_URL=${DATABASE_URL}
depends_on:
- postgres
backend:
build:
context: ./platform
dockerfile: Dockerfile
ports:
- "8000:8000"
environment:
- DATABASE_URL=${DATABASE_URL}
- OPENAI_API_KEY=${OPENAI_API_KEY}
- PINECONE_API_KEY=${PINECONE_API_KEY}
- REDIS_URL=redis://redis:6379
depends_on:
- postgres
- redis
postgres:
image: pgvector/pgvector:pg16
volumes:
- pgdata:/var/lib/postgresql/data
environment:
POSTGRES_DB: agentgpt
POSTGRES_PASSWORD: ${DB_PASSWORD}
redis:
image: redis:7-alpine
ports:
- "6379:6379"
volumes:
pgdata:
LLM Provider 切换:通过策略模式实现多 LLM 提供商的灵活切换,符合开闭原则。
# 策略接口
class LLMStrategy(ABC):
@abstractmethod
async def generate(self, prompt: str) -> str:
...
# 具体策略
class OpenAIStrategy(LLMStrategy):
async def generate(self, prompt: str) -> str:
return await self.client.chat.completions.create(
model="gpt-4",
messages=[{"role": "user", "content": prompt}]
)
class AnthropicStrategy(LLMStrategy):
async def generate(self, prompt: str) -> str:
return await self.client.messages.create(
model="claude-3-opus",
messages=[{"role": "user", "content": prompt}]
)
# 上下文
class AgentContext:
def __init__(self, strategy: LLMStrategy):
self._strategy = strategy
def set_strategy(self, strategy: LLMStrategy):
self._strategy = strategy
async def think(self, prompt: str) -> str:
return await self._strategy.generate(prompt)
Agent 步骤通知:通过观察者模式实现 Agent 执行步骤的实时推送,解耦 Agent 执行与 UI 更新。
class AgentEventEmitter:
"""Agent 事件发射器"""
def __init__(self):
self._listeners: dict[
str, list[Callable]
] = {}
def on(self, event: str, callback: Callable):
if event not in self._listeners:
self._listeners[event] = []
self._listeners[event].append(callback)
async def emit(self, event: str, data: Any):
for callback in self._listeners.get(
event, []
):
await callback(data)
# 使用
emitter = AgentEventEmitter()
# WebSocket 订阅
emitter.on("step", websocket.send_json)
emitter.on("error", log_error)
emitter.on("complete", save_result)
# Agent 执行中发射事件
await emitter.emit("step", step_data)
工具创建:通过工厂模式根据配置动态创建工具实例,支持灵活的工具组合。
class ToolFactory:
"""工具工厂 - 根据配置创建工具"""
_registry: dict[str, type[BaseTool]] = {
"web_search": WebSearchTool,
"web_browser": WebBrowserTool,
"code_execution": CodeExecutionTool,
"knowledge_graph": KnowledgeGraphTool,
}
@classmethod
def register(
cls, name: str, tool_class: type[BaseTool]
):
"""注册自定义工具"""
cls._registry[name] = tool_class
@classmethod
def create_tools(
cls, tool_names: list[str], **kwargs
) -> list[BaseTool]:
"""批量创建工具实例"""
tools = []
for name in tool_names:
if name not in cls._registry:
raise ValueError(
f"Unknown tool: {name}"
)
tool = cls._registry[name](**kwargs)
tools.append(tool)
return tools
| 特性 | AgentGPT | AutoGPT | BabyAGI |
|---|---|---|---|
| 界面 | Web 浏览器 | 命令行 | 命令行 |
| 语言 | Python + TS | Python | Python |
| 部署 | Docker Compose | 本地安装 | 本地安装 |
| 实时性 | WebSocket 流式 | 终端输出 | 终端输出 |
| 多用户 | ✅ 支持 | ❌ 单用户 | ❌ 单用户 |
| 长期记忆 | Pinecone | 本地 JSON | ChromaDB |
| 任务管理 | 简单队列 | 任务列表 | 优先级队列 |
LLM 调用优化
数据库优化
前端优化
常见问题
解决方案
调试技巧:启用详细日志 → 检查每步 Thought → 验证工具输入 → 确认上下文窗口使用率
官方资源
相关项目
推荐论文
关键概念
核心架构亮点
工程实践
AgentGPT 是一个优秀的 AI Agent 框架参考实现,它展示了如何将 LLM 推理、工具调用、长期记忆和 Web UI 有机结合,构建一个可用的智能体平台。
源码地址
https://github.com/reworkd/AgentGPT