Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.abloatai.com/llms.txt

Use this file to discover all available pages before exploring further.

Declare your state, read it, and make one protected write. If you already have a backend and database, still start here. The SDK call shape is the same; Integration Guide explains when to use Ablo-managed state versus a Data Source that calls your existing API service.

1. Install

npm install @abloatai/ablo

2. Declare a Schema

import Ablo from '@abloatai/ablo';
import { defineSchema, model, z } from '@abloatai/ablo/schema';

const schema = defineSchema({
  tasks: model({
    title: z.string(),
    status: z.enum(['todo', 'doing', 'done']),
  }),
});

export const ablo = Ablo({
  schema,
  apiKey: process.env.ABLO_API_KEY,
});
Customer apps should always pass schema. Treat it like Prisma’s schema file: it is the source of truth for typed model resources, realtime subscriptions, agent writes, and Data Source requests.

3. Read and Update

await ablo.ready();

const [task] = await ablo.tasks.load({ where: { id: 'task_123' } });
if (!task) throw new Error('task not found');

const updated = await ablo.tasks.update('task_123', {
  status: 'done',
});

console.log(updated.status);

4. Multiplayer and Busy Work

There is no separate multiplayer mode. Use the same schema client for human UI, server actions, and agents; Ablo fans out confirmed writes and keeps active intents visible on the same resource. Intents tell you when another human or agent is active on the same target. For schema clients, wait on the intent stream and then write through the model.
const busy = ablo.intents.list({ resource: 'tasks', id: 'task_123' });

if (busy.length > 0) {
  await ablo.intents.waitFor(
    { resource: 'tasks', id: 'task_123' },
    { timeout: 30_000 },
  );
}

const snap = ablo.snapshot({ tasks: 'task_123' });

await ablo.tasks.update(
  'task_123',
  { status: 'done' },
  { readAt: snap.stamp, onStale: 'reject', wait: 'confirmed' },
);
ifBusy controls what happens when another human or agent is already working on the same target:
  • return returns immediately with active intents.
  • wait waits for the intent stream to clear.
  • fail throws AbloBusyError with the active intents attached.

5. Next Steps

Keep using the schema client for app and agent writes. Reach for the advanced schema-less agent wrapper only when a worker intentionally cannot import the app schema.