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

# MargoviaRun

> Methods available on a started run.

`MargoviaRun` is returned by `margovia.startRun(...)`.

## `complete`

```ts theme={null}
await run.complete({
  outcome: "reply_generated"
});
```

Marks the run as completed.

## `fail`

```ts theme={null}
await run.fail({
  error: "Provider timed out"
});
```

Marks the run as failed.

## `trackCost`

```ts theme={null}
await run.trackCost({
  provider: "openai",
  model: "gpt-5-mini",
  inputTokens: 1200,
  outputTokens: 300
});
```

Records a cost event under this run.

## `step`

```ts theme={null}
await run.step("openai_reply", () =>
  openai.chat.completions.create({
    model: "gpt-5-mini",
    messages
  })
);
```

Runs a function with run context so wrapped provider calls attach their cost events to this run.
