# RunQuery

> 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.runquery/
> Summary: RunQuery: Query used to filter the run list.

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

Query used to filter the run list.

```csharp
public sealed record RunQuery : IEquatable<RunQuery>
```

<dl class="api-relations"><dt>Inheritance</dt><dd><a href="https://learn.microsoft.com/dotnet/api/system.object">object</a> ← <a href="/api/tracon.runquery/">RunQuery</a></dd><dt>Implements</dt><dd><a href="https://learn.microsoft.com/dotnet/api/system.iequatable-1">IEquatable&lt;RunQuery&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_RunQuery__ctor"></a> RunQuery\(\)

```csharp
public RunQuery()
```

## Properties

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

Gets the agent whose runs are returned.

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

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

Gets the run whose continuations are returned: the runs whose
[RunRecord.ContinuedFromRunId](/api/tracon.runrecord/#Tracon_RunRecord_ContinuedFromRunId) is this value.
[null](https://learn.microsoft.com/dotnet/csharp/language-reference/keywords/null) applies no filter.

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

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

A continuation points back at the run it continues, so this is how a
chain is walked forward: ask for the continuations of the first run, then
for those of the newest one returned, until none is left. Interrupted-run
continuation (agent runs), workflow recovery and an operator's resume of a
workflow run all write the link.

The filter is combined with the others. A continuation is a root run, so
the default [RunQuery.OnlyRootRuns](/api/tracon.runquery/#Tracon_RunQuery_OnlyRootRuns) keeps it in the list.

### <a id="Tracon_RunQuery_ErrorType"></a> ErrorType

Gets the error type ([RunError.Type](/api/tracon.runerror/#Tracon_RunError_Type)) whose runs are returned.
[null](https://learn.microsoft.com/dotnet/csharp/language-reference/keywords/null) includes every error type.

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

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

Gets the kind whose runs are returned. [null](https://learn.microsoft.com/dotnet/csharp/language-reference/keywords/null) includes
every kind.

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

 [RunKind](/api/tracon.runkind/)?

#### Remarks

Judge runs are [RunKind.Eval](/api/tracon.runkind/) and do not appear in
the default list (see [IRunStore.GetStatisticsAsync](/api/tracon.irunstore/#Tracon_IRunStore_GetStatisticsAsync_Tracon_RunStatisticsQuery_System_Threading_CancellationToken_)); to see
their cost, call `GET /api/runs?kind=Eval`.

### <a id="Tracon_RunQuery_LabelKey"></a> LabelKey

Gets the label a returned run must carry, or [null](https://learn.microsoft.com/dotnet/csharp/language-reference/keywords/null) to
apply no label filter.

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

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

The filter matches a key AND a value together: asking for
`team=payments` must not also return `team=billing`. Give
[RunQuery.LabelValue](/api/tracon.runquery/#Tracon_RunQuery_LabelValue) alongside it; a key on its own matches any
value of that key.

### <a id="Tracon_RunQuery_LabelValue"></a> LabelValue

Gets the value [RunQuery.LabelKey](/api/tracon.runquery/#Tracon_RunQuery_LabelKey) must have.
[null](https://learn.microsoft.com/dotnet/csharp/language-reference/keywords/null) matches any value of that key.

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

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

The field is ignored when [RunQuery.LabelKey](/api/tracon.runquery/#Tracon_RunQuery_LabelKey) is
[null](https://learn.microsoft.com/dotnet/csharp/language-reference/keywords/null): a value with no key names no dimension, and
silently returning an empty list is hard to debug.

### <a id="Tracon_RunQuery_OnlyRootRuns"></a> OnlyRootRuns

Gets whether only root runs are returned. Defaults to [true](https://learn.microsoft.com/dotnet/csharp/language-reference/builtin-types/bool).

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

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

The default is deliberately [true](https://learn.microsoft.com/dotnet/csharp/language-reference/builtin-types/bool): when an agent calls other
agents, every child call produces its own `runs` row and the list fills
with runs the user never started. Child runs appear as a tree inside their
own root's detail view; set this to [false](https://learn.microsoft.com/dotnet/csharp/language-reference/builtin-types/bool) for the full list.

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

Gets the run whose direct children are returned.

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

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

When a value is given, [RunQuery.OnlyRootRuns](/api/tracon.runquery/#Tracon_RunQuery_OnlyRootRuns) is ignored: asking for
child runs and filtering to roots contradict each other, and silently
returning an empty list is hard to debug.

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

Gets the tree whose runs are returned, including the root.

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

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

Gets the session whose runs are returned.

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

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

Gets the number of records to skip.

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

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

Gets the lower bound on start time (UTC).

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

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

Gets the status whose runs are returned.

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

 [RunStatus](/api/tracon.runstatus/)?

### <a id="Tracon_RunQuery_Take"></a> Take

Gets the maximum number of records to return.

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

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

Gets the tenant whose runs are returned.

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

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

Gets the user whose runs are returned. [null](https://learn.microsoft.com/dotnet/csharp/language-reference/keywords/null) includes
every user, including runs that carry no user at all.

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

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

### <a id="Tracon_RunQuery_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_RunQuery_Equals_Tracon_RunQuery_"></a> Equals\(RunQuery?\)

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

`other` [RunQuery](/api/tracon.runquery/)?

#### Returns

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

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

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

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

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

### <a id="Tracon_RunQuery_op_Equality_Tracon_RunQuery_Tracon_RunQuery_"></a> operator ==\(RunQuery?, RunQuery?\)

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

`left` [RunQuery](/api/tracon.runquery/)?

`right` [RunQuery](/api/tracon.runquery/)?

#### Returns

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

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

`left` [RunQuery](/api/tracon.runquery/)?

`right` [RunQuery](/api/tracon.runquery/)?

#### Returns

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