Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,12 @@ private static async Task Main()
{
Console.WriteLine($"{outputEvent}");
}

if (evt is WorkflowErrorEvent errorEvent)
{
Console.WriteLine($"Workflow error: {errorEvent.Exception?.Message}");
Console.WriteLine($"Details: {errorEvent.Exception}");
}
}
}
}
Expand Down Expand Up @@ -175,7 +181,9 @@ internal sealed class FeedbackEvent(FeedbackResult feedbackResult) : WorkflowEve
/// <summary>
/// A custom executor that uses an AI agent to provide feedback on a slogan.
/// </summary>
internal sealed class FeedbackExecutor : Executor<SloganResult>
[SendsMessage(typeof(FeedbackResult))]
[YieldsOutput(typeof(string))]
internal sealed partial class FeedbackExecutor : Executor<SloganResult>
{
private readonly AIAgent _agent;
private AgentSession? _session;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,7 @@ public static ImmutableArray<ClassProtocolInfo> AnalyzeClassProtocolAttribute(
bool isPartialClass = IsPartialClass(classSymbol, cancellationToken);
bool derivesFromExecutor = DerivesFromExecutor(classSymbol);
bool hasManualConfigureProtocol = HasConfigureProtocolDefined(classSymbol);
bool baseHasConfigureProtocol = BaseHasConfigureProtocol(classSymbol);

string? @namespace = classSymbol.ContainingNamespace?.IsGlobalNamespace == true
? null
Expand Down Expand Up @@ -241,6 +242,7 @@ public static ImmutableArray<ClassProtocolInfo> AnalyzeClassProtocolAttribute(
isPartialClass,
derivesFromExecutor,
hasManualConfigureProtocol,
baseHasConfigureProtocol,
classLocation,
Comment thread
peibekwe marked this conversation as resolved.
typeName,
attributeKind));
Expand Down Expand Up @@ -321,7 +323,7 @@ public static AnalysisResult CombineOutputOnlyResults(IEnumerable<ClassProtocolI
first.GenericParameters,
first.IsNested,
first.ContainingTypeChain,
BaseHasConfigureProtocol: false, // Not relevant for protocol-only
first.BaseHasConfigureProtocol,
Handlers: ImmutableEquatableArray<HandlerInfo>.Empty,
Comment thread
peibekwe marked this conversation as resolved.
ClassSendTypes: new ImmutableEquatableArray<string>(sendTypes.ToImmutable()),
ClassYieldTypes: new ImmutableEquatableArray<string>(yieldTypes.ToImmutable()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ namespace Microsoft.Agents.AI.Workflows.Generators.Models;
/// <param name="IsPartialClass">Whether the class is declared as partial.</param>
/// <param name="DerivesFromExecutor">Whether the class derives from Executor.</param>
/// <param name="HasManualConfigureRoutes">Whether the class has a manually defined ConfigureRoutes method.</param>
/// <param name="BaseHasConfigureProtocol">Whether a base class already overrides ConfigureProtocol.</param>
/// <param name="ClassLocation">Location info for diagnostics.</param>
Comment thread
peibekwe marked this conversation as resolved.
Outdated
/// <param name="TypeName">The fully qualified type name from the attribute.</param>
/// <param name="AttributeKind">Whether this is from a SendsMessage or YieldsOutput attribute.</param>
Expand All @@ -29,6 +30,7 @@ internal sealed record ClassProtocolInfo(
bool IsPartialClass,
bool DerivesFromExecutor,
bool HasManualConfigureRoutes,
bool BaseHasConfigureProtocol,
DiagnosticLocationInfo? ClassLocation,
string TypeName,
ProtocolAttributeKind AttributeKind)
Expand All @@ -38,5 +40,5 @@ internal sealed record ClassProtocolInfo(
/// </summary>
public static ClassProtocolInfo Empty { get; } = new(
string.Empty, null, string.Empty, null, false, string.Empty,
false, false, false, null, string.Empty, ProtocolAttributeKind.Send);
false, false, false, false, null, string.Empty, ProtocolAttributeKind.Send);
}
Loading