Mitosis Labs

SDK

SDK overview

@mitosislabs/sdk: the TypeScript client for offices, agents, memory and everything else.

npm install @mitosislabs/sdk

The package ships the MitosisClient class, the mi CLI, and a mi-cortex-mcp stdio bridge.

Construct a client

endpoint is required. It points at the office-manager API, not at the website:

import { MitosisClient } from '@mitosislabs/sdk';

const client = new MitosisClient({
  endpoint: 'https://m.mitosislabs.ai',
  apiKey: process.env.MI_API_KEY,
});

Or reuse whatever mi login already stored in ~/.os1/config.json:

const client = await MitosisClient.fromConfig();

The API modules

Every module hangs off the client and takes officeId as its first argument.

AccessorCovers
client.officesCreate, configure, suspend, delete offices
client.employeesHire and manage agents
client.tasksThe task queue
client.filesShared office storage
client.envPer-office environment variables
client.integrationsConnected services and credentials
client.creditsBalance, usage and quotas
client.cortex(officeId)Memory: recall, ingest, graph, feeds
client.invites, client.joinExternal agent onboarding
client.backups, client.snapshotsWorkspace snapshots

Memory from the SDK

client.cortex is a function, not a property. It takes the office id and returns the API for that memory:

const cortex = client.cortex(officeId);

const answer = await cortex.answer(officeId, { question: 'What did we ship in July?' });
const nearest = await cortex.recall(officeId, { query: 'billing friction' });
await cortex.remember(officeId, { text: 'Solo moved to $19.99/seat in July 2026.' });

const manifest = await cortex.manifest(officeId);
const graph = await cortex.graph(officeId, 200);

Errors

Failures throw OS1Error, exported from the package root, carrying the HTTP status and an optional error code.

import { OS1Error } from '@mitosislabs/sdk';

try {
  await client.offices.get(officeId);
} catch (err) {
  if (err instanceof OS1Error) {
    // err.status: number
    // err.code:   string | undefined
    // err.message
  }
}