Skip to main content
Using Mind Layer

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 recalled

Adaptive 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 time

Proactive 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 first

SDK 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.

create.ts
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 needed
TypeScriptPythonGoAvailable on GitHub

Build 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.

L

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?

Recalled from 6 days ago

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?

Recalled career goal + location
agents.chat()agents.memory.search()agents.chatStream()

Personality

personality.get()
OPEN
85
CONS
70
EXTR
75
AGRE
90
NEUR
25

Current Mood

getMood()
😊

Happy

confidence: 0.82

Goals

getGoals()
Build deep trusthigh
Learn about Austinmedium
Share music tastelow
createGoal() · updateGoal()

Relationship

getRelationships()
Trust85%
StageClose Friend
Interactions142

Constellation

getConstellation()
LAlexSamMiaJay

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]

Enterprise

Want a custom AI Companion for your business?

Tell us what you need. We'll pair you with our CTO and a dedicated engineering team, and deliver a custom proposal — at no cost.

2
Free consultation30-min call with founders
3
Receive your proposalAccess at proposals.sonz.ai
100% free consultationCustom proposal within 48hNo commitment required
© 2026Sonzai Labs · Singapore