> ## Documentation Index
> Fetch the complete documentation index at: https://docs.agentium.in/llms.txt
> Use this file to discover all available pages before exploring further.

# Events and results

> Versioned events, terminal results, replay cursors, and bounded event retention.

Versioned events, terminal results, replay cursors, and bounded event retention. Read the [events and results guide](/harness/events) for examples, defaults, and behavior.

These declarations cover every public export in this category. Import from `@agentium/harness`. Types such as `ChatMessage`, `RunContext`, and `ExecutionServices` come from [`@agentium/core`](/api-reference/core). A `?` marks an optional field.

## HarnessEvent

```typescript theme={null}
export interface HarnessEvent {
    schemaVersion: 1;
    eventId: string;
    sequence: number;
    timestamp: number;
    sessionId: string;
    runId: string;
    attemptId: string;
    parentRunId?: string;
    rootRunId: string;
    payload: HarnessEventPayload;
}
```

## HarnessEventPayload

```typescript theme={null}
export type HarnessEventPayload = {
    type: "run.started";
    driverId: string;
} | {
    type: "text.delta";
    text: string;
} | {
    type: "model.complete";
    providerId: string;
    modelId: string;
    usage: TokenUsage;
} | {
    type: "tool.complete";
    toolName: string;
    toolCallId: string;
    denied: boolean;
} | {
    type: "control";
    operation: "cancel" | "follow_up" | "steer" | "replace";
    reason?: string;
} | {
    type: "completion";
    action: string;
    reason: string;
} | {
    type: "run.terminal";
    result: HarnessResult;
};
```

## HarnessReason

```typescript theme={null}
export interface HarnessReason {
    code: string;
    message: string;
}
```

## HarnessResult

```typescript theme={null}
export interface HarnessResult {
    status: HarnessStatus;
    text: string;
    structured?: unknown;
    artifacts?: readonly {
        id: string;
        mimeType?: string;
    }[];
    reason?: HarnessReason;
    usage: TokenUsage;
    runId: string;
    sessionId: string;
    finalCursor: number;
    cleanupDiagnostics?: readonly string[];
}
```

## HarnessStatus

```typescript theme={null}
export type HarnessStatus = "completed" | "failed" | "cancelled" | "stopped" | "awaiting_input";
```

## HarnessEventGapError

```typescript theme={null}
export declare class HarnessEventGapError extends Error {
    readonly earliestCursor: number;
    readonly code = "event_gap";
    constructor(earliestCursor: number);
}
```

## InMemoryHarnessEventStore

```typescript theme={null}
/** Bounded in-process history; no durability, network delivery, or audio backpressure promise. */
export declare class InMemoryHarnessEventStore {
    readonly capacity: number;
    readonly durable = false;
    constructor(identity: Omit<HarnessEvent, "schemaVersion" | "eventId" | "sequence" | "timestamp" | "payload">, capacity?: number);
    get cursor(): number;
    append(payload: HarnessEventPayload): HarnessEvent;
    events(options?: {
        after?: number;
    }): AsyncGenerator<HarnessEvent>;
}
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.