Issue #4203 — consolidated and documented as of 2026-05-22
The backend mounts all API routers through a two-level system:
app_factory._register_routers()
├── load_core_routers() → initialization/router_registry/core_routers.py
└── load_optional_routers() → initialization/routers.py
├── load_analytics_routers() → router_registry/analytics_routers.py
├── load_terminal_routers() → router_registry/terminal_routers.py
├── load_monitoring_routers() → router_registry/monitoring_routers.py
├── load_integration_routers() → router_registry/integration_routers.py
├── load_feature_routers() → router_registry/feature_routers.py
└── load_mcp_routers() → router_registry/mcp_routers.py
All core and optional routers are mounted under /api<prefix>.
One special-case router (api.openai_compat) is mounted at /v1 directly in
app_factory.py for third-party client compatibility (Cursor, LibreChat, etc.).
| File | Domain | Load method |
|---|---|---|
core_routers.py |
Auth, chat, settings, knowledge base, plugin manager, user management | Hard import — must not fail |
analytics_routers.py |
Codebase analytics, code analysis | try/except graceful |
terminal_routers.py |
Terminal, SSH, VNC | try/except graceful |
monitoring_routers.py |
Metrics, Prometheus, GPU, alertmanager, RUM, diagnostics | try/except graceful |
integration_routers.py |
External integrations (Slack, Notion, GitHub, etc.) | try/except graceful |
feature_routers.py |
All remaining product features | try/except graceful |
mcp_routers.py |
Model Context Protocol extensions | try/except graceful |
- Choose the right file based on the domain table above.
- Add a 4-tuple to the
*_ROUTER_CONFIGSlist in that file:("api.my_feature", "/my-feature", ["my-feature"], "my_feature"),
- Do NOT add it to multiple files — check for existing registration first:
grep -r "my_feature\|my-feature" autobot-backend/initialization/router_registry/ - Core features that must always be available →
core_routers.py(direct import, not tuple list).
feature_routers.py, analytics_routers.py, integration_routers.py, mcp_routers.py:
(module_path, prefix, tags, display_name)
# e.g. ("api.workflow", "/workflow", ["workflow"], "workflow")monitoring_routers.py, terminal_routers.py:
(module_path, router_attr, prefix, tags, display_name)
# e.g. ("api.monitoring", "router", "/monitoring", ["monitoring"], "monitoring")Each router MUST appear in exactly one registry file.
core_routers.py takes precedence. If a module is imported in core_routers.py,
it must not appear in any other registry file.
Known previous duplicates fixed by #4203:
api.knowledge_search_aggregator,api.knowledge_ai_stack,api.knowledge_debug,api.knowledge_boards,api.knowledge_vectorization— were in bothcore_routers.pyandfeature_routers.py; removed fromfeature_routers.pyplugin_manager,api.user_management— same issue; removed fromfeature_routers.pyapi.diagnostics— was in bothmonitoring_routers.pyandfeature_routers.py; removed fromfeature_routers.py
feature_routers.py publishes per-worker load results to Redis under
autobot:feature_routers:<pid> (TTL 10 min, issue #6808). The health endpoint
can aggregate across all workers via get_cross_worker_load_results().
The 📊 Loaded N/M optional routers log line at startup shows how many
router configs successfully imported vs total attempted.