compose-for-agents

2025-07-12

ai

靡有不初,鲜克有终。一一《诗经》

Compose for Agents:用 Docker Compose 快速构建和运行 AI Agent 演示

在 AI 应用和 Agentic 工作流快速发展的今天,如何高效地组装、部署并运行多个 AI Agent、模型和上下文提供者(MCP),成为开发者和团队关注的热点。docker/compose-for-agents 项目就是为此而生——它通过 Docker Compose 提供了一套开箱即用的演示和模版,帮助你在本地或云端快速构建和编排 AI Agents、开源大模型、工具插件及上下文服务。


项目简介

  • 仓库地址docker/compose-for-agents
  • 核心描述:Build and run AI agents using Docker Compose. A collection of ready-to-use examples for orchestrating open-source LLMs, tools, and agent runtimes.
  • 主要语言:TypeScript
  • 许可证:Apache 2.0
  • 关键词:docker, docker-compose, ai-agents, agentic-workflows, large-language-models, self-hosted, open-source

功能亮点

1. 多 Agent、多模型、多 MCP 灵活编排

项目内置丰富的 AI Agent 演示案例,支持多 Agent/多模型/多上下文提供者混合编排。你可以轻松用 Compose 文件描述 AI Agent 的依赖、运行环境和交互方式,实现复杂的 agentic 工作流。

2. 支持本地与云端运行

只需一台装有 Docker Desktop 或 Docker Engine 的设备(建议具备 GPU),即可在本地运行开源大模型、Agent 及插件;也可切换到云端 context,适配更多生产场景。

3. 开源模型与 OpenAI API 灵活切换

支持本地运行如 llama3、qwen3、gemma3 等开源大模型,也可通过 OpenAI API 远程调用 GPT 等模型。轻松切换模型配置,满足不同硬件与业务需求。

4. 多种 Agentic 案例

内置多种典型 Agent 演示,如自动化 fact checker、GitHub issue 总结助手、营销策略 Agent、带 UI 的聊天 Agent 等,涵盖多 Agent协作、上下文检索、工具集成等场景。


快速体验流程

  1. 准备环境

    • 安装 Docker Desktop 4.43.0+ 或 Docker Engine(GPU 推荐)。
    • 确保 Docker Compose 2.38.1+ 已安装。
    • 配置 GPU 驱动(如需本地模型推理)。
  2. 运行演示 demo

    • 进入对应 demo 目录
    • 按需复制 .mcp.env.example.mcp.env,配置 MCP Token
    • 执行 docker compose up --build 启动演示
  3. 使用 OpenAI 模型

    • 新建 secret.openai-api-key 文件,填入你的 OpenAI API Key

    • 用如下命令启动(加载 OpenAI 配置):

      1
      docker compose -f compose.yaml -f compose.openai.yaml up
  4. 主要演示案例一览

Demo Agent系统 模型 MCPs 项目地址 Compose配置
A2A 多 Agent事实核查 Multi-Agent OpenAI duckduckgo ./a2a compose.yaml
Agno GitHub Issue总结 Multi-Agent qwen3(local) github-official ./agno compose.yaml
Vercel AI-SDK Chat-UI Single Agent llama3.2(local), qwen3(local) wikipedia-mcp, brave, resend(email) ./vercel compose.yaml
CrewAI 营销策略 Agent Multi-Agent qwen3(local) duckduckgo ./crew-ai compose.yaml
ADK 多 Agent事实核查 Multi-Agent gemma3-qat(local) duckduckgo ./adk compose.yaml

更多 Agentic 案例可在项目仓库中查看和实践。


适用场景

  • AI Agent 编排与快速原型开发
  • 多模型、多工具、多上下文 provider 混合实验
  • 开源 LLM 的本地化部署与体验
  • Agentic 工作流的团队协作和演示
  • 教学、技术分享、AI 应用创新沙盒

总结

docker/compose-for-agents 是 AI Agent 应用开发者的“组合工具箱”,它用 Docker Compose 标准化了复杂 AI agentic 流程的组装和运行。无需深入底层运维,只需几步配置,即可快速体验和构建多 Agent、多模型、多 MCP 的创新应用。非常适合希望探索 agentic 工作流、快速迭代 AI 产品原型的开发者和团队。

仓库地址:https://github.com/docker/compose-for-agents

欢迎访问项目主页,解锁更多 AI Agentic 编排新玩法!