Legion Health's AI-Native Ops Infrastructure: A Founding Engineer's Deep Dive into Mental Health's Operational Backbone
#Startups

Legion Health's AI-Native Ops Infrastructure: A Founding Engineer's Deep Dive into Mental Health's Operational Backbone

Startups Reporter
6 min read

Legion Health (YC S21) is building an AI-native operations layer for psychiatric care, running their own practice to prove out systems that coordinate human clinicians and AI agents. With $3M+ ARR and $7M+ raised, they're hiring a founding engineer to architect the event-driven backend that turns clinical intent into reliable operations for 2,000+ patients.

The mental health care system runs on operational infrastructure that's fundamentally broken. Scheduling, intake, documentation, billing, risk detection, and coordination between providers and patients form a labyrinth of manual processes, disconnected systems, and administrative burden. This operational drag doesn't just frustrate clinicians—it directly limits patient access, drives up costs, and creates safety gaps.

Legion Health (YC S21) is taking a contrarian approach. Instead of building yet another telehealth platform or "doctor-in-a-box" solution, they're rebuilding the operational backend that mental health care actually runs on. They operate their own psychiatric practice, which means every system they build gets tested against real clinical workflows, real patient needs, and real regulatory constraints. Their agent infrastructure already supports 2,000+ patients with just one human support lead—a ratio that reveals the leverage of well-designed AI-native operations.

The Technical Challenge: Coordinating Humans and Agents as a Single System

Daniel Wilson, Legion's co-founder and CTO, is hiring a founding engineer to own core backend and agent systems end-to-end. The role requires architecting an event-driven infrastructure that treats human clinicians, support staff, and AI agents as a single, coherent system—not as separate silos with different rules and interfaces.

This is fundamentally a distributed systems problem with a human-in-the-loop twist. The backend stack is Node.js/TypeScript, Supabase (Postgres), and AWS, but the real challenge lies in designing schemas, invariants, and workflows that encode how psychiatric care actually operates. Clinical workflows aren't simple CRUD operations; they're complex state machines with temporal dependencies, safety gates, and multi-actor coordination.

Consider a typical psychiatric patient journey: initial intake, medication management, therapy sessions, crisis intervention, insurance verification, and ongoing documentation. Each step involves multiple actors (patient, clinician, support staff, billing, pharmacy) and creates events that trigger downstream actions. The system must maintain a canonical "world state" for each patient across time, power alerting and routing decisions, and provide audit trails for HIPAA compliance.

Building LLM Agents as Coworkers

The engineering work extends beyond traditional backend architecture. Legion needs agents that can:

Use tools reliably: Call external APIs, update patient records, schedule appointments, and trigger clinical workflows with proper error handling and retry logic.

Maintain memory and context: Track patient history, conversation threads, and clinical decisions across sessions while respecting privacy boundaries.

Operate within safety rails: Implement guardrails that prevent agents from taking unsafe actions, with human override mechanisms and clear escalation paths.

Participate in multi-step workflows: Coordinate across complex processes like intake → risk assessment → clinician assignment → treatment planning → ongoing monitoring.

This requires designing action schemas and evaluation loops so agents can run reliably in production. It's not just about calling OpenAI's API—it's about building the orchestration layer that makes agent behavior predictable and auditable.

The Data and Compliance Layer

Healthcare adds a layer of complexity that most AI startups never face. The system must handle:

PHI security: Engineering HIPAA-compliant pipelines for transcripts, events, and EHR data with proper encryption, access controls, and audit logging.

Agent action tracking: Every agent action must be logged, attributable, and reversible. When an agent updates a patient record or schedules an appointment, there needs to be a clear chain of custody.

Human override and intervention: The system must make it trivial for human staff to see "what happened, why, and what should happen next" in any patient journey, with the ability to intervene at any point.

Real-time schedulers: Coordinating appointments, medication refills, and crisis interventions across time zones and provider availability.

