> ## 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: RunResult

> Generated from the public TypeScript API.

Terminal Agent result. Execution-limit and abort subtypes resolve normally;
inspect `isError` rather than relying on rejection.

## Example

```ts theme={null}
const result = await agent.run("Summarize the repository.")
if (result.isError) console.error(result.subtype)
else console.log(result.text)
```

## Extends

* [`ResultMessage`](ResultMessage)

## Properties

### durationMs

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

#### Inherited from

[`ResultMessage`](ResultMessage).[`durationMs`](ResultMessage#durationms)

***

### error?

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

#### cause?

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

#### message

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

#### Inherited from

[`ResultMessage`](ResultMessage).[`error`](ResultMessage#error)

***

### isError

```ts theme={null}
isError: boolean;
```

Exactly `subtype !== "success"`.

***

### messageId?

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

#### Inherited from

[`ResultMessage`](ResultMessage).[`messageId`](ResultMessage#messageid)

***

### modelUsage?

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

#### Inherited from

[`ResultMessage`](ResultMessage).[`modelUsage`](ResultMessage#modelusage)

***

### parentMessageId?

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

#### Inherited from

[`ResultMessage`](ResultMessage).[`parentMessageId`](ResultMessage#parentmessageid)

***

### sessionId

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

#### Inherited from

[`ResultMessage`](ResultMessage).[`sessionId`](ResultMessage#sessionid)

***

### stopReason?

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

#### Inherited from

[`ResultMessage`](ResultMessage).[`stopReason`](ResultMessage#stopreason)

***

### structuredOutput?

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

#### Inherited from

[`ResultMessage`](ResultMessage).[`structuredOutput`](ResultMessage#structuredoutput)

***

### subtype

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

#### Inherited from

[`ResultMessage`](ResultMessage).[`subtype`](ResultMessage#subtype)

***

### text

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

Final assistant text, or `""` when the terminal message had no text.

#### Overrides

[`ResultMessage`](ResultMessage).[`text`](ResultMessage#text)

***

### totalCostUsd?

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

#### Inherited from

[`ResultMessage`](ResultMessage).[`totalCostUsd`](ResultMessage#totalcostusd)

***

### turns

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

#### Inherited from

[`ResultMessage`](ResultMessage).[`turns`](ResultMessage#turns)

***

### usage?

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

#### Inherited from

[`ResultMessage`](ResultMessage).[`usage`](ResultMessage#usage)


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