# RunRecord

> Tracon documentation. Tracon is a .NET package family that adds a control
> plane on Microsoft Agent Framework, published as NuGet packages that run
> inside your own ASP.NET Core application.
>
> Page: https://tracon.dev/api/tracon.runrecord/
> Summary: RunRecord: Summary of a run. It acts as the header of the event stream.

<div class="api-provenance">Namespace Tracon · Assembly <code>Tracon.Abstractions.dll</code></div>

Summary of a run. It acts as the header of the event stream.

```csharp
public sealed record RunRecord : IEquatable<RunRecord>
```

<dl class="api-relations"><dt>Inheritance</dt><dd><a href="https://learn.microsoft.com/dotnet/api/system.object">object</a> ← <a href="/api/tracon.runrecord/">RunRecord</a></dd><dt>Implements</dt><dd><a href="https://learn.microsoft.com/dotnet/api/system.iequatable-1">IEquatable&lt;RunRecord&gt;</a></dd><dt>Inherited Members</dt><dd><a href="https://learn.microsoft.com/dotnet/api/system.object.gettype">object.GetType()</a>, <a href="https://learn.microsoft.com/dotnet/api/system.object.tostring">object.ToString()</a>, <a href="https://learn.microsoft.com/dotnet/api/system.object.equals#system-object-equals(system-object)">object.Equals(object?)</a>, <a href="https://learn.microsoft.com/dotnet/api/system.object.equals#system-object-equals(system-object-system-object)">object.Equals(object?, object?)</a>, <a href="https://learn.microsoft.com/dotnet/api/system.object.referenceequals">object.ReferenceEquals(object?, object?)</a>, <a href="https://learn.microsoft.com/dotnet/api/system.object.gethashcode">object.GetHashCode()</a></dd></dl>

## Constructors

### <a id="Tracon_RunRecord__ctor"></a> RunRecord\(\)

```csharp
public RunRecord()
```

## Properties

### <a id="Tracon_RunRecord_AgentName"></a> AgentName

Gets the name of the agent that ran. For workflow runs this is the workflow
name: the existing lists, statistics and user interface read this column, and
leaving it empty would show workflow rows without a name.

```csharp
public required string AgentName { get; init; }
```

