mirror of
https://github.com/microsoft/agent-framework.git
synced 2026-06-16 21:04:09 +08:00
.NET: Add missing workflow properties to the workflow.definition tag (#1261)
* add workflow edge data properties to the workflow.definition tag. * use workflow info classes for workflow.definition tag value * add unit test * fix test * fix formatting issue * remove flaky unit test * remove unused package dependency
This commit is contained in:
committed by
GitHub
Unverified
parent
988623e7b8
commit
15afc966ce
@@ -7,6 +7,7 @@ using System.Linq;
|
||||
using System.Text.Json;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.Agents.AI.Workflows.Checkpointing;
|
||||
using Microsoft.Agents.AI.Workflows.Observability;
|
||||
using Microsoft.Shared.Diagnostics;
|
||||
|
||||
@@ -414,23 +415,13 @@ public class WorkflowBuilder
|
||||
{
|
||||
activity?.SetTag(Tags.WorkflowDescription, workflow.Description);
|
||||
}
|
||||
if (activity is not null)
|
||||
{
|
||||
var workflowJsonDefinitionData = new WorkflowJsonDefinitionData
|
||||
{
|
||||
StartExecutorId = this._startExecutorId,
|
||||
Edges = this._edges.Values.SelectMany(e => e),
|
||||
Ports = this._inputPorts.Values,
|
||||
OutputExecutors = this._outputExecutors
|
||||
};
|
||||
activity.SetTag(
|
||||
activity?.SetTag(
|
||||
Tags.WorkflowDefinition,
|
||||
JsonSerializer.Serialize(
|
||||
workflowJsonDefinitionData,
|
||||
WorkflowJsonDefinitionJsonContext.Default.WorkflowJsonDefinitionData
|
||||
workflow.ToWorkflowInfo(),
|
||||
WorkflowsJsonUtilities.JsonContext.Default.WorkflowInfo
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
return workflow;
|
||||
}
|
||||
|
||||
@@ -1,20 +0,0 @@
|
||||
// Copyright (c) Microsoft. All rights reserved.
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace Microsoft.Agents.AI.Workflows;
|
||||
|
||||
[JsonSourceGenerationOptions(UseStringEnumConverter = true)]
|
||||
[JsonSerializable(typeof(WorkflowJsonDefinitionData))]
|
||||
internal partial class WorkflowJsonDefinitionJsonContext : JsonSerializerContext
|
||||
{
|
||||
}
|
||||
|
||||
internal class WorkflowJsonDefinitionData
|
||||
{
|
||||
public string StartExecutorId { get; set; } = string.Empty;
|
||||
public IEnumerable<Edge> Edges { get; set; } = [];
|
||||
public IEnumerable<RequestPort> Ports { get; set; } = [];
|
||||
public IEnumerable<string> OutputExecutors { get; set; } = [];
|
||||
}
|
||||
Reference in New Issue
Block a user