AgentRunResponse Class
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Represents the response to an AIAgent run request, containing messages and metadata about the interaction.
public class AgentRunResponse
type AgentRunResponse = class
Public Class AgentRunResponse
- Inheritance
-
AgentRunResponse
Remarks
AgentRunResponse provides one or more response messages and metadata about the response. A typical response will contain a single message, however a response may contain multiple messages in a variety of scenarios. For example, if the agent internally invokes functions or tools, performs RAG retrievals or has other complex logic, a single run by the agent may produce many messages showing the intermediate progress that the agent made towards producing the agent result.
To get the text result of the response, use the Text property or simply call ToString() on the AgentRunResponse.
Constructors
| AgentRunResponse() |
Initializes a new instance of the AgentRunResponse class. |
| AgentRunResponse(ChatMessage) |
Initializes a new instance of the AgentRunResponse class. |
| AgentRunResponse(ChatResponse) |
Initializes a new instance of the AgentRunResponse class from an existing ChatResponse. |
| AgentRunResponse(IList<ChatMessage>) |
Initializes a new instance of the AgentRunResponse class with the specified collection of messages. |
Properties
| AdditionalProperties |
Gets or sets additional properties associated with this response. |
| AgentId |
Gets or sets the identifier of the agent that generated this response. |
| CreatedAt |
Gets or sets the timestamp indicating when this response was created. |
| Messages |
Gets or sets the collection of messages to be represented by this response. |
| RawRepresentation |
Gets or sets the raw representation of the run response from an underlying implementation. |
| ResponseId |
Gets or sets the unique identifier for this specific response. |
| Text |
Gets the concatenated text content of all messages in this response. |
| Usage |
Gets or sets the resource usage information for generating this response. |
| UserInputRequests |
Gets all user input requests present in the response messages. |
Methods
| Deserialize<T>(JsonSerializerOptions) |
Deserializes the response text into the given type using the specified serializer options. |
| ToAgentRunResponseUpdates() |
Converts this AgentRunResponse into a collection of AgentRunResponseUpdate instances suitable for streaming scenarios. |
| ToString() | Returns a string that represents the current object. |
| TryDeserialize<T>(JsonSerializerOptions, T) |
Tries to deserialize response text into the given type using the specified serializer options. |
Extension Methods
| AsChatResponse(AgentRunResponse) |
Creates a ChatResponse from an AgentRunResponse instance. |
| AsOpenAIChatCompletion(AgentRunResponse) |
Creates or extracts a native OpenAI OpenAI.Chat.ChatCompletion object from an AgentRunResponse. |
| AsOpenAIResponse(AgentRunResponse) |
Creates or extracts a native OpenAI OpenAI.Responses.OpenAIResponse object from an AgentRunResponse. |