How nasirsaikh/vanna-ai works
Takaful AI Analytics is a Django platform for secure, agent-scoped natural-language analytics, with interactive queries and dashboards plus email intake and scheduled jobs. The central workflow resolves an agent and effective permissions, prepares prompts and retrieved knowledge, generates and validates SQL, executes bounded reads, and returns protected results. Agent configuration, training, schema discovery, and audit state support that workflow; mailbox and scheduler paths extend it. Several entry-point and subsystem implementations were not sampled, so those links are included only where documented or indexed.
Main entry points: services.py Query orchestration · email_service.py Email processing · tasks.py Scheduled jobs · views.py Interactive requests
Components 20
Analytics workflow
- Interactive requests
chat/views.py - Query orchestration
orchestrator/services.py - SQL validation
orchestrator/validator.py - Bounded execution
orchestrator/query_execution.py - Response security
orchestrator/response_security.py
Agent and knowledge
- Agent access
orchestrator/agent_access.py - Policy context
orchestrator/agent_context.py - Prompt building
orchestrator/prompt_builder.py - AI providers
orchestrator/llm_providers.py - Training service
orchestrator/training_service.py - Agent vector index
orchestrator/agent_vector.py - Schema and policies
orchestrator/schema_service.py - Agent and audit records
orchestrator/models.py
Email and scheduling
- Microsoft Graph
automation_center/graph_client.py - Email processing
automation_center/email_service.py - Scheduled jobs
automation_center/tasks.py - Job and email records
automation_center/models.py
Results and UI
- Chart selection
analytics/services.py - Analytics UI
static/js/console.js
Other components
- Analyst
Connections 22
- Analyst → Interactive requests: asks question
- Interactive requests → Query orchestration: submits request
- Query orchestration → Agent access: resolves agent
orchestrator/services.py - Query orchestration → Policy context: builds context
orchestrator/services.py - Policy context → Agent and audit records: reads policies
- Query orchestration → Prompt building: builds prompt
orchestrator/services.py - Query orchestration → AI providers: requests generation
orchestrator/services.py - Query orchestration → Agent vector index: retrieves knowledge
orchestrator/services.py - Training service → Agent vector index: updates index
orchestrator/training_service.py - Query orchestration → Schema and policies: loads schema
- Query orchestration → SQL validation: validates SQL
orchestrator/services.py - Query orchestration → Bounded execution: executes query
orchestrator/services.py - Bounded execution → Agent and audit records: records query
- Query orchestration → Response security: secures result
orchestrator/services.py - Response security → Chart selection: provides result
- Chart selection → Analytics UI: renders charts
- Scheduled jobs → Email processing: processes mail
automation_center/tasks.py - Email processing → Microsoft Graph: reads and replies
automation_center/email_service.py - Email processing → Query orchestration: submits analytics
automation_center/email_service.py - Scheduled jobs → Query orchestration: runs analytics
- Scheduled jobs → Job and email records: updates run state
automation_center/tasks.py - Email processing → Job and email records: stores requests
automation_center/email_service.py