// Copyright (c) Microsoft. All rights reserved. using System.Collections.Generic; using Microsoft.Shared.Diagnostics; namespace Microsoft.Agents.AI.Workflows; /// /// Represents an event triggered when an agent run produces an update. /// public sealed class AgentResponseUpdateEvent : WorkflowOutputEvent { /// /// Initializes a new instance of the class. /// /// The identifier of the executor that generated this event. /// The agent run response update. public AgentResponseUpdateEvent(string executorId, AgentResponseUpdate update) : base(update, executorId) { this.Update = Throw.IfNull(update); } /// /// Initializes a new instance of the class with the given output tag. /// /// The identifier of the executor that generated this event. /// The agent run response update. /// The output tag to associate with this event. public AgentResponseUpdateEvent(string executorId, AgentResponseUpdate update, OutputTag tag) : base(update, executorId, tag) { this.Update = Throw.IfNull(update); } /// /// Initializes a new instance of the class with the given output tags. /// /// The identifier of the executor that generated this event. /// The agent run response update. /// The output tags to associate with this event. May be or empty. public AgentResponseUpdateEvent(string executorId, AgentResponseUpdate update, IEnumerable? tags) : base(update, executorId, tags) { this.Update = Throw.IfNull(update); } /// /// Gets the agent run response update. /// public AgentResponseUpdate Update { get; } /// /// Converts this event to an containing just this update. /// /// public AgentResponse AsResponse() { IEnumerable updates = [this.Update]; return updates.ToAgentResponse(); } }