pub struct AgentResponse {
pub messages: Vec<Message>,
pub response_id: Option<String>,
pub conversation_id: Option<String>,
pub created_at: Option<String>,
pub usage_details: Option<UsageDetails>,
pub value: Option<Value>,
pub continuation_token: Option<ContinuationToken>,
pub additional_properties: HashMap<String, Value>,
}Expand description
A full response from an agent run.
Fields§
§messages: Vec<Message>§response_id: Option<String>§conversation_id: Option<String>Service-side conversation id, when the backing service manages the
conversation (e.g. Responses API previous_response_id, Azure AI
thread id). Agent persists it onto the AgentThread.
created_at: Option<String>§usage_details: Option<UsageDetails>§value: Option<Value>§continuation_token: Option<ContinuationToken>Opaque token to resume this run when it is a background/long-running
request that has not yet completed. None for ordinary complete runs.
additional_properties: HashMap<String, Value>Implementations§
Source§impl AgentResponse
impl AgentResponse
Sourcepub fn text(&self) -> String
pub fn text(&self) -> String
The concatenated text of all messages (no separator), matching Python.
Sourcepub fn user_input_requests(&self) -> Vec<&FunctionApprovalRequestContent>
pub fn user_input_requests(&self) -> Vec<&FunctionApprovalRequestContent>
All pending user-input (function-approval) requests across the messages.
Mirrors Python AgentResponse.user_input_requests; use this to detect
when a run paused awaiting human approval of a tool call.
Sourcepub fn parse_json<T>(&self) -> Result<T, Error>where
T: DeserializeOwned,
pub fn parse_json<T>(&self) -> Result<T, Error>where
T: DeserializeOwned,
Parse the run’s concatenated text into a structured value.
Mirrors Python’s response.value: the message text is treated as JSON
and deserialized into T.
Sourcepub fn from_chat_response(resp: ChatResponse) -> AgentResponse
pub fn from_chat_response(resp: ChatResponse) -> AgentResponse
Build from a chat response, mapping fields across.
Sourcepub fn from_updates(updates: Vec<AgentResponseUpdate>) -> AgentResponse
pub fn from_updates(updates: Vec<AgentResponseUpdate>) -> AgentResponse
Aggregate a stream of agent updates into a full response.
Sourcepub fn from_updates_with_format(
updates: Vec<AgentResponseUpdate>,
response_format: Option<&ResponseFormat>,
) -> AgentResponse
pub fn from_updates_with_format( updates: Vec<AgentResponseUpdate>, response_format: Option<&ResponseFormat>, ) -> AgentResponse
Aggregate a stream of agent updates into a full response, auto-populating
AgentResponse::value from the aggregated text when a structured
response_format was requested (mirrors Python’s
output_format_type argument to from_agent_run_response_updates).
Sourcepub fn from_agent_run_response_updates(
updates: Vec<AgentResponseUpdate>,
) -> AgentResponse
pub fn from_agent_run_response_updates( updates: Vec<AgentResponseUpdate>, ) -> AgentResponse
Alias for AgentResponse::from_updates, matching Python’s
AgentResponse.from_agent_run_response_updates.
Trait Implementations§
Source§impl Clone for AgentResponse
impl Clone for AgentResponse
Source§fn clone(&self) -> AgentResponse
fn clone(&self) -> AgentResponse
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more