mirror of
https://github.com/microsoft/agent-framework.git
synced 2026-06-16 21:04:09 +08:00
6a3d22598f
* feat: Implement Polymorphic Routing * feat: Add support for Send/Yield annotations with basic Executor * Adds annotations to Declarative workflow executors * fix: Address PR Comments * Implicit filter in collection loops * Remove debug / usused / superfluous code * Fix ProtocolBuilder implicit output registrations * Fix logic error in ExecuteRouteGeneratorTests.ClassWithManualConfigureProtocol_DoesNotGenerate * fix: Solidify type checks and send/yield type registrations * fix: Suppress generation of TurnTokens out of AggregateTurnMessagesExecutor * Fixes an issue where ConcurrentEndExecutor is not expecting TurnTokens. * fix: Add ProtocolBuilder support for chained-delegation * Updates Declarative pacakge to rely on chained-delegation Send/Yield registration * Renames DeclarativeActionExectuor's new ExecuteAsync to ExecuteActionAsync to avoid colliding with Executor.ExecutoeAsync * fix: Address PR Comments * Fixes type mapping in FanInEdgeRunner * Fixes and expalins send/yield type registration in FunctionExecutor * fixup: build-break * fix: Add missing SendsMesage declaration to InvokeAzureAgentExecutor
50 lines
1.6 KiB
C#
50 lines
1.6 KiB
C#
// Copyright (c) Microsoft. All rights reserved.
|
|
|
|
using System;
|
|
using Microsoft.Shared.Diagnostics;
|
|
|
|
namespace Microsoft.Agents.AI.Workflows;
|
|
|
|
/// <summary>
|
|
/// Declares that an executor may yield messages of the specified type as workflow outputs.
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// <para>
|
|
/// Apply this attribute to an <see cref="Executor"/> class to declare the types of messages
|
|
/// it may yield via <see cref="IWorkflowContext.YieldOutputAsync"/>. This information is used
|
|
/// for protocol validation and documentation.
|
|
/// </para>
|
|
/// <para>
|
|
/// This attribute can be applied multiple times to declare multiple output types.
|
|
/// It is inherited by derived classes, allowing base executors to declare common output types.
|
|
/// </para>
|
|
/// </remarks>
|
|
/// <example>
|
|
/// <code>
|
|
/// [YieldsOutput(typeof(FinalResult))]
|
|
/// [YieldsOutput(typeof(StreamChunk))]
|
|
/// public partial class MyExecutor : Executor
|
|
/// {
|
|
/// // ...
|
|
/// }
|
|
/// </code>
|
|
/// </example>
|
|
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Method, AllowMultiple = true, Inherited = true)]
|
|
public sealed class YieldsOutputAttribute : Attribute
|
|
{
|
|
/// <summary>
|
|
/// Gets the type of message that the executor may yield.
|
|
/// </summary>
|
|
public Type Type { get; }
|
|
|
|
/// <summary>
|
|
/// Initializes a new instance of the <see cref="YieldsOutputAttribute"/> class.
|
|
/// </summary>
|
|
/// <param name="type">The type of message that the executor may yield.</param>
|
|
/// <exception cref="ArgumentNullException"><paramref name="type"/> is <see langword="null"/>.</exception>
|
|
public YieldsOutputAttribute(Type type)
|
|
{
|
|
this.Type = Throw.IfNull(type);
|
|
}
|
|
}
|