Local AI Agent System

AI Systems Engineer

Impact

  • Architected custom Graph RAG from scratch — 13-table SQLite graph DAG with recursive CTEs, 4-collection ChromaDB vector store, cross-session entity edge linking, and token-budget-aware context assembly
  • Engineered Progressive Depth Escalation pipeline — per-query retrieval depth (0–3) with three-tier fallback (LLM → 50+ keyword patterns → safe default) and 4 strategy implementations (Broad, Focused, Exact, None)
  • Built microsecond-level deterministic entity extraction engine from regex patterns — no embedding model or LLM call required — with secondary LLM-based path for richer extraction when desired
  • Designed 4 specialist agents (news, mail, calendar, task) with structured tool-calling, manager-worker LLM separation (Qwen 3.5 9B/2B), and WhatsApp bridge with source-level memory isolation

Skills

PythonFastAPIUvicornPydanticLM StudioQwenMLXChromaDBSQLiteGoogle APIsNode.jsPlaywright
Local AI Agent System

Project Abstract & Details

A fully local, security-first multi-agent system with a custom Graph RAG memory architecture — built entirely from scratch on SQLite (13 tables, recursive CTEs), ChromaDB (4 collections), and local LLMs via LM Studio. Features Progressive Depth Escalation: per-query retrieval depth (0–3) where greetings use a shallow SQLite lookup and deep research questions trigger a full BFS graph walk across sessions, entities, and summaries. Includes deterministic regex-based entity extraction (microsecond-level, no embeddings), hierarchical level summarization creating a memory pyramid, and 4 specialist agents (news, mail, calendar, task) with manager-worker LLM separation (Qwen 3.5 9B/2B). All inference runs 100% locally — zero cloud dependency.

Key Features

Custom Graph RAG

SQLite as a graph database — 13-table DAG with recursive CTE lineage traversal, entity extraction, cross-session edge linking, and hierarchical level summarization — no off-the-shelf RAG framework

Progressive Depth Escalation

Query-aware retrieval depth (0–3): greetings skip history (depth=0), lookups use shallow SQLite (depth=1), deep research triggers full BFS graph walk across sessions and entities (depth=3)

Deterministic Entity Extraction

Regex-based person/email/topic/date detection in microseconds — no embedding model, no LLM call. Optional LLM-based path for richer extraction when needed

100% Local LLM Stack

Qwen 3.5 (9B manager + 2B worker) via LM Studio on MLX — all inference, vector search, and graph storage run on-device. No cloud API calls

4 Specialist Agents

News (RSS/YouTube feeds), Mail (Gmail read-only), Calendar (read events + create), Task (full CRUD with deadlines) — structured tool-calling with up to 2 execution rounds

WhatsApp Bridge

Node.js/Playwright bridge with source-level memory isolation — each chat gets its own independent graph DAG, entity index, level summaries, and vector collections

Architecture

FastAPI orchestrates a 6-step pipeline: (1) Intake — validate and normalize input. (2) Depth Reasoning — three-tier fallback (LLM → 50+ keyword patterns → safe default=depth=1) outputs a TraversalDirective with exact depth, scope, branch filter, and token budget. (3) Context Building — GraphMemoryRetriever facade executes the directive via 4 strategy implementations (Broad/Focused/Exact/None), assembling a priority-ordered ContextWindow with token-budget-aware section ordering (structured data first, then level summaries, graph history, FTS5 matches, semantic search, entity index). (4) Routing — Manager LLM classifies as chat/plan/refuse with 2-attempt retry. (5) Plan Dispatch — Worker LLM executes structured tool calls (up to 2 rounds) across specialist agents. (6) Post-processing — LevelSummarizer compresses each graph depth into summary paragraphs stored in both SQLite and ChromaDB, creating a memory pyramid. All models run locally via LM Studio OpenAI-compatible endpoint.

Architecture diagram placeholder

Outcomes & Metrics

13
SQLite Tables
4
ChromaDB Collections
4
Specialist Agents
100%
Local Inference

© Developer Portfolio by KV