๐Ÿ”ฅ Lantern Edge โ€” Architecture

Offline-first edge AI agent ยท Real Qwen models on-device (WebGPU), graceful degradation, cross-device sync

๐Ÿ–ฅ๏ธ Browser (Client / Edge Device)
๐Ÿง 
WebLLM Engine
Qwen2.5 0.5Bโ€“3B
runs via WebGPU
0 server calls
๐Ÿงฎ
On-Device Tools
Time ยท Calculator ยท Notes
No cloud needed
Works fully offline
โณ
Deferred Queue
Stores tasks when offline
Auto-executes on reconnect
Survives disconnects
โ†‘โ†“ user input ยท streaming tokens ยท tool results
๐Ÿงญ Routing Layer (Browser โ€” Model-Free Classifier + Degradation Policy)
๐Ÿ“Š
Task Classifier
Scores complexity, capabilities,
privacy & reasoning depth
(no LLM call needed)
๐Ÿ”€
Degradation Policy
decideRoute(): edge-first โ†’
escalate to cloud โ†’ or
defer to queue
โ†’ Route A (edge) ยท Route B (cloud) ยท Route C (defer)
โš™๏ธ Express Server (Node.js โ€” secrets stay server-side)
โ˜๏ธ
Qwen Cloud Proxy
DashScope streaming (SSE)
qwen-turbo / plus / max
API key never leaves server
๐Ÿ”„
OSS Sync
Alibaba Cloud OSS
Conversation + state sync
Local-disk fallback
โ†’ external API calls
โ˜๏ธ External Cloud Services
๐Ÿค–
Qwen Cloud (DashScope)
dashscope-intl.aliyuncs.com
OpenAI-compatible API
Streaming completions
๐Ÿ“ฆ
Alibaba Cloud OSS
Bucket: lantern-edge-sync
Cross-device memory
Conversation persistence

๐Ÿ”€ The Four Routing Paths

A

Edge (Offline)

Simple tasks โ†’ handled by on-device WebGPU model + local tools. Zero network calls. Works fully offline.

B

Cloud (Online)

Complex tasks โ†’ escalate to Qwen Cloud via server proxy. API key stays server-side. Streams tokens back to browser.

C

Deferred (Offline + Complex)

Hard task while offline โ†’ stored in deferred queue. Auto-executes via Qwen Cloud when connection restores.

D

Sync (On Reconnect)

Conversations + agent state synced to Alibaba Cloud OSS. Pick up on any device. Local-disk fallback when OSS unavailable.

๐Ÿ“Š Project Metrics

35

Tests passing

5

Qwen edge models

4

Routing paths

100%

Offline-capable core