Files
agent-framework/dotnet/src/Microsoft.Agents.AI.Workflows/DirectEdgeData.cs
T
Jose Luis Latorre Millas eb1117fff4 .NET: adds support for labels in edges, fixes rendering of labels in dot a… (#1507)
* adds support for labels in edges,  fixes rendering of labels in dot and mermaid, adds rendering of labels in edges

* Update dotnet/src/Microsoft.Agents.AI.Workflows/Visualization/WorkflowVisualizer.cs

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* escaping edge labels, adding tests for labels containing strange characters that would break the diagram and enabling the previous signature so the API has backwards compatibility.

* Unify label in EdgeData

* Edge API adjustments, removed useless "sanitizer"

* fixed test

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Jacob Alber <jaalber@microsoft.com>
Co-authored-by: Chris <66376200+crickman@users.noreply.github.com>
2025-12-12 00:31:45 +00:00

41 lines
1.3 KiB
C#

// Copyright (c) Microsoft. All rights reserved.
using Microsoft.Agents.AI.Workflows.Execution;
using PredicateT = System.Func<object?, bool>;
namespace Microsoft.Agents.AI.Workflows;
/// <summary>
/// Represents a directed edge between two nodes, optionally associated with a condition that determines whether the
/// edge is active.
/// </summary>
public sealed class DirectEdgeData : EdgeData
{
internal DirectEdgeData(string sourceId, string sinkId, EdgeId id, PredicateT? condition = null, string? label = null) : base(id, label)
{
this.SourceId = sourceId;
this.SinkId = sinkId;
this.Condition = condition;
this.Connection = new([sourceId], [sinkId]);
}
/// <summary>
/// The Id of the source <see cref="Executor"/> node.
/// </summary>
public string SourceId { get; }
/// <summary>
/// The Id of the destination <see cref="Executor"/> node.
/// </summary>
public string SinkId { get; }
/// <summary>
/// An optional predicate determining whether the edge is active for a given message. If <see langword="null"/>,
/// the edge is always active when a message is generated by the source.
/// </summary>
public PredicateT? Condition { get; }
/// <inheritdoc />
internal override EdgeConnection Connection { get; }
}