Appearance
AI Activation and Operations
This runbook documents what exists today in source, what is still missing, and how to verify the module once activation work is completed.
Required Integrations
- Vercel AI Gateway: required for streamed generation and embeddings through
IA_GATEWAY_API_KEY. - Qdrant: required for per-agent knowledge collections through
QDRANT_URLandQDRANT_API_KEY. - Redis: required for chat and message caching through the shared Redis cache service.
- PostgreSQL: required for the
aischema and the dedicatedaiTypeORM connection.
Current Blockers
AppModuledoes not importAIModuleor route it throughRouterModule, so none of the AI controllers are live.AIModuleleavescontrollersandprovidersempty even though the module already definesIaControllers,IaCommandHandlers,IaQueriesHandlers,IaServicesProvider,AiAdaptersRegistry,AgentRunnersProviders,SubAgentsProviders, andIaToolsProvider.apps/api/.env.exampledoes not declareIA_GATEWAY_API_KEY,QDRANT_URL, orQDRANT_API_KEY, even though the environment schema requires them.- AI migration files are not present under the module migration path, so the persistence contract is not yet deployment-ready.
FileDownloadAdapteris still a stub that always fails, andFileDeletionAdapteris a no-op.
Naming Caveat
The repository still mixes ai and ia names:
- folder/module name:
ai - env var prefix:
IA_ - provider arrays and Redis keys:
Ia*/ia:*
Keep that inconsistency in mind when wiring configuration, logs, or search queries.
Activation Checklist
- Import
AIModuleintoAppModuleand decide the final router prefix. - Register the existing controller/provider arrays inside
apps/api/src/modules/ai/ai.module.ts. - Add the missing AI environment variables to
apps/api/.env.exampleand deployment secrets. - Provision the
aischema through migrations or equivalent deployment-safe database setup. - Replace the placeholder file download and deletion adapters with real storage integrations.
- Verify Qdrant reachability from the API runtime.
Verification Steps
After the activation work is complete:
- Boot the API with valid AI and Redis environment variables.
- Trigger the model refresh endpoint and confirm the sync status endpoint reports discovered and synced models.
- Create an agent and confirm the response includes default knowledge and limits configs.
- Create a chat, then post a streamed message and verify:
- the user message is stored
- the assistant response streams successfully
- a chat title is generated on the first interaction
- token usage rows and monthly summary updates are written
- Upload a knowledge document and confirm it moves from
pendingtocompleted, with vectors present in Qdrant. - Ask a prompt that should hit the knowledge base and verify the
search-knowledge-basetool path is exercised.
Troubleshooting
- No AI routes appear at all: confirm both
AppModulewiring andAIModuleprovider/controller registration are complete. - Startup fails on env validation: confirm
IA_GATEWAY_API_KEY,QDRANT_URL, andQDRANT_API_KEYare present. - Knowledge documents stay in
failed: confirm the file download integration has been implemented and Qdrant is reachable. - Chat or message reads are stale: confirm Redis is healthy and that cache invalidation runs after chat deletion and message completion.
- Model refresh conflicts immediately: another refresh is already running in the same process; check the refresh status endpoint before retrying.