db620d33df
dotnet-build-and-test / dotnet-test-functions (push) Has been cancelled
dotnet-build-and-test / paths-filter (push) Has been cancelled
dotnet-build-and-test / dotnet-build (Debug, windows-latest, net9.0) (push) Has been cancelled
dotnet-build-and-test / dotnet-build (Release, ubuntu-latest, net10.0) (push) Has been cancelled
dotnet-build-and-test / dotnet-build (Release, ubuntu-latest, net8.0) (push) Has been cancelled
dotnet-build-and-test / dotnet-build (Release, windows-latest, net472) (push) Has been cancelled
dotnet-build-and-test / dotnet-test (Release, integration, true, ubuntu-latest, net10.0) (push) Has been cancelled
dotnet-build-and-test / dotnet-test (Release, integration, true, windows-latest, net472) (push) Has been cancelled
dotnet-build-and-test / dotnet-foundry-hosted-it (push) Has been cancelled
dotnet-build-and-test / dotnet-build-and-test-check (push) Has been cancelled
dotnet-build-and-test / Integration Test Report (push) Has been cancelled
CodeQL / Analyze (csharp) (push) Has been cancelled
CodeQL / Analyze (python) (push) Has been cancelled
33 lines
1.3 KiB
C#
33 lines
1.3 KiB
C#
// Copyright (c) Microsoft. All rights reserved.
|
|
|
|
using System.Collections.Generic;
|
|
using System.Text.Json.Serialization;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace Microsoft.Agents.AI;
|
|
|
|
/// <summary>
|
|
/// Holds non-serializable runtime references for in-flight background tasks within a single parent session.
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// Properties are marked with <see cref="JsonIgnoreAttribute"/> because <see cref="Task{TResult}"/>
|
|
/// and <see cref="AgentSession"/> are not JSON-serializable. After deserialization (e.g., after a restart),
|
|
/// a fresh empty instance is created and any previously-running tasks are marked as
|
|
/// <see cref="BackgroundTaskStatus.Lost"/> by <see cref="BackgroundAgentsProvider"/>.
|
|
/// </remarks>
|
|
internal sealed class BackgroundAgentRuntimeState
|
|
{
|
|
/// <summary>
|
|
/// Gets the mapping of task IDs to their in-flight <see cref="Task{AgentResponse}"/> instances.
|
|
/// </summary>
|
|
[JsonIgnore]
|
|
public Dictionary<int, Task<AgentResponse>> InFlightTasks { get; } = [];
|
|
|
|
/// <summary>
|
|
/// Gets the mapping of task IDs to their background agent <see cref="AgentSession"/> instances,
|
|
/// needed for <c>ContinueTask</c>.
|
|
/// </summary>
|
|
[JsonIgnore]
|
|
public Dictionary<int, AgentSession> BackgroundTaskSessions { get; } = [];
|
|
}
|