Python 為先的執行層,支援多代理系統,具永續執行狀態、串流執行事件,並提供可插拔的協調介面。
AI 翻譯
A Python-first runtime layer for multi-agent systems, with persistent run state, streaming execution events, and a pluggable orchestration interface.
開發工具Python · JavaGitHub @Emiyaaaaa自行安裝營運者未確認
試用過了嗎? 點一下就好,不需要登入。
尚未偵測到更新。GitHub 發布版本後會顯示在這裡。
個人 GitHub 帳號下公開儲存庫的擁有者可以登入並驗證所有權,自行管理介紹,無需管理員核准。
登入並產生驗證檔案,在 30 分鐘內將其提交至此儲存庫的預設分支。其他分支或分叉儲存庫中的檔案無效。然後在下方檢查檔案,即可無需管理員核准直接管理專案。請保留檔案以維持管理權限。
如需登入,將前往登入頁面。登入後請回到此處,再次點擊所選的驗證按鈕。
安裝型專案無需部署網域也可驗證。個人儲存庫可透過 GitHub 登入驗證,組織儲存庫可使用上方的儲存庫驗證檔案。
正在載入完整 README。 以下為已儲存的摘錄。
A Python-first runtime layer for multi-agent systems, with persistent run
state, streaming execution events, and a pluggable orchestration interface.
License
Python
Hivemind provides the runtime infrastructure for multi-agent applications.
It does not replace frameworks such as LangGraph, AutoGen or CrewAI. Instead,
it gives them a consistent execution model: agents are invoked as runs, runs
produce ordered steps and messages, tool calls are recorded, and every state
change can be streamed to a client.檢視完整 README ↗A Python-first runtime layer for multi-agent systems, with persistent run state, streaming execution events, and a pluggable orchestration interface.
中文 · Architecture · Data model · Plan
Hivemind provides the runtime infrastructure for multi-agent applications. It does not replace frameworks such as LangGraph, AutoGen or CrewAI. Instead, it gives them a consistent execution model: agents are invoked as runs, runs produce ordered steps and messages, tool calls are recorded, and every state change can be streamed to a client.
The project is designed for teams that want to move from an agent prototype to an inspectable service without committing to a single orchestration framework or rebuilding persistence, event streaming, and operational tooling for each new agent.
Agent frameworks are usually optimized for local composition: prompts, tools, graphs, roles and model calls. Production systems need additional runtime concerns that sit outside the framework itself:
Hivemind focuses on that runtime boundary. The stack pairs a Java/Spring Boot API for HTTP and SSE with Python workers for adapter execution, SQLAlchemy and Alembic for persistence, and Redis for job queues and live events.
Run, Step, Message, ToolCall and
Checkpoint are first-class database entities. They provide a common
observability surface across different orchestration engines.run.completed, run.failed,
run.cancelled, run.waiting_human) are pushed to configured URLs with
retries, HMAC-signed when a secret is configured, for integrations that
cannot hold an SSE stream.uv, Next.js and TypeScript.The HTTP layer that the frontend talks to is a Java/Spring Boot service in
backend-java/. Agent orchestration runs in Python worker
processes in backend/ that consume a Redis-backed job queue and
drive adapters (LangGraph, Echo, ...) to completion.
The API supports tenant-scoped RBAC through API keys and OIDC Bearer tokens.
For identity-provider setup, tenant claim requirements, and group-to-role
mapping, see docs/oidc.md.
┌───────────────────┐ REST ┌──────────────────────┐
│ Next.js console │ ──────▶ │ Java/Spring Boot API│
│ (app/runs/...) │ ◀─SSE── │ /v1/* + SSE bridge │
└───────────────────┘ └──────────┬───────────┘
│ jobs / cancel / events (Redis)
▼
┌──────────────────────┐
│ Python worker (uv) │
│ app.worker.runner │
└──────────┬───────────┘
▼
┌──────────────────────┐
│ Orchestrator adapter │
│ (LangGraph, Echo...)│
└──────────┬───────────┘
▼
┌──────────────────────┐
│ Postgres (state) │
└──────────────────────┘
See:
/v1 HTTP contract
and the API↔worker Redis protocol.Requirements: Docker, uv, Node.js 20+,
JDK 21 and Maven 3.9+.
# Infrastructure
docker compose up -d postgres redis
# Database schema
cd backend && uv sync && uv run alembic upgrade head
# Worker (separate shell)
AGENTFLOW_WORKER_MODE=queue uv run python -m app.worker
# Java API (separate shell)
cd ../backend-java && mvn spring-boot:run
# Frontend (separate shell)
cd ../frontend && npm install && npm run dev
Or via Docker Compose:
cd backend && uv sync && uv run alembic upgrade head
docker compose --profile app up --build
Open http://localhost:3000. The default echo adapter runs locally and does
not require a model provider key.
Create an agent:
curl -X POST http://localhost:8000/v1/agents \
-H "content-type: application/json" \
-d '{
"name": "writer",
"adapter": "langgraph",
"config": {
"model": "openai/gpt-4o-mini",
"system_prompt": "You are a concise technical writer."
}
}'
Start a run:
curl -X POST http://localhost:8000/v1/runs \
-H "content-type: application/json" \
-d '{"agent_id": "<id from previous response>", "input": {"prompt": "Explain SSE in two sentences."}}'
Subscribe to the run event stream:
curl -N http://localhost:8000/v1/events/<run_id>
agentflow/
├── backend/ Python runtime: adapters, worker, Alembic schema
│ ├── app/
│ │ ├── adapters/ orchestrator adapters
│ │ ├── core/ configuration and logging
│ │ ├── db/ SQLAlchemy session and base
│ │ ├── events/ in-memory and Redis event bus
│ │ ├── models/ ORM models
│ │ ├── schemas/ Pydantic schemas (shared shapes)
│ │ ├── services/ run lifecycle helpers
│ │ └── worker/ queue, cancel registry, worker loop
│ ├── alembic/ database schema (source of truth)
│ └── tests/
├── backend-java/ Spring Boot API server (frontend-facing)
│ └── src/main/java/io/agentflow/api/
│ ├── controller/ /v1 REST + SSE controllers
│ ├── dto/ wire-format DTOs (snake_case)
│ ├── entity/ JPA entities
│ ├── jobs/ Redis job producer + cancel signal
│ ├── repository/ Spring Data JPA repositories
│ └── service/ agent / run / event services
├── frontend/ Next.js admin console
├── docs/ architecture, deployment, API contract
└── docker-compose.yml profiles: default (infra), `app` (API + worker)
Adapters implement a single async method. The runtime passes an
AdapterContext; the adapter emits lifecycle events through the context and
returns an AdapterResult when execution reaches a terminal state.
from app.adapters.base import AdapterContext, AdapterResult, OrchestratorAdapter
from app.models.run import RunStatus
class MyAdapter(OrchestratorAdapter):
async def run(self, ctx: AdapterContext) -> AdapterResult:
await ctx.emit_step_started(index=0, node="think")
await ctx.emit_message(role="assistant", content="hello")
await ctx.emit_step_completed(index=0, node="think")
return AdapterResult(status=RunStatus.SUCCEEDED, output={"ok": True})
Register the adapter in app/adapters/__init__.py. Workers pick it up
automatically; the API, persistence model, event stream and console stay on
the shared runtime contract.
Official adapters can also ship as entry-point plugins. The PydanticAI package
in integrations/pydantic-ai loads an existing
PydanticAI Agent through a trusted factory and maps its streamed text, output,
model usage, and native tool/MCP events onto the same contract without adding
PydanticAI to the core backend dependency set.
Hivemind is a split runtime: a Java API tier, a Python execution tier, and shared infrastructure.
| Layer | Stack | Responsibility |
|---|---|---|
| Console | Next.js 15, React Query, SSE | Run/agent management, live event stream |
| API | Java 21, Spring Boot 3, JPA | REST /v1/*, SSE bridge, job enqueue, cancel |
| Worker | Python asyncio, RunExecutor | Consume Redis jobs, run adapters, write Postgres |
| Adapters | LangGraph, Echo, MCP (+ registry) | Framework-specific orchestration behind one interface |
| State | Postgres 16, Alembic | Durable runs, steps, messages, tool calls, checkpoints |
| Messaging | Redis Streams + pub/sub | At-least-once job queue, cancel keys, live events |
Data flow: POST /v1/runs → API writes pending row → Redis job → worker
runs adapter → rows + events → SSE to console. Postgres is the source of truth;
Redis is ephemeral coordination only.
See docs/architecture.md, docs/deployment.md and docs/api-contract.md for the full contract and API↔worker protocol.
Apache 2.0.