Architecture

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
validateInput: Ensures required fields are present
loadMemories: Retrieves relevant conversation history
wrapContext: Builds the context for LLM interactions
createMemoryFromInput: Stores the user's input
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

Last updated