Files
agent-framework/dotnet/src/Microsoft.Agents.AI.Workflows/RequestPort.cs
Jacob Alber 32e7ff00b5 .NET: Add support for Subworkflows and many threading fixes (#1066)
* feat: Add support for Workflow-as-Executor

* Fixes routing of 'object' compile-typed variables to properly take in type information
* Fixes a concurrency issue in StepTracer

* fix: Make Subworkflow ExternalRequests work properly

* fix: Threading and Concurrency fixes; prep for OffThread Mode

* refactor: Remove dead code around OffStreamRunEventStream

Currently not used, and will be replaced with a rewrite when brought back, so having it in the change is not valuable.

* ci: Work around issues with dotnet-format not properly analyzing the source

* fix: Fix the logic of AsyncCoordinator and AsyncBarrier

* Prevent individual wait cancellations from canceling the entire barrier
* Propagate information about whether the wait was completed or cancelled, and whether any waiters were present when released

* fix: Remove superfluous acces to .Keys in InProcStepTracer

* refactor: Clean up AsyncCoordinator's use of AsyncBarrier
2025-10-03 17:26:30 +00:00

34 lines
1.7 KiB
C#

// Copyright (c) Microsoft. All rights reserved.
using System;
namespace Microsoft.Agents.AI.Workflows;
/// <summary>
/// An external request port for a <see cref="Workflow"/> with the specified request and response types.
/// </summary>
/// <param name="Id"></param>
/// <param name="Request"></param>
/// <param name="Response"></param>
public record RequestPort(string Id, Type Request, Type Response)
{
/// <summary>
/// Creates a new <see cref="RequestPort"/> instance configured for the specified request and response types.
/// </summary>
/// <typeparam name="TRequest">The type of the request messages that the input port will accept.</typeparam>
/// <typeparam name="TResponse">The type of the response messages that the input port will produce.</typeparam>
/// <param name="id">The unique identifier for the input port.</param>
/// <returns>An <see cref="RequestPort"/> instance associated with the specified <paramref name="id"/>, configured to handle
/// requests of type <typeparamref name="TRequest"/> and responses of type <typeparamref name="TResponse"/>.</returns>
public static RequestPort<TRequest, TResponse> Create<TRequest, TResponse>(string id) => new(id, typeof(TRequest), typeof(TResponse));
};
/// <summary>
/// An external request port for a <see cref="Workflow"/> with the specified request and response types.
/// </summary>
/// <param name="Id"></param>
/// <param name="Request"></param>
/// <param name="Response"></param>
/// <param name="AllowWrapped"></param>
public sealed record RequestPort<TRequest, TResponse>(string Id, Type Request, Type Response, bool AllowWrapped = false) : RequestPort(Id, Request, Response);