Quickstart
Get your first AI agent running with the Mind Layer.
1. Create a Project
Go to Projects and create a new project. A project groups your agents and provides an API key for authentication.
2. Get Your API Key
In your project settings, generate an API key. This key authenticates all REST API calls to the Mind Layer.
# All requests require Bearer auth
Authorization: Bearer YOUR_API_KEY3. Create an Agent
There are two ways to create an agent: define personality traits explicitly with Big5 scores, or generate one from a natural language prompt.
Option A: Generate from a Prompt
Describe your agent in plain language and the platform generates personality, bio, and seed memories automatically.
import { Sonzai } from "@sonzai-labs/agents";
const client = new Sonzai({ apiKey: "sk-..." });
const agent = await client.agents.generation.generateAndCreate({
name: "Luna",
description: "A cheerful and curious AI assistant who loves helping developers debug code. She's patient, witty, and always encouraging.",
language: "en",
});
console.log(agent.agentId); // auto-generated UUID
console.log(agent.personality); // full Big5 profile derived from descriptionOption B: Define with Big5 Scores
For precise control, create an agent with explicit Big5 scores. The platform derives a full personality profile, speech patterns, and emotional tendencies from your scores.
import { Sonzai } from "@sonzai-labs/agents";
import { v5 as uuidv5 } from "uuid";
const client = new Sonzai({ apiKey: "sk-..." });
// Derive a stable UUID from your own entity ID
const MY_NAMESPACE = "your-uuid-namespace-here";
const agentId = uuidv5("support-agent-001", MY_NAMESPACE);
const agent = await client.agents.create({
agentId, // pass your own UUID — safe to repeat
name: "Luna",
gender: "female",
big5: {
openness: 0.75,
conscientiousness: 0.60,
extraversion: 0.80,
agreeableness: 0.70,
neuroticism: 0.30,
},
language: "en",
});
console.log(agent.agentId); // same UUID every timeIdempotent by Design
Agent creation is always a create-or-update. Calling it twice with the same ID updates the existing agent — it never errors or creates a duplicate. This means your startup code, CI pipelines, and provisioning scripts can call agents.create() unconditionally.
- With agentId: Server uses your UUID directly. Recommended — link agents to your own entity IDs (agents, assistants, employees) for a deterministic mapping you control.
- Without agentId: Server derives a UUID from your project ID + agent name. The same name always maps to the same agent within your project.
4. Chat with Your Agent
Use streaming chat to get real-time AI responses. The platform automatically handles context, memory, and state updates.
for await (const event of client.agents.chatStream({
agent: "agent-id",
messages: [{ role: "user", content: "I had a great day hiking!" }],
userId: "user-123",
})) {
process.stdout.write(event.choices?.[0]?.delta?.content ?? "");
}Server-Side Only
The SDK is for server-side use only. Never expose API keys in client-side code. For web apps, proxy through your backend. See the Integration Guide for examples.
5. Track Over Time
The dashboard shows personality shifts, memory growth, mood patterns, and relationship dynamics. All systems update automatically as users interact.
Next Steps
- Read the Architecture to understand the full system
- Follow the Integration Guide for a production setup
- Browse the API Reference for all available endpoints
- Set up a Knowledge Base so agents can query your domain data
Enterprise Agents — Quickstart
Build a workflow-aware AI agent for CRM, support, internal tools, or compliance. Multi-instance isolation, webhook-driven events, project-scoped knowledge base, eval runs, and audit-ready memory — in one pass.
Architecture
How the Mind Layer Platform fits into your application architecture.