复杂工作流
在 Astreus 文档中了解 复杂工作流,获取用于构建智能体系统的设置指导、API 模式和实用示例。 了解构建可靠的 Astreus 智能体系统所需的设置模式、API 和实用示例。
使用高级编排模式构建复杂的多智能体工作流。
快速开始
克隆完整示例
最简单的开始方式是克隆完整的示例仓库:
git clone https://github.com/astreus-ai/examples
cd examples/complex-workflows
npm install或仅安装包
如果你更喜欢从零开始构建:
npm install @astreus-ai/astreus环境配置
# .env
OPENAI_API_KEY=sk-your-openai-api-key-here
DB_URL=sqlite://./astreus.db多智能体工作流
import { Agent, Graph } from '@astreus-ai/astreus';
// Create specialized agents
const researcher = await Agent.create({
name: 'Researcher',
model: 'gpt-4o',
systemPrompt: 'You research topics thoroughly.'
});
const writer = await Agent.create({
name: 'Writer',
model: 'gpt-4o',
systemPrompt: 'You create engaging content.'
});
// Create workflow pipeline
const pipeline = new Graph({
name: 'content-pipeline'
}, researcher);
// Define workflow steps
const research = pipeline.addTaskNode({
prompt: 'Research AI trends in 2024',
agentId: researcher.id
});
const article = pipeline.addTaskNode({
prompt: 'Write an article based on the research',
agentId: writer.id,
dependencies: [research]
});
// Execute the workflow
const results = await pipeline.run();
// Parse the result and extract the response
if (results.success && results.results[article]) {
const articleResult = JSON.parse(results.results[article]);
console.log(articleResult.response);
}运行示例
如果你克隆了仓库:
npm run dev仓库
完整示例可在 GitHub 上获取:examples/complex-workflows
最后更新时间:2026年7月6日
本节内容
你的第一个智能体
在 Astreus 文档中了解 你的第一个智能体,获取用于构建智能体系统的设置指导、API 模式和实用示例。 了解构建可靠的 Astreus 智能体系统所需的设置模式、API 和实用示例。
带记忆的智能体
在 Astreus 文档中了解 带记忆的智能体,获取用于构建智能体系统的设置指导、API 模式和实用示例。 了解构建可靠的 Astreus 智能体系统所需的设置模式、API 和实用示例。
带知识库的智能体
在 Astreus 文档中了解 带知识库的智能体,获取用于构建智能体系统的设置指导、API 模式和实用示例。 了解构建可靠的 Astreus 智能体系统所需的设置模式、API 和实用示例。
带视觉能力的智能体
在 Astreus 文档中了解 带视觉能力的智能体,获取用于构建智能体系统的设置指导、API 模式和实用示例。 了解构建可靠的 Astreus 智能体系统所需的设置模式、API 和实用示例。