How Bees works under the hood
说明与用途
Bees 是一个开源桌面应用,能够在本地运行 AI 团队。本文阐述了其多进程架构、工具安全、恢复机制和本地模型集成,帮助开发者阅读、调试和扩展代码。
问题
Understanding the internal architecture and workflow of the Bees desktop app to enable developers to read, modify, and contribute to the codebase.
结果
The article demystifies Bees’ architecture, revealing how it orchestrates multiple processes, secures tool execution, recovers from crashes, and integrates local models, thereby equipping developers to read, debug, and extend the codebase.
工作流
- Launch Tauri app → show splash screen → call ensure_dsh_runtime
- Start Temporal dev server on random loopback port with SQLite persistence
- Start bundled Node 24 runtime (dsh-runtime/start.mjs) on second loopback port with fresh token
- Wait for /healthz, then point webview to runtime URL
- Rust side polls /healthz every 2s, restarts splash on timeout
- Node runtime serves UI and runs DSH plugins
- Temporal drives work items through stages, each stage runs as a fresh agent session in its own run folder
- Agent-runtime checks tool calls, enforces path restrictions and approvals
- RecoveryToolContext handles interrupted tool calls based on REPEATABLE_TOOLS list
- MCP servers managed per row in bees-stage1.db, with credential store in DSH
- Local models run via llama-server with context window sizing based on GGUF header
- Optional Bees Cloud sync uploads organization data but keeps files and credentials local
证据
Bees is an open source desktop app that runs a team of AI agents on your own computer.
When the window opens, it shows a splash screen (src/entry.ts, under 40 lines) and calls one Tauri command, ensure_dsh_runtime.
The Rust side keeps polling /healthz every two seconds. If the runtime stops answering for about 30 seconds, it sends the window back to the splash, which starts a new one.
Agents that edit shared files go through a lock tool. docs/file-access.md covers it.
recoveryToolContext in agent-runtime.js sorts the calls. A fixed list, REPEATABLE_TOOLS, holds the calls that are safe to repeat.
Local models run on llama.cpp's llama-server, which ships in llama-runtime/.
- 记录日期: 2026-10-12T15:56:03.112Z