Layi Docs

Technical

Platform Architecture

Durable Temporal workflows, hierarchical agents, and a zero-trust tool perimeter

Last updated: December 2025

πŸ—οΈ Platform Architecture

Layi is built around a Temporal-powered durability layer, a supervisor/specialist agent hierarchy, and a zero-trust Tool Gateway so enterprises can run autonomous work across modern APIs, legacy systems, and real-time channels without losing control.

Interactive Architecture Visualization

Explore our system architecture through interactive diagrams showing Context (Level 0) and Logical (Level 1) views with detailed component breakdowns, data flows, and security boundaries.

πŸ”§ Temporal Control Plane
Temporal Workflows orchestrate every mission, holding durable state, retries, and HITL pauses for days or weeks.
🧠 Supervisor · Specialist Hierarchy
Supervisors plan and store global context, while specialists execute scoped skills (research, scheduling, compliance).
🐳 Sandboxed Agent Runtime
Dockerized environments with browser automation, code tools, and streaming IOβ€”isolated per organization workload.
πŸ—„οΈ Durable Data Fabric
Cassandra for append-only state, Elasticsearch for retrieval, Postgres for org metadata, Redis for low-latency caches.
πŸ›‘οΈ Tool Gateway & Vault
Dedicated execution perimeter that proxies 500+ SaaS tools, never exposing raw credentials to the LLM.
πŸ“Š Observability & Org Console
Next.js dashboard surfaces KPIs, SLA adherence, reinforcement signals, and RBAC-controlled configuration.

πŸš€ Technology Stack

Modern technologies powering the Layi platform:

Frontend

Next.js 15+
App Router with TypeScript
Tailwind CSS
Utility-first styling
Radix UI
Accessible component primitives

Backend

FastAPI
Modern Python web framework
LiteLLM
Multi-provider LLM integration
Temporal Workers
Workflow + activity workers orchestrate retries, HITL gates, and multi-day runs without extra queues.

Infrastructure

Identity Gateway
Managed auth, org roster, and realtime channels
Redis
Caching and message broker
Docker
Containerization and isolation

🧩 Hierarchical orchestration & learning

Every request spins up a Temporal workflow that coordinates a supervisor planner, multiple specialist executors, and two reinforcement loops.

Supervisor (Planner)
Owns the global mission state, decomposes work, selects tools/memories to query, and emits KPIs for dashboards.
Specialist (Executor)
Scoped skills (e.g., voice intake, EMR scheduler) operate in isolation, reporting back after each tool call.
Runtime validator
A lightweight middleware loop checks outputs after every tool call to catch hallucinations before they escalate.
Procedural learner
Nightly org-manager jobs distill what worked, update procedural memory, and push playbook deltas to agents.

🧠 Eight-layer memory fabric

Agents stay grounded by separating knowledge into dedicated layers. Supervisors fetch only what each step needs, reducing token waste and keeping reasoning factual.

Procedural
Learned how-to guidance and guardrails extracted from successful runs.
Episodic
Event log of past conversations, approvals, and exception paths for audit.
Semantic
Static knowledge base from docs, PDFs, and manuals via LlamaIndex/RAG.
Working
Short-term scratchpad for the current phase of execution.
Workflow
Temporal history describing long-running state machines.
Entity
Profiles about patients, accounts, assets, or contacts tied to an org.
Toolbox
Schemas and policies for every connector available to the agent.
Long-term
Full conversation archives partitioned for compliance retention.

πŸ”„ Data Flow

How information moves through the Layi platform:

1

User Interaction

Voice, chat, or phone call triggers a Temporal workflow via the dashboard, SDK, or phone bridge.

2

API Processing

FastAPI services authenticate via the Org Manager identity layer + SSO, attach org context, and enqueue the workflow.

3

Agent Execution

Supervisor/specialist agents fetch relevant memories, call tools via the Gateway, and log state in Cassandra.

4

Real-time Updates

Temporal signals + realtime channels stream status, KPI deltas, and HITL prompts back to the dashboard.

πŸ”’ Security Architecture

Multi-layered security approach:

πŸ›‘οΈ Authentication
SSO/SAML integration, org-managed tokens, and org-scoped JWTs for every dashboard/API call.
πŸ” Authorization
Org-level RBAC, Temporal task queues per tenant, and row-level policies across Postgres/Cassandra.
πŸ—οΈ Isolation
Dedicated Kubernetes namespaces and Docker sandboxes ensure agents never share runtime state or network secrets.
πŸ”‘ Secrets Management
HashiCorp Vault + Tool Gateway fetch credentials just-in-time; the LLM only ever sees sanitized JSON outputs.
🧱 Outbox & Audit
Outbox projection replicates append-only Cassandra events into Elasticsearch for search, RAG, and compliance review.
πŸ“ž Voice Security
LiveKit streams stay inside org-specific rooms, while PSTN bridges terminate in the same zero-trust perimeter.

πŸš€ Deployment Options

Flexible deployment strategies for different use cases:

🐳 Docker Compose
Bundle the full stack locally for evaluation or air-gapped pilots with identical durability semantics.
☸️ Kubernetes
Run the production Helm chart with autoscaling workers, dedicated namespaces, and Vault/Redis integrations.
☁️ Hybrid / Cloud
Split control plane vs. data plane: keep Temporal + Tool Gateway in your VPC while using Layi Cloud UI services.

Execution Flow