SuperAPI AI 工具集

agent-apprenticeship-ecosystem

智能体与模型

查看项目

更新于 10-16 02:41

技能介绍

用途

Agent Apprenticeship Ecosystem 是一个用于训练 AI 智能体的技能与命令行工具。它构建了一个“活的生态”,让 AI 智能体通过迭代式工作流循环、可复用经验和集体训练信号交换,从真实世界的工作中学习。其目标是让智能体在执行长周期任务的同时,生成能够改进整个生态的训练信号。

主要能力

  • 迭代式工作流循环,支持导师指导,导师模式包括:模型辅助(model-assisted)、专家主导(expert-led)和混合(hybrid)。
  • 可复用的学习信号,来自 500+ 种子任务和 1000+ 执行轨迹。
  • 生态贡献:智能体经验包(experience packages)可贡献到生态。
  • Experience Packs:将学习成果跨任务迁移。
  • 智能体任务执行的经济价值追踪。
  • 自动检测已安装的智能体 CLI,包括 Codex、Cursor、Claude Code、OpenClaw、OpenCode、Hermes Agent,并支持自定义命令模板。

使用方式

安装

# Quick start with npx
npx agent-apprenticeship init

# Or install globally
npm install -g agent-apprenticeship

# Verify installation
apprentice --version
apprentice doctor

CLI 同时提供短命令(apprentice)和长命令(agent-apprenticeship)。

初始设置

npx agent-apprenticeship init
apprentice settings
apprentice doctor
apprentice configure
apprentice configure model

API 密钥可存放在 ~/.agent-apprenticeship/.env.local,或使用 shell 环境变量,例如 OPENAI_API_KEY、ANTHROPIC_API_KEY、GEMINI_API_KEY、OPENROUTER_API_KEY,以及 AA_MAX_ITERATIONS。

运行任务

apprentice run "Create a short market map for AI procurement tools."
apprentice run "Build a release checklist for an AI agent project." --mentor-mode model-assisted
export AA_MAX_ITERATIONS=5
apprentice run "Design a multi-step deployment pipeline."

导师模式:

  • model-assisted:导师模型提供者自动处理整个循环。
  • expert-led:人类专家在每次迭代提供检查点。
  • hybrid:模型提供草稿,人类审查并批准/编辑。

贡献包(Bundle)

运行完成后会生成贡献包,包含任务定义与执行轨迹、智能体工作片段与 rollout、学习信号与经验教训、产物与输出。

apprentice bundle inspect ./runs/2026-06-22_143022/bundle.zip
apprentice bundle check ./runs/2026-06-22_143022/bundle.zip
apprentice bundle contribute ./runs/2026-06-22_143022/bundle.zip

生态集成

apprentice ecosystem configure --repo Forsy-AI/agent-apprenticeship
apprentice ecosystem configure --auto-share manual
apprentice ecosystem configure --auto-share ask
apprentice ecosystem configure --auto-share automatic
apprentice ecosystem status

生态共享要求:已安装并认证 GitHub CLI(gh)、已配置生态仓库、有效的 bundle 格式。

搜索与探索:

apprentice ecosystem list
apprentice ecosystem search cloud
apprentice ecosystem search "deployment pipeline"
apprentice ecosystem inspect aa-seed-task-501
apprentice ecosystem pull aa-seed-task-501

Experience Packs

Experience Packs 将生态经验转化为可复用的学习信号,供未来任务使用。

apprentice learn create aa-seed-task-501
apprentice learn preview pack_12345
apprentice learn replay pack_12345
apprentice learn keep pack_12345
apprentice learn revert pack_12345

在任务中使用:

apprentice run "Create incident response checklist." --experience-pack pack_12345
apprentice run "Deploy microservice architecture." --use-active-experience-packs
apprentice run "Prototype new feature." --no-experience-packs

种子数据集

种子数据集包含 500+ 精选真实任务、495 条可复用智能体经验、1000+ 完整智能体执行轨迹、1000+ 智能体工作片段。可通过 ls seed_dataset/、apprentice ecosystem search --filter seed、apprentice ecosystem inspect aa-seed-task-001 访问。

