Running workers
Running on a schedule
Workers with a schedule run automatically at the configured time. Each run creates a conversation, just like an on-demand run. You can configure schedules when creating or updating a worker (see Creating workers).
Set active: false to pause a scheduled worker without deleting it. Paused
worker can still be run on demand.
Running on demand
Trigger a worker run at any time, regardless of whether it has a schedule. The
worker runs asynchronously and returns a chatId for the conversation created
by the run.
Endpoint: POST /v2/workers/{workerId}/run
import { Exabase } from "@exabase/sdk";
const api = new Exabase({
apiKey: process.env.EXABASE_API_KEY,
});
const run = await api.workers.run(
{
workerId: '<WORKER_ID>',
},
{
baseId: '<BASE_ID>',
},
);
curl https://api.exabase.io/v2/workers/<WORKER_ID>/run \
-X POST \
-H 'X-Api-Key: <EXABASE_API_KEY>' \
-H 'X-Exabase-Base-Id: <BASE_ID>'
Fetching results
A worker run produces a conversation. You can retrieve the messages to inspect the worker's output, reasoning, and tool calls.
Endpoint: GET /v2/workers/{workerId}/chats/{chatId}/messages.
The last message with role: "assistant" contains the worker's final output.
If the worker is still running, poll until it appears.
import { Exabase } from "@exabase/sdk";
const api = new Exabase({
apiKey: process.env.EXABASE_API_KEY,
});
const startTime = Date.now();
while (Date.now() - startTime < 30_000) {
const resp = await client.workers.listMessages(
{
workerId: 'your-worker-id',
chatId: 'chat-id-from-run-response',
},
{
baseId: '<BASE_ID>',
},
);
const lastMessage = resp.messages.at(-1);
if (lastMessage?.role !== 'assistant') {
await new Promise((r) => setTimeout(r, 1000));
} else {
const workerOutput = lastMessage?.parts
.filter((part) => part.type === 'text')
.map((part) => part.text)
.join('\n');
break;
}
}
curl https://api.exabase.io/v2/workers/<WORKER_ID>/chats/<CHAT_ID>/messages \
-X GET \
-H 'X-Api-Key: <EXABASE_API_KEY>' \
-H 'X-Exabase-Base-Id: <BASE_ID>'