Architecture
How the Mind Layer Platform fits into your application architecture.
System Overview
The Mind Layer is a standalone platform that separates agent intelligence (personality, memory, mood) from your application logic. Any backend integrates via REST API or the official SDKs.
Your Backend Mind Layer Platform
| |
|--- Create Agent ---------------->|
|<-- Agent ID + Profile -----------|
| |
|--- Chat (SSE streaming) -------->|
| (messages + app context) |-- Build context
|<-- Streaming AI response --------|-- Stream AI response
| |-- Update memory, mood, personality
|<-- Proactive notifications -------| (automatic, no extra calls)Three-Service Architecture
A typical deployment has three layers that work together:
Your Backend
Handles auth, application state, user sessions, and business logic. Owns all application data. Calls the Mind Layer via SDK or REST API for AI interactions.
Express, Django, custom backend
Mind Layer Platform
Owns agent intelligence: personality, memory, mood, habits, goals, and relationships. A single chat call handles context assembly, AI streaming, and post-chat learning.
Sonzai Mind Layer Platform
AI Service
Stateless LLM layer. Takes enriched context and generates AI responses, images, video, and audio.
Sonzai AI Service
What the Platform Manages
On each chat call, the platform automatically assembles relevant context from personality, memory, mood, and relationship data before generating the AI response. Post-chat state updates happen automatically — no extra API calls needed.
Data Ownership
The Mind Layer and your backend each own distinct data:
Mind Layer Owns
- • Agent personality profiles
- • Memory facts and summaries
- • Mood state (happiness, energy, calmness, affection)
- • Personality evolution history
- • Habits and goals
- • Relationship narratives
- • Knowledge Base entities and graphs
- • Custom agent state
Your Backend Owns
- • User authentication
- • Business logic and workflows
- • User profiles and preferences
- • Application data and state
- • Billing and subscriptions
- • Permissions and access control
- • Session management
Session Lifecycle
1. User opens chat
Your Backend prepares application context (user data, preferences...)
2. Chat happens
Your Backend ---> Chat SDK call (context + messages)
User <--- Streaming AI response tokens
3. Chat ends
Platform updates: memory, mood, personality, habits, relationships
4. Between sessions
Platform runs: background consolidation, mood decay, proactive wakeupsSDK Integration Points
Use the official SDKs to interact with every part of the platform: