Agents in the database, not in the repo: a tour of apowerb
说明与用途
apowerb 将代理定义存储在数据库中,运行时生成轻量级 Python stub,支持无需部署即可更新代理。修改数据库行后,/reload 端点会清除缓存并重建代理,立即生效。
问题
Managing agent definitions via code commits becomes cumbersome when many agents or non-engineers need to update prompts, leading to frequent releases.
结果
apowerb enables rapid, non-developer agent updates by storing definitions in a database and auto-generating stubs, reducing deployment overhead while maintaining consistency through boot-time repair and runtime reloads.
工作流
- Create or edit an agent via the UI or API, which writes a row in Postgres.
- The runtime generates a stub in agents_pool/agentX/agent.py that imports a loader.
- On startup, ensure_agent_modules repairs missing or stale stubs based on database state.
- When an agent row is updated, POST /api/agents/{id}/reload invalidates in-memory modules and caches.
- The next request rebuilds the agent from the updated database row, applying changes immediately.
- If reload fails, warnings are logged but the UI shows a success toast; the old definition may persist until a restart.
证据
Changing an agent is an UPDATE, not a deploy.
The boot sequence reconciles instead of trusting.
POST /api/agents/{id}/reload drops the agent's modules from sys.modules and from the loader cache.
- 记录日期: 2026-09-22T11:00:31.938Z