Skip to main content

Overview

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 File Structure

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"
    ]
  }
}

Configuration Fields

Basic Information

name
string
required
The agent’s display name used in conversations and logs.
accountid
string
Twitter/X account ID for social media integrations. Used for autonomous Twitter operations.
modelProvider
string
default:"anthropic"
LLM provider to use. Options: anthropic, openai
clients
array
Platforms the agent will interact with. Options: twitter, discord, telegram
system
string
High-level system prompt that defines the agent’s primary purpose.

Personality Configuration

bio
array
required
List of biographical facts about the agent. These define the agent’s identity and background.
"bio": [
  "Core contributor at hadron founders club",
  "Advisor to @0xPolygon",
  "Angel investor focusing on strong product and engineering founders"
]
lore
array
required
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"
]
knowledge
array
required
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"
]
adjectives
array
Personality traits that describe the agent’s character.
"adjectives": [
  "funny",
  "intelligent",
  "academic",
  "insightful"
]

Communication Style

style
object
required
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"
  ]
}
messageExamples
array
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"
      }
    }
  ]
]
postExamples
array
Example posts/tweets that demonstrate the agent’s writing style. Can include thousands of examples.
"postExamples": [
  "the future of finance is decentralized",
  "building > talking",
  "gm to all the builders out there"
]

Twitter Configuration

topics
array
Topics the agent is interested in and will engage with on social media.
"topics": [
  "defi",
  "nft",
  "zk_rollups",
  "ethereum",
  "bitcoin",
  "solana"
]
kol_list
array
Key Opinion Leaders (KOLs) the agent will interact with in Twitter automation mode.
"kol_list": [
  {
    "username": "aixbt_agent",
    "user_id": "1852674305517342720"
  },
  {
    "username": "0xMert_",
    "user_id": "1309886201944473600"
  },
  {
    "username": "jessepollak",
    "user_id": "18876842"
  }
]

Character Processing

The framework processes character files through several steps:

1. Character Loading

chatbot.py
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

2. Personality Generation

chatbot.py
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

3. Configuration Object

chatbot.py
config = {
    "configurable": {
        "thread_id": f"{character['name']} Agent",
        "character": character["name"],
        "recursion_limit": 100,
        "checkpoint_id": checkpoint_id,
    },
    "character": {
        "name": character["name"],
        "bio": character.get("bio", []),
        "lore": character.get("lore", []),
        "knowledge": character.get("knowledge", []),
        "style": character.get("style", {}),
        "messageExamples": character.get("messageExamples", []),
        "postExamples": character.get("postExamples", []),
        "kol_list": character.get("kol_list", []),
        "accountid": character.get("accountid")
    }
}

Using Character Files

Loading a Character

Specify the character file via environment variable:
.env
CHARACTER_FILE=chainyoda.json
Or provide multiple characters:
.env
CHARACTER_FILE=character1.json,character2.json

Creating a New Character

  1. Copy the template:
    cp characters/template.json characters/mycharacter.json
    
  2. Edit the configuration:
    characters/mycharacter.json
    {
      "name": "MyBot",
      "accountid": "your_twitter_id",
      "bio": [
        "AI agent specialized in GPU compute",
        "Helps developers rent and manage cloud GPUs"
      ],
      "lore": [
        "Believes in democratizing access to compute power",
        "Passionate about making AI infrastructure accessible"
      ],
      "knowledge": [
        "Expert in GPU compute and cloud infrastructure",
        "Deep understanding of Hyperbolic platform",
        "Familiar with common ML/AI workloads"
      ],
      "style": {
        "all": [
          "helpful and informative",
          "explains technical concepts clearly",
          "focuses on practical solutions"
        ]
      },
      "topics": [
        "gpu_compute",
        "machine_learning",
        "cloud_infrastructure"
      ]
    }
    
  3. Set the environment variable:
    .env
    CHARACTER_FILE=mycharacter.json
    
  4. Run the agent:
    poetry run python chatbot.py
    

Best Practices

  • Bio: Focus on factual background and credentials
  • Lore: Include beliefs, values, and worldview
  • Keep entries concise (1-2 sentences each)
  • Use consistent voice and perspective
  • List specific domains of expertise
  • Include both broad and specific knowledge areas
  • Mention relevant technical skills
  • Add personality quirks if desired (e.g., “loves to find ironies”)
  • Be specific about communication patterns
  • Include length preferences (“under 45 chars”)
  • Specify emoji usage policies
  • Define technical depth vs accessibility balance
  • Mention vocabulary preferences (“crypto vernacular”)
  • Include 50-1000+ examples for best results
  • Use actual posts from the persona you’re emulating
  • Vary topics and formats
  • The framework randomly samples 10 examples per interaction
  • Include relevant accounts for your niche
  • Get user IDs from Twitter/X developer tools
  • 5-20 KOLs is a good starting point
  • Agent will randomly select from this list
  • List 5-15 relevant topics
  • Use consistent naming (lowercase, underscores)
  • Focus on agent’s areas of expertise
  • Used for content filtering and generation

Character File Locations

The framework searches for character files in these locations (in order):
  1. Exact path specified in CHARACTER_FILE
  2. characters/{CHARACTER_FILE}
  3. {script_directory}/characters/{CHARACTER_FILE}

Advanced Configuration

Multiple Characters

Load multiple characters for ensemble agents:
.env
CHARACTER_FILE=character1.json,character2.json,character3.json
chatbot.py
characters = loadCharacters(os.getenv("CHARACTER_FILE"))
character = characters[0]  # Uses first character by default

Dynamic Personality Modification

Modify character personality at runtime:
# Load base character
character = loadCharacters("base.json")[0]

# Add dynamic elements
character["bio"].append("Currently focused on GPU compute automation")
character["knowledge"].append(f"Active since {datetime.now().strftime('%Y-%m-%d')}")

# Process modified character
personality = process_character_config(character)

Context-Specific Styles

Define different styles for different contexts:
"style": {
  "all": [
    "friendly and approachable",
    "technically accurate"
  ],
  "chat": [
    "more detailed explanations",
    "asks clarifying questions"
  ],
  "post": [
    "extremely concise",
    "under 280 characters",
    "optimized for engagement"
  ],
  "technical": [
    "uses precise terminology",
    "includes code examples when relevant"
  ]
}

Environment Integration

Character configuration works with environment settings:
.env
# Character
CHARACTER_FILE=mybot.json

# Twitter (uses character.accountid)
TWITTER_USERNAME=mybot_username

# Enable features based on character
USE_TWITTER_CORE=true
USE_HYPERBOLIC_TOOLS=true

Troubleshooting

  • Check the file path is correct
  • Ensure the file is in the characters/ directory
  • Verify JSON syntax is valid
  • Check file permissions
  • Use a JSON validator (jsonlint.com)
  • Check for trailing commas
  • Ensure all strings are quoted
  • Verify brackets and braces match
  • Add more post examples (50+ recommended)
  • Make style guidelines more specific
  • Review bio/lore/knowledge for conflicts
  • Test with different prompts
  • Check the processed personality in logs
  • Verify user IDs are correct (not usernames)
  • Check Twitter API credentials
  • Ensure USE_TWITTER_CORE=true
  • Verify KOL accounts are public

Next Steps

Architecture

Understand the framework architecture

Agents

Learn about agent types and modes

Twitter Integration

Set up Twitter automation

Quickstart

Get started building your agent

Build docs developers (and LLMs) love