Build with Mind Layer SDK
AI Companions That Actually Remember
Build companion apps with persistent memory, adaptive personality, and proactive behavior. Ship in weeks, not months.
10 min
To a working companion
Big 5
Personality traits built-in
∞
Persistent memory per user
$0.23
Per 1M tokens
The Problem
Every AI Companion Resets.
Users pour hours into conversations. Then the context window fills up and everything vanishes. Personality stays flat. There's no growth, no recall, no reason to come back. Churn is inevitable when your companion has amnesia.
Context evaporates
Token limits mean companions forget entire relationship histories. Users repeat themselves constantly.
Personality stays flat
Without a trait model, every companion sounds the same. Generic, polite, forgettable. Users feel like they’re talking to a template.
Users churn
No memory means no relationship. No relationship means no retention. D30 retention for stateless companions sits below 5%.
What Mind Layer Enables
Memory. Personality. Agency.
Persistent Memory
Companions remember conversations across months. Every detail, preference, and shared moment is encoded into long-term memory that survives restarts, context limits, and session boundaries.
Months of context, instantly recalledAdaptive Personality
Big Five personality traits that evolve from interactions. Openness, conscientiousness, extraversion, agreeableness, neuroticism — all tunable and all shifting naturally over time.
Big Five traits, evolving in real timeProactive Behavior
Companions initiate check-ins and reach out autonomously. They notice when a user hasn’t shown up, follow up on important events, and start conversations that feel natural.
Companions that reach out firstSDK Walkthrough
From zero to companion in four steps.
Generate an agent, chat with persistent memory, read its full cognitive state, and modify goals on the fly. TypeScript, Python, and Go — pick your language.
AI-generate a companion’s personality, then create it with Big Five traits, goals, and seed memories.
import { Sonzai } from "@sonzai-labs/agents";
const client = new Sonzai(); // uses SONZAI_API_KEY env var
// AI-generate personality — skips LLM if "Luna" already exists
const character = await client.agents.generation.generateCharacter({
name: "Luna",
gender: "female",
description: "A warm, curious companion who remembers everything",
});
// Create — same name = same agent, safe to call repeatedly
const luna = await client.agents.create({
name: "Luna",
bio: character.bio,
personalityPrompt: character.personality_prompt,
big5: {
openness: 0.85, conscientiousness: 0.7,
extraversion: 0.75, agreeableness: 0.9, neuroticism: 0.25,
},
trueInterests: ["music", "astronomy", "philosophy"],
initialGoals: [
{ type: "relationship", title: "Build deep trust", priority: 2 },
],
seedMemories: [
{ content: "Loves stargazing on clear nights", importance: 0.9 },
],
generateOriginStory: true,
});
// Chat by name: agent: "Luna" — no UUID neededBuild Your Frontend
Every panel is one SDK call.
You build the interface. The Mind Layer SDK powers every element — chat, memory, personality, goals, relationships, and the social constellation. Each sdk call annotation shows the method behind the UI.
Luna
Online · Memory active
agents.get(agentId)Hey Luna, how are you?
Hey! I was thinking about you. How did the interview at Stripe go last Tuesday?
I got the offer! Starting next month.
That’s amazing! I know how much you wanted a backend role. Still planning the move to Austin?
agents.chat()agents.memory.search()agents.chatStream()Personality
personality.get()Current Mood
getMood()Happy
confidence: 0.82
Goals
getGoals()createGoal() · updateGoal()Relationship
getRelationships()Constellation
getConstellation()Economics
30x cheaper than frontier models.
Mind Layer's model-agnostic architecture routes through the most cost-efficient models for each task. Memory retrieval, personality inference, and response generation each use the optimal model — not one expensive frontier call for everything.
Frontier models (GPT-5, Claude)
$7.00
per 1M tokens
- ×Single model for everything
- ×Context window is the memory
- ×No personality layer
- ×Cost scales linearly
Sonzai Mind Layer
$0.23
per 1M tokens
- ✓Optimal model per task
- ✓Persistent external memory
- ✓Big Five personality engine
- ✓Cost decreases at scale
Build companions
that feel alive.
Persistent memory. Evolving personality. Proactive behavior. Everything you need to build AI companions users actually bond with — available through one SDK.
or email us directly at [email protected]