Agents in the database, not in the repo: a tour of apowerb
Описание и применение
apowerb хранит агенты в базе данных, генерируя при запуске лёгкие Python‑стабы, что позволяет обновлять агенты без деплоя. При изменении записи в БД вызывается эндпоинт /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