Overview
The Chat Agent mode provides an interactive conversational interface where users can directly interact with AI agents powered by Claude. This mode supports tool usage, character personalities, and knowledge base queries.Architecture
The chat agent is built on:- LangChain for agent orchestration
- Claude (Anthropic) as the LLM provider
- LangGraph for state management and checkpointing
- ReAct pattern for reasoning and action
Implementation
Agent Initialization
The agent is created using LangGraph’screate_react_agent with memory persistence:
chatbot.py
Running Chat Mode
The chat mode provides an interactive REPL with streaming responses:chatbot.py
Character Configuration
Agents use JSON character files to define personality and behavior:characters/template.json
Available Tools
Chat agents have access to various tools configured via environment variables:Blockchain Tools
Blockchain Tools
- Wallet operations (send/receive crypto)
- Token deployment and trading
- ERC20 token interactions
- WETH wrapping/unwrapping
- Pyth price feed queries
Social Media Tools
Social Media Tools
Knowledge Bases
Knowledge Bases
- Twitter knowledge base (RAG over KOL tweets)
- Podcast knowledge base (RAG over transcripts)
- Query semantic search
Utility Tools
Utility Tools
- Web search (DuckDuckGo)
- Browser automation
- HTTP requests
- Writing/content generation
Configuration
Set up your chat agent with environment variables:.env
Usage
Start a chat session:Terminal
Example Interaction
Advanced Features
Progress Indicators
The agent shows a spinner while processing:chatbot.py
Memory Persistence
Conversations are stored with LangGraph checkpointing:chatbot.py
Best Practices
Character Design
- Define clear personality traits
- Include relevant domain knowledge
- Add style guidelines for consistency
- Use post examples to guide tone
Tool Selection
- Only enable needed tools
- Configure API keys securely
- Test tools independently first
- Monitor tool usage patterns
Knowledge Bases
- Keep embeddings updated
- Use relevant query strategies
- Combine multiple sources
- Monitor retrieval quality
Performance
- Use streaming for responsiveness
- Set reasonable recursion limits
- Handle errors gracefully
- Cache common queries
Troubleshooting
Agent not responding
Agent not responding
Check that all required API keys are set:
ANTHROPIC_API_KEYfor ClaudeCDP_API_KEY_NAMEandCDP_API_KEY_PRIVATEfor blockchain- Tool-specific keys if enabled
Character file not loading
Character file not loading
Verify the character JSON file:
- File exists at the specified path
- JSON is valid (no syntax errors)
- Required fields are present (name, bio, style)
Tool errors
Tool errors
- Ensure tool dependencies are installed
- Verify API credentials for external services
- Check
ALLOW_DANGEROUS_REQUEST=truefor HTTP tools - Review tool-specific environment variables
Next Steps
Voice Agent
Add real-time voice interaction to your agent
Twitter Automation
Deploy autonomous social media agents
Tool Development
Create custom tools for your agent
Voice Agent
Explore the voice-enabled agent interface