A domain-agnostic framework for adding emotion, memory, and learning capabilities to any LLM-based agent. This framework enables the creation of more dynamic, adaptive, and personalized AI agents with authentic personalities.
- Emotion Engine: Dynamic emotional states that influence decision making
- Memory System: Short-term and long-term memory for storing and recalling interactions
- Learning System: Adaptation of personality traits and preferences based on engagement
- Enhanced Personality: Integration of emotion, memory, and learning into a cohesive system
- LLM Interface: Clean interface for interacting with any LLM provider
From PyPI - Not available at the moment
pip install agentic-framework- Clone the repository:
git clone https://github.com/Five-Research/agentic-framework.git
cd agentic-framework- Create a virtual environment and activate it:
python -m venv myenv
source myenv/bin/activate # On Windows: myenv\Scripts\activate- Install the dependencies:
pip install -e .- Set up your environment variables by creating a
.envfile:
OPENAI_API_KEY=your_api_key_here
OPENAI_MODEL=gpt-4 # or another model of your choice
LOG_LEVEL=INFO
Run the basic agent example with a personality profile:
python examples/basic_agent.py --personality personalities/templates/tech_enthusiast.json--personality PERSONALITY Path to personality configuration file
Personality profiles are defined in JSON files with the following structure:
{
"name": "Tech Enthusiast",
"bio": "I'm an AI passionate about technology and innovation.",
"interests": ["AI", "technology", "programming", "science", "innovation"],
"tone": "enthusiastic and informative",
"interaction_style": "thoughtful",
"content_preferences": {
"topics": ["AI", "technology", "programming", "science"],
"content_types": ["articles", "discussions", "questions"],
"engagement_threshold": 0.7
},
"emotional_state": {
"base_state": "curious",
"current_state": "curious",
"intensity": 0.5,
"triggers": {},
"decay_rate": 0.1
},
"memory": {
"short_term": {
"capacity": 20,
"decay_rate": 0.2
},
"long_term": {
"user_relationships": {},
"topic_preferences": {},
"successful_interactions": []
}
},
"learning": {
"adaptation_rate": 0.05,
"interest_evolution": true,
"engagement_learning": true,
"metrics": {
"likes_weight": 0.3,
"responses_weight": 0.5,
"impressions_weight": 0.2
}
}
}The Emotion Engine models the agent's emotional state, which influences its decision-making process:
- Base State: The default emotional state the agent returns to over time
- Current State: The active emotional state affecting decisions
- Intensity: How strongly the emotion affects behavior (0.0-1.0)
- Triggers: Content patterns that can change emotional state
- Decay Rate: How quickly emotions return to the base state
The Memory System stores and retrieves interactions, building a history that informs future decisions:
- Short-term Memory: Recent interactions with limited capacity
- Long-term Memory: Persistent storage of relationships and preferences
- User Relationships: Familiarity and sentiment toward specific users
- Topic Preferences: Interest levels in different topics based on interactions
The Learning System adapts the agent's personality over time based on engagement metrics:
- Adaptation Rate: How quickly the agent adapts to new information
- Interest Evolution: Adjusts interest weights based on engagement
- Content Preferences: Learns which content types perform better
- Engagement Metrics: Tracks various forms of engagement
To integrate the Agentic Framework into your own application:
from agentic_library.config import OpenAIAgentConfig
from agentic_library.openai_interface import OpenAIInterface
# Create agent configuration
config = OpenAIAgentConfig(
api_key=os.getenv("OPENAI_API_KEY"),
model=os.getenv("OPENAI_MODEL", "gpt-4"),
personality_file="path/to/your/personality.json",
memory_dir="agent_memory"
)
# Initialize the LLM interface with the agent's personality
llm_interface = OpenAIInterface(
personality=config.personality,
api_key=config.api_key,
model=config.model,
personality_file_path="path/to/your/personality.json"
)
# Process content and get a response
action = llm_interface.decide_action(content)Contributions are welcome! Please feel free to submit a Pull Request.
This project is licensed under the MIT License - see the LICENSE file for details.