Skip to the content.

Airo Technical Architecture

System Overview

User Device (Offline-First)
├── Flutter UI Layer
│   ├── Authentication (GoRouter)
│   ├── File Upload Screen
│   ├── Chat/Query Screen
│   ├── Results Display
│   └── Notifications/Payments UI
│
├── Platform Channel Layer
│   ├── Android Method Channel
│   ├── iOS Method Channel
│   └── Web JavaScript Bridge
│
├── Native AI Layer (Per Platform)
│   ├── Model Loading & Inference
│   ├── RAG Pipeline
│   ├── Function Calling
│   └── OCR/PDF Processing
│
└── Local Storage Layer
    ├── SQLCipher (Encrypted DB)
    ├── Vector Index (HNSW)
    ├── Notification Schedule
    └── Payment Requests

Component Details

1. Flutter UI Layer

Location: app/lib/src/features/

Key Screens:

State Management: GoRouter for navigation, SharedPreferences for auth state


2. Platform Channel Bridge

Plugin: packages/ai_edge_bridge/

Android Implementation (android/src/main/kotlin/com/airo/ai_edge_bridge/):

class AiEdgeBridgePlugin : FlutterPlugin {
  private lateinit var channel: MethodChannel
  private lateinit var gemmaEngine: GemmaInferenceEngine
  private lateinit var functionCaller: FunctionCallingManager
  
  override fun onMethodCall(call: MethodCall, result: Result) {
    when (call.method) {
      "init" -> initModel(call.arguments, result)
      "query" -> query(call.arguments, result)
      "executeFunction" -> executeFunction(call.arguments, result)
      "indexDocument" -> indexDocument(call.arguments, result)
    }
  }
}

iOS Implementation (ios/Runner/AiEdgeBridge.swift):

Web Implementation (web/ai_edge_bridge.js):


3. Native AI Layer

Android (app/android/app/src/main/kotlin/com/airo/superapp/ai/)

GemmaInferenceEngine.kt:

FunctionCallingManager.kt:

RagPipeline.kt:

OcrProcessor.kt:

FieldExtractor.kt:

iOS (ios/Runner/)

GemmaInferenceEngine.swift:

FunctionCallingManager.swift:

RagPipeline.swift:

OcrProcessor.swift:

Web (web/ai_edge_bridge.js)

GemmaInferenceEngine.js:

RagPipeline.js:


4. Local Storage Layer

SQLCipher Database Schema

-- Extracted Documents
CREATE TABLE documents (
  id TEXT PRIMARY KEY,
  filename TEXT,
  file_type TEXT,
  upload_date TIMESTAMP,
  extracted_data JSON,
  encrypted_key BLOB
);

-- Vector Chunks
CREATE TABLE chunks (
  id TEXT PRIMARY KEY,
  document_id TEXT,
  chunk_text TEXT,
  embedding BLOB,
  metadata JSON,
  FOREIGN KEY(document_id) REFERENCES documents(id)
);

-- Function Execution History
CREATE TABLE function_calls (
  id TEXT PRIMARY KEY,
  function_name TEXT,
  input_args JSON,
  output_result JSON,
  execution_date TIMESTAMP,
  status TEXT
);

-- Notification Schedule
CREATE TABLE notifications (
  id TEXT PRIMARY KEY,
  plan_id TEXT,
  start_date DATE,
  recurrence TEXT,
  times TEXT,
  created_date TIMESTAMP
);

-- Payment Requests
CREATE TABLE payment_requests (
  id TEXT PRIMARY KEY,
  bill_id TEXT,
  participants JSON,
  items JSON,
  splits JSON,
  created_date TIMESTAMP
);

Vector Index (HNSW)


5. Function Calling Schemas

fill_form

{
  "name": "fill_form",
  "parameters": {
    "type": "object",
    "properties": {
      "name": {"type": "string"},
      "dob": {"type": "string", "format": "date"},
      "weight_kg": {"type": "number"},
      "height_cm": {"type": "number"},
      "diet_plan": {
        "type": "array",
        "items": {
          "type": "object",
          "properties": {
            "day": {"type": "integer"},
            "meals": {"type": "array", "items": {"type": "string"}},
            "times": {"type": "array", "items": {"type": "string"}},
            "notes": {"type": "string"}
          }
        }
      }
    },
    "required": ["name"]
  }
}

schedule_notifications

{
  "name": "schedule_notifications",
  "parameters": {
    "type": "object",
    "properties": {
      "plan_id": {"type": "string"},
      "start_date": {"type": "string", "format": "date"},
      "recurrence": {"type": "string", "enum": ["daily", "weekly", "custom"]},
      "times": {"type": "array", "items": {"type": "string", "pattern": "^([01]\\d|2[0-3]):([0-5]\\d)$"}}
    },
    "required": ["plan_id", "start_date", "times"]
  }
}

split_bill

{
  "name": "split_bill",
  "parameters": {
    "type": "object",
    "properties": {
      "bill_id": {"type": "string"},
      "participants": {
        "type": "array",
        "items": {
          "type": "object",
          "properties": {
            "user_id": {"type": "string"},
            "share_pct": {"type": "number"}
          }
        }
      },
      "items": {
        "type": "array",
        "items": {
          "type": "object",
          "properties": {
            "name": {"type": "string"},
            "price": {"type": "number"},
            "assigned_to": {"type": "array", "items": {"type": "string"}}
          }
        }
      }
    },
    "required": ["bill_id", "participants"]
  }
}

6. Data Flow Example: Bill Processing

1. User uploads PDF
   ↓
2. File preprocessing (orientation, crop)
   ↓
3. PDF text extraction (text layer or OCR)
   ↓
4. Rule-based field extraction (amounts, dates, items)
   ↓
5. Chunking + embedding (for RAG context)
   ↓
6. LLM inference with RAG context
   ↓
7. Function calling: split_bill()
   ↓
8. Native handler: compute shares, create payment requests
   ↓
9. Store in SQLCipher DB
   ↓
10. Display results in Flutter UI

7. Error Handling & Fallbacks


Last Updated: 2025-10-30