> ## Documentation Index
> Fetch the complete documentation index at: https://cognitio-agent.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Interface: ResultMessage

> Generated from the public TypeScript API.

Terminal event yielded at the end of every successful or failed run.

## Extended by

* [`RunResult`](RunResult)

## Properties

### durationMs

```ts theme={null}
durationMs: number;
```

***

### error?

```ts theme={null}
optional error?: object;
```

#### cause?

```ts theme={null}
optional cause?: unknown;
```

#### message

```ts theme={null}
message: string;
```

***

### messageId?

```ts theme={null}
optional messageId?: string;
```

***

### modelUsage?

```ts theme={null}
optional modelUsage?: Record<string, ModelUsageSummary>;
```

***

### parentMessageId?

```ts theme={null}
optional parentMessageId?: string;
```

***

### sessionId

```ts theme={null}
sessionId: string;
```

***

### stopReason?

```ts theme={null}
optional stopReason?: string;
```

***

### structuredOutput?

```ts theme={null}
optional structuredOutput?: unknown;
```

***

### subtype

```ts theme={null}
subtype:
  | "success"
  | "error_aborted"
  | "error_during_execution"
  | "error_max_turns"
  | "error_max_budget"
  | "error_max_structured_output_retries";
```

***

### text?

```ts theme={null}
optional text?: string;
```

Assistant text from every text part of the turn's final assistant
message, identified by `messageId`.

Identical to the `text` on the `assistant` stream message with the same
`messageId`, so this and the last streamed assistant text can never
disagree.

`undefined` when the turn produced no assistant text (a tool-only final
step, a result without a message id, or a hard failure before any matching
assistant message was observed). Use `text ?? ""` for a plain string —
which is exactly what `RunResult.text` does.

Unlike Claude Agent SDK's `result` (success variant only), this is also
populated on error subtypes: on `error_aborted` it is the partial answer
produced before the interrupt.

***

### totalCostUsd?

```ts theme={null}
optional totalCostUsd?: number;
```

***

### turns

```ts theme={null}
turns: number;
```

***

### usage?

```ts theme={null}
optional usage?: UsageSummary;
```


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