mirror of
https://github.com/microsoft/agent-framework.git
synced 2026-06-16 21:04:09 +08:00
0086d38f58
* refactor: Normalize Run/RunStreaming with AIAgent * refactor: Clarify Session vs. Run -level concepts * Rename RunId to SessionId to better match Run/Session terminology in AIAgent * [BREAKING]: Will break existing checkpointed sessions in CosmosDb due to field rename * refactor: Rename and simplify interface around getting typed data out of ExternalRequest/Response * Also adds hints around using value types in PortableValue * refactor: Rename AddFanInEdge to AddFanInBarrierEdge This will prevent a breaking change later when we introduce a programmable FanIn edge, analogous to the FanOut edge's EdgeSelector. The goal, in the long run is to support a number of different FanIn scenarios, with naive FanIn (no barrier) by default, similar to FanOut. * refactor: AsAgent(this Workflow, ...) => AsAIAgent(...) * misc - part1: SwitchBuilder internal --------- Co-authored-by: Dmytro Struk <13853051+dmytrostruk@users.noreply.github.com>
56 lines
1.9 KiB
C#
56 lines
1.9 KiB
C#
// Copyright (c) Microsoft. All rights reserved.
|
|
|
|
using System;
|
|
using System.Text.Json.Serialization;
|
|
using Microsoft.Shared.Diagnostics;
|
|
|
|
namespace Microsoft.Agents.AI.Workflows;
|
|
|
|
/// <summary>
|
|
/// Represents a checkpoint with a unique identifier.
|
|
/// </summary>
|
|
public sealed class CheckpointInfo : IEquatable<CheckpointInfo>
|
|
{
|
|
/// <summary>
|
|
/// Gets the unique identifier for the current session.
|
|
/// </summary>
|
|
public string SessionId { get; }
|
|
|
|
/// <summary>
|
|
/// The unique identifier for the checkpoint.
|
|
/// </summary>
|
|
public string CheckpointId { get; }
|
|
|
|
/// <summary>
|
|
/// Initializes a new instance of the <see cref="CheckpointInfo"/> class with a unique identifier.
|
|
/// </summary>
|
|
internal CheckpointInfo(string sessionId) : this(sessionId, Guid.NewGuid().ToString("N")) { }
|
|
|
|
/// <summary>
|
|
/// Initializes a new instance of the CheckpointInfo class with the specified session and checkpoint identifiers.
|
|
/// </summary>
|
|
/// <param name="sessionId">The unique identifier for the session. Cannot be null or empty.</param>
|
|
/// <param name="checkpointId">The unique identifier for the checkpoint. Cannot be null or empty.</param>
|
|
[JsonConstructor]
|
|
public CheckpointInfo(string sessionId, string checkpointId)
|
|
{
|
|
this.SessionId = Throw.IfNullOrEmpty(sessionId);
|
|
this.CheckpointId = Throw.IfNullOrEmpty(checkpointId);
|
|
}
|
|
|
|
/// <inheritdoc/>
|
|
public bool Equals(CheckpointInfo? other) =>
|
|
other is not null &&
|
|
this.SessionId == other.SessionId &&
|
|
this.CheckpointId == other.CheckpointId;
|
|
|
|
/// <inheritdoc/>
|
|
public override bool Equals(object? obj) => this.Equals(obj as CheckpointInfo);
|
|
|
|
/// <inheritdoc/>
|
|
public override int GetHashCode() => HashCode.Combine(this.SessionId, this.CheckpointId);
|
|
|
|
/// <inheritdoc/>
|
|
public override string ToString() => $"CheckpointInfo(SessionId: {this.SessionId}, CheckpointId: {this.CheckpointId})";
|
|
}
|