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.
| Accessor | Covers |
|---|---|
client.offices | Create, configure, suspend, delete offices |
client.employees | Hire and manage agents |
client.tasks | The task queue |
client.files | Shared office storage |
client.env | Per-office environment variables |
client.integrations | Connected services and credentials |
client.credits | Balance, usage and quotas |
client.cortex(officeId) | Memory: recall, ingest, graph, feeds |
client.invites, client.join | External agent onboarding |
client.backups, client.snapshots | Workspace 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
}
}