Executions API
Read and cancel execution records, filter project history, and wait for terminal state.
Read and cancel execution records, filter project history, and wait for terminal state.
ExecutionsClient
Read and poll the executor's project-scoped execution records.
cancel
Cancels a pending or running execution.
Cancellation is deterministic before provider dispatch. After dispatch may have begun, Eyeball aborts process-local work where possible, but upstream work or external side effects can still complete.
cancel(executionId: string): Promise<ExecutionBase & { userId: string; createdAt: string; startedAt?: string; completedAt?: string; readonly replayed?: true; readonly source?: ExecutionSource; readonly attachments?: ExecutionAttachmentSummary; } & { status: "cancelled"; output?: never; error: ExecutionCancelledError; latencyMs: number; cancellation: ExecutionCancellation; }>| Parameter | Type | Required | Description |
|---|---|---|---|
executionId | string | Yes | Execution identifier returned by tools.execute. |
Returns: Promise<ExecutionBase & { userId: string; createdAt: string; startedAt?: string; completedAt?: string; readonly replayed?: true; readonly source?: ExecutionSource; readonly attachments?: ExecutionAttachmentSummary; } & { status: "cancelled"; output?: never; error: ExecutionCancelledError; latencyMs: number; cancellation: ExecutionCancellation; }>
Throws
- EyeballError when the execution is unavailable, unauthorized, already succeeded or failed, or reconciliation fails.
Example
import { Eyeball } from "@eyeball/sdk";
const eyeball = new Eyeball({
apiKey: process.env.EYEBALL_API_KEY!,
baseUrl: process.env.EYEBALL_EXECUTOR_URL!,
});
const cancelled = await eyeball.executions.cancel(
"exe_01JZ6WA0Q73ZQ5B51SRYB6M4Z8",
);
if (cancelled.cancellation.dispatchMayHaveBegun) {
console.warn("Cancellation is best effort; upstream work may complete.");
} else {
console.log("Provider dispatch was fenced.");
}get
Retrieves one execution record by identifier.
The public record may include bounded replay, verified voice-session source, and staged-file ID/count provenance. It never includes canonical input, raw or derived idempotency identity, or staged-file bytes.
get(executionId: string): Promise<ExecutionRecord>| Parameter | Type | Required | Description |
|---|---|---|---|
executionId | string | Yes | Execution identifier returned by tools.execute. |
Returns: Promise<ExecutionRecord>
Throws
- EyeballError when the execution is unavailable or the request fails.
Example
import { Eyeball } from "@eyeball/sdk";
const eyeball = new Eyeball({
apiKey: process.env.EYEBALL_API_KEY!,
baseUrl: process.env.EYEBALL_EXECUTOR_URL!,
});
const execution = await eyeball.executions.get(
"exe_01JZ6WA0Q73ZQ5B51SRYB6M4Z8",
);
if (execution.replayed === true) console.log("Accepted replay observed");
if (execution.source?.kind === "voice_session") {
console.log(execution.source.sessionId);
}
for (const fileId of execution.attachments?.fileIds ?? []) {
console.log(fileId);
}list
Lists execution history with optional status, tool, user, and cursor filters.
Items preserve the same optional bounded provenance as get; canonical
input, idempotency identity, and file bytes remain private.
list(options?: ListExecutionsOptions): Promise<ExecutionPage>| Parameter | Type | Required | Description |
|---|---|---|---|
options | ListExecutionsOptions | No | Filters and pagination for the project execution history. |
Returns: Promise<ExecutionPage>
Throws
- EyeballError when a filter is invalid or the executor request fails.
wait
Polls an execution until it succeeds, fails, or is cancelled, bounded by a local deadline. The terminal record preserves optional replay, verified source, and staged-file summary fields without exposing canonical input, idempotency identity, or bytes.
wait(executionId: string, options?: WaitForExecutionOptions): Promise<TerminalExecutionRecord>| Parameter | Type | Required | Description |
|---|---|---|---|
executionId | string | Yes | Execution identifier returned by tools.execute. |
options | WaitForExecutionOptions | No | Poll interval and total timeout in milliseconds. |
Returns: Promise<TerminalExecutionRecord>
Throws
- EyeballError with
timeoutwhen the deadline expires, or the executor's normalized error for a failed request. - Error When an injected polling clock returns a non-finite timestamp.
Example
import { Eyeball } from "@eyeball/sdk";
const eyeball = new Eyeball({
apiKey: process.env.EYEBALL_API_KEY!,
baseUrl: process.env.EYEBALL_EXECUTOR_URL!,
});
const execution = { executionId: "exe_01JZ6WA0Q73ZQ5B51SRYB6M4Z8" };
const terminal = await eyeball.executions.wait(execution.executionId, {
pollMs: 500,
timeoutMs: 60_000,
});Types
ListExecutionsOptions
Project execution-history filters and cursor controls.
export interface ListExecutionsOptions {
status?: ExecutionStatus;
/** Canonical dotted or restricted wire name. */
tool?: string;
/** Uses the client-level userId when omitted. */
userId?: string;
cursor?: string;
limit?: number;
}| Property | Type | Required | Readonly | Description |
|---|---|---|---|---|
cursor | string | No | No | — |
limit | number | No | No | — |
status | ExecutionStatus | No | No | — |
tool | string | No | No | Canonical dotted or restricted wire name. |
userId | string | No | No | Uses the client-level userId when omitted. |
WaitForExecutionOptions
Local polling cadence and deadline for terminal execution state.
export interface WaitForExecutionOptions {
/** Milliseconds between polls. Defaults to 500. */
pollMs?: number;
/** Total milliseconds before a timeout error. Defaults to 60,000. */
timeoutMs?: number;
}| Property | Type | Required | Readonly | Description |
|---|---|---|---|---|
pollMs | number | No | No | Milliseconds between polls. Defaults to 500. |
timeoutMs | number | No | No | Total milliseconds before a timeout error. Defaults to 60,000. |
ExecutionPage
One cursor page of public execution records.
export interface ExecutionPage {
executions: readonly ExecutionRecord[];
nextCursor?: string;
}| Property | Type | Required | Readonly | Description |
|---|---|---|---|---|
executions | readonly ExecutionRecord[] | Yes | No | — |
nextCursor | string | No | No | — |
AsyncExecuteResponse
export type AsyncExecuteResponse = ExecutionBase & { status: "pending" };ExecutionId
export type ExecutionId = `exe_${string}`;ExecutionAttachmentSummary
Historical metadata-only summary of staged Eyeball files referenced by an execution's validated canonical input.
count is always the number of distinct IDs in fileIds. The summary does
not include names, MIME types, sizes, expiry timestamps, input paths, inline
content, decoded content, or file bytes, and it can outlive the staged files.
export interface ExecutionAttachmentSummary {
readonly count: number;
readonly fileIds: readonly FileId[];
}| Property | Type | Required | Readonly | Description |
|---|---|---|---|---|
count | number | Yes | Yes | — |
fileIds | readonly | Yes | Yes | — |
ExecutionCancellation
export interface ExecutionCancellation {
readonly dispatchMayHaveBegun: boolean;
}| Property | Type | Required | Readonly | Description |
|---|---|---|---|---|
dispatchMayHaveBegun | boolean | Yes | Yes | — |
CancelledExecutionRecord
export type CancelledExecutionRecord = Extract<
ExecutionRecord,
{ status: "cancelled" }
>;ExecutionMode
export type ExecutionMode = "sync" | "async";ExecutionRecord
export type ExecutionRecord = ExecutionBase & {
userId: string;
createdAt: string;
startedAt?: string;
completedAt?: string;
/**
* Present as literal `true` after at least one accepted idempotent replay has
* been observed for this execution.
*
* A replay reuses this record's execution ID. Absence does not show whether
* the original request carried an idempotency key. No raw idempotency key,
* prefix, hash, scope, or other derivative is included.
*/
readonly replayed?: true;
/** Verified bounded origin metadata, when the execution has one. */
readonly source?: ExecutionSource;
/** Distinct staged-file IDs referenced by the validated execution input. */
readonly attachments?: ExecutionAttachmentSummary;
} & (
| {
status: "pending" | "running";
output?: never;
error?: never;
latencyMs?: never;
}
| {
status: "succeeded";
output: JsonValue;
error?: never;
latencyMs: number;
}
| {
status: "failed";
output?: never;
error: NormalizedToolError;
latencyMs: number;
}
| {
status: "cancelled";
output?: never;
error: ExecutionCancelledError;
latencyMs: number;
cancellation: ExecutionCancellation;
}
);ExecutionResult
The immediate result of POST /v1/execute in either execution mode.
export type ExecutionResult = SyncExecuteResponse | AsyncExecuteResponse;ExecutionSource
Verified public origin metadata for an execution.
A voice-session source is recorded only when the executor has verified the session identity and its cryptographic binding to the reserved child execution ID. Session grants, control tokens, and private worker headers are never included.
export type ExecutionSource = {
readonly kind: "voice_session";
readonly sessionId: string;
};ExecutionStatus
export type ExecutionStatus =
| "pending"
| "running"
| "succeeded"
| "failed"
| "cancelled";TerminalExecutionRecord
export type TerminalExecutionRecord =
| SucceededExecutionRecord
| FailedExecutionRecord
| CancelledExecutionRecord;