The Engineering Philosophy

Legion's approach to building this system reflects a pragmatic, systems-thinking mindset:

Event-driven architecture: The team thinks in events, state, and invariants rather than just CRUD endpoints. Clinical workflows are modeled as event streams where each event (e.g., "patient completed intake form," "clinician reviewed notes," "medication prescribed") triggers specific state transitions and downstream actions.

Simplifying decisions: The system needs to move quickly while remaining understandable and robust. This means making strong architectural decisions that reduce complexity rather than adding layers of abstraction.

Immediate production deployment: Work goes live weekly, not into a backlog. The systems you build land in real clinical workflows immediately, which means you get rapid feedback on whether your architecture actually works.

Ownership and growth: The role is designed for someone who wants to grow into owning major parts of the system, not someone looking for a narrow, well-defined position. As Legion scales, the founding engineer is expected to evolve into expanded roles, potentially joining executive leadership.

The Tech Stack in Practice

Backend: Node.js and TypeScript provide type safety for complex domain logic. Supabase (Postgres) handles the database layer with real-time subscriptions for live updates. AWS ECS and Lambda provide compute orchestration, while S3 stores transcripts and documents.

Frontend: Next.js 15 with App Router powers internal tools for both human staff and agents. The UX must support dual users—humans who need clarity and agents that need structured inputs and outputs.

AI Infrastructure: OpenAI and Anthropic for model access, custom tool-calling agents, embeddings and vector databases for retrieval, and Langfuse-style observability for tracing agent behavior.

Security: PHI encryption at rest and in transit, audit trails for every action, real-time schedulers with conflict detection, and transcript ingestion pipelines that handle audio, text, and structured data.

What "Good" Looks Like

The ideal candidate has owned systems from 0→1 or 1→N, not just executed tickets. They think architecturally about state management and invariants. They're either already LLM-fluent or a strong systems engineer who can get dangerous quickly with agent systems.

Most importantly, they care about both velocity and correctness. In healthcare, "move fast and break things" isn't an option, but "move slowly and ship nothing" doesn't help patients either. The right balance is moving quickly while keeping systems understandable, robust, and auditable.

The Hiring Process

Legion's process is designed to evaluate real engineering capability rather than algorithmic puzzle-solving:

  1. Systems/portfolio deep dive (45 min): Walk through 1-2 systems you've shipped, covering architecture decisions, tradeoffs, and failure modes.
  2. Practical work trial (1.5 hours): A realistic backend/LLM-systems exercise with no LeetCode or puzzles.
  3. Final onsite (1.5 hours): Meet the team, pair on a real issue, and discuss how you'd own a specific domain.

The timeline is 7-10 days from first contact to offer, with an ASAP start date.

Compensation and Structure

  • Salary: $130,000–$190,000 based on experience
  • Equity: 0.2%–0.8% meaningful early ownership
  • Location: In-person at San Francisco HQ
  • Visa sponsorship: Available
  • Benefits: Medical, dental, vision, unlimited vacation, meal stipends, in-person retreats

Why This Matters

The mental health crisis isn't going away. Demand continues to outpace the supply of trained clinicians, and operational friction prevents the existing system from scaling. Legion's bet is that AI-native operations can unlock orders of magnitude more capacity—not by replacing clinicians, but by making them dramatically more effective.

For an engineer, this is a rare opportunity to build systems that have immediate, measurable impact on patient access and clinician experience. The infrastructure you design will coordinate thousands of patient journeys, reduce administrative burden for mental health providers, and create a playbook for AI-native healthcare operations that could extend far beyond psychiatric care.

The work is hard. It requires thinking across distributed systems, AI agents, regulatory compliance, and clinical workflows. But for the right engineer, it's also a chance to define the technical foundation of how mental health care gets delivered at scale.

Apply for the Founding Engineer role | Daniel Wilson's GitHub

Comments

Loading comments...