Loading...
Loading...
Comprehensive case studies of our most impactful projects. Architecture decisions, implementation details, code samples, and lessons learned.
Local-First AI Operating System
NEXUS AI OS is our most ambitious project — a local-first AI operating system that orchestrates 13+ specialized agents to handle personal, financial, health, home automation, and productivity tasks entirely on-device. No cloud dependency, no data leaving the machine, zero subscription fees.
The traditional AI landscape relies on cloud APIs which compromise privacy and require ongoing costs. We needed to build a system that matches cloud AI quality while running 100% locally, handling diverse domains (finance, health, home, code), and maintaining sub-2-second response times.
We designed a multi-agent architecture where each domain has a specialized agent with its own prompt templates and tool access. An orchestrator agent performs intent classification and routes queries. All inference runs through Ollama with dynamic model selection based on system resources. Agent context is shared via ChromaDB vector store and Redis pub/sub IPC bus.
Frontend Layer: React (web), Electron (desktop), React Native (mobile) sharing a common API client
API Gateway: FastAPI with async WebSocket connections for streaming responses
Orchestrator: Intent classification using Llama 3.1 8B for fast routing decisions
Specialist Agents: 13 agents each with domain-specific prompts, tools, and context
Memory Layer: ChromaDB for long-term memory, Redis for short-term session context
Model Serving: Ollama managing Llama 3.1 70B (complex), 8B (fast), CodeLlama 34B (code)
IPC Bus: Redis Pub/Sub for inter-agent communication with correlation IDs
Deployment: Docker Compose with 6 services (API, Ollama, ChromaDB, Redis, Web, Worker)
4 weeks
6 weeks
4 weeks
3 weeks
The orchestrator classifies user intent and routes to the appropriate specialist agent.
class OrchestratorAgent(BaseAgent):
def __init__(self):
super().__init__(
name="orchestrator",
model="llama3.1:8b",
system_prompt=ORCHESTRATOR_SYSTEM_PROMPT
)
self.agent_registry = AgentRegistry()
self.ipc_bus = AgentIPCBus()
async def process(self, query: str, context: dict) -> AgentResponse:
# Step 1: Classify intent
classification = await self.classify_intent(query)
# Step 2: Route to specialist
target_agent = self.agent_registry.get(classification.agent_id)
# Step 3: Execute with context
response = await target_agent.process(
query=query,
context={**context, **classification.extracted_params}
)
# Step 4: Post-process and return
return self.format_response(response, classification)Redis-based inter-process communication for agent collaboration.
class AgentIPCBus:
def __init__(self):
self.redis = Redis(host='localhost', port=6379)
self.context_db = ChromaDB(path='./agent_contexts')
async def send_message(
self,
from_agent: str,
to_agent: str,
payload: dict
):
message = AgentMessage(
sender=from_agent,
receiver=to_agent,
payload=payload,
timestamp=datetime.utcnow(),
correlation_id=uuid4()
)
await self.redis.publish(
f"agent:{to_agent}",
message.model_dump_json()
)
async def request_collaboration(
self,
initiator: str,
agents: list[str],
task: dict
) -> list[AgentResponse]:
responses = []
for agent_id in agents:
await self.send_message(initiator, agent_id, task)
response = await self.wait_for_response(
agent_id, timeout=30
)
responses.append(response)
return responses