Important: This comprehensive guide will walk you through migrating your elizaOS plugins from version 0.x to 1.x. The migration process involves several key changes to architecture, APIs, and best practices.
Migration Overview
The 1.x architecture brings:- Better modularity - Cleaner separation of concerns
- Improved testing - Easier to test individual components
- Enhanced flexibility - More customization options
- Better performance - Optimized runtime execution
- Stronger typing - Catch errors at compile time
Pre-Migration Checklist
Before starting your migration:- Backup your existing plugin code
- Review all breaking changes
- Identify custom components that need migration
- Plan your testing strategy
- Allocate sufficient time for the migration
Step 1: Create Version Branch
Create a new branch for the 1.x version while preserving the main branch for backwards compatibility:
Note: This branch will serve as your new 1.x version branch, keeping main
intact for legacy support.
Step 2: Remove Deprecated Files
Clean up deprecated tooling and configuration files:Files to Remove:
biome.json
- Deprecated linter configurationvitest.config.ts
- Replaced by Bun test runner- Lock files - Any
lock.json
oryml.lock
files
Quick Cleanup Commands:
Why? The elizaOS ecosystem has standardized on:
- Bun’s built-in test runner (replacing Vitest)
- Prettier for code formatting (replacing Biome)
Step 3: Update package.json
Version and Naming
Dependencies
Scripts Section
Step 4: Update TypeScript Configuration
Updatetsconfig.json
:
Step 5: Update Core Package Imports
Import Changes
Step 6: Update Actions
Action Signatures
Actions in 1.x must returnActionResult
and include callbacks:
Common Action Patterns
Step 7: State Management
Using composeState
The v1composeState
method has enhanced filtering capabilities:
Available State Keys
Core state keys you can filter:- Agent info:
agentId
,agentName
,bio
,lore
,adjective
- Conversation:
recentMessages
,recentMessagesData
- Providers: Any registered provider name (e.g.,
TIME
,FACTS
)
Step 8: Update Providers
Provider Migration
Provider Options
Step 9: Testing Migration
From Vitest to Bun
Test Structure
Step 10: Prompt Generation
Template System Changes
Using composePromptFromState
Step 11: Advanced Patterns
Service Migration
Event Handlers
Step 12: Final Configuration
Configure .gitignore
Configure .npmignore
Add MIT License
Create aLICENSE
file with MIT license text.
Verify package.json Fields
Ensure all required fields are present:-
name
,version
,description
-
main
,types
,module
-
author
,license
,repository
-
scripts
,dependencies
,devDependencies
-
type
: “module” -
exports
configuration
Common Migration Issues
Issue: Action not returning correct format
Solution: Ensure all actions returnActionResult
with success
field:
Issue: Tests failing with module errors
Solution: Update imports to usebun:test
:
Issue: State composition performance
Solution: Use filtering to only compose needed state:Issue: Provider not being called
Solution: Ensure provider is registered and not marked asprivate
:
Testing Your Migration
Build Test
Run Tests
Integration Test
Create a test agent using your migrated plugin:Publishing
Once migration is complete:Migration Completion Checklist
- All imports updated to
@elizaos/core
- Actions return
ActionResult
withsuccess
field - Callbacks implemented in action handlers
- Tests migrated to Bun test runner
- State composition uses new filtering API
- Providers implemented for custom data
- Package.json updated with correct dependencies
- TypeScript configuration updated
- Build succeeds without errors
- All tests pass
- Plugin works with v1.x runtime
Getting Help
If you encounter issues during migration:- Review this guide for common issues
- Search existing GitHub issues
- Join our Discord community for real-time help
- Create a detailed issue with your migration problem
Advanced Migration Topics
Evaluators Migration
Evaluator Interface Changes
Evaluators remain largely unchanged in their core structure, but their integration with the runtime has evolved:Key Changes:
- Evaluation Results: The
evaluate()
method now returnsEvaluator[]
instead ofstring[]
:
- Additional Parameters: The evaluate method accepts new optional parameters:
Entity System Migration
The most significant change is the shift from User/Participant to Entity/Room/World:User → Entity
Participant → Room Membership
New World Concept
v1 introduces the concept of “worlds” (servers/environments):Connection Management
Client Migration
Clients now have a simpler interface:Runtime Method Changes
Removed Methods
updateRecentMessageState()
→ UsecomposeState(message, ['RECENT_MESSAGES'])
registerMemoryManager()
→ Not needed, use database adaptergetMemoryManager()
→ Use database adapter methodsregisterContextProvider()
→ UseregisterProvider()
Changed Methods
evaluate()
→ Now returnsEvaluator[]
instead ofstring[]
getAccountById()
→getEntityById()
ensureUserExists()
→ensureConnection()
generateText()
→runtime.useModel()
New Methods
setSetting()
registerEvent()
emitEvent()
useModel()
registerModel()
ensureWorldExists()
getRooms()
Advanced Migration Checklist
- Update all evaluator result handling to expect
Evaluator[]
objects - Remove singleton patterns from services
- Update service registration to pass classes instead of instances
- Replace
updateRecentMessageState
withcomposeState
- Migrate from
generateText
toruntime.useModel
- Update user/participant methods to entity/room methods
- Add world management for multi-server environments
- Convert clients to service-based architecture
- Update any direct memory manager access to use database adapter
- Replace
import { settings }
withruntime.getSetting()
calls - Update functions to accept
runtime
parameter where settings are needed
Summary
The migration from 0.x to 1.x involves:- Updating package structure and dependencies
- Migrating action signatures to return
ActionResult
- Implementing callbacks for user feedback
- Converting to Bun test runner
- Using the enhanced state composition system
- Implementing providers for custom data
- Following new TypeScript patterns