Architecture

System Overview

For detailed visual representations of the system architecture, see System Architecture Diagrams.

Express-Inspired Flow

Liz uses an Express-style middleware architecture where each request flows through a series of middleware functions. This approach provides a clear, predictable processing pipeline that's easy to understand and extend.

Standard Middleware Pipeline

  1. validateInput: Ensures required fields are present

  2. loadMemories: Retrieves relevant conversation history

  3. wrapContext: Builds the context for LLM interactions

  4. createMemoryFromInput: Stores the user's input

  5. router: Determines and executes the appropriate route handler

Agent Framework

The AgentFramework class in src/framework orchestrates the middleware pipeline and handles request processing:

Agents vs. Middleware

Agent

  • Defines personality and capabilities

  • Holds system prompt and style context

  • Manages route definitions

  • Provides agent-specific context

Middleware

  • Handles request processing

  • Manages memory operations

  • Builds context for LLM

  • Routes requests to handlers

Route Handling

Routes define how an agent handles different types of interactions. The router middleware uses LLM to select the most appropriate handler:

Request Flow Example

Architecture Background

Next: Agents →

Last updated