配置管理

apprentice settings
apprentice ecosystem status
apprentice doctor
apprentice configure
apprentice configure model
apprentice ecosystem configure --repo your-org/your-repo
apprentice ecosystem configure --auto-share ask

常见工作流

  • 简单任务执行:运行任务 → 检查生成的 bundle → 可选贡献到生态。
  • 从生态学习:搜索相关经验 → 检查结果 → 拉取到本地 → 创建 experience pack → 在新任务中使用。
  • 迭代复杂任务:设置迭代上限 → 使用混合导师模式运行 → 审查执行轨迹 → 为未来类似任务创建 experience pack。
  • 领域特定智能体训练:搜索领域任务 → 拉取多个相关经验 → 创建 experience packs → 保留所有 pack → 使用累积经验运行新领域任务。

仓库结构

seed_dataset/              # Initial 500+ curated tasks
ecosystem/                 # Community experience
  contributions/           # Contributed bundles
schemas/                   # Bundle and trace schemas
examples/                  # Example usage and integrations

高级配置

  • 最大迭代次数:可通过设置、环境变量 AA_MAX_ITERATIONS 或命令标志 --max-iterations 控制。
  • 自定义导师模型:配置模型提供者时可指定模型,如 OpenAI 的 gpt-4、gpt-4-turbo,Anthropic 的 claude-3-opus-20240229、claude-3-sonnet-20240229,Gemini 的 gemini-pro、gemini-ultra,以及 OpenRouter 的多种模型。
  • 工作区管理:每次运行创建隔离工作区,默认位于 ~/.agent-apprenticeship/runs/,包含 workspace、artifacts、bundle.zip、trace.json。

故障排查

  • 智能体未检测到:检查已安装的智能体,重新配置,或为自定义智能体验证命令模板。
  • API 密钥问题:使用 apprentice doctor 验证,检查环境文件,重新配置模型提供者。
  • Bundle 验证失败:检查 bundle 结构,确认任务定义、执行轨迹和产物符合 schema 要求。
  • 生态连接问题:验证 GitHub CLI 认证,重新认证,检查生态配置。
  • Experience Pack 问题:列出所有 pack,验证内容,回退有问题的 pack,或清空所有 pack。

集成示例

  • CI/CD 集成:在 CI 管道中运行智能体任务,成功后贡献 bundle。
  • Python 脚本集成:通过 subprocess 调用 apprentice run,可传入 experience packs。
  • 自动化学习管道:搜索相关任务 → 拉取并创建 experience packs → 使用累积经验运行新任务 → 贡献结果。

最佳实践

  • 从种子数据集开始:探索 aa-seed-task-* 任务以理解生态模式。
  • 使用合适的导师模式:自动化用 model-assisted,高价值任务用 expert-led,平衡用 hybrid。
  • 策略性创建 experience packs:关注可复用模式,而非一次性任务。
  • 贡献高质量 bundle:确保任务成功完成后再贡献。
  • 创建前先搜索:检查生态中是否有类似任务,避免重复。
  • 逐步迭代:从较低的 AA_MAX_ITERATIONS 开始,复杂任务再增加。
  • 审查轨迹:使用 bundle inspect 理解智能体学习模式。
  • 管理活跃 pack:只保留相关的 experience packs 活跃,以获得更好性能。

适用场景

  • 需要让 AI 智能体执行长周期、多步骤任务,并通过迭代循环逐步改进。
  • 希望将智能体在真实任务中积累的经验跨任务迁移和复用。
  • 需要构建集体训练信号交换机制,让多个智能体或团队共享学习成果。
  • 需要追踪智能体任务执行的经济价值。
  • 需要为特定领域(如 Kubernetes、API 设计、部署管道)训练智能体。

限制

  • 生态共享需要已安装并认证 GitHub CLI(gh),并配置生态仓库。
  • 需要配置模型提供者的 API 密钥(如 OpenAI、Anthropic、Gemini、OpenRouter)。
  • 自定义智能体需要提供命令模板。
  • 关于收费、价格、平台支持范围等具体信息,资料中暂未提供。