Architecture Overview
elizaOS is built with a modular, plugin-based architecture that enables flexible development of multi-agent AI applications. The framework consists of several interconnected layers that work together to provide a complete agent runtime environment.High-Level Architecture
Core Layers
1. Character Layer
At the foundation is the Character definition, which serves as the blueprint for an agent:- Identity: Name, bio, personality traits (adjectives)
- Knowledge: Static knowledge sources and examples
- Behavior: Templates, message examples, topics of interest
- Configuration: Plugin list, settings, and secrets
- Capabilities: Feature flags for advanced planning and memory
2. Runtime Layer
The AgentRuntime is the central orchestration engine:- Plugin registration and lifecycle management
- State composition from providers
- Action execution and planning
- Model invocation and routing
- Memory management and retrieval
- Event emission and handling
3. Plugin System
Plugins are the primary extension mechanism:Plugin Registration Flow
Plugin Registration Flow
- Registration:
runtime.registerPlugin(plugin)is called - Initialization: Plugin’s
init()method is invoked with configuration - Component Registration: Actions, evaluators, providers are added to runtime
- Service Startup: Service classes are instantiated and started
- Model Handlers: Model handlers are registered with priority
- Schema Migration: Database schemas are applied
- Event Handlers: Event listeners are registered
4. Component Types
Actions
Actions are executable capabilities that the agent can perform:Evaluators
Evaluators run at different phases to assess and transform messages:- Pre-phase evaluators run before memory storage (security gates, content filtering)
- Post-phase evaluators run after response generation (reflection, trust scoring)
Providers
Providers inject dynamic context into the agent’s state:Services
Services provide long-lived functionality:task- Background task schedulingapproval- Action approval workflowstool_policy- Action access controltranscription- Audio transcriptionbrowser- Web automationwallet- Blockchain interactions
5. Memory Architecture
Memory is typed and scoped:- Message arrives → Pre-evaluators run (can block/rewrite)
- Message stored with embedding generation queued
- State composed from relevant memories + providers
- Response generated and actions executed
- Post-evaluators run for reflection
6. Model Layer
The model layer provides abstraction over different LLM providers:- Runtime checks for registered handlers by model type
- Highest priority handler is selected
- LLM mode can override model selection:
DEFAULT- Use requested model typeSMALL- Force all text generation to use TEXT_SMALLLARGE- Force all text generation to use TEXT_LARGE
Data Flow
State Composition
The State object is the context passed to all components:- Load recent conversation history (respects
conversationLengthsetting) - Execute static providers (non-dynamic, alwaysRun)
- Execute dynamic providers (only if relevant keywords detected)
- Merge results into unified state object
- Cache state by message ID for reuse
Configuration Hierarchy
Settings are resolved in order of precedence:- Runtime constructor options (highest priority)
- Character settings (
character.settings) - Character secrets (
character.secrets) - Environment variables (lowest priority)
Extensibility Points
How to extend elizaOS
How to extend elizaOS
Performance Considerations
Caching
- State Cache: LRU cache with 200 entry limit prevents memory bloat
- Action Index: Pre-computed for O(1) action lookup
- Embedding Queue: Async generation prevents blocking
Action Planning
Action planning can be toggled for performance:Sandbox Mode
For secure multi-tenant scenarios:Next Steps
Agents
Learn about agent creation and lifecycle
Runtime
Deep dive into runtime capabilities
Plugins
Explore the plugin ecosystem
Memory & State
Understand memory management