// Copyright (c) Microsoft. All rights reserved. using System.Collections.Generic; using Microsoft.Extensions.AI; namespace Microsoft.Agents.AI.Workflows; /// /// Optional interface implemented by request payload types that wrap underlying /// AI content (such as or /// ) and define a paired response envelope. /// /// /// /// This abstraction allows higher-level layers (e.g., declarative workflows) to define /// their own request/response envelope types while still allowing /// WorkflowSession to surface the inner content to hosts on the request side /// and to wrap incoming responses back into the envelope on the response side - /// without the runtime taking a reference back to the higher-level layer. /// /// /// When an ExternalRequest.Data payload implements this interface, the /// runtime uses to drive wire serialization /// for hosts (so a host receives a normal or /// ), and uses /// to wrap the host's response payload back into the envelope expected by the /// workflow's request port. /// /// public interface IExternalRequestEnvelope { /// /// Returns the inner AI content that should be delivered to the host on the wire. /// Typically a or . /// /// The inner content, or null if no suitable inner content is available. AIContent? GetInnerRequestContent(); /// /// Wraps the supplied response messages into the envelope's matching response type /// for delivery to the workflow's request port. /// /// The response messages, typically containing a /// and/or . /// An instance of the envelope's response type wrapping . object CreateResponse(IList messages); }