Files
agent-framework/dotnet/src/Microsoft.Agents.AI.Workflows/Checkpointing/EdgeInfo.cs
T
Ben ThomasandGitHub 647db9635a .NET: Rename workflows projects (#975)
* Renaming Microsoft.Agent.Workflows to Microsoft.Agents.AI.Workflows

* Removing local settings.

* Removing remining old files from merge.
2025-09-29 18:30:45 +00:00

44 lines
1.3 KiB
C#

// Copyright (c) Microsoft. All rights reserved.
using System.Text.Json.Serialization;
using Microsoft.Agents.AI.Workflows.Execution;
using Microsoft.Shared.Diagnostics;
namespace Microsoft.Agents.AI.Workflows.Checkpointing;
/// <summary>
/// Base class representing information about an edge in a workflow.
/// </summary>
[JsonPolymorphic(UnknownDerivedTypeHandling = JsonUnknownDerivedTypeHandling.FailSerialization)]
[JsonDerivedType(typeof(DirectEdgeInfo), (int)EdgeKind.Direct)]
[JsonDerivedType(typeof(FanOutEdgeInfo), (int)EdgeKind.FanOut)]
[JsonDerivedType(typeof(FanInEdgeInfo), (int)EdgeKind.FanIn)]
public class EdgeInfo
{
/// <summary>
/// The kind of edge.
/// </summary>
public EdgeKind Kind { get; }
/// <summary>
/// Gets the connection information associated with the edge.
/// </summary>
public EdgeConnection Connection { get; }
[JsonConstructor]
internal EdgeInfo(EdgeKind kind, EdgeConnection connection)
{
this.Kind = kind;
this.Connection = Throw.IfNull(connection);
}
internal bool IsMatch(Edge edge)
{
return this.Kind == edge.Kind
&& this.Connection.Equals(edge.Data.Connection)
&& this.IsMatchInternal(edge.Data);
}
internal virtual bool IsMatchInternal(EdgeData edgeData) => true;
}