// Copyright (c) Microsoft. All rights reserved. using System.Collections.Generic; using Microsoft.Extensions.AI.Agents; using Microsoft.Shared.Diagnostics; namespace Microsoft.Agents.Workflows; /// /// Represents an event triggered when an agent run produces an update. /// public class AgentRunUpdateEvent : ExecutorEvent { /// /// Initializes a new instance of the class. /// /// The identifier of the executor that generated this event. /// The agent run response update. public AgentRunUpdateEvent(string executorId, AgentRunResponseUpdate update) : base(executorId, data: update) { this.Update = Throw.IfNull(update); } /// /// Gets the agent run response update. /// public AgentRunResponseUpdate Update { get; } /// /// Converts this event to an containing just this update. /// /// public AgentRunResponse AsResponse() { IEnumerable updates = [this.Update]; return updates.ToAgentRunResponse(); } }