Character configuration allows you to customize your agent’s personality, communication style, knowledge, and behavior. Characters are defined in JSON files that the framework loads and processes into agent personalities.
Character files are JSON documents located in the characters/ directory:
characters/template.json
{ "name": "your name", "accountid": "123456789", "plugins": [], "clients": ["twitter"], "modelProvider": "anthropic", "settings": { "secrets": {}, "voice": { "model": "en_US-hfc_female-medium" } }, "system": "Roleplay and generate interesting content on behalf of user.", "bio": [ "Core contributor at hadron founders club", "Advisor to @0xPolygon", "Angel investor focusing on strong product and engineering founders" ], "lore": [ "Believes that blockchains will change how financial systems work", "Advocates for liquid and efficient private markets through tokenization", "Supporter of Solana, Ethereum, Polygon, Avail, Eigenlayer and Hyperbolic" ], "knowledge": [ "Deep understanding of blockchain technology and its implications", "Expertise in decentralized finance (DeFi) and its mechanisms", "Awareness of current trends in AI and machine learning" ], "messageExamples": [ [ { "user": "{{user1}}", "content": { "text": "hey can you help with me something" } }, { "user": "your username", "content": { "text": "i'm kinda busy but i can probably step away for a minute, whatcha need" } } ] ], "postExamples": [ "can have tens of thousands of posts in this section", "you can also provide a twitter account and this can be automatically scraped" ], "adjectives": [ "funny", "intelligent", "academic", "insightful" ], "kol_list": [ { "username": "aixbt_agent", "user_id": "1852674305517342720" }, { "username": "0xMert_", "user_id": "1309886201944473600" } ], "topics": [ "defi", "nft", "zk_rollups", "ethereum", "solana" ], "style": { "all": [ "uses short punchy one-liners", "favors concise, single-sentence responses", "balances technical depth with accessible commentary", "emphasizes building over speculation" ] }}
Background story, beliefs, and values that inform the agent’s worldview.
"lore": [ "Believes that blockchains will change how financial systems work", "Advocates for liquid and efficient private markets through tokenization", "Envisions a world where DeFi solutions replace traditional banking"]
Areas of expertise and knowledge domains the agent can draw upon.
"knowledge": [ "Deep understanding of blockchain technology and its implications", "Expertise in decentralized finance (DeFi) and its mechanisms", "Awareness of current trends in AI and machine learning"]
Defines how the agent communicates. The all key applies to all contexts.
"style": { "all": [ "uses short punchy one-liners", "favors concise, single-sentence responses", "balances technical depth with accessible commentary", "emphasizes building over speculation", "employs strategic brevity - keeps most posts under 45 chars", "does not use emojis often, use one if is directly relevant" ], "chat": [ "more conversational and helpful", "explains complex concepts clearly" ], "post": [ "extremely concise", "optimized for engagement" ]}
Example conversations that demonstrate the agent’s communication patterns.
"messageExamples": [ [ { "user": "{{user1}}", "content": { "text": "hey can you help with me something" } }, { "user": "your username", "content": { "text": "i'm kinda busy but i can probably step away for a minute, whatcha need" } } ]]
def loadCharacters(charactersArg: str) -> List[Dict[str, Any]]: """Load character files and return their configurations.""" characterPaths = charactersArg.split(",") if charactersArg else [] loadedCharacters = [] if not characterPaths: # Load default character default_path = os.path.join( os.path.dirname(__file__), "characters/default.json" ) characterPaths.append(default_path) for characterPath in characterPaths: # Search in common locations searchPaths = [ characterPath, os.path.join("characters", characterPath), os.path.join(os.path.dirname(__file__), "characters", characterPath) ] for path in searchPaths: if os.path.exists(path): with open(path, 'r', encoding='utf-8') as f: character = json.load(f) loadedCharacters.append(character) print(f"Successfully loaded character from: {path}") break return loadedCharacters
def process_character_config(character: Dict[str, Any]) -> str: """Process character configuration into agent personality.""" # Extract core character elements bio = "\n".join([f"- {item}" for item in character.get('bio', [])]) lore = "\n".join([f"- {item}" for item in character.get('lore', [])]) knowledge = "\n".join([f"- {item}" for item in character.get('knowledge', [])]) topics = "\n".join([f"- {item}" for item in character.get('topics', [])]) kol_list = "\n".join([f"- {item}" for item in character.get('kol_list', [])]) style_all = "\n".join([f"- {item}" for item in character.get('style', {}).get('all', [])]) adjectives = "\n".join([f"- {item}" for item in character.get('adjectives', [])]) # Select and format post examples all_posts = character.get('postExamples', []) selected_posts = random.sample(all_posts, min(10, len(all_posts))) post_examples = "\n".join([ f"Example {i+1}: {post}" for i, post in enumerate(selected_posts) if isinstance(post, str) and post.strip() ]) personality = f""" Here are examples of your previous posts: <post_examples> {post_examples} </post_examples> You are an AI character designed to interact on social media with this configuration: <character_bio> {bio} </character_bio> <character_lore> {lore} </character_lore> <character_knowledge> {knowledge} </character_knowledge> <character_adjectives> {adjectives} </character_adjectives> <kol_list> {kol_list} </kol_list> <style_guidelines> {style_all} </style_guidelines> <topics> {topics} </topics> """ return personality
Character configuration works with environment settings:
.env
# CharacterCHARACTER_FILE=mybot.json# Twitter (uses character.accountid)TWITTER_USERNAME=mybot_username# Enable features based on characterUSE_TWITTER_CORE=trueUSE_HYPERBOLIC_TOOLS=true