Skip to main content

Overview

Omi’s chat system is a sophisticated agentic AI pipeline that enables users to have intelligent conversations about their recorded memories, calendar events, health data, and more. This document provides a complete technical understanding of how questions flow through the system.

Classifies

Determines if context is needed

Routes

Simple, Agentic, or Persona path

Tools

22+ integrated data sources

Retrieves

Vector search & metadata filters

Cites

Links to source conversations

Streams

Real-time thinking & response

System Architecture Diagram

The Three Routing Paths

Path 1: No Context Conversation

When triggered: Simple greetings, general advice, brainstorming questionsClassification criteria (from requires_context() function):
  • Greetings: “Hi”, “Hello”, “How are you?”
  • General knowledge: “What’s the capital of France?”
  • Advice without personal context: “Tips for productivity”
Processing:
This path provides the fastest responses since no external data retrieval is needed.

Classification Logic

The requires_context() function determines the routing path:

The Agentic Tool System

How Tool Calling Works

The LangGraph ReAct agent follows this cycle:

Receive Question

System prompt provides tool descriptions, user’s timezone, and citation instructions

Decide Tools

LLM autonomously decides which tool(s) to call based on question intent

Execute Tools

Tool calls are executed and results returned to the agent

Synthesize or Continue

Agent synthesizes response OR makes additional tool calls if more context needed

Generate Answer

Final answer generated with proper [1][2] citations linking to source conversations

Available Tools (22+)

Tools are loaded dynamically based on user’s enabled integrations and installed apps.
Core tools for retrieving user’s conversations and extracted memories.
Manage tasks and to-dos extracted from conversations.
Full CRUD operations on user’s Google Calendar.
Connect to external services for richer context.
Third-party apps can define custom tools that become available when users enable them.
See Chat Tools for Apps to learn how to build custom tools.

Safety Guards

Vector Search Deep Dive

Configuration

What Gets Embedded vs Stored as Metadata

Vector Creation (Write Path)

Vectors are created ONCE during initial processing, not on every edit. Reprocessed conversations do NOT create new vectors.

Vector Query (Read Path)

Memories System

Memories are distinct from Conversations. They are structured facts extracted about the user over time.

Memory Categories

Extraction Rules

Memory Retrieval in Chat

Chat Sessions & Context

Session Structure

Context Window

Citation System

The LLM generates citations in [1][2] format:

System Prompt Structure

The main system prompt includes:

DateTime Formatting Rules

Critical for correct tool behavior. All dates must use ISO format with timezone.

Conversation Retrieval Strategy

The system prompt guides the LLM through a 5-step strategy:
  1. Assess the question - Determine type (temporal, topic, person, etc.)
  2. Choose primary tool - get_conversations for date-based, vector_search for topic-based
  3. Apply filters - Use start_date/end_date when temporal bounds are known
  4. Request transcripts - Only when detailed content is needed
  5. Cite sources - Always cite conversations used in the answer

LLM Models Used

Models are selected via QoS profiles (premium, max, fair_use, byok) in backend/utils/llm/model_config.py. The fair_use profile uses gpt-5.1 as a fallback. See the config file for the current authoritative set.

Streaming Response Format

The backend streams responses in Server-Sent Events (SSE) format:
The Flutter app parses these to show:
  • Loading indicators with tool names
  • Streaming response text
  • Final message with linked memories

Key File Locations

Example: Question Flow

User asks: “What did I discuss with John yesterday about the project?”

Classification

requires_context()TRUE (temporal + person + topic reference)Route to: agentic_context_dependent_conversation

Agent Decides Tools

System prompt provides: current datetime, tool descriptionsAgent thinks: “Need conversations from yesterday about project with John”Agent calls: search_conversations_tool
  • query: “John project discussion”
  • start_date: “2024-01-19T00:00:00-08:00”
  • end_date: “2024-01-19T23:59:59-08:00”

Tool Execution

  1. Embed query → [0.012, -0.034, 0.056, ...]
  2. Query Pinecone with uid filter + date range
  3. Fetch full conversations from Firestore
  4. Format for LLM context

Response Generation

LLM synthesizes answer with citations:“Yesterday you discussed the Q1 roadmap with John[1]. He mentioned the frontend refactoring is ahead of schedule[1][2]…”

Post-Processing

  1. Extract citations → memories_id: ["conv_456", "conv_789"]
  2. Save message to Firestore
  3. Stream final response with linked conversation cards

Chat Tools for Apps

Learn how to build custom chat tools for your Omi apps

Storing Conversations

How conversations and memories are stored

Backend Deep Dive

General backend architecture overview

Real-time Transcription

WebSocket transcription and STT providers