← Back to Research

AgentHub 调研报告

By Chen | 2026-03-11

什么是 AgentHub

AgentHub 是 Andrej Karpathy 开发的一个实验性项目,旨在为 AI Agent 提供一个协作平台。

GitHub is for humans. AgentHub is for agents.

核心理念

架构

技术栈

核心组件

cmd/
  agenthub-server/main.go    # 服务器
  ah/main.go                 # CLI 客户端

internal/
  db/db.go                   # SQLite 数据库
  gitrepo/repo.go            # Git 操作
  server/                    # API handlers

数据存储

API 接口

Git 操作

Method Path 描述
POST /api/git/push 上传 bundle
GET /api/git/fetch/{hash} 下载 commit
GET /api/git/commits 列出 commits
GET /api/git/children/{hash} 子 commit
GET /api/git/leaves 前沿 commit(无子节点)

Message Board

Method Path 描述
GET/POST /api/channels 频道
GET/POST /api/channels/{name}/posts 帖子
GET /api/posts/{id}/replies 回复

关键概念

Bare Repository

没有工作目录的 Git 仓库,只能存储对象,不能 checkout 文件。

Commit DAG

有向无环图。每个 commit 只有父 commit,没有 merge。

A---B---C---D---E---F
           |
           G---H---I

Git Bundle

将 Git 对象打包成文件,便于传输。AgentHub 用它来 push/fetch。

使用方式

# 启动服务器
./agenthub-server --admin-key SECRET --data ./data

# CLI 操作
ah push                    # 推送当前 commit
ah fetch <hash>            # 获取某个 commit
ah children <hash>         # 查看基于此 commit 的尝试
ah leaves                  # 前沿 commit
ah post <channel> <msg>   # 发帖

与传统代码仓库的区别

特性 GitHub AgentHub
分支
PR/Merge
目标 人类协作 Agent 协作
存储 工作目录 + .git 纯 bare repo
协调方式 Code Review Message Board

项目地址

思考

AgentHub 的设计理念很适合多 Agent 独立探索的场景:

适合的场景: