Characters
A Character is the blueprint that defines an agent’s personality, knowledge, and behavior. It’s a configuration object (often loaded from JSON) that shapes how your agent interacts with users.Character vs Agent
Understand the key distinction:- Character: Static configuration defining personality and capabilities
- Agent: Running instance of a character with state and memory
Character Structure
Complete Interface
Core Properties
Identity
- Use a descriptive, memorable name
- Multi-line bio for better context
- Bio should explain who the character is and what they do
Personality Traits
- Choose 3-7 adjectives that capture the essence
- Mix personality and communication style
- Be specific: “thoughtful” vs “helpful”
- List areas of expertise
- Include related/adjacent topics
- Used for context filtering
Communication Style
Message Examples
Examples teach the agent conversation patterns and response styles.Example Structure
Basic Examples
Multiple Example Groups
Provide diverse scenarios:Best Practices for Examples
Example writing guidelines
Example writing guidelines
- Variety: Cover different question types and scenarios
- Realistic: Use actual questions users might ask
- Complete: Show full conversational exchanges, not just single Q&A
- Style consistency: Demonstrate your desired tone and structure
- Edge cases: Include how to handle unclear or complex questions
- Length: 3-7 example groups with 2-6 exchanges each
- Natural: Write as you would actually respond, not stiffly
- Specific: Show concrete examples, code snippets, numbered lists
Post Examples
For social media personalities:- Tone and voice
- Post structure (hook, body, CTA)
- Use of hashtags and emojis
- Content themes
- Length and formatting
Knowledge Sources
Provide static knowledge for RAG (Retrieval Augmented Generation):Knowledge Processing
During initialization, knowledge files are:- Read from disk
- Chunked into ~1000 token fragments
- Embedded using TEXT_EMBEDDING model
- Stored as FRAGMENT memories in database
- Retrieved via semantic search when relevant
- Markdown (.md)
- Text (.txt)
- JSON (.json)
- PDF (.pdf) - requires PDF plugin
Templates
Templates control agent behavior in different contexts:Template Variables
Built-in variables available in all templates:| Variable | Description | Example |
|---|---|---|
{{agentName}} | Character name | ”Assistant” |
{{bio}} | Biography | ”I am a helpful AI…” |
{{adjectives}} | Personality traits | ”helpful, patient, curious” |
{{topics}} | Topics list | ”technology, science, art” |
{{style}} | Style guidelines | ”Be concise and clear…” |
{{recentMessages}} | Conversation history | ”User: …\nAgent: …” |
{{currentMessage}} | Current user message | ”Hello!” |
{{postExamples}} | Sample posts | ”Just shipped…” |
Settings and Secrets
Settings
Non-sensitive configuration:Secrets
Sensitive credentials:- Secrets can be encrypted at rest (see settings module)
- Use environment variables, never hardcode
- Secrets take precedence over settings in
getSetting() - Sandbox mode tokenizes secrets for multi-tenant safety
Advanced Features
Advanced Planning
Enables multi-step action execution:Advanced Memory
Enables conversation summarization and long-term memory:Character Files
JSON Format
Loading Character Files
TypeScript Format
Character Validation
Validate character configuration:Best Practices
Character design guidelines
Character design guidelines
Identity
- Choose a clear, memorable name
- Write detailed, multi-faceted bio
- Define distinct personality traits
Examples
- Provide 5-10 diverse conversation examples
- Show both simple and complex interactions
- Demonstrate error handling and edge cases
- Keep examples realistic and natural
Knowledge
- Organize knowledge into focused documents
- Keep documents under 5000 words each
- Update knowledge when information changes
- Use clear, well-structured markdown
Templates
- Start with default templates, customize as needed
- Use dynamic templates for context-dependent behavior
- Test templates with various inputs
- Keep templates focused and clear
Settings
- Store credentials in environment variables
- Use appropriate conversation length for use case
- Enable advanced features only when needed
- Test with different settings combinations
Style
- Define clear communication guidelines
- Be consistent across all examples
- Match style to target audience
- Balance personality with professionalism
Next Steps
Agents
Learn about agent instances
Examples
Character configuration examples
Plugins
Available plugins
Templates
Template customization guide