Production-grade AI Personality Engine — emotions, relationships, evolution, and character-driven interactions
Project description
██╗ ██╗ █████╗ ██████╗ ██╗ ██╗██╗ ██╗ █████╗
██║ ██╔╝██╔══██╗██╔════╝ ██║ ██║╚██╗ ██╔╝██╔══██╗
█████╔╝ ███████║██║ ███╗██║ ██║ ╚████╔╝ ███████║
██╔═██╗ ██╔══██║██║ ██║██║ ██║ ╚██╔╝ ██╔══██║
██║ ██╗██║ ██║╚██████╔╝╚██████╔╝ ██║ ██║ ██║
╚═╝ ╚═╝╚═╝ ╚═╝ ╚═════╝ ╚═════╝ ╚═╝ ╚═╝ ╚═╝
A Production-Grade AI Personality Engine
Give your AI a soul.
What is KAGUYA?
KAGUYA is a modular Personality Operating Layer for AI systems. It gives AI agents, chatbots, VTubers, NPCs, and digital companions:
- Persistent Identity — consistent personality across conversations
- Emotional Intelligence — real-time mood simulation with decay
- Relationship Memory — per-user trust, familiarity, and affinity tracking
- Response Modification — LLM output shaped by personality + emotion + relationships
- Personality Evolution — traits gradually change based on interactions
Architecture
┌─────────────────────────────────────────────────────┐
│ KAGUYA Engine │
├─────────────┬─────────────┬─────────────┬───────────┤
│ Personality │ Emotion │ Relationship│ Evolution │
│ Core │ Engine │ System │ Engine │
├─────────────┴─────────────┴─────────────┴───────────┤
│ Response Modifier Middleware │
├─────────────────────────────────────────────────────┤
│ Storage Layer (SQLite / PostgreSQL) │
├─────────────────────────────────────────────────────┤
│ REST API │ WebSocket │ Dashboard │
└─────────────────────────────────────────────────────┘
Quick Start
# Install
pip install kaguya
# Or with Docker
docker-compose up -d
Basic Usage
from kaguya.personality.traits import TraitVector
from kaguya.personality.profile import CharacterProfile
from kaguya.emotion.engine import EmotionalStateEngine
from kaguya.relationships.manager import RelationshipManager
from kaguya.middleware.response_modifier import ResponseModifier
# Create a personality
profile = CharacterProfile(
name="Sakura",
traits=TraitVector(
kindness=0.9,
humor=0.6,
empathy=0.85,
confidence=0.4,
curiosity=0.7,
),
)
# Initialize systems
emotion = EmotionalStateEngine(profile)
relationships = RelationshipManager()
modifier = ResponseModifier(profile, emotion, relationships)
# Modify an LLM prompt based on personality
enhanced_prompt = modifier.modify_prompt(
base_prompt="You are a helpful assistant.",
user_id="user_123"
)
Character Presets
from kaguya.personality.presets import tsundere, kuudere, chaotic_gremlin
# Use a preset personality
profile = tsundere(name="Kaguya")
profile = kuudere(name="Ice Queen")
profile = chaotic_gremlin(name="Gremlin")
REST API
# Start the server
uvicorn api.main:app --host 0.0.0.0 --port 8000
# Create personality
curl -X POST http://localhost:8000/personality \
-H "Content-Type: application/json" \
-d '{"name": "Kaguya", "traits": {"kindness": 0.8, "humor": 0.6}}'
# Get emotional state
curl http://localhost:8000/emotion/{personality_id}
# Chat with personality
curl -X POST http://localhost:8000/chat \
-d '{"personality_id": "xxx", "user_id": "user_1", "message": "Hello!"}'
Features
| Feature | Description |
|---|---|
| 🎭 Personality Traits | 10+ traits with float precision (0.0-1.0) |
| 💜 Emotion Engine | Valence-Arousal model with decay and transitions |
| 💕 Relationships | Per-user trust, familiarity, affinity, respect |
| 🧠 Memory Bias | Personality-influenced memory retrieval |
| 📈 Evolution | Gradual trait changes from interactions |
| 🔧 Response Modifier | LLM prompt enhancement based on state |
| 🎨 Character Presets | tsundere, kuudere, chaotic_gremlin, and more |
| 🖥️ Dashboard | Futuristic dark-mode visualization |
| 🐳 Docker | One-command deployment |
| 🔌 REST API | Full CRUD + WebSocket streaming |
Dashboard
Access at http://localhost:8000/dashboard after starting the server.
Features:
- Personality radar chart
- Real-time emotion gauge
- Relationship map
- Mood timeline
- Trait evolution graph
Project Structure
kaguya/
├── src/kaguya/
│ ├── personality/ # Trait system, profiles, presets
│ ├── emotion/ # Emotional state engine
│ ├── relationships/ # Per-user relationship tracking
│ ├── evolution/ # Personality evolution over time
│ ├── middleware/ # Response modification
│ └── storage/ # Database layer
├── api/ # FastAPI REST API + WebSocket
├── dashboard/ # Web dashboard
├── examples/ # Usage examples
├── tests/ # Test suite
└── docs/ # Documentation
Tech Stack
- Python 3.10+
- FastAPI — REST API + WebSocket
- SQLAlchemy — async ORM
- SQLite / PostgreSQL — storage
- Docker — deployment
Contributing
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests
- Submit a pull request
License
MIT License — see LICENSE for details.
Built with ❤️ for the AI character community
KAGUYA — Because AI deserves a personality.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file kaguya-0.1.0.tar.gz.
File metadata
- Download URL: kaguya-0.1.0.tar.gz
- Upload date:
- Size: 39.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.15
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6133ff6e7ab58f7b568d6a924a30d18e474d31058ff8d1715d5b6d5be9030cff
|
|
| MD5 |
9fd55e4eefc82e02bef8ec0ece476c21
|
|
| BLAKE2b-256 |
19c8992a3104cb444dbccf4585d57f288dcda59b45e6973e252a09a6b77cadc7
|
File details
Details for the file kaguya-0.1.0-py3-none-any.whl.
File metadata
- Download URL: kaguya-0.1.0-py3-none-any.whl
- Upload date:
- Size: 37.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.15
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7cbaf8107736b52dc2c57102b20f7f0fc65f67438e640c10946387e896c4565d
|
|
| MD5 |
939ce34eaf82a7157a278892141eae5f
|
|
| BLAKE2b-256 |
f3ee09d14a5ffe0be476de4f4b331801150bd537dd07f35a8c5d908cbb9df666
|