How trideep091/kairo works
Kairo is a Gmail-embedded email assistant: the user selects an email in the extension, the backend analyzes and routes it through agent stages, then presents a draft for explicit approval before any send. The graph also preserves documented OAuth/calendar integration, follow-up tracking, and extension capabilities. Relationships among agents and major runtime stages follow the workflow excerpt and README; unsampled extension wiring is shown only where the README documents it.
Main entry points: workflow.py LangGraph Workflow · routes.py API Routes · critic.py Draft Critic · rag_agent.py Agentic RAG
Components 28
Chrome Extension
- Gmail Content Hooks
extension/content.js - Email Extractor
extension/src/content/extractor.ts - Gmail Selectors
extension/src/content/selectors.ts - Reply Injector
extension/src/content/injector.ts - Side Panel
extension/sidepanel.js - Background Worker
extension/background.js
Backend API
- API Routes
backend/app/api/routes.py - SSE Streaming
backend/app/api/sse.py
Agent Workflow
- Email Triage
backend/app/agents/triage.py - Plan Supervisor
backend/app/agents/supervisor.py - Agentic RAG
backend/app/agents/rag_agent.py - Calendar Agent
backend/app/agents/calendar_agent.py - Reply Drafter
backend/app/agents/drafter.py - Draft Critic
backend/app/agents/critic.py - Approval Gate
backend/app/agents/approval.py - LangGraph Workflow
backend/app/graph/workflow.py - Shared Agent State
backend/app/graph/state.py - Extraction Engine
backend/app/pipeline/engine.py - Unslop Validator
backend/app/unslop/validator.py
Memory and Tracking
- SQLite Records
backend/app/memory/db.py - Vector Store
backend/app/memory/vector_store.py - Follow-up Scheduler
backend/app/scheduler/followups.py
Workspace Integrations
- Google OAuth
backend/app/tools/google_auth.py - Google Workspace Service
backend/app/tools/google_service.py - MCP Calendar
backend/app/tools/mcp_calendar.py - Mail Dispatcher
backend/app/tools/mailer.py
Other components
- Email User
- Gmail
Connections 40
- Email User → Gmail Content Hooks: uses Gmail
- Gmail Content Hooks → Email Extractor: extracts email
- Email Extractor → Gmail Selectors: queries DOM
extension/src/content/extractor.ts - Gmail Content Hooks → Reply Injector: injects replies
- Email User → Side Panel: reviews drafts
- Side Panel → API Routes: sends requests
- API Routes → LangGraph Workflow: starts processing
backend/app/api/routes.py - API Routes → SSE Streaming: streams events
backend/app/api/routes.py - Side Panel → SSE Streaming: displays SSE
- Background Worker → API Routes: routes requests
- LangGraph Workflow → Email Triage: starts at
backend/app/graph/workflow.py - LangGraph Workflow → Plan Supervisor: dispatches
backend/app/graph/workflow.py - LangGraph Workflow → Agentic RAG: dispatches
backend/app/graph/workflow.py - LangGraph Workflow → Calendar Agent: dispatches
backend/app/graph/workflow.py - LangGraph Workflow → Reply Drafter: dispatches
backend/app/graph/workflow.py - LangGraph Workflow → Draft Critic: dispatches
backend/app/graph/workflow.py - LangGraph Workflow → Approval Gate: dispatches
backend/app/graph/workflow.py - LangGraph Workflow → Shared Agent State: uses state
backend/app/graph/workflow.py - Email Triage → Plan Supervisor: then routes
backend/app/graph/workflow.py - Plan Supervisor → Agentic RAG: plans retrieval
- Agentic RAG → Vector Store: retrieves context
backend/app/agents/rag_agent.py - Agentic RAG → Calendar Agent: routes calendar work
- Calendar Agent → MCP Calendar: checks availability
backend/app/agents/calendar_agent.py - Calendar Agent → Plan Supervisor: replans conflicts
- Reply Drafter → Draft Critic: submits draft
backend/app/graph/workflow.py - Draft Critic → Reply Drafter: requests revision
backend/app/graph/workflow.py - Draft Critic → Approval Gate: passes draft
backend/app/graph/workflow.py - Reply Drafter → Unslop Validator: validates voice
backend/app/agents/drafter.py - Draft Critic → Unslop Validator: checks style
backend/app/agents/critic.py - Approval Gate → Mail Dispatcher: sends when approved
backend/app/agents/approval.py - Approval Gate → SQLite Records: records approval
backend/app/agents/approval.py - API Routes → SQLite Records: reads email records
backend/app/api/routes.py - API Routes → Follow-up Scheduler: retrieves follow-ups
backend/app/api/routes.py - Follow-up Scheduler → SQLite Records: tracks commitments
backend/app/scheduler/followups.py - API Routes → Google OAuth: handles OAuth
backend/app/api/routes.py - API Routes → Google Workspace Service: syncs workspace
backend/app/api/routes.py - Google Workspace Service → Google OAuth: checks credentials
backend/app/tools/google_service.py - Google Workspace Service → SQLite Records: stores synced email
backend/app/tools/google_service.py - Mail Dispatcher → Google Workspace Service: dispatches via Gmail
backend/app/tools/mailer.py - Email User → Google OAuth: connects account