Agents
Agents are the core operational units in elizaOS. An agent is a running instance of a Character configuration, equipped with a runtime environment that enables it to process messages, execute actions, and maintain conversational context.Agent vs Character
It’s important to understand the distinction:| Aspect | Character | Agent |
|---|---|---|
| Definition | Blueprint/configuration | Running instance |
| Lifecycle | Static (file or object) | Dynamic (created, runs, stops) |
| Storage | JSON/TypeScript file | Database record |
| State | Stateless | Stateful (has memories, relationships) |
| Example | character.json | Running bot in Discord |
Creating an Agent
Method 1: From Character Object
Method 2: From Character File
Character Configuration
Core Properties
Message Examples
Message examples help the agent learn conversational patterns:Knowledge Sources
Add static knowledge to your agent:- Split into chunks
- Embedded using the configured embedding model
- Stored in the database as FRAGMENT memories
- Retrieved via semantic search when relevant
Templates
Templates control agent behavior:{{agentName}}- Agent’s name{{bio}}- Agent’s biography{{adjectives}}- Personality traits{{topics}}- Topics of interest{{recentMessages}}- Conversation history- Custom variables from providers
Settings and Secrets
Setting Precedence
Setting Precedence
Settings are resolved in priority order:
-
Runtime constructor options (highest)
-
Character settings
-
Character secrets
-
Environment variables (lowest)
Agent Lifecycle
Initialization
- Register bootstrap plugin (built-in actions/providers)
- Register advanced planning plugin (if enabled)
- Register advanced memory plugin (if enabled)
- Register character plugins
- Initialize database adapter
- Run plugin migrations
- Ensure agent exists in database
- Create agent’s default room
- Setup embedding dimension
Message Processing
Cleanup
Multi-Agent Patterns
Shared Memory
Agents can share memories in the same room:Private Memory
UseagentId field to make memories private:
Agent Communication
Agents can communicate via shared rooms:Advanced Features
Action Planning
Enable multi-step action execution:Advanced Memory
Enable conversation summarization and long-term memory:Autonomy Mode
Enable autonomous operation:Sandbox Mode
Secure multi-tenant deployment:Performance Tuning
Conversation Length
LLM Mode
Force model size for cost/quality tradeoff:DEFAULT- Use requested model typeSMALL- Force TEXT_SMALL for all callsLARGE- Force TEXT_LARGE for all calls
Disable shouldRespond Check
For direct chat interfaces (always respond):Best Practices
Agent Design Guidelines
Agent Design Guidelines
-
Keep Characters Focused
- Define clear personality and purpose
- Use specific adjectives and topics
- Provide relevant examples
-
Use Settings Appropriately
- Store credentials in
secrets - Use
settingsfor non-sensitive config - Leverage environment variables for deployment
- Store credentials in
-
Provide Good Examples
- Include diverse conversation scenarios
- Show desired response style
- Cover edge cases and error handling
-
Knowledge Management
- Keep knowledge files focused
- Use directories for related documents
- Update knowledge when information changes
-
Performance
- Adjust conversation length based on needs
- Use action planning only when needed
- Consider LLM mode for cost optimization
-
Testing
- Test with different message types
- Verify action execution
- Check memory persistence
Next Steps
Runtime
Explore runtime capabilities
Plugins
Build and use plugins
Characters
Character configuration deep dive
Memory
Memory management details