#### Property Value

 [string](https://learn.microsoft.com/dotnet/api/system.string)

### <a id="Tracon_RunRecord_AgentVersion"></a> AgentVersion

Gets the definition version this run measured, or [null](https://learn.microsoft.com/dotnet/csharp/language-reference/keywords/null) when unknown.

```csharp
public int? AgentVersion { get; init; }
```

#### Property Value

 [int](https://learn.microsoft.com/dotnet/api/system.int32)?

### <a id="Tracon_RunRecord_ChildRunCount"></a> ChildRunCount

Gets the number of *direct* child runs.

```csharp
public int ChildRunCount { get; init; }
```

#### Property Value

 [int](https://learn.microsoft.com/dotnet/api/system.int32)

### <a id="Tracon_RunRecord_CompletedAt"></a> CompletedAt

Gets the completion time (UTC), or [null](https://learn.microsoft.com/dotnet/csharp/language-reference/keywords/null) while the run is in flight.

```csharp
public DateTimeOffset? CompletedAt { get; init; }
```

#### Property Value

 [DateTimeOffset](https://learn.microsoft.com/dotnet/api/system.datetimeoffset)?

### <a id="Tracon_RunRecord_ContinuedFromRunId"></a> ContinuedFromRunId

Gets the id of the run this one continues after an interruption, or
[null](https://learn.microsoft.com/dotnet/csharp/language-reference/keywords/null) for a run that is not a continuation.

```csharp
public Guid? ContinuedFromRunId { get; init; }
```

#### Property Value

 [Guid](https://learn.microsoft.com/dotnet/api/system.guid)?

#### Remarks

A continuation is a new root run in the SAME session; it is not a child of
the interrupted run ([RunRecord.Depth](/api/tracon.runrecord/#Tracon_RunRecord_Depth) does not increase for it).
Orphaned-run reconciliation opens one for an agent run, and a queued
workflow's job opens one when it resumes an interrupted workflow run.
A workflow run that an operator resumes records the run it resumes the same way.
A workflow run that answers a person's request does not: it names the run that
waited in its own history.

The link points back. To walk a chain forward, query
[RunQuery.ContinuedFromRunId](/api/tracon.runquery/#Tracon_RunQuery_ContinuedFromRunId)
(`GET /api/runs?continuedFromRunId=`).

### <a id="Tracon_RunRecord_Cost"></a> Cost

Gets the run's own cost. [null](https://learn.microsoft.com/dotnet/csharp/language-reference/keywords/null) when the model is unknown;
when the model is known the value is populated even if the price is not.

```csharp
public RunCost? Cost { get; init; }
```

#### Property Value

 [RunCost](/api/tracon.runcost/)?

### <a id="Tracon_RunRecord_Depth"></a> Depth

Gets the depth in the tree. The root run is 0.

```csharp
public int Depth { get; init; }
```

#### Property Value

 [int](https://learn.microsoft.com/dotnet/api/system.int32)

### <a id="Tracon_RunRecord_Error"></a> Error

Gets the error information. Populated only for [RunStatus.Failed](/api/tracon.runstatus/).

```csharp
public RunError? Error { get; init; }
```

#### Property Value

 [RunError](/api/tracon.runerror/)?

### <a id="Tracon_RunRecord_EventCount"></a> EventCount

Gets the number of events written for this run.

```csharp
public long EventCount { get; init; }
```

#### Property Value

 [long](https://learn.microsoft.com/dotnet/api/system.int64)

### <a id="Tracon_RunRecord_ExperimentId"></a> ExperimentId

Gets the experiment this run belongs to, or [null](https://learn.microsoft.com/dotnet/csharp/language-reference/keywords/null) outside an experiment.

```csharp
public Guid? ExperimentId { get; init; }
```

#### Property Value

 [Guid](https://learn.microsoft.com/dotnet/api/system.guid)?

### <a id="Tracon_RunRecord_Id"></a> Id

Gets the run id. A time-ordered UUID (v7).

```csharp
public required Guid Id { get; init; }
```

#### Property Value

 [Guid](https://learn.microsoft.com/dotnet/api/system.guid)

### <a id="Tracon_RunRecord_IsStreaming"></a> IsStreaming

Gets whether the run streamed.

```csharp
public bool IsStreaming { get; init; }
```

#### Property Value

 [bool](https://learn.microsoft.com/dotnet/api/system.boolean)

### <a id="Tracon_RunRecord_Kind"></a> Kind

Gets whether this row records an agent or a workflow.

```csharp
public RunKind Kind { get; init; }
```

#### Property Value

 [RunKind](/api/tracon.runkind/)

### <a id="Tracon_RunRecord_Labels"></a> Labels

Gets the labels the run carries, or [null](https://learn.microsoft.com/dotnet/csharp/language-reference/keywords/null) when it
carries none.

```csharp
public IReadOnlyDictionary<string, string>? Labels { get; init; }
```

#### Property Value

 [IReadOnlyDictionary](https://learn.microsoft.com/dotnet/api/system.collections.generic.ireadonlydictionary\-2)<[string](https://learn.microsoft.com/dotnet/api/system.string), [string](https://learn.microsoft.com/dotnet/api/system.string)\>?

#### Remarks

A query dimension only. Labels never become metric tags — see
[IRunAttributionContext.Labels](/api/tracon.irunattributioncontext/#Tracon_IRunAttributionContext_Labels).

### <a id="Tracon_RunRecord_ModelId"></a> ModelId

Gets the model used by the run. Cost and per-model reports need it. It is
[null](https://learn.microsoft.com/dotnet/csharp/language-reference/keywords/null) when the agent definition carries no model.

```csharp
public string? ModelId { get; init; }
```

#### Property Value

 [string](https://learn.microsoft.com/dotnet/api/system.string)?

### <a id="Tracon_RunRecord_ModelProvider"></a> ModelProvider

Gets the provider of `ModelId`, or [null](https://learn.microsoft.com/dotnet/csharp/language-reference/keywords/null) for
a row written before this column existed. Rows written before are not
backfilled — see `POST /api/stats/recalculate-costs`.

```csharp
public string? ModelProvider { get; init; }
```

#### Property Value

 [string](https://learn.microsoft.com/dotnet/api/system.string)?

### <a id="Tracon_RunRecord_NonTokenCost"></a> NonTokenCost

Gets what this run itself reported as spent that is not tokens — the amounts its
workflow function nodes and tools reported. [null](https://learn.microsoft.com/dotnet/csharp/language-reference/keywords/null) when it
reported nothing.

```csharp
public RunNonTokenCost? NonTokenCost { get; init; }
```

#### Property Value

 [RunNonTokenCost](/api/tracon.runnontokencost/)?

#### Remarks

A snapshot written when the run closes. It is a total of its own and not a term
of [RunCost.Total](/api/tracon.runcost/#Tracon_RunCost_Total); [RunSpend](/api/tracon.runspend/) adds the two.

Rows written before the column existed hold [null](https://learn.microsoft.com/dotnet/csharp/language-reference/keywords/null); they are not
backfilled (nobody reported a number for them).

### <a id="Tracon_RunRecord_ParentRunId"></a> ParentRunId

Gets the id of the run that started this one, or [null](https://learn.microsoft.com/dotnet/csharp/language-reference/keywords/null) for a
root run.

```csharp
public Guid? ParentRunId { get; init; }
```

#### Property Value

 [Guid](https://learn.microsoft.com/dotnet/api/system.guid)?

### <a id="Tracon_RunRecord_ReplayOfRunId"></a> ReplayOfRunId

Gets the source run id when this run is a replay, otherwise
[null](https://learn.microsoft.com/dotnet/csharp/language-reference/keywords/null).

```csharp
public Guid? ReplayOfRunId { get; init; }
```

#### Property Value

 [Guid](https://learn.microsoft.com/dotnet/api/system.guid)?

#### Remarks

The lineage is one-way: the source run is **immutable** and does
not know which runs replay it. Every replay of a source is found through this
column.

### <a id="Tracon_RunRecord_RootRunId"></a> RootRunId

Gets the id of the run at the root of the tree. [null](https://learn.microsoft.com/dotnet/csharp/language-reference/keywords/null) for a
root run and always populated for a child run.

```csharp
public Guid? RootRunId { get; init; }
```

#### Property Value

 [Guid](https://learn.microsoft.com/dotnet/api/system.guid)?

#### Remarks

Denormalized on purpose: a whole tree is fetched with a single indexed query
on this column, with no recursive CTE over [RunRecord.ParentRunId](/api/tracon.runrecord/#Tracon_RunRecord_ParentRunId).

### <a id="Tracon_RunRecord_SessionId"></a> SessionId

Gets the id of the session that was used.

```csharp
public string? SessionId { get; init; }
```

#### Property Value

 [string](https://learn.microsoft.com/dotnet/api/system.string)?

### <a id="Tracon_RunRecord_StartedAt"></a> StartedAt

Gets the start time (UTC).

```csharp
public required DateTimeOffset StartedAt { get; init; }
```

#### Property Value

 [DateTimeOffset](https://learn.microsoft.com/dotnet/api/system.datetimeoffset)

### <a id="Tracon_RunRecord_Status"></a> Status

Gets the current status of the run.

```csharp
public required RunStatus Status { get; init; }
```

#### Property Value

 [RunStatus](/api/tracon.runstatus/)

### <a id="Tracon_RunRecord_TenantId"></a> TenantId

Gets the tenant the run belongs to.

```csharp
public string? TenantId { get; init; }
```

#### Property Value

 [string](https://learn.microsoft.com/dotnet/api/system.string)?

### <a id="Tracon_RunRecord_TreeCost"></a> TreeCost

Gets the total cost of this run and every run below it.

```csharp
public RunTreeCost? TreeCost { get; init; }
```

#### Property Value

 [RunTreeCost](/api/tracon.runtreecost/)?

#### Remarks

This **must not be added** to [RunRecord.Cost](/api/tracon.runrecord/#Tracon_RunRecord_Cost): the value
already includes the run's own cost, for the same reason as
[RunRecord.TreeUsage](/api/tracon.runrecord/#Tracon_RunRecord_TreeUsage). For a run without children the two are equivalent.

### <a id="Tracon_RunRecord_TreeNonTokenCost"></a> TreeNonTokenCost

Gets the reported non-token cost of this run and every run below it.

```csharp
public RunNonTokenCost? TreeNonTokenCost { get; init; }
```

#### Property Value

 [RunNonTokenCost](/api/tracon.runnontokencost/)?

#### Remarks

This **must not be added** to [RunRecord.NonTokenCost](/api/tracon.runrecord/#Tracon_RunRecord_NonTokenCost): the value
already includes the run's own share, for the same reason as
[RunRecord.TreeCost](/api/tracon.runrecord/#Tracon_RunRecord_TreeCost).

### <a id="Tracon_RunRecord_TreeUsage"></a> TreeUsage

Gets the total token usage of this run and every run below it.

```csharp
public RunUsage? TreeUsage { get; init; }
```

#### Property Value

 [RunUsage](/api/tracon.runusage/)?

#### Remarks

This **must not be added** to [RunRecord.Usage](/api/tracon.runrecord/#Tracon_RunRecord_Usage): the value
already includes [RunRecord.Usage](/api/tracon.runrecord/#Tracon_RunRecord_Usage). For a run without children the two are
equal. The user interface shows them in separate columns, because "what did
this run spend" and "what did this request spend in total" are different
questions.

### <a id="Tracon_RunRecord_Usage"></a> Usage

Gets the token usage, or [null](https://learn.microsoft.com/dotnet/csharp/language-reference/keywords/null) when the provider reported none.

```csharp
public RunUsage? Usage { get; init; }
```

#### Property Value

 [RunUsage](/api/tracon.runusage/)?

### <a id="Tracon_RunRecord_UserId"></a> UserId

Gets the user the run belongs to, or [null](https://learn.microsoft.com/dotnet/csharp/language-reference/keywords/null) when it was
not known.

```csharp
public string? UserId { get; init; }
```

#### Property Value

 [string](https://learn.microsoft.com/dotnet/api/system.string)?

#### Remarks

The value is opaque and comes from
[IRunAttributionContext](/api/tracon.irunattributioncontext/), never from the request body. Rows
written before the column existed hold [null](https://learn.microsoft.com/dotnet/csharp/language-reference/keywords/null); they are
not backfilled.

### <a id="Tracon_RunRecord_Variant"></a> Variant

Gets the experiment variant this run was assigned to, or [null](https://learn.microsoft.com/dotnet/csharp/language-reference/keywords/null) outside an experiment.

```csharp
public string? Variant { get; init; }
```

#### Property Value

 [string](https://learn.microsoft.com/dotnet/api/system.string)?

### <a id="Tracon_RunRecord_WorkflowName"></a> WorkflowName

Gets the name of the workflow. Populated only on
[RunKind.Workflow](/api/tracon.runkind/) rows.

```csharp
public string? WorkflowName { get; init; }
```

#### Property Value

 [string](https://learn.microsoft.com/dotnet/api/system.string)?

## Methods

### <a id="Tracon_RunRecord_Equals_System_Object_"></a> Equals\(object?\)

```csharp
public override bool Equals(object? obj)
```

#### Parameters

`obj` [object](https://learn.microsoft.com/dotnet/api/system.object)?

#### Returns

 [bool](https://learn.microsoft.com/dotnet/api/system.boolean)

### <a id="Tracon_RunRecord_Equals_Tracon_RunRecord_"></a> Equals\(RunRecord?\)

```csharp
public bool Equals(RunRecord? other)
```

#### Parameters

`other` [RunRecord](/api/tracon.runrecord/)?

#### Returns

 [bool](https://learn.microsoft.com/dotnet/api/system.boolean)

### <a id="Tracon_RunRecord_GetHashCode"></a> GetHashCode\(\)

```csharp
public override int GetHashCode()
```

#### Returns

 [int](https://learn.microsoft.com/dotnet/api/system.int32)

### <a id="Tracon_RunRecord_ToString"></a> ToString\(\)

```csharp
public override string ToString()
```

#### Returns

 [string](https://learn.microsoft.com/dotnet/api/system.string)

## Operators

### <a id="Tracon_RunRecord_op_Equality_Tracon_RunRecord_Tracon_RunRecord_"></a> operator ==\(RunRecord?, RunRecord?\)

```csharp
public static bool operator ==(RunRecord? left, RunRecord? right)
```

#### Parameters

`left` [RunRecord](/api/tracon.runrecord/)?

`right` [RunRecord](/api/tracon.runrecord/)?

#### Returns

 [bool](https://learn.microsoft.com/dotnet/api/system.boolean)

### <a id="Tracon_RunRecord_op_Inequality_Tracon_RunRecord_Tracon_RunRecord_"></a> operator \!=\(RunRecord?, RunRecord?\)

```csharp
public static bool operator !=(RunRecord? left, RunRecord? right)
```

#### Parameters

`left` [RunRecord](/api/tracon.runrecord/)?

`right` [RunRecord](/api/tracon.runrecord/)?

#### Returns

 [bool](https://learn.microsoft.com/dotnet/api/system.boolean)
