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

# RunLedger

> Keeps a connector's , its stories and its steps in one directory.

Keeps a connector's [RunRecord](https://klef.ai/docs/connector-sdk/reference/testing/runrecord.md), its stories and its steps in one directory.

```csharp
public sealed class RunLedger
```

## Constructors

```csharp
public RunLedger(string directory, ConnectorManifest manifest)
```

### Parameters

**directory** `string` *required*

**manifest** `ConnectorManifest` *required*

## Fields

**DirectoryVariable** `string` *required*

Where a run keeps what it saw.

**ScenarioVariable** `string` *required*

The one scenario a run asked for, for a connector that has scenarios.

**SeedVariable** `string` *required*

What replays a run's order.

**SunsetDays** `int` *required*

Days before a vendor API retires that a run warns.

## Properties

**Budget** `RunBudget` *required*

**Host** `string` *required*

Which host ran the scenarios, for the record. A run without scenarios has none.

**Seed** `int` *required*

## Methods

### Add()

```csharp
public void Add(string scenario, ScenarioResult result, string? why = null)
```

Keeps how a scenario that took no steps ended, and why.

#### Parameters

**scenario** `string` *required*

**result** `ScenarioResult` *required*

**why** `string`

```csharp
public void Add<TStep>(string scenario, ScenarioResult result, string? why, IReadOnlyList<TStep> steps, Func<TStep, string> story)
```

Keeps how a scenario ended, why, and its steps: each as a line of its story and as JSON.

#### Type Parameters

**TStep** *required*

#### Parameters

**scenario** `string` *required*

**result** `ScenarioResult` *required*

**why** `string` *required*

**steps** `IReadOnlyList\<TStep\>` *required*

**story** `Func\<TStep, string\>` *required*

### AddJourney()

```csharp
public void AddJourney(IReadOnlyList<JourneyStep> steps)
```

#### Parameters

**steps** `IReadOnlyList\<JourneyStep\>` *required*

**Type:** `IReadOnlyList<JourneyStep>`

### Read()

```csharp
public static RunRecord? Read(string directory, string id)
```

The record of the last run in `directory`, or none.

#### Parameters

**directory** `string` *required*

**id** `string` *required*

#### Returns

`RunRecord`

### Shared()

```csharp
public static RunLedger Shared(ConnectorManifest manifest)
```

The run in this process, for `manifest`.

#### Parameters

**manifest** `ConnectorManifest` *required*

#### Returns

`RunLedger`

### Signal()

```csharp
public void Signal(string warning)
```

Notes a warning, which reports apart from every step.

#### Parameters

**warning** `string` *required*

### TenantProblemAsync()

```csharp
public Task<string?> TenantProblemAsync(Func<Task<IReadOnlyList<string>>> check)
```

The tenant check's finding, which one run makes once.

#### Parameters

**check** `Func\<Task\<IReadOnlyList\<string\>\>\>` *required*

Finds what stops a run here.

#### Returns

`Task<string>`

### WarnOfSunset()

```csharp
public void WarnOfSunset(DateOnly? sunset)
```

Warns when the vendor API retires within [SunsetDays](https://klef.ai/docs/connector-sdk/reference/testing/runledger.md) of the run's start.

#### Parameters

**sunset** `DateOnly?` *required*


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