diff --git a/.rust-file-sizes.json b/.rust-file-sizes.json index ac99f168a..4d2015984 100644 --- a/.rust-file-sizes.json +++ b/.rust-file-sizes.json @@ -28,10 +28,6 @@ "crates/agentic-server/src/main.rs": { "limit": 644, "reason": "Server configuration resolves the web_fetch settings with the same file and environment precedence as the other tool settings." - }, - "crates/agentic-server-core/src/storage/models/item.rs": { - "limit": 510, - "reason": "The item CRUD now owns response-history row identity, as requested in review; consolidating the insert here adds the row/public-ID bookkeeping. Splitting the item storage module is a separate change." } }, "generated": {} diff --git a/ARCHITECTURE.md b/ARCHITECTURE.md index 6d572f72b..fe3ce7b63 100644 --- a/ARCHITECTURE.md +++ b/ARCHITECTURE.md @@ -596,6 +596,9 @@ access happen — those live in `tool/`, `executor/`, and `storage/` respectivel `InOutItem::into_input_items` uses the existing output-to-input conversion and client-tool lowering for model history. Storage row markers and legacy decoding remain in `storage/`; there is no separate conversation-item enum. + Item retrieval and listing return `InOutItem` directly. `into_public` assigns the + storage identity and expands shorthand messages on the returned item; + serialization uses the item types themselves, without an item-response wrapper. `ResponsesInput::input_items` uses `InOutItem::as_input` to borrow submitted input items and project outputs. The existing compaction-window selection accepts these borrowed items, so estimation avoids copying message and image payloads and model diff --git a/README.md b/README.md index 3c021bb17..fdb51bab6 100644 --- a/README.md +++ b/README.md @@ -68,6 +68,8 @@ flowchart LR | --- | --- | --- | | `POST /v1/responses` | OpenAI-compatible Responses API with state, tools, and streaming | ✅ | | `GET /v1/responses/{response_id}` | Retrieve a locally stored response | ✅ | +| `DELETE /v1/responses/{response_id}` | Delete a locally stored response | ✅ | +| `GET /v1/responses/{response_id}/input_items` | List the input items of a stored response | ✅ | | `GET /v1/responses` | WebSocket transport for the Responses API | ✅ | | `POST /v1/responses/compact` | Compact direct input or a stored response chain | ✅ | | `/v1/conversations` · `/v1/conversations/{id}/items` | Conversations API: create, retrieve, update, and delete conversations and their items | ✅ | diff --git a/crates/agentic-llm-d/tests/split_execution_integration.rs b/crates/agentic-llm-d/tests/split_execution_integration.rs index 3f2adaabf..05b8f4fe1 100644 --- a/crates/agentic-llm-d/tests/split_execution_integration.rs +++ b/crates/agentic-llm-d/tests/split_execution_integration.rs @@ -609,7 +609,7 @@ async fn a_turn_that_cannot_be_stored_is_refused() { let ctx = exec_ctx().await; let unknown = hydrate(request("hi", Some("resp_missing")), &ctx).await; - assert_eq!(status_of(&unknown.expect_err("unknown id")), 404); + assert_eq!(status_of(&unknown.expect_err("unknown id")), 400); // A caller-supplied body gets none of the in-process parser's defaults, // including the catch-all used for compatibility on trusted internal paths. @@ -746,7 +746,7 @@ async fn a_turn_that_is_not_written_still_returns() { [agentic_core::types::io::OutputItem::FunctionCall(call)] if call.call_id.is_empty() )); let orphan = hydrate(request("and then?", Some(&id)), &ctx).await; - assert_eq!(status_of(&orphan.expect_err("never stored")), 404); + assert_eq!(status_of(&orphan.expect_err("never stored")), 400); // A failed response remains returned-but-unstored even when its partial // item representations disagree; no unusable continuation can be created. @@ -762,7 +762,7 @@ async fn a_turn_that_is_not_written_still_returns() { .expect("failed partial output is not a persistence error"); assert_eq!(payload.status, "error"); let orphan = hydrate(request("and then?", Some(&failed_id)), &ctx).await; - assert_eq!(status_of(&orphan.expect_err("failed SSE was never stored")), 404); + assert_eq!(status_of(&orphan.expect_err("failed SSE was never stored")), 400); } /// Until an identical retry can be proven identical, a reused id is refused. diff --git a/crates/agentic-server-core/src/executor/compaction.rs b/crates/agentic-server-core/src/executor/compaction.rs index 1eb0b8f84..5f5bfb654 100644 --- a/crates/agentic-server-core/src/executor/compaction.rs +++ b/crates/agentic-server-core/src/executor/compaction.rs @@ -455,6 +455,8 @@ mod tests { fn function_image_output(encoded_bytes: usize) -> InputItem { InputItem::FunctionCallOutput(FunctionToolResultMessage { + id: None, + status: None, call_id: "call_view_image".to_owned(), output: ToolCallOutput::Content(vec![ToolOutputContent::InputImage(inline_image(encoded_bytes))]), }) @@ -462,6 +464,8 @@ mod tests { fn custom_image_output(encoded_bytes: usize) -> InputItem { InputItem::CustomToolCallOutput(CustomToolCallOutputMessage { + status: None, + id: None, call_id: "call_view_image".to_owned(), name: Some("view_image".to_owned()), output: ToolCallOutput::Content(vec![ToolOutputContent::InputImage(inline_image(encoded_bytes))]), @@ -585,6 +589,8 @@ mod tests { }), user_message("first"), InputItem::FunctionCallOutput(FunctionToolResultMessage { + id: None, + status: None, call_id: "call_1".to_owned(), output: "tool output".into(), }), @@ -700,6 +706,8 @@ mod tests { let input = ResponsesInput::from(vec![ user_message("hello context"), InputItem::FunctionCallOutput(FunctionToolResultMessage { + id: None, + status: None, call_id: "call_1".to_owned(), output: "substantial tool output".into(), }), diff --git a/crates/agentic-server-core/src/executor/engine/multi_agent/delivery.rs b/crates/agentic-server-core/src/executor/engine/multi_agent/delivery.rs index ff8fb9b1b..2f4a98ccb 100644 --- a/crates/agentic-server-core/src/executor/engine/multi_agent/delivery.rs +++ b/crates/agentic-server-core/src/executor/engine/multi_agent/delivery.rs @@ -10,6 +10,7 @@ use crate::executor::{ use crate::types::{ agent::{AgentCompletion, AgentIdentity, AgentTurnKey}, agent_commands::CollaborationResult, + event::MessageStatus, io::output::OutputTextContent, io::{ AgentMessage, AgentMessageContent, FunctionToolResultMessage, InputItem, MultiAgentAction, @@ -43,6 +44,8 @@ impl MultiAgentRun { .stored .history .push(InputItem::FunctionCallOutput(FunctionToolResultMessage { + id: Some(uuid7_str("fc_")), + status: Some(MessageStatus::Completed), call_id: call_id.clone(), output: ToolCallOutput::Text(text.clone()), })); diff --git a/crates/agentic-server-core/src/executor/engine/multi_agent_tests.rs b/crates/agentic-server-core/src/executor/engine/multi_agent_tests.rs index a5d57ccc9..299998622 100644 --- a/crates/agentic-server-core/src/executor/engine/multi_agent_tests.rs +++ b/crates/agentic-server-core/src/executor/engine/multi_agent_tests.rs @@ -483,6 +483,8 @@ async fn concurrent_children_pause_and_resume_from_durable_tree_json_and_sse() { .iter() .map(|call| { InputItem::FunctionCallOutput(FunctionToolResultMessage { + id: None, + status: None, call_id: call.call_id.clone(), output: ToolCallOutput::Text("proposal details".into()), }) diff --git a/crates/agentic-server-core/src/executor/engine/multi_agent_tests/live_control.rs b/crates/agentic-server-core/src/executor/engine/multi_agent_tests/live_control.rs index 82a7ed8c0..d612a448a 100644 --- a/crates/agentic-server-core/src/executor/engine/multi_agent_tests/live_control.rs +++ b/crates/agentic-server-core/src/executor/engine/multi_agent_tests/live_control.rs @@ -163,6 +163,8 @@ fn batch(response: &str, ids: &[&str]) -> ClientToolOutputBatch { .iter() .map(|id| { ClientToolOutput::Function(FunctionToolResultMessage { + id: None, + status: None, call_id: (*id).into(), output: ToolCallOutput::Text(format!("output for {id}")), }) diff --git a/crates/agentic-server-core/src/executor/error.rs b/crates/agentic-server-core/src/executor/error.rs index 5b91595de..dc00700a8 100644 --- a/crates/agentic-server-core/src/executor/error.rs +++ b/crates/agentic-server-core/src/executor/error.rs @@ -117,10 +117,13 @@ pub enum ExecutorError { /// The request's `max_tool_calls` is not an integer of at least one. #[error(transparent)] InvalidMaxToolCalls(#[from] MaxToolCallsError), - /// A recognized request value that cannot be used in this combination, reported with - /// `code: unsupported_value` and the offending request parameter. + /// A rejected request parameter value, with its public code and parameter name. #[error("{message}")] - UnsupportedValue { param: &'static str, message: &'static str }, + UnsupportedValue { + param: String, + code: Option<&'static str>, + message: String, + }, /// A recognized request member this gateway cannot honour (`background: true`, `prompt`). #[error(transparent)] UnsupportedParameter(#[from] UnsupportedParameterError), @@ -240,6 +243,9 @@ impl ExecutorError { | Self::JsonError(_) | Self::PayloadTooLarge(_) | Self::Storage(StorageError::ItemCursorNotFound { .. }) => "invalid_request_error", + Self::Storage(StorageError::NotFound { resource_type, .. }) if resource_type == "Response" => { + "invalid_request_error" + } Self::Storage(e) if e.is_not_found() => "not_found", Self::Storage(e) if e.is_validation() => "invalid_request_error", Self::Conflict(_) => "conflict_error", @@ -270,7 +276,7 @@ impl ExecutorError { Self::ResourceLimitExceeded { .. } => "response_resource_limit_exceeded", Self::InvalidPromptCacheOptions(PromptCacheOptionsError::Unsupported) => "unsupported_parameter", Self::InvalidMaxToolCalls(error) => error.code(), - Self::UnsupportedValue { .. } => "unsupported_value", + Self::UnsupportedValue { code, .. } => code.unwrap_or("unsupported_value"), Self::UnsupportedParameter(error) => error.code(), Self::Tool(ToolError::UnknownParameter { .. }) => "unknown_parameter", other => other.error_type(), @@ -282,7 +288,8 @@ impl ExecutorError { pub fn error_param(&self) -> Option<&str> { match self.client_visible_error() { Self::Storage(StorageError::InvalidItemId { param, .. }) - | Self::Tool(ToolError::UnknownParameter { param }) => Some(param), + | Self::Tool(ToolError::UnknownParameter { param }) + | Self::UnsupportedValue { param, .. } => Some(param), Self::Storage(StorageError::ItemAlreadyInConversation) => Some("items"), Self::Storage(StorageError::ItemCursorNotFound { .. }) => Some("after"), Self::ConversationLocked { .. } => Some("conversation"), @@ -290,7 +297,6 @@ impl ExecutorError { Self::Tool(ToolError::MissingOutput { .. } | ToolError::UnknownCallOutput { .. }) => Some("input"), Self::InvalidPromptCacheOptions(_) => Some("prompt_cache_options"), Self::InvalidMaxToolCalls(_) => Some(MAX_TOOL_CALLS_PARAM), - Self::UnsupportedValue { param, .. } => Some(param), Self::UnsupportedParameter(error) => Some(error.param()), _ => None, } @@ -317,11 +323,15 @@ impl ExecutorError { /// Builds the OpenAI-compatible error object shared by HTTP and SSE. pub(crate) fn response_error(&self) -> serde_json::Value { - let code = if matches!( - self.client_visible_error(), - Self::Tool(ToolError::MissingOutput { .. } | ToolError::UnknownCallOutput { .. }) - | Self::Storage(StorageError::ItemCursorNotFound { .. }) - ) { + let missing_response = matches!(self.client_visible_error(), + Self::Storage(StorageError::NotFound { resource_type, .. }) if resource_type == "Response"); + let code = if missing_response + || matches!( + self.client_visible_error(), + Self::Tool(ToolError::MissingOutput { .. } | ToolError::UnknownCallOutput { .. }) + | Self::Storage(StorageError::ItemCursorNotFound { .. }) + | Self::UnsupportedValue { code: None, .. } + ) { serde_json::Value::Null } else { serde_json::json!(self.error_code()) @@ -332,6 +342,8 @@ impl ExecutorError { error.insert("code".to_owned(), code); if let Some(param) = self.error_param() { error.insert("param".to_owned(), serde_json::json!(param)); + } else if missing_response { + error.insert("param".to_owned(), serde_json::Value::Null); } serde_json::Value::Object(error) } @@ -565,8 +577,9 @@ mod tests { #[test] fn unsupported_value_matches_openai_error_envelope() { let error = ExecutorError::UnsupportedValue { - param: "multi_agent", - message: "Async parallel tool calls are not yet supported in multi-agent mode.", + param: "multi_agent".into(), + code: Some("unsupported_value"), + message: "Async parallel tool calls are not yet supported in multi-agent mode.".into(), }; assert_eq!( envelope(error), diff --git a/crates/agentic-server-core/src/executor/modes/conversation.rs b/crates/agentic-server-core/src/executor/modes/conversation.rs index f13556d27..a897e1d47 100644 --- a/crates/agentic-server-core/src/executor/modes/conversation.rs +++ b/crates/agentic-server-core/src/executor/modes/conversation.rs @@ -3,9 +3,10 @@ use crate::storage::{ ConversationData, ConversationSnapshot, ConversationStore, ConversationVersion, ResponseMetadata, StorageError, }; -use crate::types::conversations::{ConversationMetadata, ItemResponse, ListItemsResponse}; +use crate::types::conversations::ConversationMetadata; use crate::types::io::InOutItem; use crate::types::io::OutputItem; +use crate::types::io::{ItemPage, ListItemsResponse}; use super::CommittedResponse; use crate::executor::error::{ExecutorError, ExecutorResult}; @@ -194,7 +195,7 @@ impl ConversationHandler { tenant_id: &str, conversation_id: &str, items: Vec, - ) -> ExecutorResult> { + ) -> ExecutorResult> { if items.is_empty() || items.len() > 20 { return Err(ExecutorError::InvalidRequest( "items must contain between 1 and 20 items".into(), @@ -211,7 +212,7 @@ impl ConversationHandler { let mut item_responses = Vec::with_capacity(created.len()); for db_item in created { let conversation_item = InOutItem::try_from(&db_item)?; - item_responses.push(ItemResponse::new(db_item.public_id().to_owned(), conversation_item)); + item_responses.push(conversation_item.into_public(db_item.public_id().to_owned())); } Ok(item_responses) @@ -225,41 +226,22 @@ impl ConversationHandler { &self, tenant_id: &str, conversation_id: &str, - limit: i64, - after: Option<&str>, - order: &str, + page: ItemPage<'_>, ) -> ExecutorResult { - // Validate order parameter - if order != "asc" && order != "desc" { - return Err(ExecutorError::InvalidRequest("order must be 'asc' or 'desc'".into())); - } - - let limit = limit.clamp(1, 100); - let order_enum = if order == "desc" { - crate::types::conversations::ItemOrder::Desc - } else { - crate::types::conversations::ItemOrder::Asc - }; - - // Fetch limit + 1 to determine if there are more items + // Fetch one extra item to determine if there are more items let mut items = self .store - .list_items(tenant_id, conversation_id, limit + 1, after, order_enum) + .list_items(tenant_id, conversation_id, page.limit.probe(), page.after, page.order) .await .map_err(ExecutorError::Storage)?; - - // Safe: limit is clamped to [1, 100], far below usize range - #[allow(clippy::cast_possible_wrap)] - let has_more = (items.len() as i64) > limit; - if has_more { - items.pop(); // Remove the extra item - } + let has_more = items.len() > page.limit.get(); + items.truncate(page.limit.get()); // Perform fallible conversion - propagate errors instead of silently dropping items let mut item_responses = Vec::with_capacity(items.len()); for db_item in items { let conversation_item = InOutItem::try_from(&db_item)?; - item_responses.push(ItemResponse::new(db_item.public_id().to_owned(), conversation_item)); + item_responses.push(conversation_item.into_public(db_item.public_id().to_owned())); } Ok(ListItemsResponse::new(item_responses, has_more)) @@ -274,7 +256,7 @@ impl ConversationHandler { tenant_id: &str, conversation_id: &str, item_id: &str, - ) -> ExecutorResult { + ) -> ExecutorResult { let db_item = self .store .retrieve_item(tenant_id, conversation_id, item_id) @@ -282,7 +264,7 @@ impl ConversationHandler { .map_err(ExecutorError::Storage)?; let conversation_item = InOutItem::try_from(&db_item)?; - Ok(ItemResponse::new(db_item.public_id().to_owned(), conversation_item)) + Ok(conversation_item.into_public(db_item.public_id().to_owned())) } /// Deletes an item by ID, returning the updated conversation. diff --git a/crates/agentic-server-core/src/executor/modes/response.rs b/crates/agentic-server-core/src/executor/modes/response.rs index 4975380ef..648e42b39 100644 --- a/crates/agentic-server-core/src/executor/modes/response.rs +++ b/crates/agentic-server-core/src/executor/modes/response.rs @@ -1,8 +1,11 @@ //! Response storage handler — owns all response store operations. -use crate::storage::{ResponseData, ResponseMetadata, ResponseStore}; -use crate::types::io::InOutItem; +use std::collections::HashSet; + +use crate::storage::{ResponseData, ResponseMetadata, ResponseStore, StorageError}; use crate::types::io::OutputItem; +use crate::types::io::{InOutItem, InputItem}; +use crate::types::io::{ItemOrder, ItemPage, ListItemsResponse}; use crate::types::request_response::ResponsePayload; use super::CommittedResponse; @@ -52,6 +55,89 @@ impl ResponseHandler { }) } + /// Deletes a stored response. + /// + /// # Errors + /// Returns an error if the response is missing or storage is unavailable. + pub async fn delete(&self, response_id: &str) -> ExecutorResult<()> { + self.store.delete(response_id).await.map_err(ExecutorError::Storage) + } + + /// Resolve client references without overwriting the stored item with supplied content. + pub(crate) async fn resolve_input_items(&self, items: &mut [InOutItem]) -> ExecutorResult<()> { + let mut seen = HashSet::new(); + for (index, item) in items.iter_mut().enumerate() { + let Some(id) = item.id() else { continue }; + if !seen.insert(id.to_owned()) { + return Err(ExecutorError::UnsupportedValue { + param: "input".into(), + code: None, + message: format!( + "Duplicate item found with id {id}. Remove duplicate items from your input and try again." + ), + }); + } + // Validate message identities at admission, never while persisting upstream outputs. + if matches!( + item, + InOutItem::Input(InputItem::Message(_)) | InOutItem::Output(OutputItem::Message(_)) + ) { + item.validate_client_id(format!("input[{index}].id"))?; + } + if let Some(row) = self.store.get_input_item(id).await? { + *item = InOutItem::try_from(&row)?.into_public(row.public_id().to_owned()); + } + } + Ok(()) + } + + /// Lists stored context, excluding this response's own output. + /// + /// # Errors + /// Returns an error for invalid pagination, missing history, or a legacy response + /// without a retrievable snapshot. + pub async fn list_input_items(&self, response_id: &str, page: ItemPage<'_>) -> ExecutorResult { + let snapshot = self.retrieve(response_id).await?; + let rows = self.store.get_items(response_id).await?; + let mut items = rows + .into_iter() + .map(|row| { + let item = InOutItem::try_from(&row)?; + Ok(item.into_public(row.public_id().to_owned())) + }) + .collect::, StorageError>>()?; + // Both persistence paths append public outputs after the turn's inputs. + // Bound the suffix by this snapshot's output count so an inherited output + // remains input even when a turn supplies no new items. Session execution + // can already have recorded some outputs as canonical input history. + for _ in &snapshot.output { + if !items.last().is_some_and(|item| matches!(item, InOutItem::Output(_))) { + break; + } + items.pop(); + } + if page.order == ItemOrder::Desc { + items.reverse(); + } + let start = match page.after.filter(|cursor| !cursor.is_empty()) { + Some(cursor) => { + // Match conversation pagination when a public ID occurs repeatedly. + items + .iter() + .rposition(|item| item.id() == Some(cursor)) + .ok_or_else(|| StorageError::ItemCursorNotFound { id: cursor.to_owned() })? + + 1 + } + None => 0, + }; + let limit = page.limit.get(); + let has_more = items.len() - start > limit; + Ok(ListItemsResponse::new( + items.into_iter().skip(start).take(limit).collect(), + has_more, + )) + } + /// Retrieves the stored response for `previous_response_id`. /// /// Reads `previous_response_id` from `ctx.original_request`. @@ -65,7 +151,13 @@ impl ResponseHandler { .previous_response_id .as_deref() .ok_or_else(|| ExecutorError::InvalidRequest("previous_response_id is required for get".into()))?; - let mut stored = self.store.get(prev_id).await?; + let mut stored = self.store.get(prev_id).await.map_err(|error| { + if error.is_not_found() { + ExecutorError::PreviousResponseNotFound { id: prev_id.to_owned() } + } else { + ExecutorError::Storage(error) + } + })?; // Continuation checkpoints retain history and settings, not a duplicate payload. stored.metadata.response_snapshot = None; Ok(stored) diff --git a/crates/agentic-server-core/src/executor/multi_agent/control.rs b/crates/agentic-server-core/src/executor/multi_agent/control.rs index bdcf03c31..07566e415 100644 --- a/crates/agentic-server-core/src/executor/multi_agent/control.rs +++ b/crates/agentic-server-core/src/executor/multi_agent/control.rs @@ -180,6 +180,8 @@ mod tests { ClientToolOutputBatch { response_id: "resp_test".into(), outputs: vec![ClientToolOutput::Function(FunctionToolResultMessage { + id: None, + status: None, call_id: "call_test".into(), output: ToolCallOutput::Text(text.into()), })], diff --git a/crates/agentic-server-core/src/executor/multi_agent/pending_calls.rs b/crates/agentic-server-core/src/executor/multi_agent/pending_calls.rs index 565495079..22c70651d 100644 --- a/crates/agentic-server-core/src/executor/multi_agent/pending_calls.rs +++ b/crates/agentic-server-core/src/executor/multi_agent/pending_calls.rs @@ -402,6 +402,8 @@ mod tests { fn function(id: &str) -> ClientToolOutput { ClientToolOutput::Function(FunctionToolResultMessage { + id: None, + status: None, call_id: id.into(), output: ToolCallOutput::Text("same output".into()), }) @@ -673,6 +675,8 @@ mod tests { .into_iter() .map(|part| { ClientToolOutput::Function(FunctionToolResultMessage { + id: None, + status: None, call_id: "large".into(), output: ToolCallOutput::Content(vec![part]), }) diff --git a/crates/agentic-server-core/src/executor/pending_calls.rs b/crates/agentic-server-core/src/executor/pending_calls.rs index 0db43de58..08d1db7fd 100644 --- a/crates/agentic-server-core/src/executor/pending_calls.rs +++ b/crates/agentic-server-core/src/executor/pending_calls.rs @@ -325,6 +325,8 @@ mod tests { fn function_call_output(call_id: &str) -> InputItem { InputItem::FunctionCallOutput(FunctionToolResultMessage { + id: None, + status: None, call_id: call_id.to_owned(), output: ToolCallOutput::Text(String::new()), }) @@ -344,6 +346,8 @@ mod tests { fn custom_tool_call_output(call_id: &str) -> InputItem { InputItem::CustomToolCallOutput(CustomToolCallOutputMessage { + status: None, + id: None, call_id: call_id.to_owned(), name: None, output: ToolCallOutput::Text(String::new()), diff --git a/crates/agentic-server-core/src/executor/rehydrate.rs b/crates/agentic-server-core/src/executor/rehydrate.rs index 3f945bc0b..7888b8a80 100644 --- a/crates/agentic-server-core/src/executor/rehydrate.rs +++ b/crates/agentic-server-core/src/executor/rehydrate.rs @@ -153,7 +153,8 @@ async fn rehydrate_request( let response_id = uuid7_str("resp_"); // Persistence keeps the public items. Tool lowering belongs to the enriched // inference copy, including when a later turn loads these items from storage. - let new_input_items = request.input.clone().into_canonical_items(); + let mut new_input_items = request.input.clone().into_canonical_items(); + exec_ctx.resp_handler.resolve_input_items(&mut new_input_items).await?; // One clone for the unmodified original; `request` is moved as enriched_request. let original_request = request.clone(); @@ -179,7 +180,7 @@ async fn rehydrate_request( } else if ctx.original_request.previous_response_id.is_some() { from_response(&mut ctx, exec_ctx).await?; } else { - ctx.enriched_request.input = ResponsesInput::from(Vec::from(&ctx.original_request.input)); + ctx.enriched_request.input = ResponsesInput::from(InOutItem::into_input_items(ctx.new_input_items.clone())); } exec_ctx @@ -213,8 +214,9 @@ fn validate_multi_agent_request(request: &RequestPayload) -> ExecutorResult<()> // `parallel_tool_calls` to false, so only an explicit `true` conflicts. if request.parallel_tool_calls == Some(true) && request.declares_async_tools() { return Err(ExecutorError::UnsupportedValue { - param: "multi_agent", - message: "Async parallel tool calls are not yet supported in multi-agent mode.", + param: "multi_agent".into(), + code: Some("unsupported_value"), + message: "Async parallel tool calls are not yet supported in multi-agent mode.".into(), }); } if request @@ -247,7 +249,7 @@ async fn from_response(ctx: &mut RequestContext, exec_ctx: &ExecutionContext) -> let mut items = InOutItem::into_input_items(history); items.reserve(ctx.new_input_items.len()); - items.extend(Vec::from(&ctx.original_request.input)); + items.extend(InOutItem::into_input_items(ctx.new_input_items.clone())); if let Some(pending) = first_unanswered_sync_call(&items)? { return Err(ExecutorError::Tool(ToolError::MissingOutput { call_id: pending.call_id, @@ -260,6 +262,16 @@ async fn from_response(ctx: &mut RequestContext, exec_ctx: &ExecutionContext) -> Ok(()) } +/// A missing `previous_response_id` is a request error, as `OpenAI` reports it, not a missing resource. +fn previous_response_missing(error: ExecutorError, previous_id: &str) -> ExecutorError { + match error { + ExecutorError::Storage(ref source) if source.is_not_found() => ExecutorError::PreviousResponseNotFound { + id: previous_id.to_owned(), + }, + other => other, + } +} + async fn from_session_response(ctx: &mut RequestContext, exec_ctx: &ExecutionContext) -> ExecutorResult<()> { let cached = ctx .continuation @@ -274,12 +286,7 @@ async fn from_session_response(ctx: &mut RequestContext, exec_ctx: &ExecutionCon id: previous_id.to_owned(), }); } - let map_missing = |error| match error { - ExecutorError::Storage(ref source) if source.is_not_found() => ExecutorError::PreviousResponseNotFound { - id: previous_id.to_owned(), - }, - other => other, - }; + let map_missing = |error| previous_response_missing(error, previous_id); let stored = exec_ctx.resp_handler.get(ctx).await.map_err(map_missing)?; let history = exec_ctx.resp_handler.rehydrate(ctx).await.map_err(map_missing)?; let checkpoint = ResponseCheckpoint { @@ -303,7 +310,7 @@ async fn from_session_response(ctx: &mut RequestContext, exec_ctx: &ExecutionCon let mut items = parent.history.clone(); // Match durable rehydration: lower custom/shell call outputs only in the // inference copy. new_input_items retains their public wire types. - items.extend(Vec::from(&ctx.original_request.input)); + items.extend(InOutItem::into_input_items(ctx.new_input_items.clone())); let items = canonical_session_history(items); if let Some(pending) = first_unanswered_sync_call(&items)? { return Err(ExecutorError::Tool(ToolError::MissingOutput { @@ -357,7 +364,7 @@ async fn from_conversation(ctx: &mut RequestContext, exec_ctx: &ExecutionContext let mut items = InOutItem::into_input_items(snapshot.items); items.reserve(ctx.new_input_items.len()); - items.extend(Vec::from(&ctx.original_request.input)); + items.extend(InOutItem::into_input_items(ctx.new_input_items.clone())); if let Some(pending) = first_unanswered_sync_call(&items)? { return Err(ExecutorError::Tool(ToolError::MissingOutput { call_id: pending.call_id, @@ -759,9 +766,10 @@ mod tests { assert!(matches!( error, ExecutorError::UnsupportedValue { - param: "multi_agent", - message: "Async parallel tool calls are not yet supported in multi-agent mode." - } + param, + code, + message, + } if param == "multi_agent" && code == Some("unsupported_value") && message == "Async parallel tool calls are not yet supported in multi-agent mode." )); for (parallel, async_tool) in [ (serde_json::json!(false), true), diff --git a/crates/agentic-server-core/src/executor/response_budget/client_outputs.rs b/crates/agentic-server-core/src/executor/response_budget/client_outputs.rs index c84932d06..d3b42af39 100644 --- a/crates/agentic-server-core/src/executor/response_budget/client_outputs.rs +++ b/crates/agentic-server-core/src/executor/response_budget/client_outputs.rs @@ -70,7 +70,10 @@ impl RetainedSize for ToolCallOutput { impl RetainedSize for FunctionToolResultMessage { fn retained_bytes(&self) -> usize { - RETAINED_CONTAINER_OVERHEAD_BYTES + self.call_id.len() + self.output.retained_bytes() + RETAINED_CONTAINER_OVERHEAD_BYTES + + opt_len(self.id.as_ref()) + + self.call_id.len() + + self.output.retained_bytes() } } @@ -104,6 +107,7 @@ impl RetainedSize for ShellCallOutputMessage { impl RetainedSize for CustomToolCallOutputMessage { fn retained_bytes(&self) -> usize { RETAINED_CONTAINER_OVERHEAD_BYTES + + opt_len(self.id.as_ref()) + self.call_id.len() + opt_len(self.name.as_ref()) + self.output.retained_bytes() diff --git a/crates/agentic-server-core/src/storage/conversation.rs b/crates/agentic-server-core/src/storage/conversation.rs index ad92fa5c3..5f8acf5fd 100644 --- a/crates/agentic-server-core/src/storage/conversation.rs +++ b/crates/agentic-server-core/src/storage/conversation.rs @@ -10,8 +10,9 @@ use super::types::{ ConversationData, ConversationSnapshot, ConversationVersion, ResponseMetadata, StorageError, StoreResult, }; use crate::storage::{DbTransaction, Item}; -use crate::types::conversations::{ConversationMetadata, ItemOrder}; +use crate::types::conversations::ConversationMetadata; use crate::types::io::InOutItem; +use crate::types::io::ItemOrder; use crate::utils::common::{serialize_to_string, uuid7_str}; /// Conversation storage operations. @@ -205,7 +206,24 @@ impl ConversationStore { ) -> StoreResult<()> { let pool = self.pool()?; - let items_ = item::serialize_new_items(new_items, item::ItemSource::ResponseHistory)?; + let new_items = new_items + .into_iter() + .map(|item| { + let prefix = match &item { + InOutItem::Input(input) => input.id_prefix(), + InOutItem::Output(output) => output.id_prefix(), + }; + if item.id() == Some("") { + return Err(StorageError::Validation("item id cannot be an empty string".to_owned())); + } + let id = item + .id() + .map_or_else(|| uuid7_str(prefix.unwrap_or("item_")), str::to_owned); + let data = String::try_from(&item)?; + Ok((id, data)) + }) + .collect::>>()?; + let metadata_json = String::try_from(metadata)?; let mut tx = pool.begin().await?; @@ -229,7 +247,7 @@ impl ConversationStore { }); } } - item::create_in_tx(&mut tx, items_, Some(conversation_id)).await?; + item::create_in_tx(&mut tx, new_items, Some(conversation_id)).await?; // A response branch must see the conversation as it existed at this turn, // including manually added items that may later be detached or deleted. let history_item_ids = item::ids_for_conversation_in_tx(&mut tx, conversation_id).await?; @@ -261,13 +279,33 @@ impl ConversationStore { metadata: Option, initial_items: Vec, ) -> StoreResult { - let items = item::serialize_new_items(initial_items, item::ItemSource::ConversationApi)?; + for (index, item) in initial_items.iter().enumerate() { + item.validate_client_id(format!("items[{index}].id"))?; + } + let initial_items = initial_items + .into_iter() + .map(|item| { + let prefix = match &item { + InOutItem::Input(input) => input.id_prefix(), + InOutItem::Output(output) => output.id_prefix(), + }; + if item.id() == Some("") { + return Err(StorageError::Validation("item id cannot be an empty string".to_owned())); + } + let id = item + .id() + .map_or_else(|| uuid7_str(prefix.unwrap_or("item_")), str::to_owned); + let data = String::try_from(&item)?; + Ok((id, data)) + }) + .collect::>>()?; + let metadata = metadata.map(|value| serialize_to_string(&value)).transpose()?; let id = uuid7_str("conv_"); let mut tx = self.pool()?.begin().await?; let row = conversation::create_in_tx(&mut tx, &id, tenant_id, metadata.as_deref()).await?; - if !items.is_empty() { - item::create_in_tx(&mut tx, items, Some(&id)).await?; + if !initial_items.is_empty() { + item::create_in_tx(&mut tx, initial_items, Some(&id)).await?; conversation::bump_revision_in_tx(&mut tx, &id).await?; } tx.commit().await?; @@ -320,7 +358,27 @@ impl ConversationStore { /// # Errors /// Returns an error if the resource is missing or persistence fails. pub async fn create_items(&self, tenant_id: &str, id: &str, items: Vec) -> StoreResult> { - let items = item::serialize_new_items(items, item::ItemSource::ConversationApi)?; + for (index, item) in items.iter().enumerate() { + item.validate_client_id(format!("items[{index}].id"))?; + } + let items = items + .into_iter() + .map(|item| { + let prefix = match &item { + InOutItem::Input(input) => input.id_prefix(), + InOutItem::Output(output) => output.id_prefix(), + }; + if item.id() == Some("") { + return Err(StorageError::Validation("item id cannot be an empty string".to_owned())); + } + let id = item + .id() + .map_or_else(|| uuid7_str(prefix.unwrap_or("item_")), str::to_owned); + let data = String::try_from(&item)?; + Ok((id, data)) + }) + .collect::>>()?; + let mut tx = self.pool()?.begin().await?; lock_owned(&mut tx, tenant_id, id).await?; let rows = item::create_in_tx(&mut tx, items, Some(id)).await?; diff --git a/crates/agentic-server-core/src/storage/models/item.rs b/crates/agentic-server-core/src/storage/models/item.rs index 7933c3fb8..0ca9155f2 100644 --- a/crates/agentic-server-core/src/storage/models/item.rs +++ b/crates/agentic-server-core/src/storage/models/item.rs @@ -1,15 +1,14 @@ //! Conversation history item stored in the database. use serde_json::Value; -use std::convert::TryFrom; use std::fmt::Write; use tracing::warn; use super::super::pool::{DbPool, DbResult, DbTransaction}; use super::super::types::item::{ItemKind, STORED_CODE_INTERPRETER_ORIGIN_KEY, STORED_ITEM_KIND_KEY}; use crate::storage::{StorageError, StoreResult}; -use crate::types::conversations::ItemOrder; use crate::types::io::InOutItem; +use crate::types::io::ItemOrder; use crate::types::io::code_interpreter::CodeInterpreterCallOrigin; use crate::types::io::{InputItem, OutputItem, ReasoningOutput}; use crate::utils::common::{deserialize_from_str_opt, utcnow_str, uuid7_str}; @@ -164,49 +163,6 @@ fn item_values_clause(row_count: usize, first_bind_index: usize, sequence_from_c clause } -/// Distinguishes client-supplied conversation items from persisted model history. -#[derive(Clone, Copy, PartialEq, Eq)] -pub(crate) enum ItemSource { - ConversationApi, - ResponseHistory, -} - -/// Serialize new history items, retaining public IDs already assigned to input or output items. -/// Items without IDs receive a storage-generated ID. -/// -/// # Errors -/// Returns an error if serialization fails or a supplied ID is empty or has an invalid prefix. -pub(crate) fn serialize_new_items(items: Vec, source: ItemSource) -> StoreResult> { - items - .into_iter() - .enumerate() - .map(|(index, item)| { - let (existing_id, prefix) = match &item { - InOutItem::Input(input) => (input.id(), input.id_prefix()), - InOutItem::Output(output) => (output.id(), output.id_prefix()), - }; - // Upstream model IDs are preserved; some vLLM reasoning items use - // msg_ IDs. Prefix errors apply to supplied Conversation Items IDs. - if source == ItemSource::ConversationApi - && let (Some(id), Some(prefix)) = (existing_id, prefix) - && !id.starts_with(prefix) - { - return Err(StorageError::InvalidItemId { - param: format!("items[{index}].id"), - id: id.to_owned(), - prefix: prefix.trim_end_matches('_'), - }); - } - if existing_id == Some("") { - return Err(StorageError::Validation("item id cannot be an empty string".to_owned())); - } - let id = existing_id.map_or_else(|| uuid7_str(prefix.unwrap_or("item_")), str::to_owned); - let data = String::try_from(&item)?; - Ok((id, data)) - }) - .collect() -} - /// Create items in a transaction with optional conversation context. /// /// If `conversation_id` is provided, the next sequence range is computed in the insert statement so @@ -367,6 +323,19 @@ pub async fn get_items(pool: &DbPool, ids: &[String]) -> DbResult> { Ok(rows) } +/// Find the original stored item carrying a public identity. +/// +/// # Errors +/// Returns an error if the database query fails. +pub async fn get_by_public_id(pool: &DbPool, id: &str) -> DbResult> { + sqlx::query_as::<_, Item>( + "SELECT * FROM items WHERE COALESCE(public_id, reference_id, id) = $1 ORDER BY created_at, id LIMIT 1", + ) + .bind(id) + .fetch_optional(pool) + .await +} + /// Get items by conversation ID ordered by sequence. /// /// # Errors @@ -506,167 +475,7 @@ pub async fn detach_from_conversation_in_tx( mod tests { use super::*; use crate::types::event::MessageStatus; - use crate::types::io::{ - InputItem, OutputItem, OutputMessage, ReasoningOutput, ReasoningTextContent, ResponsesInput, - }; - - #[test] - fn new_items_reuse_public_ids_and_generate_storage_ids() { - let input: InputItem = serde_json::from_value(serde_json::json!({ - "type": "message", "id": "msg_supplied", "role": "user", "content": "hello" - })) - .unwrap(); - let output = OutputItem::Message(OutputMessage::new("msg_generated", MessageStatus::Completed)); - let without_id: InputItem = serde_json::from_value(serde_json::json!({ - "type": "message", "role": "user", "content": "next" - })) - .unwrap(); - let function_call: InputItem = serde_json::from_value(serde_json::json!({ - "type": "function_call", "id": "fc_supplied", "call_id": "call_1", - "name": "lookup", "arguments": "{}" - })) - .unwrap(); - let rows = serialize_new_items( - vec![ - InOutItem::Input(input), - InOutItem::Output(output), - InOutItem::Input(without_id), - InOutItem::Input(function_call), - ], - ItemSource::ConversationApi, - ) - .unwrap(); - assert_eq!(rows[0].0, "msg_supplied"); - assert_eq!(rows[1].0, "msg_generated"); - assert!(rows[2].0.starts_with("msg_")); - assert_eq!(rows[3].0, "fc_supplied"); - } - - #[test] - fn response_history_preserves_code_interpreter_public_id() { - let output = OutputItem::CodeInterpreterCall(crate::types::io::CodeInterpreterCall { - agent: None, - id: "ci_public".to_owned(), - container_id: "cntr_public".to_owned(), - code: "print(42)".to_owned(), - status: crate::types::io::CodeInterpreterCallStatus::Completed, - outputs: Some(vec![]), - origin: CodeInterpreterCallOrigin::default(), - }); - let rows = serialize_new_items(vec![InOutItem::Output(output)], ItemSource::ResponseHistory) - .expect("serialize code interpreter response history"); - - assert_eq!(rows[0].0, "ci_public"); - let data: Value = serde_json::from_str(&rows[0].1).expect("stored output JSON"); - assert_eq!(data["id"], "ci_public"); - assert_eq!(data["type"], "code_interpreter_call"); - } - - #[test] - fn code_interpreter_history_replays_native_call_without_gateway_duplicate() { - let gateway_call: InputItem = serde_json::from_value(serde_json::json!({ - "type": "function_call", - "id": "fc_gateway", - "call_id": "call_gateway", - "name": "code_interpreter", - "arguments": "{\"code\":\"print(42)\"}", - "status": "completed" - })) - .expect("gateway model-facing call"); - let gateway_result: InputItem = serde_json::from_value(serde_json::json!({ - "type": "function_call_output", - "call_id": "call_gateway", - "output": "42" - })) - .expect("gateway model-facing output"); - let native_call: OutputItem = serde_json::from_value(serde_json::json!({ - "type": "code_interpreter_call", - "id": "ci_native", - "container_id": "cntr_native", - "code": "print(7)", - "status": "completed", - "outputs": [{"type": "logs", "logs": "7\n"}] - })) - .expect("native upstream call"); - let mut gateway_projection = native_call.clone(); - let OutputItem::CodeInterpreterCall(call) = &mut gateway_projection else { - panic!("code interpreter call"); - }; - call.id = "ci_gateway".to_owned(); - call.container_id = "cntr_gateway".to_owned(); - call.origin = CodeInterpreterCallOrigin::Gateway; - - let stored = serialize_new_items( - vec![ - InOutItem::Input(gateway_call), - InOutItem::Input(gateway_result), - InOutItem::Output(gateway_projection), - InOutItem::Output(native_call), - ], - ItemSource::ResponseHistory, - ) - .expect("serialize response history"); - let gateway_data: Value = serde_json::from_str(&stored[2].1).expect("stored gateway call"); - let native_data: Value = serde_json::from_str(&stored[3].1).expect("stored native call"); - assert_eq!(gateway_data[STORED_CODE_INTERPRETER_ORIGIN_KEY], "gateway"); - assert!(native_data.get(STORED_CODE_INTERPRETER_ORIGIN_KEY).is_none()); - - let history = stored - .into_iter() - .map(|(id, data)| { - Item { - id, - data, - created_at: 0, - conversation_id: None, - seq: None, - tenant_id: None, - reference_id: None, - public_id: None, - } - .as_inout() - .expect("rehydrate stored item") - }) - .collect(); - let inputs = InOutItem::into_input_items(history); - assert_eq!(inputs.len(), 3); - assert!(matches!(&inputs[0], InputItem::FunctionCall(call) if call.call_id == "call_gateway")); - assert!(matches!(&inputs[1], InputItem::FunctionCallOutput(output) if output.call_id == "call_gateway")); - assert!( - matches!(&inputs[2], InputItem::CodeInterpreterCall(call) if call.id == "ci_native" - && call.code == "print(7)" && call.outputs.as_ref().is_some_and(|outputs| outputs.len() == 1)) - ); - let model_input = - serde_json::to_value(ResponsesInput::from(inputs).model_input()).expect("model input serializes"); - assert_eq!(model_input[2]["type"], "code_interpreter_call"); - assert!(model_input[2].get(STORED_CODE_INTERPRETER_ORIGIN_KEY).is_none()); - } - - #[test] - fn serialize_new_items_rejects_empty_id() { - let input: InputItem = serde_json::from_value(serde_json::json!({ - "type": "message", "id": "", "role": "user", "content": "test" - })) - .unwrap(); - let result = serialize_new_items(vec![InOutItem::Input(input)], ItemSource::ConversationApi); - assert!(result.is_err()); - let err = result.unwrap_err(); - assert!(err.is_validation()); - assert!(matches!(err, StorageError::InvalidItemId { param, .. } if param == "items[0].id")); - } - - #[test] - fn serialize_new_items_accepts_missing_id() { - let input: InputItem = serde_json::from_value(serde_json::json!({ - "type": "message", "role": "user", "content": "test" - })) - .unwrap(); - let result = serialize_new_items(vec![InOutItem::Input(input)], ItemSource::ConversationApi); - assert!(result.is_ok()); - let rows = result.unwrap(); - assert_eq!(rows.len(), 1); - assert!(rows[0].0.starts_with("msg_")); - } + use crate::types::io::{InputItem, OutputItem, ReasoningOutput, ReasoningTextContent}; #[test] fn item_values_clause_numbers_plain_rows() { @@ -1070,6 +879,10 @@ mod item_id_tests { json!({"type":"message", "id":"msg_1", "role":"user", "content":"hello"}), json!({"type":"function_call", "id":"fc_1", "call_id":"call_1", "name":"f", "arguments":"{}"}), json!({"type":"tool_search_call", "id":"tsc_1", "call_id":"call_1", "arguments":{}}), + json!({"type":"function_call_output", "id":"fc_1", "call_id":"call_1", "output":"done"}), + json!({"type":"custom_tool_call_output", "id":"ctco_1", "call_id":"call_1", "output":"done"}), + json!({"type":"shell_call_output", "id":"sho_1", "call_id":"call_1", "output":[]}), + json!({"type":"tool_search_output", "id":"tso_1", "call_id":"call_1", "tools":[]}), json!({"type":"custom_tool_call", "id":"ctc_1", "call_id":"call_1", "name":"f", "input":"x"}), json!({"type":"shell_call", "id":"sh_1", "call_id":"call_1", "action":{"commands":["pwd"]}}), json!({"type":"reasoning", "id":"rs_1", "summary":[]}), @@ -1080,35 +893,40 @@ mod item_id_tests { ]; for mut value in cases { let item = stored(value.clone()); - serialize_new_items(vec![item], ItemSource::ConversationApi).expect("matching public ID prefix"); + item.validate_client_id("items[0].id".into()) + .expect("matching public ID prefix"); value["id"] = json!("wrong_1"); let item = stored(value); - let error = serialize_new_items(vec![item], ItemSource::ConversationApi).unwrap_err(); + let error = item.validate_client_id("items[0].id".into()).unwrap_err(); assert!(error.is_validation()); assert!(matches!(error, StorageError::InvalidItemId { param, .. } if param == "items[0].id")); } } #[test] - fn optional_ids_and_unverified_prefixes_are_not_restricted() { + fn optional_ids_are_not_required() { for value in [ json!({"type":"message", "role":"user", "content":"hello"}), json!({"type":"function_call", "call_id":"call_1", "name":"f", "arguments":"{}"}), json!({"type":"function_call_output", "call_id":"call_1", "output":"done"}), - json!({"type":"shell_call_output", "id":"output_1", "call_id":"call_1", "output":[]}), + json!({"type":"shell_call_output", "call_id":"call_1", "output":[]}), ] { - serialize_new_items(vec![stored(value)], ItemSource::ConversationApi).unwrap(); + stored(value).validate_client_id("items[0].id".into()).unwrap(); } } #[test] fn invalid_id_reports_its_batch_index_and_rejects_empty_ids() { for id in ["", "item_wrongprefix"] { - let items = vec![ + let items = [ stored(json!({"type":"message", "role":"user", "content":"valid"})), stored(json!({"type":"message", "id":id, "role":"user", "content":"invalid"})), ]; - let error = serialize_new_items(items, ItemSource::ConversationApi).unwrap_err(); + let error = items + .iter() + .enumerate() + .try_for_each(|(index, item)| item.validate_client_id(format!("items[{index}].id"))) + .unwrap_err(); assert!(matches!(&error, StorageError::InvalidItemId { param, .. } if param == "items[1].id")); assert_eq!( error.to_string(), diff --git a/crates/agentic-server-core/src/storage/models/response.rs b/crates/agentic-server-core/src/storage/models/response.rs index a63555f91..d358f6ff6 100644 --- a/crates/agentic-server-core/src/storage/models/response.rs +++ b/crates/agentic-server-core/src/storage/models/response.rs @@ -1,7 +1,9 @@ //! LLM API response stored in the database. +use std::collections::HashSet; + use super::super::pool::{DbPool, DbResult, DbTransaction}; -use crate::utils::common::utcnow_str; +use crate::utils::common::{serialize_to_string, utcnow_str}; /// LLM API response stored in the database. /// @@ -67,6 +69,74 @@ pub async fn get(pool: &DbPool, id: &str) -> DbResult> { .await } +/// Read a response row inside the caller's transaction. +/// +/// # Errors +/// Returns an error if the database query fails. +pub async fn get_in_tx(tx: &mut DbTransaction<'_>, id: &str) -> DbResult> { + sqlx::query_as::<_, Response>("SELECT * FROM responses WHERE id = $1") + .bind(id) + .fetch_optional(&mut **tx) + .await +} + +/// Delete a response and remove its inherited context from response-chain descendants. +/// Conversation snapshots and shared item rows are retained. +/// The caller owns the transaction and commits or rolls back all changes together. +/// +/// # Errors +/// Returns an error if history is malformed or the transaction fails. +pub async fn delete_in_tx(tx: &mut DbTransaction<'_>, id: &str) -> DbResult { + let Some(root) = get_in_tx(tx, id).await? else { + return Ok(false); + }; + let inherited: HashSet = root + .history_item_ids_vec() + .map_err(|error| sqlx::Error::Decode(Box::new(error)))? + .into_iter() + .collect(); + let mut parents = vec![root.id]; + while let Some(parent) = parents.pop() { + let children = + sqlx::query_as::<_, Response>("SELECT * FROM responses WHERE previous_response_id = $1 ORDER BY id") + .bind(parent) + .fetch_all(&mut **tx) + .await?; + for child in children { + if child.conversation_id.is_none() { + let mut ids = child + .history_item_ids_vec() + .map_err(|error| sqlx::Error::Decode(Box::new(error)))?; + ids.retain(|id| !inherited.contains(id)); + let json = serialize_to_string(&ids).map_err(|error| sqlx::Error::Encode(Box::new(error)))?; + sqlx::query("UPDATE responses SET history_item_ids = $1 WHERE id = $2") + .bind(json) + .bind(&child.id) + .execute(&mut **tx) + .await?; + } + parents.push(child.id); + } + } + sqlx::query("DELETE FROM responses WHERE id = $1") + .bind(id) + .execute(&mut **tx) + .await?; + Ok(true) +} + +/// Read the ordered history item IDs without loading response metadata. +/// A legacy NULL history is empty; a missing response returns `None`. +/// +/// # Errors +/// Returns an error if the database query fails. +pub async fn get_item_ids(pool: &DbPool, id: &str) -> DbResult> { + sqlx::query_scalar("SELECT COALESCE(history_item_ids, '[]') FROM responses WHERE id = $1") + .bind(id) + .fetch_optional(pool) + .await +} + /// Get the response that committed a conversation turn. /// /// # Errors diff --git a/crates/agentic-server-core/src/storage/response.rs b/crates/agentic-server-core/src/storage/response.rs index 78dab433a..760f73be4 100644 --- a/crates/agentic-server-core/src/storage/response.rs +++ b/crates/agentic-server-core/src/storage/response.rs @@ -8,7 +8,7 @@ use super::models::{item, response}; use super::pool::DbPool; use super::types::{ResponseData, ResponseMetadata, StorageError, StoreResult}; use crate::types::io::InOutItem; -use crate::utils::common::serialize_to_string; +use crate::utils::common::{deserialize_from_str, serialize_to_string, uuid7_str}; /// Response storage operations. #[derive(Clone, Debug)] @@ -58,6 +58,52 @@ impl ResponseStore { row.try_into() } + /// Deletes a response without deleting shared history items. + /// + /// # Errors + /// Returns an error if the response is missing, storage is disabled, or deletion fails. + pub async fn delete(&self, response_id: &str) -> StoreResult<()> { + let mut tx = self.pool()?.begin().await?; + if !response::delete_in_tx(&mut tx, response_id).await? { + return Err(StorageError::not_found("Response", response_id)); + } + tx.commit().await?; + Ok(()) + } + + /// Resolve a supplied public item ID when storage is configured. + /// + /// # Errors + /// Returns an error if the database query fails. + pub async fn get_input_item(&self, id: &str) -> StoreResult> { + let Some(pool) = self.pool.as_deref() else { + return Ok(None); + }; + Ok(item::get_by_public_id(pool, id).await?) + } + + /// Loads the response's existing item rows in history order. + /// + /// # Errors + /// Returns an error for missing or invalid history, unavailable storage, or query failure. + pub async fn get_items(&self, response_id: &str) -> StoreResult> { + let pool = self.pool()?; + let json = response::get_item_ids(pool, response_id) + .await? + .ok_or_else(|| StorageError::not_found("Response", response_id))?; + let ids: Vec = deserialize_from_str(&json).map_err(|_| StorageError::InvalidResponseHistory { + response_id: response_id.to_owned(), + })?; + let mut rows: HashMap<_, _> = item::get_items(pool, &ids) + .await? + .into_iter() + .map(|row| (row.id.clone(), row)) + .collect(); + ids.into_iter() + .map(|id| rows.remove(&id).ok_or(StorageError::InvalidHistoryItem { item_id: id })) + .collect() + } + /// Rehydrates a response with full history. /// /// Fetches all history items referenced by a response. @@ -128,13 +174,30 @@ impl ResponseStore { Some(prev_id) => self.get(prev_id).await?.history_item_ids, None => Vec::new(), }; - let items_ = item::serialize_new_items(new_items, item::ItemSource::ResponseHistory)?; + let new_items = new_items + .into_iter() + .map(|item| { + let prefix = match &item { + InOutItem::Input(input) => input.id_prefix(), + InOutItem::Output(output) => output.id_prefix(), + }; + if item.id() == Some("") { + return Err(StorageError::Validation("item id cannot be an empty string".to_owned())); + } + let id = item + .id() + .map_or_else(|| uuid7_str(prefix.unwrap_or("item_")), str::to_owned); + let data = String::try_from(&item)?; + Ok((id, data)) + }) + .collect::>>()?; + let metadata_json = String::try_from(metadata)?; let mut tx = pool.begin().await?; // History rows get their own row IDs, so repeated public IDs keep every position. - let created = item::create_in_tx(&mut tx, items_, None).await?; + let created = item::create_in_tx(&mut tx, new_items, None).await?; item_ids.extend(created.into_iter().map(|item| item.id)); let history_item_ids_json = serialize_to_string(&item_ids)?; @@ -157,6 +220,202 @@ impl ResponseStore { mod tests { use super::super::types::ResponseMetadata; use super::*; + use crate::storage::create_pool_with_schema; + use crate::storage::types::item::STORED_CODE_INTERPRETER_ORIGIN_KEY; + use crate::types::event::MessageStatus; + use crate::types::io::code_interpreter::CodeInterpreterCallOrigin; + use crate::types::io::{ + CodeInterpreterCall, CodeInterpreterCallStatus, InputItem, OutputItem, OutputMessage, ResponsesInput, + }; + use serde_json::Value; + + #[tokio::test] + async fn new_items_reuse_public_ids_and_generate_storage_ids() { + let pool = create_pool_with_schema(Some("sqlite://?mode=memory")).await.unwrap(); + let store = ResponseStore::new(pool); + let input: InputItem = serde_json::from_value(serde_json::json!({ + "type": "message", "id": "msg_supplied", "role": "user", "content": "hello" + })) + .unwrap(); + let output = OutputItem::Message(OutputMessage::new("msg_generated", MessageStatus::Completed)); + let without_id: InputItem = serde_json::from_value(serde_json::json!({ + "type": "message", "role": "user", "content": "next" + })) + .unwrap(); + let function_call: InputItem = serde_json::from_value(serde_json::json!({ + "type": "function_call", "id": "fc_supplied", "call_id": "call_1", + "name": "lookup", "arguments": "{}" + })) + .unwrap(); + store + .persist( + "resp_items", + None, + vec![ + InOutItem::Input(input), + InOutItem::Output(output), + InOutItem::Input(without_id), + InOutItem::Input(function_call), + ], + &ResponseMetadata::default(), + ) + .await + .unwrap(); + let rows = store.get_items("resp_items").await.unwrap(); + assert_eq!(rows[0].public_id(), "msg_supplied"); + assert_eq!(rows[1].public_id(), "msg_generated"); + assert!(rows[2].public_id().starts_with("msg_")); + assert_eq!(rows[3].public_id(), "fc_supplied"); + } + + #[tokio::test] + async fn response_history_preserves_code_interpreter_public_id() { + let pool = create_pool_with_schema(Some("sqlite://?mode=memory")).await.unwrap(); + let store = ResponseStore::new(pool); + let output = OutputItem::CodeInterpreterCall(CodeInterpreterCall { + agent: None, + id: "ci_public".to_owned(), + container_id: "cntr_public".to_owned(), + code: "print(42)".to_owned(), + status: CodeInterpreterCallStatus::Completed, + outputs: Some(vec![]), + origin: CodeInterpreterCallOrigin::default(), + }); + store + .persist( + "resp_items", + None, + vec![InOutItem::Output(output)], + &ResponseMetadata::default(), + ) + .await + .expect("serialize code interpreter response history"); + + let rows = store.get_items("resp_items").await.unwrap(); + assert_eq!(rows[0].public_id(), "ci_public"); + let data: Value = serde_json::from_str(&rows[0].data).expect("stored output JSON"); + assert_eq!(data["id"], "ci_public"); + assert_eq!(data["type"], "code_interpreter_call"); + } + + #[tokio::test] + async fn code_interpreter_history_replays_native_call_without_gateway_duplicate() { + let pool = create_pool_with_schema(Some("sqlite://?mode=memory")).await.unwrap(); + let store = ResponseStore::new(pool); + let gateway_call: InputItem = serde_json::from_value(serde_json::json!({ + "type": "function_call", + "id": "fc_gateway", + "call_id": "call_gateway", + "name": "code_interpreter", + "arguments": "{\"code\":\"print(42)\"}", + "status": "completed" + })) + .expect("gateway model-facing call"); + let gateway_result: InputItem = serde_json::from_value(serde_json::json!({ + "type": "function_call_output", + "call_id": "call_gateway", + "output": "42" + })) + .expect("gateway model-facing output"); + let native_call: OutputItem = serde_json::from_value(serde_json::json!({ + "type": "code_interpreter_call", + "id": "ci_native", + "container_id": "cntr_native", + "code": "print(7)", + "status": "completed", + "outputs": [{"type": "logs", "logs": "7\n"}] + })) + .expect("native upstream call"); + let mut gateway_projection = native_call.clone(); + let OutputItem::CodeInterpreterCall(call) = &mut gateway_projection else { + panic!("code interpreter call"); + }; + call.id = "ci_gateway".to_owned(); + call.container_id = "cntr_gateway".to_owned(); + call.origin = CodeInterpreterCallOrigin::Gateway; + + store + .persist( + "resp_items", + None, + vec![ + InOutItem::Input(gateway_call), + InOutItem::Input(gateway_result), + InOutItem::Output(gateway_projection), + InOutItem::Output(native_call), + ], + &ResponseMetadata::default(), + ) + .await + .expect("serialize response history"); + let stored = store.get_items("resp_items").await.unwrap(); + let gateway_data: Value = serde_json::from_str(&stored[2].data).expect("stored gateway call"); + let native_data: Value = serde_json::from_str(&stored[3].data).expect("stored native call"); + assert_eq!(gateway_data[STORED_CODE_INTERPRETER_ORIGIN_KEY], "gateway"); + assert!(native_data.get(STORED_CODE_INTERPRETER_ORIGIN_KEY).is_none()); + + let history = stored + .into_iter() + .map(|row| row.as_inout().expect("rehydrate stored item")) + .collect(); + let inputs = InOutItem::into_input_items(history); + assert_eq!(inputs.len(), 3); + assert!(matches!(&inputs[0], InputItem::FunctionCall(call) if call.call_id == "call_gateway")); + assert!(matches!(&inputs[1], InputItem::FunctionCallOutput(output) if output.call_id == "call_gateway")); + assert!( + matches!(&inputs[2], InputItem::CodeInterpreterCall(call) if call.id == "ci_native" + && call.code == "print(7)" && call.outputs.as_ref().is_some_and(|outputs| outputs.len() == 1)) + ); + let model_input = + serde_json::to_value(ResponsesInput::from(inputs).model_input()).expect("model input serializes"); + assert_eq!(model_input[2]["type"], "code_interpreter_call"); + assert!(model_input[2].get(STORED_CODE_INTERPRETER_ORIGIN_KEY).is_none()); + } + + #[tokio::test] + async fn create_items_rejects_empty_id() { + let pool = create_pool_with_schema(Some("sqlite://?mode=memory")).await.unwrap(); + let store = ResponseStore::new(pool); + let input: InputItem = serde_json::from_value(serde_json::json!({ + "type": "message", "id": "", "role": "user", "content": "test" + })) + .unwrap(); + let result = store + .persist( + "resp_items", + None, + vec![InOutItem::Input(input)], + &ResponseMetadata::default(), + ) + .await; + assert!(result.is_err()); + let err = result.unwrap_err(); + assert!(err.is_validation()); + assert!(matches!(err, StorageError::Validation(_))); + } + + #[tokio::test] + async fn create_items_accepts_missing_id() { + let pool = create_pool_with_schema(Some("sqlite://?mode=memory")).await.unwrap(); + let store = ResponseStore::new(pool); + let input: InputItem = serde_json::from_value(serde_json::json!({ + "type": "message", "role": "user", "content": "test" + })) + .unwrap(); + let result = store + .persist( + "resp_items", + None, + vec![InOutItem::Input(input)], + &ResponseMetadata::default(), + ) + .await; + assert!(result.is_ok()); + result.unwrap(); + let rows = store.get_items("resp_items").await.unwrap(); + assert_eq!(rows.len(), 1); + assert!(rows[0].public_id().starts_with("msg_")); + } #[test] fn test_response_store_disabled() { diff --git a/crates/agentic-server-core/src/storage/types/item.rs b/crates/agentic-server-core/src/storage/types/item.rs index cb9af84a7..a830b43dd 100644 --- a/crates/agentic-server-core/src/storage/types/item.rs +++ b/crates/agentic-server-core/src/storage/types/item.rs @@ -38,6 +38,27 @@ impl ItemKind { } } +impl InOutItem { + /// Validate a client-supplied public identity before item creation. + /// Persistence itself also accepts provider-assigned IDs with different prefixes. + pub(crate) fn validate_client_id(&self, param: String) -> Result<(), StorageError> { + let (id, prefix) = match self { + Self::Input(item) => (item.id(), item.id_prefix()), + Self::Output(item) => (item.id(), item.id_prefix()), + }; + if let (Some(id), Some(prefix)) = (id, prefix) + && !id.starts_with(prefix) + { + return Err(StorageError::InvalidItemId { + param, + id: id.to_owned(), + prefix: prefix.trim_end_matches('_'), + }); + } + Ok(()) + } +} + /// Decode retained history without silently omitting invalid records. /// /// Legacy unmarked items retain the existing input/output discrimination policy. diff --git a/crates/agentic-server-core/src/tool/normalize.rs b/crates/agentic-server-core/src/tool/normalize.rs index 6e7020af7..3ef85c3a2 100644 --- a/crates/agentic-server-core/src/tool/normalize.rs +++ b/crates/agentic-server-core/src/tool/normalize.rs @@ -1,5 +1,7 @@ +use crate::types::event::MessageStatus; use crate::types::io::FunctionTool; use crate::types::io::input::FunctionToolResultMessage; +use crate::utils::uuid7_str; use super::code_interpreter::CodeInterpreterHandler; use super::codex::CodexNamespaceHandler; @@ -146,6 +148,8 @@ impl ToolDeclaration { impl From for FunctionToolResultMessage { fn from(o: ToolOutput) -> Self { Self { + id: Some(uuid7_str("fc_")), + status: Some(MessageStatus::Completed), call_id: o.call_id, output: o.output.into(), } diff --git a/crates/agentic-server-core/src/tool/tool_search.rs b/crates/agentic-server-core/src/tool/tool_search.rs index ccb44d343..602d26cb4 100644 --- a/crates/agentic-server-core/src/tool/tool_search.rs +++ b/crates/agentic-server-core/src/tool/tool_search.rs @@ -1157,14 +1157,14 @@ fn prepare_search_output( load_definition(tool, definition_accumulator)?; } let projected_tools = model_visible_output_tools(&output.tools)?; - let canonical_value = serialize_to_value(&CanonicalToolSearchOutput { + let canonical_output = serialize_to_string(&CanonicalToolSearchOutput { tools: &projected_tools, }) .map_err(|_| ToolError::Config("tool_search_output could not be canonicalized safely".to_owned()))?; - let canonical_output = serialize_to_string(&canonical_value) - .map_err(|_| ToolError::Config("tool_search_output could not be canonicalized safely".to_owned()))?; completed_call_ids.insert(output.call_id.clone()); Ok(InputItem::FunctionCallOutput(FunctionToolResultMessage { + id: None, + status: None, call_id: output.call_id.clone(), output: ToolCallOutput::Text(canonical_output), })) diff --git a/crates/agentic-server-core/src/types/conversations.rs b/crates/agentic-server-core/src/types/conversations.rs index b4fbdc477..d320d7fff 100644 --- a/crates/agentic-server-core/src/types/conversations.rs +++ b/crates/agentic-server-core/src/types/conversations.rs @@ -2,13 +2,9 @@ use std::collections::BTreeMap; -use serde::{Deserialize, Serialize, Serializer}; +use serde::{Deserialize, Serialize}; -use super::event::MessageStatus; -use super::io::{InputContent, InputMessageContent, InputTextContent}; -use serde_json::Value; - -use super::io::{InOutItem, InputItem}; +use super::io::InOutItem; /// String metadata attached to a conversation. pub type ConversationMetadata = BTreeMap; @@ -60,89 +56,6 @@ pub struct CreateItemRequest { pub items: Vec, } -/// Response for listing items with pagination. -#[derive(Debug, Clone, Serialize)] -#[cfg_attr(feature = "openapi", derive(utoipa::ToSchema))] -pub struct ListItemsResponse { - /// Object type, always "list". - pub object: String, - - /// Array of conversation items. - pub data: Vec, - - /// Whether there are more items available. - pub has_more: bool, - - /// ID of the first item in this page. - pub first_id: Option, - - /// ID of the last item in this page. - pub last_id: Option, -} - -/// A conversation item with its storage identity and flattened public payload. -#[derive(Debug, Clone)] -pub struct ItemResponse { - pub id: String, - pub item: InOutItem, -} - -#[cfg(feature = "openapi")] -impl utoipa::PartialSchema for ItemResponse { - fn schema() -> utoipa::openapi::RefOr { - use utoipa::openapi::schema::{AllOfBuilder, Type}; - use utoipa::openapi::{ObjectBuilder, Ref}; - AllOfBuilder::new() - .item( - ObjectBuilder::new() - .property("id", ObjectBuilder::new().schema_type(Type::String)) - .required("id"), - ) - .item(Ref::from_schema_name("InOutItem")) - .into() - } -} - -#[cfg(feature = "openapi")] -impl utoipa::ToSchema for ItemResponse {} - -impl Serialize for ItemResponse { - fn serialize(&self, serializer: S) -> Result { - let mut value = serde_json::to_value(&self.item).map_err(serde::ser::Error::custom)?; - let object = value - .as_object_mut() - .ok_or_else(|| serde::ser::Error::custom("item must be an object"))?; - // Stored Responses output may retain an upstream ID. The public resource - // must use the same ID as its retrieval URL and pagination cursor, once. - object.insert("id".to_owned(), Value::String(self.id.clone())); - value.serialize(serializer) - } -} - -/// Ordering for conversation item pages. -#[derive(Debug, Clone, Copy, Default, PartialEq, Eq, Serialize, Deserialize)] -#[serde(rename_all = "lowercase")] -#[cfg_attr(feature = "openapi", derive(utoipa::ToSchema))] -pub enum ItemOrder { - Asc, - #[default] - Desc, -} - -/// Response for successful deletion. -#[derive(Debug, Clone, Serialize, Deserialize)] -#[cfg_attr(feature = "openapi", derive(utoipa::ToSchema))] -pub struct DeletedResponse { - /// ID of the deleted resource. - pub id: String, - - /// Object type. - pub object: String, - - /// Whether the deletion was successful. - pub deleted: bool, -} - impl ConversationResponse { /// Create a new conversation response. #[must_use] @@ -156,59 +69,5 @@ impl ConversationResponse { } } -impl ItemResponse { - /// Build the public resource, expanding shorthand message content. - #[must_use] - pub fn new(id: String, mut item: InOutItem) -> Self { - if let InOutItem::Input(InputItem::Message(message)) = &mut item { - message.status.get_or_insert(MessageStatus::Completed); - if let InputMessageContent::Text(text) = &mut message.content { - let content = InputTextContent::new(std::mem::take(text)); - message.content = InputMessageContent::Parts(vec![InputContent::InputText(content)]); - } - } - Self { id, item } - } -} - -impl ListItemsResponse { - /// Create a new list response. - #[must_use] - pub fn new(data: Vec, has_more: bool) -> Self { - let first_id = data.first().map(|item| item.id.clone()); - let last_id = data.last().map(|item| item.id.clone()); - - Self { - object: "list".to_string(), - data, - has_more, - first_id, - last_id, - } - } -} - -impl DeletedResponse { - /// Create a deleted conversation response. - #[must_use] - pub fn conversation(id: String) -> Self { - Self { - id, - object: "conversation.deleted".to_string(), - deleted: true, - } - } - - /// Create a deleted item response. - #[must_use] - pub fn item(id: String) -> Self { - Self { - id, - object: "conversation.item.deleted".to_string(), - deleted: true, - } - } -} - #[cfg(test)] mod tests; diff --git a/crates/agentic-server-core/src/types/conversations/tests.rs b/crates/agentic-server-core/src/types/conversations/tests.rs index 59784fc60..62cb7333e 100644 --- a/crates/agentic-server-core/src/types/conversations/tests.rs +++ b/crates/agentic-server-core/src/types/conversations/tests.rs @@ -18,37 +18,9 @@ fn gateway_calls_keep_their_payload_and_unknown_types_are_rejected() { } #[test] -fn item_resource_has_one_id_and_flattened_content() { - let item = serde_json::from_value(json!({"type":"message", "id":"upstream_id", "role":"user", "content":"hello"})) - .unwrap(); - let resource = ItemResponse::new("item_stored".into(), item); - let text = serde_json::to_string(&resource).unwrap(); - assert_eq!(text.matches("\"id\"").count(), 1); - let actual: Value = serde_json::from_str(&text).unwrap(); - assert_eq!(actual["id"], "item_stored"); - assert_eq!(actual["type"], "message"); - assert_eq!(actual["status"], "completed"); - assert_eq!(actual["content"], json!([{"type":"input_text", "text":"hello"}])); - assert!(actual.get("item").is_none()); -} - -#[test] -fn batch_requests_and_empty_pages_match_wire_contract() { +fn batch_requests_match_wire_contract() { let request: CreateItemRequest = serde_json::from_value(json!({"items":[{"role":"user", "content":"hello"}]})).unwrap(); assert_eq!(request.items.len(), 1); assert!(serde_json::from_value::(json!({"item":{"role":"user", "content":"hello"}})).is_err()); - assert_eq!( - serde_json::to_value(ListItemsResponse::new(vec![], false)).unwrap(), - json!({"object":"list", "data":[], "has_more":false, "first_id":null, "last_id":null}) - ); -} - -#[test] -fn manually_added_assistant_shorthand_remains_input_text() { - let item: InOutItem = serde_json::from_value(json!({"type":"message", "role":"assistant", "content":"9"})).unwrap(); - let resource = ItemResponse::new("msg_manual".into(), item); - let actual = serde_json::to_value(resource).unwrap(); - assert_eq!(actual["role"], "assistant"); - assert_eq!(actual["content"], json!([{"type":"input_text", "text":"9"}])); } diff --git a/crates/agentic-server-core/src/types/injection.rs b/crates/agentic-server-core/src/types/injection.rs index 9a8043dda..5dc91ca3e 100644 --- a/crates/agentic-server-core/src/types/injection.rs +++ b/crates/agentic-server-core/src/types/injection.rs @@ -58,6 +58,8 @@ pub struct InjectionFunctionOutput { impl From for FunctionToolResultMessage { fn from(output: InjectionFunctionOutput) -> Self { Self { + id: None, + status: None, call_id: output.call_id, output: output.output, } diff --git a/crates/agentic-server-core/src/types/io/input.rs b/crates/agentic-server-core/src/types/io/input.rs index ab4b297f6..4afe6d7c2 100644 --- a/crates/agentic-server-core/src/types/io/input.rs +++ b/crates/agentic-server-core/src/types/io/input.rs @@ -77,6 +77,10 @@ impl Default for InputMessageContent { #[derive(Debug, Clone, Serialize, Deserialize)] #[cfg_attr(feature = "openapi", derive(utoipa::ToSchema))] pub struct FunctionToolResultMessage { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub status: Option, pub call_id: String, pub output: ToolCallOutput, } @@ -209,18 +213,6 @@ impl From for InputFunctionToolCall { } } -impl From for FunctionToolResultMessage { - fn from(output: ShellCallOutputMessage) -> Self { - Self { - call_id: output.call_id, - // Command outputs contain only JSON-compatible values and string map keys. - output: serde_json::to_string(&output.output) - .expect("shell outputs serialize to JSON") - .into(), - } - } -} - pub(super) fn deserialize_non_blank_string<'de, D>(deserializer: D) -> Result where D: serde::Deserializer<'de>, @@ -271,6 +263,8 @@ impl TryFrom<&ToolSearchCall> for InputToolSearchCall { #[derive(Debug, Clone, Serialize, Deserialize)] #[cfg_attr(feature = "openapi", derive(utoipa::ToSchema))] pub struct ToolSearchOutputMessage { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, #[serde(deserialize_with = "deserialize_non_blank_string")] pub call_id: String, #[serde(default)] @@ -295,21 +289,16 @@ pub struct CompactionItem { #[derive(Debug, Clone, Serialize, Deserialize)] #[cfg_attr(feature = "openapi", derive(utoipa::ToSchema))] pub struct CustomToolCallOutputMessage { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub status: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub id: Option, pub call_id: String, #[serde(skip_serializing_if = "Option::is_none")] pub name: Option, pub output: ToolCallOutput, } -impl From for FunctionToolResultMessage { - fn from(output: CustomToolCallOutputMessage) -> Self { - Self { - call_id: output.call_id, - output: output.output, - } - } -} - #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(tag = "type")] pub enum InputItem { diff --git a/crates/agentic-server-core/src/types/io/input/conversions.rs b/crates/agentic-server-core/src/types/io/input/conversions.rs index fa8fc96c6..e20f82636 100644 --- a/crates/agentic-server-core/src/types/io/input/conversions.rs +++ b/crates/agentic-server-core/src/types/io/input/conversions.rs @@ -1,12 +1,42 @@ -use crate::types::io::{InOutItem, OutputMessage, OutputMessageContent}; +use crate::types::event::MessageStatus; +use crate::types::io::{InOutItem, OutputMessage, OutputMessageContent, ShellCallOutputMessage, ShellCallStatus}; use serde_json::Value; use super::{ - InputContent, InputItem, InputMessage, InputMessageContent, InputMessageType, InputTextContent, - InputValidationError, ResponsesInput, + CustomToolCallOutputMessage, FunctionToolResultMessage, InputContent, InputItem, InputMessage, InputMessageContent, + InputMessageType, InputTextContent, InputValidationError, ResponsesInput, }; use std::borrow::Cow; +impl From for FunctionToolResultMessage { + fn from(output: ShellCallOutputMessage) -> Self { + Self { + id: output.id, + status: match output.status { + Some(ShellCallStatus::Completed) => Some(MessageStatus::Completed), + Some(ShellCallStatus::InProgress) => Some(MessageStatus::InProgress), + Some(ShellCallStatus::Incomplete) | None => None, + }, + call_id: output.call_id, + // Command outputs contain only JSON-compatible values and string map keys. + output: serde_json::to_string(&output.output) + .expect("shell outputs serialize to JSON") + .into(), + } + } +} + +impl From for FunctionToolResultMessage { + fn from(output: CustomToolCallOutputMessage) -> Self { + Self { + id: output.id, + status: output.status, + call_id: output.call_id, + output: output.output, + } + } +} + impl From for InputContent { fn from(part: OutputMessageContent) -> Self { match part { @@ -60,10 +90,29 @@ impl ResponsesInput { /// Move request input into canonical items without normalizing tool types, /// removing items, or applying model-specific content defaults. /// Text becomes one user message, including when the text is empty. + /// Submitted tool results default to completed before persistence and model + /// lowering. This describes delivery of the result, even if its payload + /// reports an error; explicit statuses and call execution states are retained. #[must_use] pub fn into_canonical_items(self) -> Vec { match self { - Self::Items(items) => items, + Self::Items(mut items) => { + for item in &mut items { + match item { + InOutItem::Input(InputItem::FunctionCallOutput(output)) => { + output.status.get_or_insert(MessageStatus::Completed); + } + InOutItem::Input(InputItem::CustomToolCallOutput(output)) => { + output.status.get_or_insert(MessageStatus::Completed); + } + InOutItem::Input(InputItem::ShellCallOutput(output)) => { + output.status.get_or_insert(ShellCallStatus::Completed); + } + _ => {} + } + } + items + } // Reuse the existing user-message conversion only for text. Its // item-array branch also lowers custom/shell items for inference. text @ Self::Text(_) => Vec::::from(text).into_iter().map(InOutItem::Input).collect(), @@ -167,15 +216,30 @@ mod tests { use crate::utils::common::{deserialize_from_value, serialize_to_value}; use serde_json::json; + #[test] + fn canonical_results_default_to_completed_even_when_their_payload_reports_failure() { + for wire in [ + json!({"type":"function_call_output", "call_id":"call_1", "output":"error: lookup failed"}), + json!({"type":"custom_tool_call_output", "call_id":"call_1", "output":"error: lookup failed"}), + json!({"type":"shell_call_output", "call_id":"call_1", "output":[{"stdout":"", "stderr":"failed", "outcome":{"type":"exit", "exit_code":1}}]}), + ] { + let item: InOutItem = serde_json::from_value(wire.clone()).unwrap(); + let items = ResponsesInput::Items(vec![item]).into_canonical_items(); + let public = serde_json::to_value(&items[0]).unwrap(); + assert_eq!(public["status"], "completed"); + assert_eq!(public["output"], wire["output"]); + } + } + #[test] fn canonical_items_preserve_custom_shell_and_unknown_items() { let mut items: Vec = deserialize_from_value(json!([ {"type":"custom_tool_call", "id":"ctc_notes", "call_id":"notes", "name":"record_notes", "input":"note"}, - {"type":"custom_tool_call_output", "call_id":"notes", "output":"recorded"}, + {"type":"custom_tool_call_output", "call_id":"notes", "output":"recorded", "status":"in_progress"}, {"type":"shell_call", "id":"sh_test", "call_id":"shell", "action":{ "commands":["pwd"], "timeout_ms":1000, "max_output_length":1024 }}, - {"type":"shell_call_output", "call_id":"shell", "output":[{ + {"type":"shell_call_output", "call_id":"shell", "status":"incomplete", "output":[{ "stdout":"/tmp", "stderr":"", "outcome":{"type":"exit", "exit_code":0} }]} ])) @@ -211,7 +275,7 @@ mod tests { #[test] fn canonical_items_keep_media_defaults_separate_from_model_normalization() { let input: ResponsesInput = deserialize_from_value(json!([ - {"type":"custom_tool_call_output", "call_id":"notes", "output":"recorded"}, + {"type":"custom_tool_call_output", "call_id":"notes", "output":"recorded", "status":"in_progress"}, {"role":"user", "content":[{"type":"input_image", "image_url":"data:image/png;base64,test"}]} ])) .unwrap(); diff --git a/crates/agentic-server-core/src/types/io/item.rs b/crates/agentic-server-core/src/types/io/item.rs index 0426919f1..69fe374ac 100644 --- a/crates/agentic-server-core/src/types/io/item.rs +++ b/crates/agentic-server-core/src/types/io/item.rs @@ -3,7 +3,9 @@ mod item_id; use std::borrow::Cow; +use std::str::FromStr; +use serde::de::IntoDeserializer; use serde::{Deserialize, Serialize}; #[cfg(feature = "openapi")] use utoipa::{ @@ -11,7 +13,8 @@ use utoipa::{ openapi::{Ref, RefOr, schema::Schema}, }; -use super::{InputItem, OutputItem}; +use super::{InputContent, InputItem, InputMessageContent, InputTextContent, OutputItem}; +use crate::types::event::MessageStatus; use crate::utils::common::serialize_to_value; /// An input or output item retained in request, response, or conversation history. @@ -59,6 +62,22 @@ impl From for InOutItem { } impl InOutItem { + /// Assign the stored public identity and expand shorthand message content. + /// This consumes the returned copy; retained model history is not modified. + #[must_use] + pub(crate) fn into_public(mut self, id: String) -> Self { + self.set_id(id); + if let Self::Input(InputItem::Message(message)) = &mut self { + message.status.get_or_insert(MessageStatus::Completed); + if let InputMessageContent::Text(text) = &mut message.content { + message.content = InputMessageContent::Parts(vec![InputContent::InputText(InputTextContent::new( + std::mem::take(text), + ))]); + } + } + self + } + /// Borrow an input record or project a public output using the existing continuation conversion. pub(crate) fn as_input(&self) -> Option> { match self { @@ -99,5 +118,205 @@ impl InOutItem { } } +/// Response for listing items with pagination. +#[derive(Debug, Clone, Serialize)] +#[cfg_attr(feature = "openapi", derive(utoipa::ToSchema))] +pub struct ListItemsResponse { + /// Object type, always "list". + pub object: String, + + /// Items in this page. + pub data: Vec, + + /// Whether there are more items available. + pub has_more: bool, + + /// ID of the first item in this page. + pub first_id: Option, + + /// ID of the last item in this page. + pub last_id: Option, +} + +/// Ordering for item pages. +#[derive(Debug, Clone, Copy, Default, PartialEq, Eq, Serialize, Deserialize)] +#[serde(rename_all = "lowercase")] +#[cfg_attr(feature = "openapi", derive(utoipa::ToSchema))] +pub enum ItemOrder { + Asc, + #[default] + Desc, +} + +/// Page size for item listings, validated to `0..=100`. +/// Conversation listings additionally require a nonzero limit. +#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)] +#[serde(try_from = "i64", into = "i64")] +pub struct ItemLimit(u8); + +impl ItemLimit { + /// The number of items a page holds. + #[must_use] + pub fn get(self) -> usize { + usize::from(self.0) + } + + /// One extra item determines whether another page follows. + #[must_use] + pub fn probe(self) -> i64 { + i64::from(self.0) + 1 + } +} + +impl Default for ItemLimit { + fn default() -> Self { + Self(20) + } +} + +impl TryFrom for ItemLimit { + type Error = InvalidItemLimit; + + fn try_from(value: i64) -> Result { + if value < 0 { + return Err(InvalidItemLimit::BelowMinimum); + } + if value > 100 { + return Err(InvalidItemLimit::AboveMaximum); + } + u8::try_from(value) + .map(Self) + .map_err(|_| InvalidItemLimit::AboveMaximum) + } +} + +impl From for i64 { + fn from(limit: ItemLimit) -> Self { + Self::from(limit.0) + } +} + +/// A page size outside `0..=100`. +#[derive(Debug, Clone, Copy, PartialEq, Eq, thiserror::Error)] +pub enum InvalidItemLimit { + #[error("limit must be at least 0")] + BelowMinimum, + #[error("limit must be at most 100")] + AboveMaximum, +} + +impl InvalidItemLimit { + /// Machine-readable code for an invalid page size. + #[must_use] + pub fn code(&self) -> &'static str { + match self { + Self::BelowMinimum => "integer_below_min_value", + Self::AboveMaximum => "integer_above_max_value", + } + } +} + +/// Validated pagination for item listings. +#[derive(Debug, Clone, Copy, Default, PartialEq, Eq)] +pub struct ItemPage<'a> { + pub limit: ItemLimit, + /// Public ID of the last item on the previous page. + pub after: Option<&'a str>, + pub order: ItemOrder, +} + +/// Extra item fields a listing can be asked to include, as `OpenAI` defines them. +#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)] +#[cfg_attr(feature = "openapi", derive(utoipa::ToSchema))] +pub enum ItemInclude { + #[serde(rename = "file_search_call.results")] + FileSearchCallResults, + #[serde(rename = "web_search_call.results")] + WebSearchCallResults, + #[serde(rename = "web_search_call.action.sources")] + WebSearchCallActionSources, + #[serde(rename = "message.input_image.image_url")] + MessageInputImageUrl, + #[serde(rename = "computer_call_output.output.image_url")] + ComputerCallOutputImageUrl, + #[serde(rename = "code_interpreter_call.outputs")] + CodeInterpreterCallOutputs, + #[serde(rename = "reasoning.encrypted_content")] + ReasoningEncryptedContent, + #[serde(rename = "message.output_text.logprobs")] + MessageOutputTextLogprobs, +} + +impl FromStr for ItemInclude { + type Err = serde::de::value::Error; + + fn from_str(value: &str) -> Result { + Self::deserialize(value.into_deserializer()) + } +} + +/// Response for successful deletion. +#[derive(Debug, Clone, Serialize, Deserialize)] +#[cfg_attr(feature = "openapi", derive(utoipa::ToSchema))] +pub struct DeletedResponse { + /// ID of the deleted resource. + pub id: String, + + /// Object type. + pub object: String, + + /// Whether the deletion was successful. + pub deleted: bool, +} + +impl ListItemsResponse { + /// Create a new list response. + #[must_use] + pub fn new(data: Vec, has_more: bool) -> Self { + let first_id = data.first().and_then(InOutItem::id).map(str::to_owned); + let last_id = data.last().and_then(InOutItem::id).map(str::to_owned); + + Self { + object: "list".to_string(), + data, + has_more, + first_id, + last_id, + } + } +} + +impl DeletedResponse { + /// Create a deleted response resource. + #[must_use] + pub fn response(id: String) -> Self { + Self { + id, + object: "response.deleted".to_string(), + deleted: true, + } + } + + /// Create a deleted conversation response. + #[must_use] + pub fn conversation(id: String) -> Self { + Self { + id, + object: "conversation.deleted".to_string(), + deleted: true, + } + } + + /// Create a deleted item response. + #[must_use] + pub fn item(id: String) -> Self { + Self { + id, + object: "conversation.item.deleted".to_string(), + deleted: true, + } + } +} + #[cfg(test)] mod tests; diff --git a/crates/agentic-server-core/src/types/io/item/item_id.rs b/crates/agentic-server-core/src/types/io/item/item_id.rs index 1a9644ecc..426733759 100644 --- a/crates/agentic-server-core/src/types/io/item/item_id.rs +++ b/crates/agentic-server-core/src/types/io/item/item_id.rs @@ -1,6 +1,6 @@ //! Typed public item identities and their known type-specific prefixes. -use crate::types::io::{InputItem, OutputItem}; +use crate::types::io::{InOutItem, InputItem, OutputItem}; impl InputItem { /// Returns the public ID carried by this input item, when present. @@ -22,10 +22,10 @@ impl InputItem { Self::Compaction(item) => item.id.as_deref(), Self::WebSearchCall(item) => Some(&item.id), Self::McpCall(item) => Some(&item.id), - Self::FunctionCallOutput(_) - | Self::ToolSearchOutput(_) - | Self::CustomToolCallOutput(_) - | Self::CompactionTrigger => None, + Self::ToolSearchOutput(item) => item.id.as_deref(), + Self::CustomToolCallOutput(item) => item.id.as_deref(), + Self::FunctionCallOutput(item) => item.id.as_deref(), + Self::CompactionTrigger => None, } } @@ -38,7 +38,7 @@ impl InputItem { Self::MultiAgentCallOutput(_) => Some("maco_"), Self::AgentMessage(_) => Some("amsg_"), Self::Message(_) => Some("msg_"), - Self::FunctionCall(_) => Some("fc_"), + Self::FunctionCall(_) | Self::FunctionCallOutput(_) => Some("fc_"), Self::CodeInterpreterCall(_) => Some("ci_"), Self::ToolSearchCall(_) => Some("tsc_"), Self::CustomToolCall(_) => Some("ctc_"), @@ -48,11 +48,10 @@ impl InputItem { Self::Compaction(_) => Some("cmp_"), Self::WebSearchCall(_) => Some("ws_"), Self::McpCall(_) => Some("mcp_"), - Self::ShellCallOutput(_) - | Self::FunctionCallOutput(_) - | Self::ToolSearchOutput(_) - | Self::CustomToolCallOutput(_) - | Self::CompactionTrigger => None, + Self::ShellCallOutput(_) => Some("sho_"), + Self::CustomToolCallOutput(_) => Some("ctco_"), + Self::ToolSearchOutput(_) => Some("tso_"), + Self::CompactionTrigger => None, } } } @@ -103,3 +102,58 @@ impl OutputItem { } } } + +impl InOutItem { + /// The item's public identity, when supplied or assigned by storage. + #[must_use] + pub fn id(&self) -> Option<&str> { + match self { + Self::Input(item) => item.id(), + Self::Output(item) => item.id(), + } + } + + /// Assign the public resource identity without changing the item kind or payload. + pub(crate) fn set_id(&mut self, id: String) { + match self { + Self::Input(item) => match item { + InputItem::MultiAgentCall(item) => item.id = Some(id), + InputItem::MultiAgentCallOutput(item) => item.id = Some(id), + InputItem::AgentMessage(item) => item.id = Some(id), + InputItem::Message(item) => item.id = Some(id), + InputItem::FunctionCall(item) => item.id = Some(id), + InputItem::ShellCall(item) => item.id = Some(id), + InputItem::ShellCallOutput(item) => item.id = Some(id), + InputItem::Compaction(item) => item.id = Some(id), + InputItem::ToolSearchOutput(item) => item.id = Some(id), + InputItem::CustomToolCallOutput(item) => item.id = Some(id), + InputItem::CodeInterpreterCall(item) => item.id = id, + InputItem::ToolSearchCall(item) => item.id = id, + InputItem::CustomToolCall(item) => item.id = id, + InputItem::Reasoning(item) => item.id = id, + InputItem::McpListTools(item) => item.id = id, + InputItem::WebSearchCall(item) => item.id = id, + InputItem::McpCall(item) => item.id = id, + InputItem::FunctionCallOutput(item) => item.id = Some(id), + InputItem::CompactionTrigger => {} + }, + Self::Output(item) => match item { + OutputItem::MultiAgentCall(item) => item.id = id, + OutputItem::MultiAgentCallOutput(item) => item.id = id, + OutputItem::AgentMessage(item) => item.id = id, + OutputItem::Message(item) => item.id = id, + OutputItem::FunctionCall(item) => item.id = id, + OutputItem::CodeInterpreterCall(item) => item.id = id, + OutputItem::ToolSearchCall(item) => item.id = id, + OutputItem::CustomToolCall(item) => item.id = id, + OutputItem::WebSearchCall(item) => item.id = id, + OutputItem::McpCall(item) => item.id = id, + OutputItem::McpListTools(item) => item.id = id, + OutputItem::Reasoning(item) => item.id = id, + OutputItem::ShellCall(item) => item.id = Some(id), + OutputItem::Compaction(item) => item.id = Some(id), + OutputItem::Unknown => {} + }, + } + } +} diff --git a/crates/agentic-server-core/src/types/io/item/tests.rs b/crates/agentic-server-core/src/types/io/item/tests.rs index 77db83ebc..e1f14e55d 100644 --- a/crates/agentic-server-core/src/types/io/item/tests.rs +++ b/crates/agentic-server-core/src/types/io/item/tests.rs @@ -210,3 +210,112 @@ fn preserves_gateway_call_input_and_rejects_unknown_types() { assert!(serde_json::from_value::(json!({"type":"future_item", "payload":42})).is_err()); assert!(serde_json::from_value::(json!({"type":"function_call_output"})).is_err()); } + +#[test] +fn item_resource_has_one_id_and_flattened_content() { + let item: InOutItem = + serde_json::from_value(json!({"type":"message", "id":"upstream_id", "role":"user", "content":"hello"})) + .unwrap(); + let resource = item.into_public("item_stored".into()); + let text = serde_json::to_string(&resource).unwrap(); + assert_eq!(text.matches("\"id\"").count(), 1); + let actual: serde_json::Value = serde_json::from_str(&text).unwrap(); + assert_eq!(actual["id"], "item_stored"); + assert_eq!(actual["type"], "message"); + assert_eq!(actual["status"], "completed"); + assert_eq!(actual["content"], json!([{"type":"input_text", "text":"hello"}])); + assert!(actual.get("item").is_none()); +} + +#[test] +fn function_call_history_status_is_preserved() { + for wire in [ + json!({"type":"function_call","call_id":"call_1","name":"lookup","arguments":"{}"}), + json!({"type":"function_call","call_id":"call_1","name":"lookup","arguments":"{}","status":"completed"}), + ] { + let item: InOutItem = serde_json::from_value(wire.clone()).unwrap(); + let public = serde_json::to_value(item.into_public("fc_history".into())).unwrap(); + assert_eq!(public.get("status"), wire.get("status")); + assert_eq!(public["call_id"], "call_1"); + } +} + +#[test] +fn manually_added_assistant_shorthand_remains_input_text() { + let item: InOutItem = serde_json::from_value(json!({"type":"message", "role":"assistant", "content":"9"})).unwrap(); + let resource = item.into_public("msg_manual".into()); + let actual = serde_json::to_value(resource).unwrap(); + assert_eq!(actual["role"], "assistant"); + assert_eq!(actual["content"], json!([{"type":"input_text", "text":"9"}])); +} + +#[test] +fn public_item_ids_are_typed_and_preserve_tool_and_orchestration_payloads() { + for wire in [ + json!({"type":"custom_tool_call_output", "id":"old", "call_id":"call_1", "output":"done", "status":"in_progress"}), + json!({"type":"tool_search_output", "id":"old", "call_id":"call_1", "tools":[]}), + json!({"type":"web_search_call", "id":"old", "status":"completed", "action":{"type":"search", "query":"weather"}}), + json!({"type":"mcp_list_tools", "id":"old", "server_label":"weather", "tools":[]}), + json!({"type":"compaction", "id":"old", "encrypted_content":"opaque"}), + ] { + let item: InOutItem = serde_json::from_value(wire).unwrap(); + assert_eq!(item.id(), Some("old")); + let mut expected = serde_json::to_value(&item).unwrap(); + expected["id"] = json!("stored"); + let public = item.into_public("stored".into()); + assert_eq!(public.id(), Some("stored")); + assert_eq!(serde_json::to_value(public).unwrap(), expected); + } + + let item = InOutItem::Output(OutputItem::Message(OutputMessage::new( + "upstream", + MessageStatus::Completed, + ))); + let mut expected = serde_json::to_value(&item).unwrap(); + expected["id"] = json!("stored"); + let public = item.into_public("stored".into()); + assert!(matches!(public, InOutItem::Output(_))); + assert_eq!(serde_json::to_value(public).unwrap(), expected); +} + +#[test] +fn item_limit_serde_preserves_bounds() { + for value in [0_i64, 20, 100] { + let limit: ItemLimit = serde_json::from_value(json!(value)).unwrap(); + assert_eq!(i64::from(limit), value); + assert_eq!(serde_json::to_value(limit).unwrap(), value); + } + for value in [json!(-1), json!(101), json!(1.5)] { + assert!(serde_json::from_value::(value).is_err()); + } +} + +#[test] +fn empty_pages_match_wire_contract() { + assert_eq!( + serde_json::to_value(ListItemsResponse::new(vec![], false)).unwrap(), + json!({"object":"list", "data":[], "has_more":false, "first_id":null, "last_id":null}) + ); +} + +#[test] +fn public_items_preserve_failed_and_incomplete_tool_states() { + for wire in [ + json!({"type":"code_interpreter_call", "id":"ci_1", "container_id":"cntr_1", "code":"1/0", "outputs":[], "status":"failed"}), + json!({"type":"web_search_call", "id":"ws_1", "action":{"type":"search", "query":"weather"}, "status":"failed"}), + json!({"type":"tool_search_call", "id":"tsc_1", "call_id":"call_1", "arguments":{}, "status":"incomplete"}), + json!({"type":"tool_search_output", "id":"tso_1", "call_id":"call_1", "tools":[], "status":"incomplete"}), + json!({"type":"mcp_call", "id":"mcp_1", "server_label":"weather", "name":"forecast", "arguments":"{}", "error":"unavailable", "status":"failed"}), + json!({"type":"shell_call_output", "id":"sho_1", "call_id":"call_1", "output":[], "status":"incomplete"}), + json!({"type":"function_call_output", "id":"fc_1", "call_id":"call_1", "output":"partial", "status":"in_progress"}), + json!({"type":"custom_tool_call_output", "id":"ctco_1", "call_id":"call_1", "output":"partial", "status":"in_progress"}), + ] { + let item: InOutItem = serde_json::from_value(wire).unwrap(); + let mut expected = serde_json::to_value(&item).unwrap(); + expected["id"] = json!("stored"); + assert_eq!( + serde_json::to_value(item.into_public("stored".into())).unwrap(), + expected + ); + } +} diff --git a/crates/agentic-server-core/src/types/io/mod.rs b/crates/agentic-server-core/src/types/io/mod.rs index b8be1f29d..d76e027c9 100644 --- a/crates/agentic-server-core/src/types/io/mod.rs +++ b/crates/agentic-server-core/src/types/io/mod.rs @@ -1,7 +1,9 @@ pub mod code_interpreter; pub mod input; mod item; -pub use item::InOutItem; +pub use item::{ + DeletedResponse, InOutItem, InvalidItemLimit, ItemInclude, ItemLimit, ItemOrder, ItemPage, ListItemsResponse, +}; pub mod multi_agent; pub mod output; pub mod reasoning; diff --git a/crates/agentic-server-core/src/types/mod.rs b/crates/agentic-server-core/src/types/mod.rs index 3872de462..3b14c7db0 100644 --- a/crates/agentic-server-core/src/types/mod.rs +++ b/crates/agentic-server-core/src/types/mod.rs @@ -8,9 +8,9 @@ pub mod request_response; pub mod tools; pub use conversations::{ - ConversationResponse, CreateConversationRequest, CreateItemRequest, DeletedResponse, ItemResponse, - ListItemsResponse, UpdateConversationRequest, + ConversationResponse, CreateConversationRequest, CreateItemRequest, UpdateConversationRequest, }; + pub use io::{ AllowedTool, AllowedToolsMode, CodeInterpreterCall, CodeInterpreterCallOutput, CodeInterpreterCallStatus, CodeInterpreterCallStreamEvent, CompactionItem, CustomToolCall, CustomToolCallOutputMessage, FunctionTool, @@ -25,6 +25,7 @@ pub use io::{ WebSearchActionFindInPage, WebSearchActionOpenPage, WebSearchActionSearch, WebSearchCall, WebSearchCallStatus, WebSearchSource, }; +pub use io::{DeletedResponse, ListItemsResponse}; pub use request_response::{ CompactRequest, CompactedResponse, ContextManagement, IncompleteDetails, ReasoningConfig, RequestPayload, ResponsePayload, ResponseTextConfig, ResponseTextFormat, UpstreamRequest, UpstreamTool, diff --git a/crates/agentic-server-core/tests/cassettes/README.md b/crates/agentic-server-core/tests/cassettes/README.md index 79eb78adc..9e49482a0 100644 --- a/crates/agentic-server-core/tests/cassettes/README.md +++ b/crates/agentic-server-core/tests/cassettes/README.md @@ -37,6 +37,138 @@ printf 'What did I just show you?\n' | python tests/cassettes/record_cassette.py The recorder scripts (`record_reasoning_cassettes.sh`, `record_tool_call_cassettes.sh`, etc.) use `printf` to feed fixed prompts per test so no manual input is needed. +`record_responses_api_cassettes.sh` extends the existing recorder's `items` mode. +Each provider gets one flat `turns` list per suite, using the same capture format as +`cassettes/conversations`. Individual edge probes record the observed status rather +than assuming that OpenAI and the gateway accept the same requests. + +| `RESPONSES_SCENARIO` | HTTP turns | Coverage | +| --- | --- | --- | +| `lifecycle` | 19 | Stored parent/child responses, input pages, retrieval, parent deletion, child visibility, continued inference after deletion, repeated deletion. | +| `pagination` | 16 | Ascending, descending and default order; one-item pages; limit 100; cursors at the end; a cursor from an unrelated response. | +| `edge-cases` | 23 | Unstored/missing IDs; missing parent; invalid, repeated and out-of-range query parameters; unknown and repeated includes; repeated deletion. | +| `conversation` | 19 | Responses attached to a conversation, manual item insertion/deletion, snapshots before and after mutations, response deletion, conversation deletion. | +| `replayed-items` | 14 | Generated-ID reuse, two copies of an ID with different content, wrong-prefix IDs, function call/output history without public item IDs, seed immutability after probes. | +| `tool-items` | 48 plus additional pages | Replay existing parallel builtin/client/mixed tools, shell, code interpreter, tool search, and the multi-agent review task; inspect complete input pages after each response and a final continuation. | + +From the worktree root, with an inference server already running: + +```bash +# One-time recorder dependencies. +uv venv .venv +uv pip install --python .venv/bin/python -r crates/agentic-server-core/tests/cassettes/recorder-requirements.txt + +# Start the release gateway in a separate terminal; persistence must be enabled. +AGENTIC_API_HOME=/home/akk/maral/res/.agentic-api \ + ./target/release/agentic-server --llm-api-base http://127.0.0.1:5050 --gateway-port 9000 + +# Load credentials without printing them. Record each provider independently. +set -a; source /home/akk/maral/res/.env; set +a +RESPONSES_RECORD_SET=openai OPENAI_MODEL=gpt-4.1 \ + bash crates/agentic-server-core/tests/cassettes/record_responses_api_cassettes.sh +RESPONSES_RECORD_SET=gateway GATEWAY_MODEL=Qwen/Qwen3.8-27B-FP8 GATEWAY_URL=http://127.0.0.1:9000 \ + bash crates/agentic-server-core/tests/cassettes/record_responses_api_cassettes.sh + +# Replay both providers' recordings through the actual gateway handlers. +cargo build --locked -p agentic-server --bin agentic-server +cargo test --locked -p agentic-server-core --test responses_api_test +``` + +Use the exact model alias served by your inference engine for `GATEWAY_MODEL`. +`RESPONSES_SCENARIO=all` is the default; select any row above to replace only that suite. +`RESPONSES_STREAM_MODE=nonstreaming` is the default. Set `streaming` or `both` to +exercise streamed response creation as well; management calls still return JSON. +The `replayed-items` suite keeps admission probes non-streaming so rejected request +bodies remain inspectable, while its seed response follows the selected mode. +Files are named `responses/response--.yaml`, with `-stream` +appended to the scenario for streaming runs. Incomplete recordings remain `.yaml.tmp` +and do not replace a previously validated capture. + +The `tool-items` suite uses `replay_old_cassettes.py` through the shared recorder. +It replays the original tool-enabled requests from the non-streaming OpenAI +`parallel_tool_calls/` builtin-only, client-only and mixed suites, plus `shell/` +and `code_interpreter/`, `tool_search/`, and only the `multi_agent/` review case. MCP uses the public documentation-search server declared +in the parallel fixture. Client outputs use the existing simulated tool callbacks +with the live response's calls and IDs; no shell commands are executed. + +Each successful creation is followed by `GET /responses/{id}/input_items`, +following `has_more` and `last_id` until the complete input history is captured. +A final continuation resolves pending client calls and makes the preceding output +visible in the next input-items page. Rejected creations are recorded and end that +scenario, so configuration failures can produce fewer than 48 HTTP turns. Pagination +can produce additional GET requests even with `limit=100`. These +captures use JSON even when both transports are selected. To refresh them: + +```bash +RESPONSES_RECORD_SET=all RESPONSES_SCENARIO=tool-items OPENAI_MODEL=gpt-5.6 \ + GATEWAY_MODEL=Qwen/Qwen3.8-27B-FP8 \ + bash crates/agentic-server-core/tests/cassettes/record_responses_api_cassettes.sh +``` + +For the review case, `OPENAI_MULTI_AGENT_MODEL` defaults to `gpt-5.6-sol`; the +recorder preserves the fixture's multi-agent beta header. Gateway cases always use +`GATEWAY_MODEL`. Tool-search continuations reuse the fixture's discovered definitions +and client output callbacks through the shared recorder. + +The gateway needs MCP access to the fixture's server and an enabled code-interpreter +runtime to complete those cases. Recorded failures do not establish tool parity. + +`recorded_tool_execution_ids_and_statuses` checks both provider captures, including +complete pagination, tool item ID prefixes and statuses, and parent output identity +in continuation input pages. The live gateway replays cover the five +management suites plus client-tool and tool-search input pages from the gateway execution capture. +Those tool replays assert result IDs and completed statuses against the OpenAI +contract even when the older gateway capture lacks those fields. OpenAI's opaque +reasoning cannot serve as vLLM inference history, so the live client-tool replay +uses the gateway's own recorded reasoning without dropping it. Separate web-search +and MCP execution regressions verify that stored tool call/result pairs remain in +both inference history and input-item listings. + +The refreshed gateway capture contains 48 successful HTTP exchanges, including code +interpreter, tool search, and the multi-agent review case. All fifteen tool and +orchestration item types match the OpenAI reference's ID-prefix and status contracts; +parent output identities are preserved in continuation input pages. The Rust replay +executes the client function/custom, shell, and tool-search flows (13 Responses +requests plus their input pages) through a local gateway with inference mocked. +This validates the recorded successful flows, not every possible tool failure. + +`HTTP_READ_TIMEOUT` overrides the recorder's upstream read timeout. Tool-item +recordings default to 900 seconds, matching the existing multi-agent recorder; +other management scenarios default to 300 seconds. + +`RESPONSES_CASSETTES_DIR` overrides the output/replay directory and +`RECORDER_PROXY_PORT` overrides the local proxy port (default 7070). +Repeated query values are retained as arrays in `request.query_params`; a single +value remains a string. No observed response body or status is rewritten. + +The Rust tests require the five original suites for both providers in JSON and streaming mode. +They assert the recordings directly, then replay every management request through +a local gateway process with only inference mocked. `RESPONSES_GATEWAY_BIN` can +select an explicitly built binary; otherwise the tests use `agentic-server` from +the Cargo profile directory. Error `type`, `code`, and `param` are checked against +the OpenAI reference. Log probabilities are excluded from item comparisons. +The lifecycle suite also checks that the continuation retains the surviving child's +history and new user message after parent deletion, and inspects the live gateway's +upstream request to ensure the deleted parent's user message is not sent to inference. +Client-supplied function-call status defaults remain deferred: OpenAI lists an +omitted call status as `in_progress`; these comparisons tolerate its absence while +checking other values. Function, custom, and shell result types retain their IDs +and statuses. Stored results use `fc_`, `ctco_`, and `sho_` IDs respectively. +Request input conversion fills omitted result statuses as `completed` before +persistence, without changing explicit statuses or call execution states. +Gateway-created function results receive their identity and completed status at +creation. Input-item listings return stored items without classifying gateway call/result +pairs by their projected IDs. The gateway tool capture predates removal of that +filter, so its built-in-tool pages must be re-recorded before claiming parity for +this listing behavior. The captured YAML is retained unchanged. +Stateless creation remains upstream pass-through on this branch, so its optional +`store` response field is not compared across providers; subsequent CRUD calls +verify that the response was not retained. Differences in model-generated output +are checked within each provider's pages, while client input must match across providers. + +Reference: [Responses input items](https://developers.openai.com/api/reference/resources/responses/subresources/input_items/methods/list) +and [Conversation items](https://developers.openai.com/api/reference/resources/conversations/subresources/items/methods/list). + ## Mid-turn steering exploration `record_multi_turn_steering_cassettes.sh` records OpenAI references or gateway observations of the WebSocket diff --git a/crates/agentic-server-core/tests/cassettes/record_cassette.py b/crates/agentic-server-core/tests/cassettes/record_cassette.py index a62fd31c5..8c9d6aa00 100644 --- a/crates/agentic-server-core/tests/cassettes/record_cassette.py +++ b/crates/agentic-server-core/tests/cassettes/record_cassette.py @@ -63,6 +63,8 @@ from yaml import dump as yaml_dump from yaml import safe_load as yaml_load +from replay_old_cassettes import run_tool_items + logging.basicConfig(level=logging.WARNING) logger = logging.getLogger("cassette_proxy") @@ -196,12 +198,16 @@ async def proxy_request(request: Request, path: str) -> Response: raw_body = await request.body() parsed_body = json.loads(raw_body.decode("utf-8")) if raw_body else {} + query_params = {} + for key in request.query_params: + values = request.query_params.getlist(key) + query_params[key] = values[0] if len(values) == 1 else values turn: dict[str, Any] = { "filename": filename, "request": { "method": request.method, "path": f"/{path}", - "query_params": dict(request.query_params), + "query_params": query_params, "body": parsed_body, "headers": _filter_request_headers(request.headers), }, @@ -349,12 +355,14 @@ def _item_request( path: str, *, body: dict | None = None, - params: dict | None = None, + params: dict | list[tuple[str, str]] | None = None, + headers: dict[str, str] | None = None, expected_status: int | None = 200, ) -> dict: """Send management requests through the shared recording proxy.""" response = client.request( - method, f"{proxy_url}{path}", json=body, params=params, timeout=TIMEOUT + method, f"{proxy_url}{path}", json=body, params=params, headers=headers, + timeout=_http_timeout(proxy_client=True), ) if expected_status is not None and response.status_code != expected_status: raise RuntimeError( @@ -373,13 +381,14 @@ def _item_response( conversation: str | None = None, previous_response_id: str | None = None, stream: bool = False, + store: bool = True, ) -> dict: if conversation and previous_response_id: raise ValueError("conversation and previous_response_id are mutually exclusive") body: dict[str, Any] = { "model": model, "input": [{"role": "user", "content": prompt}], - "store": True, + "store": store, "stream": stream, } if conversation: @@ -419,7 +428,172 @@ def _record_duplicate_items( def run_items( client: httpx.Client, proxy_url: str, model: str, scenario: str, stream: bool ) -> None: - """Record each conversation or item API request as its own numbered step.""" + """Record each fixed Conversation Items or Responses API request as a numbered step.""" + if scenario == "response-tool-items": + run_tool_items(client, proxy_url, model, send_request=_item_request, + extract_tool_calls=_extract_tool_calls, + load_tool_outputs=_load_tool_outputs_file, + build_tool_output_input=_build_tool_output_input) + return + if scenario == "response-lifecycle": + first = _item_response(client, proxy_url, model, "Reply with only SAPPHIRE.", stream=stream) + first_path = f"/v1/responses/{first['id']}" + _item_request(client, proxy_url, "GET", f"{first_path}/input_items") + child = _item_response( + client, proxy_url, model, "Reply with only ORCHID.", + previous_response_id=first["id"], stream=stream, + ) + child_path = f"/v1/responses/{child['id']}" + child_items_path = f"{child_path}/input_items" + _item_request(client, proxy_url, "GET", child_items_path, params={"order": "asc"}) + page = _item_request( + client, proxy_url, "GET", child_items_path, + params={"order": "asc", "limit": 1}, + ) + if not page.get("last_id") or not page.get("has_more"): + raise RuntimeError(f"expected a non-final one-item input page: {page}") + _item_request( + client, proxy_url, "GET", child_items_path, + params={"order": "asc", "limit": 1, "after": page["last_id"]}, + ) + _item_request(client, proxy_url, "GET", child_path) + _item_request(client, proxy_url, "DELETE", first_path) + _item_request(client, proxy_url, "GET", first_path, expected_status=None) + _item_request(client, proxy_url, "GET", f"{first_path}/input_items", expected_status=None) + _item_request(client, proxy_url, "GET", child_items_path, params={"order": "asc"}) + _item_request(client, proxy_url, "GET", child_path) + _item_request(client, proxy_url, "DELETE", first_path, expected_status=None) + # A listing's deletion visibility does not establish what inference sees. + # Continue the surviving child before deleting it and capture both the + # model's answer and the new response's input window. + continuation = _item_response( + client, proxy_url, model, + "What exact word did the first user message ask you to reply with? Reply with only that word.", + previous_response_id=child["id"], stream=stream, + ) + continuation_path = f"/v1/responses/{continuation['id']}" + _item_request(client, proxy_url, "GET", f"{continuation_path}/input_items", params={"order": "asc"}) + _item_request(client, proxy_url, "DELETE", continuation_path) + _item_request(client, proxy_url, "DELETE", child_path) + _item_request(client, proxy_url, "GET", child_items_path, expected_status=None) + _item_request(client, proxy_url, "GET", child_path, expected_status=None) + return + if scenario == "response-pagination": + first = _item_response(client, proxy_url, model, "Reply with only SAPPHIRE.", stream=stream) + child = _item_response( + client, proxy_url, model, "Reply with only ORCHID.", + previous_response_id=first["id"], stream=stream, + ) + path = f"/v1/responses/{child['id']}/input_items" + _item_request(client, proxy_url, "GET", path, params={"order": "asc"}) + _item_request(client, proxy_url, "GET", path, params={"order": "desc"}) + for order in ("asc", "desc"): + page = _item_request(client, proxy_url, "GET", path, params={"order": order, "limit": 1}) + if not page.get("last_id") or not page.get("has_more"): + raise RuntimeError(f"expected a non-final {order} page: {page}") + _item_request( + client, proxy_url, "GET", path, + params={"order": order, "limit": 1, "after": page["last_id"]}, + ) + _item_request(client, proxy_url, "GET", path) + for order in ("asc", "desc"): + page = _item_request(client, proxy_url, "GET", path, params={"order": order, "limit": 100}) + if not page.get("last_id"): + raise RuntimeError(f"expected an input cursor: {page}") + _item_request(client, proxy_url, "GET", path, + params={"order": order, "after": page["last_id"]}, expected_status=None) + foreign = _item_response(client, proxy_url, model, "Reply with only VIOLET.", stream=stream) + foreign_page = _item_request(client, proxy_url, "GET", f"/v1/responses/{foreign['id']}/input_items") + _item_request(client, proxy_url, "GET", path, + params={"after": foreign_page["data"][0]["id"]}, expected_status=None) + return + if scenario == "response-edge-cases": + transient = _item_response(client, proxy_url, model, "Reply with only SAPPHIRE.", stream=stream, store=False) + transient_path = f"/v1/responses/{transient['id']}" + for method, path in ( + ("GET", transient_path), ("GET", f"{transient_path}/input_items"), + ("DELETE", transient_path), ("GET", "/v1/responses/resp_missing"), + ("GET", "/v1/responses/resp_missing/input_items"), + ("DELETE", "/v1/responses/resp_missing"), + ): + _item_request(client, proxy_url, method, path, expected_status=None) + _item_request( + client, proxy_url, "POST", "/v1/responses", + body={"model": model, "input": [{"role": "user", "content": "Reply with only ORCHID."}], + "previous_response_id": "resp_missing", "store": True, "stream": False}, + expected_status=None, + ) + stored = _item_response(client, proxy_url, model, "Reply with only ORCHID.", stream=stream) + path = f"/v1/responses/{stored['id']}/input_items" + for params in ( + {"limit": "0"}, {"limit": "101"}, {"order": "sideways"}, + {"after": "msg_missing"}, {"include[]": "web_search_call.results"}, + {"include[]": "message.output_text.logprobs"}, + {"limit": "-1"}, {"limit": "ten"}, {"after": ""}, + {"include[]": "not.a.valid.include"}, + [("limit", "1"), ("limit", "2")], + [("include[]", "message.output_text.logprobs"), + ("include[]", "reasoning.encrypted_content")], + ): + _item_request(client, proxy_url, "GET", path, params=params, expected_status=None) + _item_request(client, proxy_url, "DELETE", f"/v1/responses/{stored['id']}") + _item_request(client, proxy_url, "DELETE", f"/v1/responses/{stored['id']}", expected_status=None) + return + if scenario == "response-conversation": + conversation = _create_conversation(client, proxy_url) + items_path = f"/v1/conversations/{conversation}/items" + _item_request(client, proxy_url, "POST", items_path, + body={"items": [{"role": "user", "content": "Remember SAPPHIRE."}]}) + first = _item_response(client, proxy_url, model, "Reply with only SAPPHIRE.", + conversation=conversation, stream=stream) + first_path = f"/v1/responses/{first['id']}" + _item_request(client, proxy_url, "GET", f"{first_path}/input_items", params={"order": "asc"}) + added = _item_request(client, proxy_url, "POST", items_path, + body={"items": [{"role": "user", "content": "Now remember ORCHID."}]}) + _item_request(client, proxy_url, "GET", f"{first_path}/input_items", params={"order": "asc"}) + child = _item_response(client, proxy_url, model, "Reply with only ORCHID.", + conversation=conversation, stream=stream) + child_path = f"/v1/responses/{child['id']}" + _item_request(client, proxy_url, "GET", f"{child_path}/input_items", params={"order": "asc"}) + _item_request(client, proxy_url, "GET", items_path, params={"order": "asc"}) + _item_request(client, proxy_url, "DELETE", f"{items_path}/{added['data'][0]['id']}") + for path in (child_path, first_path): + _item_request(client, proxy_url, "GET", f"{path}/input_items", + params={"order": "asc"}, expected_status=None) + _item_request(client, proxy_url, "DELETE", first_path) + _item_request(client, proxy_url, "GET", f"{child_path}/input_items", + params={"order": "asc"}, expected_status=None) + _item_request(client, proxy_url, "GET", items_path, params={"order": "asc"}) + _item_request(client, proxy_url, "GET", child_path, expected_status=None) + _item_request(client, proxy_url, "DELETE", f"/v1/conversations/{conversation}") + _item_request(client, proxy_url, "GET", f"{child_path}/input_items", expected_status=None) + _item_request(client, proxy_url, "GET", child_path, expected_status=None) + return + if scenario == "response-replayed-items": + seed = _item_response(client, proxy_url, model, "Reply with only SAPPHIRE.", stream=stream) + seed_items = f"/v1/responses/{seed['id']}/input_items" + page = _item_request(client, proxy_url, "GET", seed_items, params={"order": "asc"}) + reused = {"type": "message", "id": page["data"][0]["id"], + "role": "user", "content": "Reply with only ORCHID."} + for items in ( + [reused], + [reused, {**reused, "content": "Reply with only VIOLET."}], + [{**reused, "id": f"item_wrongprefix_{secrets.token_hex(8)}"}], + [{"type": "function_call", "call_id": "call_history_probe", "name": "lookup", + "arguments": "{}"}, + {"type": "function_call_output", "call_id": "call_history_probe", "output": "SAPPHIRE"}, + {"role": "user", "content": "Reply with only the lookup result."}], + ): + # Probe status is evidence. On rejection, still inspect the seed to + # establish that rejected input did not mutate its stored context. + result = _item_request(client, proxy_url, "POST", "/v1/responses", + body={"model": model, "input": items, "store": True, + "stream": False}, expected_status=None) + response_id = result.get("id", seed["id"]) + _item_request(client, proxy_url, "GET", f"/v1/responses/{response_id}/input_items", + params={"order": "asc"}, expected_status=None) + _item_request(client, proxy_url, "GET", seed_items, params={"order": "asc"}) + return if scenario == "edge-cases": for item in ( { @@ -1728,9 +1902,9 @@ def run_responses( ) @click.option( "--items-scenario", - type=click.Choice(["continuation", "branch", "deletion", "pagination", "edge-cases"]), + type=click.Choice(["continuation", "branch", "deletion", "pagination", "edge-cases", "response-lifecycle", "response-pagination", "response-edge-cases", "response-conversation", "response-replayed-items", "response-tool-items"]), default="continuation", - help="Conversation item recording scenario (for --mode items).", + help="Fixed Conversation Items or Responses API scenario (for --mode items).", ) @click.option( "--branch-from", @@ -1996,7 +2170,13 @@ def main( raise click.UsageError("--max-tool-calls requires linear --mode responses without branches.") if mode == "items": - expected_turns = (10 if items_scenario == "pagination" else + expected_turns = (19 if items_scenario == "response-lifecycle" else + 16 if items_scenario == "response-pagination" else + 23 if items_scenario == "response-edge-cases" else + 19 if items_scenario == "response-conversation" else + 14 if items_scenario == "response-replayed-items" else + 48 if items_scenario == "response-tool-items" else + 10 if items_scenario == "pagination" else 6 if items_scenario == "branch" else 19 if items_scenario == "edge-cases" else 5) if turns != expected_turns: @@ -2165,7 +2345,8 @@ def main( if gateway_url: target = gateway_url.rstrip("/") - headers = {} + gateway_api_key = os.environ.get("GATEWAY_API_KEY", "") + headers = {"Authorization": f"Bearer {gateway_api_key}"} if gateway_api_key else {} backend_label = f"Gateway: {target}" elif vllm_url: target = vllm_url.rstrip("/") diff --git a/crates/agentic-server-core/tests/cassettes/record_responses_api_cassettes.sh b/crates/agentic-server-core/tests/cassettes/record_responses_api_cassettes.sh new file mode 100755 index 000000000..c229beb9f --- /dev/null +++ b/crates/agentic-server-core/tests/cassettes/record_responses_api_cassettes.sh @@ -0,0 +1,159 @@ +#!/usr/bin/env bash +# Record flat Responses API cassettes with the existing Python recorder. +# RESPONSES_RECORD_SET=all|openai|gateway; RESPONSES_SCENARIO=all|lifecycle|pagination|edge-cases|conversation|replayed-items|tool-items. +# RESPONSES_STREAM_MODE=nonstreaming|streaming|both (default: nonstreaming). +set -euo pipefail + +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +CASSETTES_DIR="${RESPONSES_CASSETTES_DIR:-$SCRIPT_DIR/responses}" +RECORD_SET="${RESPONSES_RECORD_SET:-all}" +SCENARIO="${RESPONSES_SCENARIO:-all}" +STREAM_MODE="${RESPONSES_STREAM_MODE:-nonstreaming}" +OPENAI_MODEL="${OPENAI_MODEL:-gpt-4.1}" +GATEWAY_MODEL="${GATEWAY_MODEL:-$OPENAI_MODEL}" +GATEWAY_URL="${GATEWAY_URL:-http://localhost:9000}" +WORKTREE_PYTHON="$SCRIPT_DIR/../../../../.venv/bin/python" +if [[ -x "$WORKTREE_PYTHON" ]]; then + PYTHON_BIN="${PYTHON_BIN:-$WORKTREE_PYTHON}" +else + PYTHON_BIN="${PYTHON_BIN:-python3}" +fi + +case "$RECORD_SET" in + all|openai|gateway) ;; + *) echo "RESPONSES_RECORD_SET must be all, openai, or gateway" >&2; exit 2 ;; +esac +case "$SCENARIO" in + all|lifecycle|pagination|edge-cases|conversation|replayed-items|tool-items) ;; + *) echo "RESPONSES_SCENARIO must be all, lifecycle, pagination, edge-cases, conversation, replayed-items, or tool-items" >&2; exit 2 ;; +esac +case "$STREAM_MODE" in + nonstreaming|streaming|both) ;; + *) echo "RESPONSES_STREAM_MODE must be nonstreaming, streaming, or both" >&2; exit 2 ;; +esac +if [[ "$RECORD_SET" != gateway && -z "${OPENAI_API_KEY:-}" ]]; then + echo "OPENAI_API_KEY is required for OpenAI recordings" >&2 + exit 2 +fi +if ! "$PYTHON_BIN" -c 'import click, fastapi, httpx, uvicorn, yaml' 2>/dev/null; then + echo "Recorder dependencies are missing for $PYTHON_BIN; install recorder-requirements.txt" >&2 + exit 2 +fi + +mkdir -p "$CASSETTES_DIR" +record() { + local provider="$1" scenario="$2" model="$3" transport="$4" + local turns mode destination temporary read_timeout + read_timeout="${HTTP_READ_TIMEOUT:-300}" + case "$scenario" in + lifecycle) turns=19; mode=response-lifecycle ;; + pagination) turns=16; mode=response-pagination ;; + edge-cases) turns=23; mode=response-edge-cases ;; + conversation) turns=19; mode=response-conversation ;; + replayed-items) turns=14; mode=response-replayed-items ;; + tool-items) turns=48; mode=response-tool-items; read_timeout="${HTTP_READ_TIMEOUT:-900}" ;; + esac + local suffix="" stream_flag=--no-stream + if [[ "$transport" == streaming ]]; then suffix="-stream"; stream_flag=--stream; fi + destination="$CASSETTES_DIR/response-${scenario}${suffix}-${provider}.yaml" + temporary="${destination}.tmp" + local backend=() + if [[ "$provider" == openai ]]; then + backend=(--openai https://api.openai.com) + else + backend=(--gateway "$GATEWAY_URL") + export GATEWAY_API_KEY="${GATEWAY_API_KEY:-${OPENAI_API_KEY:-}}" + fi + echo "Recording $provider/$scenario -> $destination" + rm -f "$temporary" + local multi_agent_model="$model" + if [[ "$provider" == openai ]]; then multi_agent_model="${OPENAI_MULTI_AGENT_MODEL:-gpt-5.6-sol}"; fi + RESPONSES_MULTI_AGENT_MODEL="$multi_agent_model" "$PYTHON_BIN" "$SCRIPT_DIR/record_cassette.py" \ + --mode items --items-scenario "$mode" --turns "$turns" \ + --http-read-timeout "$read_timeout" \ + --proxy-port "${RECORDER_PROXY_PORT:-7070}" --model "$model" "$stream_flag" "${backend[@]}" --output "$temporary" + "$PYTHON_BIN" - "$temporary" "$scenario" "$turns" <<'CASSETTE_CHECK' +import sys +from pathlib import Path +from yaml import safe_load + +path, scenario, count = Path(sys.argv[1]), sys.argv[2], int(sys.argv[3]) +cassette = safe_load(path.read_text()) +assert list(cassette) == ["turns"], "cassette must have one flat turns list" +turns = cassette["turns"] +assert len(turns) >= 5 if scenario == "tool-items" else len(turns) == count +assert [turn["filename"] for turn in turns] == [f"t{i}" for i in range(1, len(turns) + 1)] +for turn in turns: + assert set(turn) == {"filename", "request", "response"} + request, response = turn["request"], turn["response"] + assert {"method", "path", "query_params", "body", "headers"} <= set(request) + assert {"status_code", "headers"} <= set(response) + assert "body" in response or "sse" in response + assert request["path"].startswith(("/v1/responses", "/v1/conversations")), request["path"] + assert request["headers"].get("authorization", "Bearer ***") == "Bearer ***" + assert "transport_error" not in response, "upstream transport failed" + assert isinstance(response["status_code"], int) +first_path = "/v1/conversations" if scenario == "conversation" else "/v1/responses" +assert (turns[0]["request"]["method"], turns[0]["request"]["path"]) == ("POST", first_path) +if scenario == "lifecycle": + assert sum(turn["request"]["method"] == "DELETE" for turn in turns) == 4 + assert sum(turn["request"]["path"].endswith("/input_items") for turn in turns) == 8 +elif scenario == "pagination": + assert sum(turn["request"]["method"] == "POST" for turn in turns) == 3 + assert {"asc", "desc"} <= {turn["request"]["query_params"].get("order") for turn in turns[2:]} +elif scenario == "edge-cases": + assert turns[0]["request"]["body"]["store"] is False + assert turns[7]["request"]["body"]["previous_response_id"] == "resp_missing" + assert turns[8]["request"]["body"]["store"] is True + assert sum(turn["request"]["method"] == "DELETE" for turn in turns) == 4 +elif scenario == "conversation": + assert sum(turn["request"]["method"] == "DELETE" for turn in turns) == 3 + assert any(turn["request"]["body"].get("conversation") for turn in turns) +elif scenario == "replayed-items": + assert sum(turn["request"]["method"] == "POST" for turn in turns) == 5 + assert any(len(turn["request"]["body"].get("input", [])) == 3 for turn in turns) +elif scenario == "tool-items": + created_ids = set() + first_tools = set() + for index, turn in enumerate(turns): + request, response = turn["request"], turn["response"] + if request["method"] != "POST": + continue + body = request["body"] + if "previous_response_id" not in body and not body.get("multi_agent", {}).get("enabled"): + assert body["tools"], "tool-enabled requests must preserve declarations" + assert body["stream"] is False + if "previous_response_id" in body: + assert body["previous_response_id"] in created_ids + else: + first_tools.update(tool["type"] for tool in body.get("tools", [])) + if response["status_code"] == 200: + response_id = response["body"]["id"] + created_ids.add(response_id) + listing = turns[index + 1]["request"] + assert listing["method"] == "GET" + assert listing["path"] == f"/v1/responses/{response_id}/input_items" + assert first_tools == {"web_search_preview", "mcp", "function", "code_interpreter", "shell", "custom", "tool_search", "namespace"} +print(f"Validated {path.name}: {len(turns)} flat HTTP turns") +CASSETTE_CHECK + mv "$temporary" "$destination" +} + +for provider in openai gateway; do + if [[ "$RECORD_SET" != all && "$RECORD_SET" != "$provider" ]]; then continue; fi + if [[ "$provider" == openai ]]; then model="$OPENAI_MODEL"; else model="$GATEWAY_MODEL"; fi + for scenario in lifecycle pagination edge-cases conversation replayed-items tool-items; do + if [[ "$SCENARIO" != all && "$SCENARIO" != "$scenario" ]]; then continue; fi + # Source tool scenarios use JSON. Capture tool-items once even + # when both transports are selected. + if [[ "$scenario" == tool-items ]]; then + record "$provider" "$scenario" "$model" nonstreaming + continue + fi + for transport in nonstreaming streaming; do + if [[ "$STREAM_MODE" == both || "$STREAM_MODE" == "$transport" ]]; then + record "$provider" "$scenario" "$model" "$transport" + fi + done + done +done diff --git a/crates/agentic-server-core/tests/cassettes/replay_old_cassettes.py b/crates/agentic-server-core/tests/cassettes/replay_old_cassettes.py new file mode 100644 index 000000000..670615ac1 --- /dev/null +++ b/crates/agentic-server-core/tests/cassettes/replay_old_cassettes.py @@ -0,0 +1,76 @@ +"""Replay existing tool scenarios through the shared recorder, then list inputs.""" + +import copy +import json +import os +from pathlib import Path + +from yaml import safe_load as yaml_load + + +def run_tool_items(client, proxy_url, model, *, send_request, extract_tool_calls, + load_tool_outputs, build_tool_output_input): + root = Path(__file__).parent + references = ( + "parallel_tool_calls/parallel-builtin-only-openai-reference-gpt-5.6-nonstreaming.yaml", + "parallel_tool_calls/parallel-client-openai-reference-gpt-5.6-nonstreaming.yaml", + "parallel_tool_calls/parallel-mixed-openai-reference-gpt-5.6-nonstreaming.yaml", + "shell/shell-openai-reference-success-gpt-5.6-nonstreaming.yaml", + "code_interpreter/code-interpreter-openai-reference-gpt-5.6-nonstreaming.yaml", + "tool_search/tool-search-openai-reference-gpt-5.6-nonstreaming.yaml", + "multi_agent/multi-agent-openai-reference-review-gpt-5.6-sol-nonstreaming.yaml", + ) + for filename in references: + turns = yaml_load((root / filename).read_text(encoding="utf-8"))["turns"] + if filename.startswith("tool_search/"): + fixtures = load_tool_outputs(root / "tool_search/function_outputs.json") + search_tools = json.loads((root / "tool_search/returned_tools.json").read_text()) + else: + fixtures = load_tool_outputs(root / ("shell/scenarios.py" if filename.startswith("shell/") + else "parallel_tool_calls/tool_outputs.py")) + search_tools = None + headers = {key: value for key, value in turns[0]["request"]["headers"].items() + if key.lower() == "openai-beta"} + scenario_model = os.environ.get("RESPONSES_MULTI_AGENT_MODEL", model) if filename.startswith("multi_agent/") else model + # The last response's output appears in the following response's input + # page. Resolve any pending client calls using the existing fake tools. + followup = copy.deepcopy(turns[-1]["request"]["body"]) + followup.update(previous_response_id=turns[-1]["response"]["body"]["id"], + input="Do not call tools again. Reply only OK.", tool_choice="none") + responses = {} + for turn in [*turns, {"request": {"body": followup}}]: + body = copy.deepcopy(turn["request"]["body"]) + body.update(model=scenario_model, store=True, stream=False) + previous = body.get("previous_response_id") + if previous: + parent = responses[previous] + body["previous_response_id"] = parent["id"] + # Preserve recorded user messages, but answer the live calls; + # models can choose different batches and ordering of calls. + user_input = body["input"] + if isinstance(user_input, str): + user_input = [{"type": "message", "role": "user", "content": user_input}] + else: + user_input = [item for item in user_input if item.get("type") == "message"] + body["input"] = build_tool_output_input( + extract_tool_calls(parent), fixtures, None, search_tools + ) + user_input + print(f"[tool execution: {filename}; continuation: {bool(previous)}]", flush=True) + result = send_request(client, proxy_url, "POST", "/v1/responses", + body=body, headers=headers, expected_status=None) + if not result.get("id"): + print(f"[tool execution failed: {result.get('error')}]", flush=True) + break + params = {"order": "asc", "limit": 100} + while True: + page = send_request(client, proxy_url, "GET", f"/v1/responses/{result['id']}/input_items", + params=params, expected_status=None) + if not page.get("has_more"): + break + cursor = page.get("last_id") + if not cursor or cursor == params.get("after"): + raise RuntimeError("Input-items pagination made no progress") + params["after"] = cursor + recorded = turn.get("response", {}).get("body") + if recorded is not None: + responses[recorded["id"]] = result diff --git a/crates/agentic-server-core/tests/cassettes/responses/response-conversation-gateway.yaml b/crates/agentic-server-core/tests/cassettes/responses/response-conversation-gateway.yaml new file mode 100644 index 000000000..1d3086a70 --- /dev/null +++ b/crates/agentic-server-core/tests/cassettes/responses/response-conversation-gateway.yaml @@ -0,0 +1,1016 @@ +turns: +- filename: t1 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + content-type: application/json + user-agent: python-httpx/0.28.1 + method: POST + path: /v1/conversations + query_params: {} + response: + body: + created_at: 1792748297 + id: conv_01a16820-1c5c-76e1-b321-93d02754171d + metadata: {} + object: conversation + headers: + content-type: application/json + status_code: 200 +- filename: t2 + request: + body: + items: + - content: Remember SAPPHIRE. + role: user + headers: + accept: '*/*' + authorization: Bearer *** + content-type: application/json + user-agent: python-httpx/0.28.1 + method: POST + path: /v1/conversations/conv_01a16820-1c5c-76e1-b321-93d02754171d/items + query_params: {} + response: + body: + data: + - content: + - text: Remember SAPPHIRE. + type: input_text + id: msg_01a16820-1c68-7513-b9de-5efef8bfc898 + role: user + status: completed + type: message + first_id: msg_01a16820-1c68-7513-b9de-5efef8bfc898 + has_more: false + last_id: msg_01a16820-1c68-7513-b9de-5efef8bfc898 + object: list + headers: + content-type: application/json + status_code: 200 +- filename: t3 + request: + body: + conversation: conv_01a16820-1c5c-76e1-b321-93d02754171d + input: + - content: Reply with only SAPPHIRE. + role: user + model: Qwen/Qwen3.8-27B-FP8 + store: true + stream: false + headers: + accept: '*/*' + authorization: Bearer *** + content-type: application/json + user-agent: python-httpx/0.28.1 + method: POST + path: /v1/responses + query_params: {} + response: + body: + background: false + completed_at: 1792748298 + conversation: + id: conv_01a16820-1c5c-76e1-b321-93d02754171d + created_at: 1792748298 + error: null + frequency_penalty: 0.0 + id: resp_01a16820-1c75-7f40-9579-ee0308b75eb5 + incomplete_details: null + instructions: null + max_output_tokens: null + max_tool_calls: null + metadata: {} + model: Qwen/Qwen3.8-27B-FP8 + object: response + output: + - content: + - text: 'The user wants me to remember the word "SAPPHIRE" and then reply + with only that word. + + ' + type: reasoning_text + id: rs_80555bf008476001 + summary: [] + type: reasoning + - content: + - annotations: [] + text: ' + + + SAPPHIRE' + type: output_text + id: msg_b472515258629203 + role: assistant + status: completed + type: message + parallel_tool_calls: false + presence_penalty: 0.0 + previous_response_id: null + prompt_cache_key: null + prompt_cache_options: null + reasoning: null + safety_identifier: null + service_tier: auto + status: completed + store: true + temperature: 1.0 + text: + format: + type: text + tool_choice: auto + tools: [] + top_logprobs: 0 + top_p: 1.0 + truncation: disabled + usage: + input_tokens: 57 + input_tokens_details: + cache_write_tokens: 0 + cached_tokens: 0 + output_tokens: 30 + output_tokens_details: + reasoning_tokens: 23 + total_tokens: 87 + headers: + content-type: application/json + status_code: 200 +- filename: t4 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_01a16820-1c75-7f40-9579-ee0308b75eb5/input_items + query_params: + order: asc + response: + body: + data: + - content: + - text: Remember SAPPHIRE. + type: input_text + id: msg_01a16820-1c68-7513-b9de-5efef8bfc898 + role: user + status: completed + type: message + - content: + - text: Reply with only SAPPHIRE. + type: input_text + id: msg_01a16820-1f3a-7c03-b205-a86401a8a875 + role: user + status: completed + type: message + first_id: msg_01a16820-1c68-7513-b9de-5efef8bfc898 + has_more: false + last_id: msg_01a16820-1f3a-7c03-b205-a86401a8a875 + object: list + headers: + content-type: application/json + status_code: 200 +- filename: t5 + request: + body: + items: + - content: Now remember ORCHID. + role: user + headers: + accept: '*/*' + authorization: Bearer *** + content-type: application/json + user-agent: python-httpx/0.28.1 + method: POST + path: /v1/conversations/conv_01a16820-1c5c-76e1-b321-93d02754171d/items + query_params: {} + response: + body: + data: + - content: + - text: Now remember ORCHID. + type: input_text + id: msg_01a16820-1f6c-7d51-be19-3d1d69b74858 + role: user + status: completed + type: message + first_id: msg_01a16820-1f6c-7d51-be19-3d1d69b74858 + has_more: false + last_id: msg_01a16820-1f6c-7d51-be19-3d1d69b74858 + object: list + headers: + content-type: application/json + status_code: 200 +- filename: t6 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_01a16820-1c75-7f40-9579-ee0308b75eb5/input_items + query_params: + order: asc + response: + body: + data: + - content: + - text: Remember SAPPHIRE. + type: input_text + id: msg_01a16820-1c68-7513-b9de-5efef8bfc898 + role: user + status: completed + type: message + - content: + - text: Reply with only SAPPHIRE. + type: input_text + id: msg_01a16820-1f3a-7c03-b205-a86401a8a875 + role: user + status: completed + type: message + first_id: msg_01a16820-1c68-7513-b9de-5efef8bfc898 + has_more: false + last_id: msg_01a16820-1f3a-7c03-b205-a86401a8a875 + object: list + headers: + content-type: application/json + status_code: 200 +- filename: t7 + request: + body: + conversation: conv_01a16820-1c5c-76e1-b321-93d02754171d + input: + - content: Reply with only ORCHID. + role: user + model: Qwen/Qwen3.8-27B-FP8 + store: true + stream: false + headers: + accept: '*/*' + authorization: Bearer *** + content-type: application/json + user-agent: python-httpx/0.28.1 + method: POST + path: /v1/responses + query_params: {} + response: + body: + background: false + completed_at: 1792748298 + conversation: + id: conv_01a16820-1c5c-76e1-b321-93d02754171d + created_at: 1792748298 + error: null + frequency_penalty: 0.0 + id: resp_01a16820-1fab-7cd0-9e0a-08eb28e5769a + incomplete_details: null + instructions: null + max_output_tokens: null + max_tool_calls: null + metadata: {} + model: Qwen/Qwen3.8-27B-FP8 + object: response + output: + - content: + - text: 'The user wants me to remember "ORCHID" and reply with only that word. + + ' + type: reasoning_text + id: rs_850b00fd9650bc59 + summary: [] + type: reasoning + - content: + - annotations: [] + text: ' + + + ORCHID' + type: output_text + id: msg_967d1f143e45818e + role: assistant + status: completed + type: message + parallel_tool_calls: false + presence_penalty: 0.0 + previous_response_id: null + prompt_cache_key: null + prompt_cache_options: null + reasoning: null + safety_identifier: null + service_tier: auto + status: completed + store: true + temperature: 1.0 + text: + format: + type: text + tool_choice: auto + tools: [] + top_logprobs: 0 + top_p: 1.0 + truncation: disabled + usage: + input_tokens: 116 + input_tokens_details: + cache_write_tokens: 0 + cached_tokens: 0 + output_tokens: 25 + output_tokens_details: + reasoning_tokens: 19 + total_tokens: 141 + headers: + content-type: application/json + status_code: 200 +- filename: t8 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_01a16820-1fab-7cd0-9e0a-08eb28e5769a/input_items + query_params: + order: asc + response: + body: + data: + - content: + - text: Remember SAPPHIRE. + type: input_text + id: msg_01a16820-1c68-7513-b9de-5efef8bfc898 + role: user + status: completed + type: message + - content: + - text: Reply with only SAPPHIRE. + type: input_text + id: msg_01a16820-1f3a-7c03-b205-a86401a8a875 + role: user + status: completed + type: message + - content: + - text: 'The user wants me to remember the word "SAPPHIRE" and then reply + with only that word. + + ' + type: reasoning_text + id: rs_80555bf008476001 + summary: [] + type: reasoning + - content: + - annotations: [] + text: ' + + + SAPPHIRE' + type: output_text + id: msg_b472515258629203 + role: assistant + status: completed + type: message + - content: + - text: Now remember ORCHID. + type: input_text + id: msg_01a16820-1f6c-7d51-be19-3d1d69b74858 + role: user + status: completed + type: message + - content: + - text: Reply with only ORCHID. + type: input_text + id: msg_01a16820-220a-7ea2-a264-af426a40c9be + role: user + status: completed + type: message + first_id: msg_01a16820-1c68-7513-b9de-5efef8bfc898 + has_more: false + last_id: msg_01a16820-220a-7ea2-a264-af426a40c9be + object: list + headers: + content-type: application/json + status_code: 200 +- filename: t9 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/conversations/conv_01a16820-1c5c-76e1-b321-93d02754171d/items + query_params: + order: asc + response: + body: + data: + - content: + - text: Remember SAPPHIRE. + type: input_text + id: msg_01a16820-1c68-7513-b9de-5efef8bfc898 + role: user + status: completed + type: message + - content: + - text: Reply with only SAPPHIRE. + type: input_text + id: msg_01a16820-1f3a-7c03-b205-a86401a8a875 + role: user + status: completed + type: message + - content: + - text: 'The user wants me to remember the word "SAPPHIRE" and then reply + with only that word. + + ' + type: reasoning_text + id: rs_80555bf008476001 + summary: [] + type: reasoning + - content: + - annotations: [] + text: ' + + + SAPPHIRE' + type: output_text + id: msg_b472515258629203 + role: assistant + status: completed + type: message + - content: + - text: Now remember ORCHID. + type: input_text + id: msg_01a16820-1f6c-7d51-be19-3d1d69b74858 + role: user + status: completed + type: message + - content: + - text: Reply with only ORCHID. + type: input_text + id: msg_01a16820-220a-7ea2-a264-af426a40c9be + role: user + status: completed + type: message + - content: + - text: 'The user wants me to remember "ORCHID" and reply with only that word. + + ' + type: reasoning_text + id: rs_850b00fd9650bc59 + summary: [] + type: reasoning + - content: + - annotations: [] + text: ' + + + ORCHID' + type: output_text + id: msg_967d1f143e45818e + role: assistant + status: completed + type: message + first_id: msg_01a16820-1c68-7513-b9de-5efef8bfc898 + has_more: false + last_id: msg_967d1f143e45818e + object: list + headers: + content-type: application/json + status_code: 200 +- filename: t10 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: DELETE + path: /v1/conversations/conv_01a16820-1c5c-76e1-b321-93d02754171d/items/msg_01a16820-1f6c-7d51-be19-3d1d69b74858 + query_params: {} + response: + body: + created_at: 1792748297 + id: conv_01a16820-1c5c-76e1-b321-93d02754171d + metadata: {} + object: conversation + headers: + content-type: application/json + status_code: 200 +- filename: t11 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_01a16820-1fab-7cd0-9e0a-08eb28e5769a/input_items + query_params: + order: asc + response: + body: + data: + - content: + - text: Remember SAPPHIRE. + type: input_text + id: msg_01a16820-1c68-7513-b9de-5efef8bfc898 + role: user + status: completed + type: message + - content: + - text: Reply with only SAPPHIRE. + type: input_text + id: msg_01a16820-1f3a-7c03-b205-a86401a8a875 + role: user + status: completed + type: message + - content: + - text: 'The user wants me to remember the word "SAPPHIRE" and then reply + with only that word. + + ' + type: reasoning_text + id: rs_80555bf008476001 + summary: [] + type: reasoning + - content: + - annotations: [] + text: ' + + + SAPPHIRE' + type: output_text + id: msg_b472515258629203 + role: assistant + status: completed + type: message + - content: + - text: Now remember ORCHID. + type: input_text + id: msg_01a16820-1f6c-7d51-be19-3d1d69b74858 + role: user + status: completed + type: message + - content: + - text: Reply with only ORCHID. + type: input_text + id: msg_01a16820-220a-7ea2-a264-af426a40c9be + role: user + status: completed + type: message + first_id: msg_01a16820-1c68-7513-b9de-5efef8bfc898 + has_more: false + last_id: msg_01a16820-220a-7ea2-a264-af426a40c9be + object: list + headers: + content-type: application/json + status_code: 200 +- filename: t12 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_01a16820-1c75-7f40-9579-ee0308b75eb5/input_items + query_params: + order: asc + response: + body: + data: + - content: + - text: Remember SAPPHIRE. + type: input_text + id: msg_01a16820-1c68-7513-b9de-5efef8bfc898 + role: user + status: completed + type: message + - content: + - text: Reply with only SAPPHIRE. + type: input_text + id: msg_01a16820-1f3a-7c03-b205-a86401a8a875 + role: user + status: completed + type: message + first_id: msg_01a16820-1c68-7513-b9de-5efef8bfc898 + has_more: false + last_id: msg_01a16820-1f3a-7c03-b205-a86401a8a875 + object: list + headers: + content-type: application/json + status_code: 200 +- filename: t13 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: DELETE + path: /v1/responses/resp_01a16820-1c75-7f40-9579-ee0308b75eb5 + query_params: {} + response: + body: + deleted: true + id: resp_01a16820-1c75-7f40-9579-ee0308b75eb5 + object: response.deleted + headers: + content-type: application/json + status_code: 200 +- filename: t14 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_01a16820-1fab-7cd0-9e0a-08eb28e5769a/input_items + query_params: + order: asc + response: + body: + data: + - content: + - text: Remember SAPPHIRE. + type: input_text + id: msg_01a16820-1c68-7513-b9de-5efef8bfc898 + role: user + status: completed + type: message + - content: + - text: Reply with only SAPPHIRE. + type: input_text + id: msg_01a16820-1f3a-7c03-b205-a86401a8a875 + role: user + status: completed + type: message + - content: + - text: 'The user wants me to remember the word "SAPPHIRE" and then reply + with only that word. + + ' + type: reasoning_text + id: rs_80555bf008476001 + summary: [] + type: reasoning + - content: + - annotations: [] + text: ' + + + SAPPHIRE' + type: output_text + id: msg_b472515258629203 + role: assistant + status: completed + type: message + - content: + - text: Now remember ORCHID. + type: input_text + id: msg_01a16820-1f6c-7d51-be19-3d1d69b74858 + role: user + status: completed + type: message + - content: + - text: Reply with only ORCHID. + type: input_text + id: msg_01a16820-220a-7ea2-a264-af426a40c9be + role: user + status: completed + type: message + first_id: msg_01a16820-1c68-7513-b9de-5efef8bfc898 + has_more: false + last_id: msg_01a16820-220a-7ea2-a264-af426a40c9be + object: list + headers: + content-type: application/json + status_code: 200 +- filename: t15 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/conversations/conv_01a16820-1c5c-76e1-b321-93d02754171d/items + query_params: + order: asc + response: + body: + data: + - content: + - text: Remember SAPPHIRE. + type: input_text + id: msg_01a16820-1c68-7513-b9de-5efef8bfc898 + role: user + status: completed + type: message + - content: + - text: Reply with only SAPPHIRE. + type: input_text + id: msg_01a16820-1f3a-7c03-b205-a86401a8a875 + role: user + status: completed + type: message + - content: + - text: 'The user wants me to remember the word "SAPPHIRE" and then reply + with only that word. + + ' + type: reasoning_text + id: rs_80555bf008476001 + summary: [] + type: reasoning + - content: + - annotations: [] + text: ' + + + SAPPHIRE' + type: output_text + id: msg_b472515258629203 + role: assistant + status: completed + type: message + - content: + - text: Reply with only ORCHID. + type: input_text + id: msg_01a16820-220a-7ea2-a264-af426a40c9be + role: user + status: completed + type: message + - content: + - text: 'The user wants me to remember "ORCHID" and reply with only that word. + + ' + type: reasoning_text + id: rs_850b00fd9650bc59 + summary: [] + type: reasoning + - content: + - annotations: [] + text: ' + + + ORCHID' + type: output_text + id: msg_967d1f143e45818e + role: assistant + status: completed + type: message + first_id: msg_01a16820-1c68-7513-b9de-5efef8bfc898 + has_more: false + last_id: msg_967d1f143e45818e + object: list + headers: + content-type: application/json + status_code: 200 +- filename: t16 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_01a16820-1fab-7cd0-9e0a-08eb28e5769a + query_params: {} + response: + body: + background: false + completed_at: 1792748298 + conversation: + id: conv_01a16820-1c5c-76e1-b321-93d02754171d + created_at: 1792748298 + error: null + frequency_penalty: 0.0 + id: resp_01a16820-1fab-7cd0-9e0a-08eb28e5769a + incomplete_details: null + instructions: null + max_output_tokens: null + max_tool_calls: null + metadata: {} + model: Qwen/Qwen3.8-27B-FP8 + object: response + output: + - content: + - text: 'The user wants me to remember "ORCHID" and reply with only that word. + + ' + type: reasoning_text + id: rs_850b00fd9650bc59 + summary: [] + type: reasoning + - content: + - annotations: [] + text: ' + + + ORCHID' + type: output_text + id: msg_967d1f143e45818e + role: assistant + status: completed + type: message + parallel_tool_calls: false + presence_penalty: 0.0 + previous_response_id: null + prompt_cache_key: null + prompt_cache_options: null + reasoning: null + safety_identifier: null + service_tier: auto + status: completed + store: true + temperature: 1.0 + text: + format: + type: text + tool_choice: auto + tools: [] + top_logprobs: 0 + top_p: 1.0 + truncation: disabled + usage: + input_tokens: 116 + input_tokens_details: + cache_write_tokens: 0 + cached_tokens: 0 + output_tokens: 25 + output_tokens_details: + reasoning_tokens: 19 + total_tokens: 141 + headers: + content-type: application/json + status_code: 200 +- filename: t17 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: DELETE + path: /v1/conversations/conv_01a16820-1c5c-76e1-b321-93d02754171d + query_params: {} + response: + body: + deleted: true + id: conv_01a16820-1c5c-76e1-b321-93d02754171d + object: conversation.deleted + headers: + content-type: application/json + status_code: 200 +- filename: t18 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_01a16820-1fab-7cd0-9e0a-08eb28e5769a/input_items + query_params: {} + response: + body: + data: + - content: + - text: Reply with only ORCHID. + type: input_text + id: msg_01a16820-220a-7ea2-a264-af426a40c9be + role: user + status: completed + type: message + - content: + - text: Now remember ORCHID. + type: input_text + id: msg_01a16820-1f6c-7d51-be19-3d1d69b74858 + role: user + status: completed + type: message + - content: + - annotations: [] + text: ' + + + SAPPHIRE' + type: output_text + id: msg_b472515258629203 + role: assistant + status: completed + type: message + - content: + - text: 'The user wants me to remember the word "SAPPHIRE" and then reply + with only that word. + + ' + type: reasoning_text + id: rs_80555bf008476001 + summary: [] + type: reasoning + - content: + - text: Reply with only SAPPHIRE. + type: input_text + id: msg_01a16820-1f3a-7c03-b205-a86401a8a875 + role: user + status: completed + type: message + - content: + - text: Remember SAPPHIRE. + type: input_text + id: msg_01a16820-1c68-7513-b9de-5efef8bfc898 + role: user + status: completed + type: message + first_id: msg_01a16820-220a-7ea2-a264-af426a40c9be + has_more: false + last_id: msg_01a16820-1c68-7513-b9de-5efef8bfc898 + object: list + headers: + content-type: application/json + status_code: 200 +- filename: t19 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_01a16820-1fab-7cd0-9e0a-08eb28e5769a + query_params: {} + response: + body: + background: false + completed_at: 1792748298 + conversation: + id: conv_01a16820-1c5c-76e1-b321-93d02754171d + created_at: 1792748298 + error: null + frequency_penalty: 0.0 + id: resp_01a16820-1fab-7cd0-9e0a-08eb28e5769a + incomplete_details: null + instructions: null + max_output_tokens: null + max_tool_calls: null + metadata: {} + model: Qwen/Qwen3.8-27B-FP8 + object: response + output: + - content: + - text: 'The user wants me to remember "ORCHID" and reply with only that word. + + ' + type: reasoning_text + id: rs_850b00fd9650bc59 + summary: [] + type: reasoning + - content: + - annotations: [] + text: ' + + + ORCHID' + type: output_text + id: msg_967d1f143e45818e + role: assistant + status: completed + type: message + parallel_tool_calls: false + presence_penalty: 0.0 + previous_response_id: null + prompt_cache_key: null + prompt_cache_options: null + reasoning: null + safety_identifier: null + service_tier: auto + status: completed + store: true + temperature: 1.0 + text: + format: + type: text + tool_choice: auto + tools: [] + top_logprobs: 0 + top_p: 1.0 + truncation: disabled + usage: + input_tokens: 116 + input_tokens_details: + cache_write_tokens: 0 + cached_tokens: 0 + output_tokens: 25 + output_tokens_details: + reasoning_tokens: 19 + total_tokens: 141 + headers: + content-type: application/json + status_code: 200 diff --git a/crates/agentic-server-core/tests/cassettes/responses/response-conversation-openai.yaml b/crates/agentic-server-core/tests/cassettes/responses/response-conversation-openai.yaml new file mode 100644 index 000000000..78937cf19 --- /dev/null +++ b/crates/agentic-server-core/tests/cassettes/responses/response-conversation-openai.yaml @@ -0,0 +1,977 @@ +turns: +- filename: t1 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + content-type: application/json + user-agent: python-httpx/0.28.1 + method: POST + path: /v1/conversations + query_params: {} + response: + body: + created_at: 1792738271 + id: conv_6adb03df14c08197b2bb094ed25cf7fd0186b7532502d89f + metadata: {} + object: conversation + headers: + content-type: application/json + status_code: 200 +- filename: t2 + request: + body: + items: + - content: Remember SAPPHIRE. + role: user + headers: + accept: '*/*' + authorization: Bearer *** + content-type: application/json + user-agent: python-httpx/0.28.1 + method: POST + path: /v1/conversations/conv_6adb03df14c08197b2bb094ed25cf7fd0186b7532502d89f/items + query_params: {} + response: + body: + data: + - content: + - text: Remember SAPPHIRE. + type: input_text + id: msg_6adb03dfbae48197a061baae3f401fe40186b7532502d89f + role: user + status: completed + type: message + first_id: msg_6adb03dfbae48197a061baae3f401fe40186b7532502d89f + has_more: false + last_id: msg_6adb03dfbae48197a061baae3f401fe40186b7532502d89f + object: list + headers: + content-type: application/json + status_code: 200 +- filename: t3 + request: + body: + conversation: conv_6adb03df14c08197b2bb094ed25cf7fd0186b7532502d89f + input: + - content: Reply with only SAPPHIRE. + role: user + model: gpt-4.1 + store: true + stream: false + headers: + accept: '*/*' + authorization: Bearer *** + content-type: application/json + user-agent: python-httpx/0.28.1 + method: POST + path: /v1/responses + query_params: {} + response: + body: + access_programs: null + background: false + billing: + payer: developer + completed_at: 1792738273 + conversation: + id: conv_6adb03df14c08197b2bb094ed25cf7fd0186b7532502d89f + created_at: 1792738273 + error: null + frequency_penalty: 0.0 + id: resp_0186b7532502d89f006adb03e0cd348197a454dbacff6b234c + incomplete_details: null + instructions: null + max_output_tokens: null + max_tool_calls: null + metadata: {} + model: gpt-4.1-2025-04-14 + moderation: null + object: response + output: + - content: + - annotations: [] + logprobs: [] + text: SAPPHIRE. + type: output_text + id: msg_0186b7532502d89f006adb03e1b6608197a9104e4c499c3bb8 + role: assistant + status: completed + type: message + parallel_tool_calls: true + presence_penalty: 0.0 + previous_response_id: null + prompt_cache_key: null + prompt_cache_retention: in_memory + reasoning: + context: null + effort: null + summary: null + safety_identifier: null + service_tier: default + status: completed + store: true + temperature: 1.0 + text: + format: + type: text + verbosity: medium + tool_choice: auto + tool_usage: + image_gen: + input_tokens: 0 + input_tokens_details: + image_tokens: 0 + text_tokens: 0 + output_tokens: 0 + output_tokens_details: + image_tokens: 0 + text_tokens: 0 + total_tokens: 0 + web_search: + num_requests: 0 + tools: [] + top_logprobs: 0 + top_p: 1.0 + truncation: disabled + usage: + input_tokens: 25 + input_tokens_details: + cache_write_tokens: 0 + cached_tokens: 0 + output_tokens: 6 + output_tokens_details: + reasoning_tokens: 0 + total_tokens: 31 + user: null + headers: + content-type: application/json + status_code: 200 +- filename: t4 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_0186b7532502d89f006adb03e0cd348197a454dbacff6b234c/input_items + query_params: + order: asc + response: + body: + data: + - content: + - text: Remember SAPPHIRE. + type: input_text + id: msg_6adb03dfbae48197a061baae3f401fe40186b7532502d89f + role: user + status: completed + type: message + - content: + - text: Reply with only SAPPHIRE. + type: input_text + id: msg_0186b7532502d89f006adb03e178788197ab9cda68741a4f92 + role: user + status: completed + type: message + first_id: msg_6adb03dfbae48197a061baae3f401fe40186b7532502d89f + has_more: false + last_id: msg_0186b7532502d89f006adb03e178788197ab9cda68741a4f92 + object: list + headers: + content-type: application/json + status_code: 200 +- filename: t5 + request: + body: + items: + - content: Now remember ORCHID. + role: user + headers: + accept: '*/*' + authorization: Bearer *** + content-type: application/json + user-agent: python-httpx/0.28.1 + method: POST + path: /v1/conversations/conv_6adb03df14c08197b2bb094ed25cf7fd0186b7532502d89f/items + query_params: {} + response: + body: + data: + - content: + - text: Now remember ORCHID. + type: input_text + id: msg_6adb03e33fa0819787cbdb0d1682bd790186b7532502d89f + role: user + status: completed + type: message + first_id: msg_6adb03e33fa0819787cbdb0d1682bd790186b7532502d89f + has_more: false + last_id: msg_6adb03e33fa0819787cbdb0d1682bd790186b7532502d89f + object: list + headers: + content-type: application/json + status_code: 200 +- filename: t6 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_0186b7532502d89f006adb03e0cd348197a454dbacff6b234c/input_items + query_params: + order: asc + response: + body: + data: + - content: + - text: Remember SAPPHIRE. + type: input_text + id: msg_6adb03dfbae48197a061baae3f401fe40186b7532502d89f + role: user + status: completed + type: message + - content: + - text: Reply with only SAPPHIRE. + type: input_text + id: msg_0186b7532502d89f006adb03e178788197ab9cda68741a4f92 + role: user + status: completed + type: message + first_id: msg_6adb03dfbae48197a061baae3f401fe40186b7532502d89f + has_more: false + last_id: msg_0186b7532502d89f006adb03e178788197ab9cda68741a4f92 + object: list + headers: + content-type: application/json + status_code: 200 +- filename: t7 + request: + body: + conversation: conv_6adb03df14c08197b2bb094ed25cf7fd0186b7532502d89f + input: + - content: Reply with only ORCHID. + role: user + model: gpt-4.1 + store: true + stream: false + headers: + accept: '*/*' + authorization: Bearer *** + content-type: application/json + user-agent: python-httpx/0.28.1 + method: POST + path: /v1/responses + query_params: {} + response: + body: + access_programs: null + background: false + billing: + payer: developer + completed_at: 1792738277 + conversation: + id: conv_6adb03df14c08197b2bb094ed25cf7fd0186b7532502d89f + created_at: 1792738276 + error: null + frequency_penalty: 0.0 + id: resp_0186b7532502d89f006adb03e451988197846ca60742726a66 + incomplete_details: null + instructions: null + max_output_tokens: null + max_tool_calls: null + metadata: {} + model: gpt-4.1-2025-04-14 + moderation: null + object: response + output: + - content: + - annotations: [] + logprobs: [] + text: ORCHID. + type: output_text + id: msg_0186b7532502d89f006adb03e4f3648197b1d3d884ff5c1cf8 + role: assistant + status: completed + type: message + parallel_tool_calls: true + presence_penalty: 0.0 + previous_response_id: null + prompt_cache_key: null + prompt_cache_retention: in_memory + reasoning: + context: null + effort: null + summary: null + safety_identifier: null + service_tier: default + status: completed + store: true + temperature: 1.0 + text: + format: + type: text + verbosity: medium + tool_choice: auto + tool_usage: + image_gen: + input_tokens: 0 + input_tokens_details: + image_tokens: 0 + text_tokens: 0 + output_tokens: 0 + output_tokens_details: + image_tokens: 0 + text_tokens: 0 + total_tokens: 0 + web_search: + num_requests: 0 + tools: [] + top_logprobs: 0 + top_p: 1.0 + truncation: disabled + usage: + input_tokens: 55 + input_tokens_details: + cache_write_tokens: 0 + cached_tokens: 0 + output_tokens: 5 + output_tokens_details: + reasoning_tokens: 0 + total_tokens: 60 + user: null + headers: + content-type: application/json + status_code: 200 +- filename: t8 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_0186b7532502d89f006adb03e451988197846ca60742726a66/input_items + query_params: + order: asc + response: + body: + data: + - content: + - text: Remember SAPPHIRE. + type: input_text + id: msg_6adb03dfbae48197a061baae3f401fe40186b7532502d89f + role: user + status: completed + type: message + - content: + - text: Reply with only SAPPHIRE. + type: input_text + id: msg_0186b7532502d89f006adb03e178788197ab9cda68741a4f92 + role: user + status: completed + type: message + - content: + - annotations: [] + logprobs: [] + text: SAPPHIRE. + type: output_text + id: msg_0186b7532502d89f006adb03e1b6608197a9104e4c499c3bb8 + role: assistant + status: completed + type: message + - content: + - text: Now remember ORCHID. + type: input_text + id: msg_6adb03e33fa0819787cbdb0d1682bd790186b7532502d89f + role: user + status: completed + type: message + - content: + - text: Reply with only ORCHID. + type: input_text + id: msg_0186b7532502d89f006adb03e4899081978fb72810bff05971 + role: user + status: completed + type: message + first_id: msg_6adb03dfbae48197a061baae3f401fe40186b7532502d89f + has_more: false + last_id: msg_0186b7532502d89f006adb03e4899081978fb72810bff05971 + object: list + headers: + content-type: application/json + status_code: 200 +- filename: t9 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/conversations/conv_6adb03df14c08197b2bb094ed25cf7fd0186b7532502d89f/items + query_params: + order: asc + response: + body: + data: + - content: + - text: Remember SAPPHIRE. + type: input_text + id: msg_6adb03dfbae48197a061baae3f401fe40186b7532502d89f + role: user + status: completed + type: message + - content: + - text: Reply with only SAPPHIRE. + type: input_text + id: msg_0186b7532502d89f006adb03e178788197ab9cda68741a4f92 + role: user + status: completed + type: message + - content: + - annotations: [] + logprobs: [] + text: SAPPHIRE. + type: output_text + id: msg_0186b7532502d89f006adb03e1b6608197a9104e4c499c3bb8 + role: assistant + status: completed + type: message + - content: + - text: Now remember ORCHID. + type: input_text + id: msg_6adb03e33fa0819787cbdb0d1682bd790186b7532502d89f + role: user + status: completed + type: message + - content: + - text: Reply with only ORCHID. + type: input_text + id: msg_0186b7532502d89f006adb03e4899081978fb72810bff05971 + role: user + status: completed + type: message + - content: + - annotations: [] + logprobs: [] + text: ORCHID. + type: output_text + id: msg_0186b7532502d89f006adb03e4f3648197b1d3d884ff5c1cf8 + role: assistant + status: completed + type: message + first_id: msg_6adb03dfbae48197a061baae3f401fe40186b7532502d89f + has_more: false + last_id: msg_0186b7532502d89f006adb03e4f3648197b1d3d884ff5c1cf8 + object: list + headers: + content-type: application/json + status_code: 200 +- filename: t10 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: DELETE + path: /v1/conversations/conv_6adb03df14c08197b2bb094ed25cf7fd0186b7532502d89f/items/msg_6adb03e33fa0819787cbdb0d1682bd790186b7532502d89f + query_params: {} + response: + body: + created_at: 1792738271 + id: conv_6adb03df14c08197b2bb094ed25cf7fd0186b7532502d89f + metadata: {} + object: conversation + headers: + content-type: application/json + status_code: 200 +- filename: t11 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_0186b7532502d89f006adb03e451988197846ca60742726a66/input_items + query_params: + order: asc + response: + body: + data: + - content: + - text: Remember SAPPHIRE. + type: input_text + id: msg_6adb03dfbae48197a061baae3f401fe40186b7532502d89f + role: user + status: completed + type: message + - content: + - text: Reply with only SAPPHIRE. + type: input_text + id: msg_0186b7532502d89f006adb03e178788197ab9cda68741a4f92 + role: user + status: completed + type: message + - content: + - annotations: [] + logprobs: [] + text: SAPPHIRE. + type: output_text + id: msg_0186b7532502d89f006adb03e1b6608197a9104e4c499c3bb8 + role: assistant + status: completed + type: message + - content: + - text: Now remember ORCHID. + type: input_text + id: msg_6adb03e33fa0819787cbdb0d1682bd790186b7532502d89f + role: user + status: completed + type: message + - content: + - text: Reply with only ORCHID. + type: input_text + id: msg_0186b7532502d89f006adb03e4899081978fb72810bff05971 + role: user + status: completed + type: message + first_id: msg_6adb03dfbae48197a061baae3f401fe40186b7532502d89f + has_more: false + last_id: msg_0186b7532502d89f006adb03e4899081978fb72810bff05971 + object: list + headers: + content-type: application/json + status_code: 200 +- filename: t12 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_0186b7532502d89f006adb03e0cd348197a454dbacff6b234c/input_items + query_params: + order: asc + response: + body: + data: + - content: + - text: Remember SAPPHIRE. + type: input_text + id: msg_6adb03dfbae48197a061baae3f401fe40186b7532502d89f + role: user + status: completed + type: message + - content: + - text: Reply with only SAPPHIRE. + type: input_text + id: msg_0186b7532502d89f006adb03e178788197ab9cda68741a4f92 + role: user + status: completed + type: message + first_id: msg_6adb03dfbae48197a061baae3f401fe40186b7532502d89f + has_more: false + last_id: msg_0186b7532502d89f006adb03e178788197ab9cda68741a4f92 + object: list + headers: + content-type: application/json + status_code: 200 +- filename: t13 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: DELETE + path: /v1/responses/resp_0186b7532502d89f006adb03e0cd348197a454dbacff6b234c + query_params: {} + response: + body: + deleted: true + id: resp_0186b7532502d89f006adb03e0cd348197a454dbacff6b234c + object: response.deleted + headers: + content-type: application/json + status_code: 200 +- filename: t14 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_0186b7532502d89f006adb03e451988197846ca60742726a66/input_items + query_params: + order: asc + response: + body: + data: + - content: + - text: Remember SAPPHIRE. + type: input_text + id: msg_6adb03dfbae48197a061baae3f401fe40186b7532502d89f + role: user + status: completed + type: message + - content: + - text: Reply with only SAPPHIRE. + type: input_text + id: msg_0186b7532502d89f006adb03e178788197ab9cda68741a4f92 + role: user + status: completed + type: message + - content: + - annotations: [] + logprobs: [] + text: SAPPHIRE. + type: output_text + id: msg_0186b7532502d89f006adb03e1b6608197a9104e4c499c3bb8 + role: assistant + status: completed + type: message + - content: + - text: Now remember ORCHID. + type: input_text + id: msg_6adb03e33fa0819787cbdb0d1682bd790186b7532502d89f + role: user + status: completed + type: message + - content: + - text: Reply with only ORCHID. + type: input_text + id: msg_0186b7532502d89f006adb03e4899081978fb72810bff05971 + role: user + status: completed + type: message + first_id: msg_6adb03dfbae48197a061baae3f401fe40186b7532502d89f + has_more: false + last_id: msg_0186b7532502d89f006adb03e4899081978fb72810bff05971 + object: list + headers: + content-type: application/json + status_code: 200 +- filename: t15 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/conversations/conv_6adb03df14c08197b2bb094ed25cf7fd0186b7532502d89f/items + query_params: + order: asc + response: + body: + data: + - content: + - text: Remember SAPPHIRE. + type: input_text + id: msg_6adb03dfbae48197a061baae3f401fe40186b7532502d89f + role: user + status: completed + type: message + - content: + - text: Reply with only SAPPHIRE. + type: input_text + id: msg_0186b7532502d89f006adb03e178788197ab9cda68741a4f92 + role: user + status: completed + type: message + - content: + - annotations: [] + logprobs: [] + text: SAPPHIRE. + type: output_text + id: msg_0186b7532502d89f006adb03e1b6608197a9104e4c499c3bb8 + role: assistant + status: completed + type: message + - content: + - text: Reply with only ORCHID. + type: input_text + id: msg_0186b7532502d89f006adb03e4899081978fb72810bff05971 + role: user + status: completed + type: message + - content: + - annotations: [] + logprobs: [] + text: ORCHID. + type: output_text + id: msg_0186b7532502d89f006adb03e4f3648197b1d3d884ff5c1cf8 + role: assistant + status: completed + type: message + first_id: msg_6adb03dfbae48197a061baae3f401fe40186b7532502d89f + has_more: false + last_id: msg_0186b7532502d89f006adb03e4f3648197b1d3d884ff5c1cf8 + object: list + headers: + content-type: application/json + status_code: 200 +- filename: t16 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_0186b7532502d89f006adb03e451988197846ca60742726a66 + query_params: {} + response: + body: + access_programs: null + background: false + billing: + payer: developer + completed_at: 1792738277 + conversation: + id: conv_6adb03df14c08197b2bb094ed25cf7fd0186b7532502d89f + created_at: 1792738276 + error: null + frequency_penalty: 0.0 + id: resp_0186b7532502d89f006adb03e451988197846ca60742726a66 + incomplete_details: null + instructions: null + max_output_tokens: null + max_tool_calls: null + metadata: {} + model: gpt-4.1-2025-04-14 + moderation: null + object: response + output: + - content: + - annotations: [] + logprobs: [] + text: ORCHID. + type: output_text + id: msg_0186b7532502d89f006adb03e4f3648197b1d3d884ff5c1cf8 + role: assistant + status: completed + type: message + parallel_tool_calls: true + presence_penalty: 0.0 + previous_response_id: null + prompt_cache_key: null + prompt_cache_retention: in_memory + reasoning: + context: null + effort: null + summary: null + safety_identifier: null + service_tier: default + status: completed + store: true + temperature: 1.0 + text: + format: + type: text + verbosity: medium + tool_choice: auto + tool_usage: + image_gen: + input_tokens: 0 + input_tokens_details: + image_tokens: 0 + text_tokens: 0 + output_tokens: 0 + output_tokens_details: + image_tokens: 0 + text_tokens: 0 + total_tokens: 0 + web_search: + num_requests: 0 + tools: [] + top_logprobs: 0 + top_p: 1.0 + truncation: disabled + usage: + input_tokens: 55 + input_tokens_details: + cache_write_tokens: 0 + cached_tokens: 0 + output_tokens: 5 + output_tokens_details: + reasoning_tokens: 0 + total_tokens: 60 + user: null + headers: + content-type: application/json + status_code: 200 +- filename: t17 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: DELETE + path: /v1/conversations/conv_6adb03df14c08197b2bb094ed25cf7fd0186b7532502d89f + query_params: {} + response: + body: + deleted: true + id: conv_6adb03df14c08197b2bb094ed25cf7fd0186b7532502d89f + object: conversation.deleted + headers: + content-type: application/json + status_code: 200 +- filename: t18 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_0186b7532502d89f006adb03e451988197846ca60742726a66/input_items + query_params: {} + response: + body: + data: + - content: + - text: Reply with only ORCHID. + type: input_text + id: msg_0186b7532502d89f006adb03e4899081978fb72810bff05971 + role: user + status: completed + type: message + - content: + - text: Now remember ORCHID. + type: input_text + id: msg_6adb03e33fa0819787cbdb0d1682bd790186b7532502d89f + role: user + status: completed + type: message + - content: + - annotations: [] + logprobs: [] + text: SAPPHIRE. + type: output_text + id: msg_0186b7532502d89f006adb03e1b6608197a9104e4c499c3bb8 + role: assistant + status: completed + type: message + - content: + - text: Reply with only SAPPHIRE. + type: input_text + id: msg_0186b7532502d89f006adb03e178788197ab9cda68741a4f92 + role: user + status: completed + type: message + - content: + - text: Remember SAPPHIRE. + type: input_text + id: msg_6adb03dfbae48197a061baae3f401fe40186b7532502d89f + role: user + status: completed + type: message + first_id: msg_0186b7532502d89f006adb03e4899081978fb72810bff05971 + has_more: false + last_id: msg_6adb03dfbae48197a061baae3f401fe40186b7532502d89f + object: list + headers: + content-type: application/json + status_code: 200 +- filename: t19 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_0186b7532502d89f006adb03e451988197846ca60742726a66 + query_params: {} + response: + body: + access_programs: null + background: false + billing: + payer: developer + completed_at: 1792738277 + conversation: + id: conv_6adb03df14c08197b2bb094ed25cf7fd0186b7532502d89f + created_at: 1792738276 + error: null + frequency_penalty: 0.0 + id: resp_0186b7532502d89f006adb03e451988197846ca60742726a66 + incomplete_details: null + instructions: null + max_output_tokens: null + max_tool_calls: null + metadata: {} + model: gpt-4.1-2025-04-14 + moderation: null + object: response + output: + - content: + - annotations: [] + logprobs: [] + text: ORCHID. + type: output_text + id: msg_0186b7532502d89f006adb03e4f3648197b1d3d884ff5c1cf8 + role: assistant + status: completed + type: message + parallel_tool_calls: true + presence_penalty: 0.0 + previous_response_id: null + prompt_cache_key: null + prompt_cache_retention: in_memory + reasoning: + context: null + effort: null + summary: null + safety_identifier: null + service_tier: default + status: completed + store: true + temperature: 1.0 + text: + format: + type: text + verbosity: medium + tool_choice: auto + tool_usage: + image_gen: + input_tokens: 0 + input_tokens_details: + image_tokens: 0 + text_tokens: 0 + output_tokens: 0 + output_tokens_details: + image_tokens: 0 + text_tokens: 0 + total_tokens: 0 + web_search: + num_requests: 0 + tools: [] + top_logprobs: 0 + top_p: 1.0 + truncation: disabled + usage: + input_tokens: 55 + input_tokens_details: + cache_write_tokens: 0 + cached_tokens: 0 + output_tokens: 5 + output_tokens_details: + reasoning_tokens: 0 + total_tokens: 60 + user: null + headers: + content-type: application/json + status_code: 200 diff --git a/crates/agentic-server-core/tests/cassettes/responses/response-conversation-stream-gateway.yaml b/crates/agentic-server-core/tests/cassettes/responses/response-conversation-stream-gateway.yaml new file mode 100644 index 000000000..1dcba3d62 --- /dev/null +++ b/crates/agentic-server-core/tests/cassettes/responses/response-conversation-stream-gateway.yaml @@ -0,0 +1,1489 @@ +turns: +- filename: t1 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + content-type: application/json + user-agent: python-httpx/0.28.1 + method: POST + path: /v1/conversations + query_params: {} + response: + body: + created_at: 1792748301 + id: conv_01a16820-2b87-7c53-9bb1-676804d87fd4 + metadata: {} + object: conversation + headers: + content-type: application/json + status_code: 200 +- filename: t2 + request: + body: + items: + - content: Remember SAPPHIRE. + role: user + headers: + accept: '*/*' + authorization: Bearer *** + content-type: application/json + user-agent: python-httpx/0.28.1 + method: POST + path: /v1/conversations/conv_01a16820-2b87-7c53-9bb1-676804d87fd4/items + query_params: {} + response: + body: + data: + - content: + - text: Remember SAPPHIRE. + type: input_text + id: msg_01a16820-2b91-7bf0-8ac3-76392132d0d8 + role: user + status: completed + type: message + first_id: msg_01a16820-2b91-7bf0-8ac3-76392132d0d8 + has_more: false + last_id: msg_01a16820-2b91-7bf0-8ac3-76392132d0d8 + object: list + headers: + content-type: application/json + status_code: 200 +- filename: t3 + request: + body: + conversation: conv_01a16820-2b87-7c53-9bb1-676804d87fd4 + input: + - content: Reply with only SAPPHIRE. + role: user + model: Qwen/Qwen3.8-27B-FP8 + store: true + stream: true + headers: + accept: '*/*' + authorization: Bearer *** + content-type: application/json + user-agent: python-httpx/0.28.1 + method: POST + path: /v1/responses + query_params: {} + response: + headers: + content-type: text/event-stream; charset=utf-8 + sse: + - 'event: response.created + + ' + - 'data: {"type":"response.created","sequence_number":0,"response":{"id":"resp_01a16820-2b9b-7410-a0cb-696c5bb1db8c","created_at":1792748301,"incomplete_details":null,"instructions":null,"metadata":{},"model":"Qwen/Qwen3.8-27B-FP8","object":"response","output":[],"parallel_tool_calls":false,"temperature":1.0,"tool_choice":"none","tools":[],"top_p":1.0,"background":false,"max_output_tokens":null,"max_tool_calls":null,"previous_response_id":null,"prompt":null,"reasoning":null,"service_tier":"auto","status":"in_progress","text":{"format":{"type":"text"}},"top_logprobs":0,"truncation":"disabled","usage":null,"user":null,"presence_penalty":0.0,"frequency_penalty":0.0,"kv_transfer_params":null,"ec_transfer_params":null,"input_messages":null,"output_messages":null,"completed_at":null,"store":true,"safety_identifier":null,"prompt_cache_key":null,"prompt_cache_options":null,"error":null,"conversation":{"id":"conv_01a16820-2b87-7c53-9bb1-676804d87fd4"}}} + + ' + - ' + + ' + - 'event: response.in_progress + + ' + - 'data: {"type":"response.in_progress","sequence_number":1,"response":{"id":"resp_01a16820-2b9b-7410-a0cb-696c5bb1db8c","created_at":1792748301,"incomplete_details":null,"instructions":null,"metadata":{},"model":"Qwen/Qwen3.8-27B-FP8","object":"response","output":[],"parallel_tool_calls":false,"temperature":1.0,"tool_choice":"none","tools":[],"top_p":1.0,"background":false,"max_output_tokens":null,"max_tool_calls":null,"previous_response_id":null,"prompt":null,"reasoning":null,"service_tier":"auto","status":"in_progress","text":{"format":{"type":"text"}},"top_logprobs":0,"truncation":"disabled","usage":null,"user":null,"presence_penalty":0.0,"frequency_penalty":0.0,"kv_transfer_params":null,"ec_transfer_params":null,"input_messages":null,"output_messages":null,"completed_at":null,"store":true,"safety_identifier":null,"prompt_cache_key":null,"prompt_cache_options":null,"error":null,"conversation":{"id":"conv_01a16820-2b87-7c53-9bb1-676804d87fd4"}}} + + ' + - ' + + ' + - 'event: response.output_item.added + + ' + - 'data: {"type":"response.output_item.added","sequence_number":2,"output_index":0,"item":{"id":"rs_9c49380ef26d9800","summary":[],"type":"reasoning","content":[],"status":"in_progress"}} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"type":"response.reasoning_text.delta","sequence_number":3,"output_index":0,"content_index":0,"delta":"The","item_id":"rs_9c49380ef26d9800"} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"type":"response.reasoning_text.delta","sequence_number":4,"output_index":0,"content_index":0,"delta":" + user","item_id":"rs_9c49380ef26d9800"} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"type":"response.reasoning_text.delta","sequence_number":5,"output_index":0,"content_index":0,"delta":" + wants","item_id":"rs_9c49380ef26d9800"} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"type":"response.reasoning_text.delta","sequence_number":6,"output_index":0,"content_index":0,"delta":" + me","item_id":"rs_9c49380ef26d9800"} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"type":"response.reasoning_text.delta","sequence_number":7,"output_index":0,"content_index":0,"delta":" + to","item_id":"rs_9c49380ef26d9800"} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"type":"response.reasoning_text.delta","sequence_number":8,"output_index":0,"content_index":0,"delta":" + reply","item_id":"rs_9c49380ef26d9800"} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"type":"response.reasoning_text.delta","sequence_number":9,"output_index":0,"content_index":0,"delta":" + with","item_id":"rs_9c49380ef26d9800"} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"type":"response.reasoning_text.delta","sequence_number":10,"output_index":0,"content_index":0,"delta":" + only","item_id":"rs_9c49380ef26d9800"} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"type":"response.reasoning_text.delta","sequence_number":11,"output_index":0,"content_index":0,"delta":" + the","item_id":"rs_9c49380ef26d9800"} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"type":"response.reasoning_text.delta","sequence_number":12,"output_index":0,"content_index":0,"delta":" + word","item_id":"rs_9c49380ef26d9800"} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"type":"response.reasoning_text.delta","sequence_number":13,"output_index":0,"content_index":0,"delta":" + \"","item_id":"rs_9c49380ef26d9800"} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"type":"response.reasoning_text.delta","sequence_number":14,"output_index":0,"content_index":0,"delta":"S","item_id":"rs_9c49380ef26d9800"} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"type":"response.reasoning_text.delta","sequence_number":15,"output_index":0,"content_index":0,"delta":"AP","item_id":"rs_9c49380ef26d9800"} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"type":"response.reasoning_text.delta","sequence_number":16,"output_index":0,"content_index":0,"delta":"PH","item_id":"rs_9c49380ef26d9800"} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"type":"response.reasoning_text.delta","sequence_number":17,"output_index":0,"content_index":0,"delta":"IRE","item_id":"rs_9c49380ef26d9800"} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"type":"response.reasoning_text.delta","sequence_number":18,"output_index":0,"content_index":0,"delta":"\".","item_id":"rs_9c49380ef26d9800"} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"type":"response.reasoning_text.delta","sequence_number":19,"output_index":0,"content_index":0,"delta":"\n","item_id":"rs_9c49380ef26d9800"} + + ' + - ' + + ' + - 'event: response.reasoning_text.done + + ' + - 'data: {"type":"response.reasoning_text.done","sequence_number":20,"output_index":0,"content_index":0,"item_id":"rs_9c49380ef26d9800","text":"The + user wants me to reply with only the word \"SAPPHIRE\".\n"} + + ' + - ' + + ' + - 'event: response.output_item.done + + ' + - 'data: {"type":"response.output_item.done","sequence_number":21,"output_index":0,"item":{"id":"rs_9c49380ef26d9800","summary":[],"type":"reasoning","content":[{"text":"The + user wants me to reply with only the word \"SAPPHIRE\".\n","type":"reasoning_text"}],"status":"completed"}} + + ' + - ' + + ' + - 'event: response.output_item.added + + ' + - 'data: {"type":"response.output_item.added","sequence_number":22,"output_index":1,"item":{"id":"msg_bbe8b713e5898ffa","content":[],"role":"assistant","status":"in_progress","type":"message"}} + + ' + - ' + + ' + - 'event: response.content_part.added + + ' + - 'data: {"type":"response.content_part.added","sequence_number":23,"output_index":1,"content_index":0,"item_id":"msg_bbe8b713e5898ffa","part":{"annotations":[],"text":"","type":"output_text","logprobs":[]}} + + ' + - ' + + ' + - 'event: response.output_text.delta + + ' + - 'data: {"type":"response.output_text.delta","sequence_number":24,"output_index":1,"content_index":0,"delta":"\n\nS","item_id":"msg_bbe8b713e5898ffa","logprobs":[]} + + ' + - ' + + ' + - 'event: response.output_text.delta + + ' + - 'data: {"type":"response.output_text.delta","sequence_number":25,"output_index":1,"content_index":0,"delta":"AP","item_id":"msg_bbe8b713e5898ffa","logprobs":[]} + + ' + - ' + + ' + - 'event: response.output_text.delta + + ' + - 'data: {"type":"response.output_text.delta","sequence_number":26,"output_index":1,"content_index":0,"delta":"PH","item_id":"msg_bbe8b713e5898ffa","logprobs":[]} + + ' + - ' + + ' + - 'event: response.output_text.delta + + ' + - 'data: {"type":"response.output_text.delta","sequence_number":27,"output_index":1,"content_index":0,"delta":"IRE","item_id":"msg_bbe8b713e5898ffa","logprobs":[]} + + ' + - ' + + ' + - 'event: response.output_text.done + + ' + - 'data: {"type":"response.output_text.done","sequence_number":28,"output_index":1,"content_index":0,"item_id":"msg_bbe8b713e5898ffa","logprobs":[],"text":"\n\nSAPPHIRE"} + + ' + - ' + + ' + - 'event: response.content_part.done + + ' + - 'data: {"type":"response.content_part.done","sequence_number":29,"output_index":1,"content_index":0,"item_id":"msg_bbe8b713e5898ffa","part":{"annotations":[],"text":"\n\nSAPPHIRE","type":"output_text","logprobs":[]}} + + ' + - ' + + ' + - 'event: response.output_item.done + + ' + - 'data: {"type":"response.output_item.done","sequence_number":30,"output_index":1,"item":{"id":"msg_bbe8b713e5898ffa","content":[{"annotations":[],"text":"\n\nSAPPHIRE","type":"output_text","logprobs":[]}],"role":"assistant","status":"completed","type":"message"}} + + ' + - ' + + ' + - 'event: response.completed + + ' + - 'data: {"type":"response.completed","sequence_number":31,"response":{"id":"resp_01a16820-2b9b-7410-a0cb-696c5bb1db8c","object":"response","created_at":1792748301,"model":"Qwen/Qwen3.8-27B-FP8","status":"completed","output":[{"type":"reasoning","id":"rs_9c49380ef26d9800","content":[{"type":"reasoning_text","text":"The + user wants me to reply with only the word \"SAPPHIRE\".\n"}],"summary":[],"status":"completed"},{"type":"message","id":"msg_bbe8b713e5898ffa","role":"assistant","status":"completed","content":[{"type":"output_text","text":"\n\nSAPPHIRE","annotations":[]}]}],"usage":{"input_tokens":57,"output_tokens":24,"total_tokens":81,"input_tokens_details":{"cached_tokens":0,"cache_write_tokens":0},"output_tokens_details":{"reasoning_tokens":17}},"incomplete_details":null,"error":null,"previous_response_id":null,"conversation":{"id":"conv_01a16820-2b87-7c53-9bb1-676804d87fd4"},"instructions":null,"max_tool_calls":null,"service_tier":"auto","tools":[],"tool_choice":"auto","completed_at":1792748301,"truncation":"disabled","parallel_tool_calls":false,"text":{"format":{"type":"text"}},"top_p":1.0,"presence_penalty":0.0,"frequency_penalty":0.0,"top_logprobs":0,"temperature":1.0,"reasoning":null,"max_output_tokens":null,"store":true,"background":false,"metadata":{},"safety_identifier":null,"prompt_cache_key":null,"prompt_cache_options":null}} + + ' + - ' + + ' + - 'data: [DONE] + + ' + - ' + + ' + status_code: 200 +- filename: t4 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_01a16820-2b9b-7410-a0cb-696c5bb1db8c/input_items + query_params: + order: asc + response: + body: + data: + - content: + - text: Remember SAPPHIRE. + type: input_text + id: msg_01a16820-2b91-7bf0-8ac3-76392132d0d8 + role: user + status: completed + type: message + - content: + - text: Reply with only SAPPHIRE. + type: input_text + id: msg_01a16820-2de1-7c51-9f2f-d64870812414 + role: user + status: completed + type: message + first_id: msg_01a16820-2b91-7bf0-8ac3-76392132d0d8 + has_more: false + last_id: msg_01a16820-2de1-7c51-9f2f-d64870812414 + object: list + headers: + content-type: application/json + status_code: 200 +- filename: t5 + request: + body: + items: + - content: Now remember ORCHID. + role: user + headers: + accept: '*/*' + authorization: Bearer *** + content-type: application/json + user-agent: python-httpx/0.28.1 + method: POST + path: /v1/conversations/conv_01a16820-2b87-7c53-9bb1-676804d87fd4/items + query_params: {} + response: + body: + data: + - content: + - text: Now remember ORCHID. + type: input_text + id: msg_01a16820-2e29-7993-80a9-0eddbfed3890 + role: user + status: completed + type: message + first_id: msg_01a16820-2e29-7993-80a9-0eddbfed3890 + has_more: false + last_id: msg_01a16820-2e29-7993-80a9-0eddbfed3890 + object: list + headers: + content-type: application/json + status_code: 200 +- filename: t6 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_01a16820-2b9b-7410-a0cb-696c5bb1db8c/input_items + query_params: + order: asc + response: + body: + data: + - content: + - text: Remember SAPPHIRE. + type: input_text + id: msg_01a16820-2b91-7bf0-8ac3-76392132d0d8 + role: user + status: completed + type: message + - content: + - text: Reply with only SAPPHIRE. + type: input_text + id: msg_01a16820-2de1-7c51-9f2f-d64870812414 + role: user + status: completed + type: message + first_id: msg_01a16820-2b91-7bf0-8ac3-76392132d0d8 + has_more: false + last_id: msg_01a16820-2de1-7c51-9f2f-d64870812414 + object: list + headers: + content-type: application/json + status_code: 200 +- filename: t7 + request: + body: + conversation: conv_01a16820-2b87-7c53-9bb1-676804d87fd4 + input: + - content: Reply with only ORCHID. + role: user + model: Qwen/Qwen3.8-27B-FP8 + store: true + stream: true + headers: + accept: '*/*' + authorization: Bearer *** + content-type: application/json + user-agent: python-httpx/0.28.1 + method: POST + path: /v1/responses + query_params: {} + response: + headers: + content-type: text/event-stream; charset=utf-8 + sse: + - 'event: response.created + + ' + - 'data: {"type":"response.created","sequence_number":0,"response":{"id":"resp_01a16820-2e87-7210-8e58-c1e51d100a74","created_at":1792748301,"incomplete_details":null,"instructions":null,"metadata":{},"model":"Qwen/Qwen3.8-27B-FP8","object":"response","output":[],"parallel_tool_calls":false,"temperature":1.0,"tool_choice":"none","tools":[],"top_p":1.0,"background":false,"max_output_tokens":null,"max_tool_calls":null,"previous_response_id":null,"prompt":null,"reasoning":null,"service_tier":"auto","status":"in_progress","text":{"format":{"type":"text"}},"top_logprobs":0,"truncation":"disabled","usage":null,"user":null,"presence_penalty":0.0,"frequency_penalty":0.0,"kv_transfer_params":null,"ec_transfer_params":null,"input_messages":null,"output_messages":null,"completed_at":null,"store":true,"safety_identifier":null,"prompt_cache_key":null,"prompt_cache_options":null,"error":null,"conversation":{"id":"conv_01a16820-2b87-7c53-9bb1-676804d87fd4"}}} + + ' + - ' + + ' + - 'event: response.in_progress + + ' + - 'data: {"type":"response.in_progress","sequence_number":1,"response":{"id":"resp_01a16820-2e87-7210-8e58-c1e51d100a74","created_at":1792748301,"incomplete_details":null,"instructions":null,"metadata":{},"model":"Qwen/Qwen3.8-27B-FP8","object":"response","output":[],"parallel_tool_calls":false,"temperature":1.0,"tool_choice":"none","tools":[],"top_p":1.0,"background":false,"max_output_tokens":null,"max_tool_calls":null,"previous_response_id":null,"prompt":null,"reasoning":null,"service_tier":"auto","status":"in_progress","text":{"format":{"type":"text"}},"top_logprobs":0,"truncation":"disabled","usage":null,"user":null,"presence_penalty":0.0,"frequency_penalty":0.0,"kv_transfer_params":null,"ec_transfer_params":null,"input_messages":null,"output_messages":null,"completed_at":null,"store":true,"safety_identifier":null,"prompt_cache_key":null,"prompt_cache_options":null,"error":null,"conversation":{"id":"conv_01a16820-2b87-7c53-9bb1-676804d87fd4"}}} + + ' + - ' + + ' + - 'event: response.output_item.added + + ' + - 'data: {"type":"response.output_item.added","sequence_number":2,"output_index":0,"item":{"id":"rs_b74e1e323184327f","summary":[],"type":"reasoning","content":[],"status":"in_progress"}} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"type":"response.reasoning_text.delta","sequence_number":3,"output_index":0,"content_index":0,"delta":"The","item_id":"rs_b74e1e323184327f"} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"type":"response.reasoning_text.delta","sequence_number":4,"output_index":0,"content_index":0,"delta":" + user","item_id":"rs_b74e1e323184327f"} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"type":"response.reasoning_text.delta","sequence_number":5,"output_index":0,"content_index":0,"delta":" + wants","item_id":"rs_b74e1e323184327f"} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"type":"response.reasoning_text.delta","sequence_number":6,"output_index":0,"content_index":0,"delta":" + me","item_id":"rs_b74e1e323184327f"} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"type":"response.reasoning_text.delta","sequence_number":7,"output_index":0,"content_index":0,"delta":" + to","item_id":"rs_b74e1e323184327f"} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"type":"response.reasoning_text.delta","sequence_number":8,"output_index":0,"content_index":0,"delta":" + reply","item_id":"rs_b74e1e323184327f"} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"type":"response.reasoning_text.delta","sequence_number":9,"output_index":0,"content_index":0,"delta":" + with","item_id":"rs_b74e1e323184327f"} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"type":"response.reasoning_text.delta","sequence_number":10,"output_index":0,"content_index":0,"delta":" + only","item_id":"rs_b74e1e323184327f"} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"type":"response.reasoning_text.delta","sequence_number":11,"output_index":0,"content_index":0,"delta":" + the","item_id":"rs_b74e1e323184327f"} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"type":"response.reasoning_text.delta","sequence_number":12,"output_index":0,"content_index":0,"delta":" + word","item_id":"rs_b74e1e323184327f"} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"type":"response.reasoning_text.delta","sequence_number":13,"output_index":0,"content_index":0,"delta":" + \"","item_id":"rs_b74e1e323184327f"} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"type":"response.reasoning_text.delta","sequence_number":14,"output_index":0,"content_index":0,"delta":"OR","item_id":"rs_b74e1e323184327f"} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"type":"response.reasoning_text.delta","sequence_number":15,"output_index":0,"content_index":0,"delta":"CH","item_id":"rs_b74e1e323184327f"} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"type":"response.reasoning_text.delta","sequence_number":16,"output_index":0,"content_index":0,"delta":"ID","item_id":"rs_b74e1e323184327f"} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"type":"response.reasoning_text.delta","sequence_number":17,"output_index":0,"content_index":0,"delta":"\".","item_id":"rs_b74e1e323184327f"} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"type":"response.reasoning_text.delta","sequence_number":18,"output_index":0,"content_index":0,"delta":"\n","item_id":"rs_b74e1e323184327f"} + + ' + - ' + + ' + - 'event: response.reasoning_text.done + + ' + - 'data: {"type":"response.reasoning_text.done","sequence_number":19,"output_index":0,"content_index":0,"item_id":"rs_b74e1e323184327f","text":"The + user wants me to reply with only the word \"ORCHID\".\n"} + + ' + - ' + + ' + - 'event: response.output_item.done + + ' + - 'data: {"type":"response.output_item.done","sequence_number":20,"output_index":0,"item":{"id":"rs_b74e1e323184327f","summary":[],"type":"reasoning","content":[{"text":"The + user wants me to reply with only the word \"ORCHID\".\n","type":"reasoning_text"}],"status":"completed"}} + + ' + - ' + + ' + - 'event: response.output_item.added + + ' + - 'data: {"type":"response.output_item.added","sequence_number":21,"output_index":1,"item":{"id":"msg_b65d8e89158b45ee","content":[],"role":"assistant","status":"in_progress","type":"message"}} + + ' + - ' + + ' + - 'event: response.content_part.added + + ' + - 'data: {"type":"response.content_part.added","sequence_number":22,"output_index":1,"content_index":0,"item_id":"msg_b65d8e89158b45ee","part":{"annotations":[],"text":"","type":"output_text","logprobs":[]}} + + ' + - ' + + ' + - 'event: response.output_text.delta + + ' + - 'data: {"type":"response.output_text.delta","sequence_number":23,"output_index":1,"content_index":0,"delta":"\n\nOR","item_id":"msg_b65d8e89158b45ee","logprobs":[]} + + ' + - ' + + ' + - 'event: response.output_text.delta + + ' + - 'data: {"type":"response.output_text.delta","sequence_number":24,"output_index":1,"content_index":0,"delta":"CH","item_id":"msg_b65d8e89158b45ee","logprobs":[]} + + ' + - ' + + ' + - 'event: response.output_text.delta + + ' + - 'data: {"type":"response.output_text.delta","sequence_number":25,"output_index":1,"content_index":0,"delta":"ID","item_id":"msg_b65d8e89158b45ee","logprobs":[]} + + ' + - ' + + ' + - 'event: response.output_text.done + + ' + - 'data: {"type":"response.output_text.done","sequence_number":26,"output_index":1,"content_index":0,"item_id":"msg_b65d8e89158b45ee","logprobs":[],"text":"\n\nORCHID"} + + ' + - ' + + ' + - 'event: response.content_part.done + + ' + - 'data: {"type":"response.content_part.done","sequence_number":27,"output_index":1,"content_index":0,"item_id":"msg_b65d8e89158b45ee","part":{"annotations":[],"text":"\n\nORCHID","type":"output_text","logprobs":[]}} + + ' + - ' + + ' + - 'event: response.output_item.done + + ' + - 'data: {"type":"response.output_item.done","sequence_number":28,"output_index":1,"item":{"id":"msg_b65d8e89158b45ee","content":[{"annotations":[],"text":"\n\nORCHID","type":"output_text","logprobs":[]}],"role":"assistant","status":"completed","type":"message"}} + + ' + - ' + + ' + - 'event: response.completed + + ' + - 'data: {"type":"response.completed","sequence_number":29,"response":{"id":"resp_01a16820-2e87-7210-8e58-c1e51d100a74","object":"response","created_at":1792748302,"model":"Qwen/Qwen3.8-27B-FP8","status":"completed","output":[{"type":"reasoning","id":"rs_b74e1e323184327f","content":[{"type":"reasoning_text","text":"The + user wants me to reply with only the word \"ORCHID\".\n"}],"summary":[],"status":"completed"},{"type":"message","id":"msg_b65d8e89158b45ee","role":"assistant","status":"completed","content":[{"type":"output_text","text":"\n\nORCHID","annotations":[]}]}],"usage":{"input_tokens":110,"output_tokens":22,"total_tokens":132,"input_tokens_details":{"cached_tokens":0,"cache_write_tokens":0},"output_tokens_details":{"reasoning_tokens":16}},"incomplete_details":null,"error":null,"previous_response_id":null,"conversation":{"id":"conv_01a16820-2b87-7c53-9bb1-676804d87fd4"},"instructions":null,"max_tool_calls":null,"service_tier":"auto","tools":[],"tool_choice":"auto","completed_at":1792748302,"truncation":"disabled","parallel_tool_calls":false,"text":{"format":{"type":"text"}},"top_p":1.0,"presence_penalty":0.0,"frequency_penalty":0.0,"top_logprobs":0,"temperature":1.0,"reasoning":null,"max_output_tokens":null,"store":true,"background":false,"metadata":{},"safety_identifier":null,"prompt_cache_key":null,"prompt_cache_options":null}} + + ' + - ' + + ' + - 'data: [DONE] + + ' + - ' + + ' + status_code: 200 +- filename: t8 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_01a16820-2e87-7210-8e58-c1e51d100a74/input_items + query_params: + order: asc + response: + body: + data: + - content: + - text: Remember SAPPHIRE. + type: input_text + id: msg_01a16820-2b91-7bf0-8ac3-76392132d0d8 + role: user + status: completed + type: message + - content: + - text: Reply with only SAPPHIRE. + type: input_text + id: msg_01a16820-2de1-7c51-9f2f-d64870812414 + role: user + status: completed + type: message + - content: + - text: 'The user wants me to reply with only the word "SAPPHIRE". + + ' + type: reasoning_text + id: rs_9c49380ef26d9800 + status: completed + summary: [] + type: reasoning + - content: + - annotations: [] + text: ' + + + SAPPHIRE' + type: output_text + id: msg_bbe8b713e5898ffa + role: assistant + status: completed + type: message + - content: + - text: Now remember ORCHID. + type: input_text + id: msg_01a16820-2e29-7993-80a9-0eddbfed3890 + role: user + status: completed + type: message + - content: + - text: Reply with only ORCHID. + type: input_text + id: msg_01a16820-30a6-7831-9ba0-b47b94f85227 + role: user + status: completed + type: message + first_id: msg_01a16820-2b91-7bf0-8ac3-76392132d0d8 + has_more: false + last_id: msg_01a16820-30a6-7831-9ba0-b47b94f85227 + object: list + headers: + content-type: application/json + status_code: 200 +- filename: t9 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/conversations/conv_01a16820-2b87-7c53-9bb1-676804d87fd4/items + query_params: + order: asc + response: + body: + data: + - content: + - text: Remember SAPPHIRE. + type: input_text + id: msg_01a16820-2b91-7bf0-8ac3-76392132d0d8 + role: user + status: completed + type: message + - content: + - text: Reply with only SAPPHIRE. + type: input_text + id: msg_01a16820-2de1-7c51-9f2f-d64870812414 + role: user + status: completed + type: message + - content: + - text: 'The user wants me to reply with only the word "SAPPHIRE". + + ' + type: reasoning_text + id: rs_9c49380ef26d9800 + status: completed + summary: [] + type: reasoning + - content: + - annotations: [] + text: ' + + + SAPPHIRE' + type: output_text + id: msg_bbe8b713e5898ffa + role: assistant + status: completed + type: message + - content: + - text: Now remember ORCHID. + type: input_text + id: msg_01a16820-2e29-7993-80a9-0eddbfed3890 + role: user + status: completed + type: message + - content: + - text: Reply with only ORCHID. + type: input_text + id: msg_01a16820-30a6-7831-9ba0-b47b94f85227 + role: user + status: completed + type: message + - content: + - text: 'The user wants me to reply with only the word "ORCHID". + + ' + type: reasoning_text + id: rs_b74e1e323184327f + status: completed + summary: [] + type: reasoning + - content: + - annotations: [] + text: ' + + + ORCHID' + type: output_text + id: msg_b65d8e89158b45ee + role: assistant + status: completed + type: message + first_id: msg_01a16820-2b91-7bf0-8ac3-76392132d0d8 + has_more: false + last_id: msg_b65d8e89158b45ee + object: list + headers: + content-type: application/json + status_code: 200 +- filename: t10 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: DELETE + path: /v1/conversations/conv_01a16820-2b87-7c53-9bb1-676804d87fd4/items/msg_01a16820-2e29-7993-80a9-0eddbfed3890 + query_params: {} + response: + body: + created_at: 1792748301 + id: conv_01a16820-2b87-7c53-9bb1-676804d87fd4 + metadata: {} + object: conversation + headers: + content-type: application/json + status_code: 200 +- filename: t11 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_01a16820-2e87-7210-8e58-c1e51d100a74/input_items + query_params: + order: asc + response: + body: + data: + - content: + - text: Remember SAPPHIRE. + type: input_text + id: msg_01a16820-2b91-7bf0-8ac3-76392132d0d8 + role: user + status: completed + type: message + - content: + - text: Reply with only SAPPHIRE. + type: input_text + id: msg_01a16820-2de1-7c51-9f2f-d64870812414 + role: user + status: completed + type: message + - content: + - text: 'The user wants me to reply with only the word "SAPPHIRE". + + ' + type: reasoning_text + id: rs_9c49380ef26d9800 + status: completed + summary: [] + type: reasoning + - content: + - annotations: [] + text: ' + + + SAPPHIRE' + type: output_text + id: msg_bbe8b713e5898ffa + role: assistant + status: completed + type: message + - content: + - text: Now remember ORCHID. + type: input_text + id: msg_01a16820-2e29-7993-80a9-0eddbfed3890 + role: user + status: completed + type: message + - content: + - text: Reply with only ORCHID. + type: input_text + id: msg_01a16820-30a6-7831-9ba0-b47b94f85227 + role: user + status: completed + type: message + first_id: msg_01a16820-2b91-7bf0-8ac3-76392132d0d8 + has_more: false + last_id: msg_01a16820-30a6-7831-9ba0-b47b94f85227 + object: list + headers: + content-type: application/json + status_code: 200 +- filename: t12 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_01a16820-2b9b-7410-a0cb-696c5bb1db8c/input_items + query_params: + order: asc + response: + body: + data: + - content: + - text: Remember SAPPHIRE. + type: input_text + id: msg_01a16820-2b91-7bf0-8ac3-76392132d0d8 + role: user + status: completed + type: message + - content: + - text: Reply with only SAPPHIRE. + type: input_text + id: msg_01a16820-2de1-7c51-9f2f-d64870812414 + role: user + status: completed + type: message + first_id: msg_01a16820-2b91-7bf0-8ac3-76392132d0d8 + has_more: false + last_id: msg_01a16820-2de1-7c51-9f2f-d64870812414 + object: list + headers: + content-type: application/json + status_code: 200 +- filename: t13 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: DELETE + path: /v1/responses/resp_01a16820-2b9b-7410-a0cb-696c5bb1db8c + query_params: {} + response: + body: + deleted: true + id: resp_01a16820-2b9b-7410-a0cb-696c5bb1db8c + object: response.deleted + headers: + content-type: application/json + status_code: 200 +- filename: t14 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_01a16820-2e87-7210-8e58-c1e51d100a74/input_items + query_params: + order: asc + response: + body: + data: + - content: + - text: Remember SAPPHIRE. + type: input_text + id: msg_01a16820-2b91-7bf0-8ac3-76392132d0d8 + role: user + status: completed + type: message + - content: + - text: Reply with only SAPPHIRE. + type: input_text + id: msg_01a16820-2de1-7c51-9f2f-d64870812414 + role: user + status: completed + type: message + - content: + - text: 'The user wants me to reply with only the word "SAPPHIRE". + + ' + type: reasoning_text + id: rs_9c49380ef26d9800 + status: completed + summary: [] + type: reasoning + - content: + - annotations: [] + text: ' + + + SAPPHIRE' + type: output_text + id: msg_bbe8b713e5898ffa + role: assistant + status: completed + type: message + - content: + - text: Now remember ORCHID. + type: input_text + id: msg_01a16820-2e29-7993-80a9-0eddbfed3890 + role: user + status: completed + type: message + - content: + - text: Reply with only ORCHID. + type: input_text + id: msg_01a16820-30a6-7831-9ba0-b47b94f85227 + role: user + status: completed + type: message + first_id: msg_01a16820-2b91-7bf0-8ac3-76392132d0d8 + has_more: false + last_id: msg_01a16820-30a6-7831-9ba0-b47b94f85227 + object: list + headers: + content-type: application/json + status_code: 200 +- filename: t15 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/conversations/conv_01a16820-2b87-7c53-9bb1-676804d87fd4/items + query_params: + order: asc + response: + body: + data: + - content: + - text: Remember SAPPHIRE. + type: input_text + id: msg_01a16820-2b91-7bf0-8ac3-76392132d0d8 + role: user + status: completed + type: message + - content: + - text: Reply with only SAPPHIRE. + type: input_text + id: msg_01a16820-2de1-7c51-9f2f-d64870812414 + role: user + status: completed + type: message + - content: + - text: 'The user wants me to reply with only the word "SAPPHIRE". + + ' + type: reasoning_text + id: rs_9c49380ef26d9800 + status: completed + summary: [] + type: reasoning + - content: + - annotations: [] + text: ' + + + SAPPHIRE' + type: output_text + id: msg_bbe8b713e5898ffa + role: assistant + status: completed + type: message + - content: + - text: Reply with only ORCHID. + type: input_text + id: msg_01a16820-30a6-7831-9ba0-b47b94f85227 + role: user + status: completed + type: message + - content: + - text: 'The user wants me to reply with only the word "ORCHID". + + ' + type: reasoning_text + id: rs_b74e1e323184327f + status: completed + summary: [] + type: reasoning + - content: + - annotations: [] + text: ' + + + ORCHID' + type: output_text + id: msg_b65d8e89158b45ee + role: assistant + status: completed + type: message + first_id: msg_01a16820-2b91-7bf0-8ac3-76392132d0d8 + has_more: false + last_id: msg_b65d8e89158b45ee + object: list + headers: + content-type: application/json + status_code: 200 +- filename: t16 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_01a16820-2e87-7210-8e58-c1e51d100a74 + query_params: {} + response: + body: + background: false + completed_at: 1792748302 + conversation: + id: conv_01a16820-2b87-7c53-9bb1-676804d87fd4 + created_at: 1792748302 + error: null + frequency_penalty: 0.0 + id: resp_01a16820-2e87-7210-8e58-c1e51d100a74 + incomplete_details: null + instructions: null + max_output_tokens: null + max_tool_calls: null + metadata: {} + model: Qwen/Qwen3.8-27B-FP8 + object: response + output: + - content: + - text: 'The user wants me to reply with only the word "ORCHID". + + ' + type: reasoning_text + id: rs_b74e1e323184327f + status: completed + summary: [] + type: reasoning + - content: + - annotations: [] + text: ' + + + ORCHID' + type: output_text + id: msg_b65d8e89158b45ee + role: assistant + status: completed + type: message + parallel_tool_calls: false + presence_penalty: 0.0 + previous_response_id: null + prompt_cache_key: null + prompt_cache_options: null + reasoning: null + safety_identifier: null + service_tier: auto + status: completed + store: true + temperature: 1.0 + text: + format: + type: text + tool_choice: auto + tools: [] + top_logprobs: 0 + top_p: 1.0 + truncation: disabled + usage: + input_tokens: 110 + input_tokens_details: + cache_write_tokens: 0 + cached_tokens: 0 + output_tokens: 22 + output_tokens_details: + reasoning_tokens: 16 + total_tokens: 132 + headers: + content-type: application/json + status_code: 200 +- filename: t17 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: DELETE + path: /v1/conversations/conv_01a16820-2b87-7c53-9bb1-676804d87fd4 + query_params: {} + response: + body: + deleted: true + id: conv_01a16820-2b87-7c53-9bb1-676804d87fd4 + object: conversation.deleted + headers: + content-type: application/json + status_code: 200 +- filename: t18 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_01a16820-2e87-7210-8e58-c1e51d100a74/input_items + query_params: {} + response: + body: + data: + - content: + - text: Reply with only ORCHID. + type: input_text + id: msg_01a16820-30a6-7831-9ba0-b47b94f85227 + role: user + status: completed + type: message + - content: + - text: Now remember ORCHID. + type: input_text + id: msg_01a16820-2e29-7993-80a9-0eddbfed3890 + role: user + status: completed + type: message + - content: + - annotations: [] + text: ' + + + SAPPHIRE' + type: output_text + id: msg_bbe8b713e5898ffa + role: assistant + status: completed + type: message + - content: + - text: 'The user wants me to reply with only the word "SAPPHIRE". + + ' + type: reasoning_text + id: rs_9c49380ef26d9800 + status: completed + summary: [] + type: reasoning + - content: + - text: Reply with only SAPPHIRE. + type: input_text + id: msg_01a16820-2de1-7c51-9f2f-d64870812414 + role: user + status: completed + type: message + - content: + - text: Remember SAPPHIRE. + type: input_text + id: msg_01a16820-2b91-7bf0-8ac3-76392132d0d8 + role: user + status: completed + type: message + first_id: msg_01a16820-30a6-7831-9ba0-b47b94f85227 + has_more: false + last_id: msg_01a16820-2b91-7bf0-8ac3-76392132d0d8 + object: list + headers: + content-type: application/json + status_code: 200 +- filename: t19 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_01a16820-2e87-7210-8e58-c1e51d100a74 + query_params: {} + response: + body: + background: false + completed_at: 1792748302 + conversation: + id: conv_01a16820-2b87-7c53-9bb1-676804d87fd4 + created_at: 1792748302 + error: null + frequency_penalty: 0.0 + id: resp_01a16820-2e87-7210-8e58-c1e51d100a74 + incomplete_details: null + instructions: null + max_output_tokens: null + max_tool_calls: null + metadata: {} + model: Qwen/Qwen3.8-27B-FP8 + object: response + output: + - content: + - text: 'The user wants me to reply with only the word "ORCHID". + + ' + type: reasoning_text + id: rs_b74e1e323184327f + status: completed + summary: [] + type: reasoning + - content: + - annotations: [] + text: ' + + + ORCHID' + type: output_text + id: msg_b65d8e89158b45ee + role: assistant + status: completed + type: message + parallel_tool_calls: false + presence_penalty: 0.0 + previous_response_id: null + prompt_cache_key: null + prompt_cache_options: null + reasoning: null + safety_identifier: null + service_tier: auto + status: completed + store: true + temperature: 1.0 + text: + format: + type: text + tool_choice: auto + tools: [] + top_logprobs: 0 + top_p: 1.0 + truncation: disabled + usage: + input_tokens: 110 + input_tokens_details: + cache_write_tokens: 0 + cached_tokens: 0 + output_tokens: 22 + output_tokens_details: + reasoning_tokens: 16 + total_tokens: 132 + headers: + content-type: application/json + status_code: 200 diff --git a/crates/agentic-server-core/tests/cassettes/responses/response-conversation-stream-openai.yaml b/crates/agentic-server-core/tests/cassettes/responses/response-conversation-stream-openai.yaml new file mode 100644 index 000000000..1af4bbded --- /dev/null +++ b/crates/agentic-server-core/tests/cassettes/responses/response-conversation-stream-openai.yaml @@ -0,0 +1,1052 @@ +turns: +- filename: t1 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + content-type: application/json + user-agent: python-httpx/0.28.1 + method: POST + path: /v1/conversations + query_params: {} + response: + body: + created_at: 1792738289 + id: conv_6adb03f135508196bb37728642fa17e60f78024076088eaa + metadata: {} + object: conversation + headers: + content-type: application/json + status_code: 200 +- filename: t2 + request: + body: + items: + - content: Remember SAPPHIRE. + role: user + headers: + accept: '*/*' + authorization: Bearer *** + content-type: application/json + user-agent: python-httpx/0.28.1 + method: POST + path: /v1/conversations/conv_6adb03f135508196bb37728642fa17e60f78024076088eaa/items + query_params: {} + response: + body: + data: + - content: + - text: Remember SAPPHIRE. + type: input_text + id: msg_6adb03f273008196a7793f98b07f32600f78024076088eaa + role: user + status: completed + type: message + first_id: msg_6adb03f273008196a7793f98b07f32600f78024076088eaa + has_more: false + last_id: msg_6adb03f273008196a7793f98b07f32600f78024076088eaa + object: list + headers: + content-type: application/json + status_code: 200 +- filename: t3 + request: + body: + conversation: conv_6adb03f135508196bb37728642fa17e60f78024076088eaa + input: + - content: Reply with only SAPPHIRE. + role: user + model: gpt-4.1 + store: true + stream: true + headers: + accept: '*/*' + authorization: Bearer *** + content-type: application/json + user-agent: python-httpx/0.28.1 + method: POST + path: /v1/responses + query_params: {} + response: + headers: + content-type: text/event-stream; charset=utf-8 + sse: + - 'event: response.created + + ' + - 'data: {"type":"response.created","response":{"id":"resp_0f78024076088eaa006adb03f3e7ac8196a6895584da7e1e39","object":"response","created_at":1792738293,"status":"in_progress","access_programs":null,"background":false,"completed_at":null,"conversation":{"id":"conv_6adb03f135508196bb37728642fa17e60f78024076088eaa"},"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"max_tool_calls":null,"model":"gpt-4.1-2025-04-14","moderation":null,"output":[],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":null,"prompt_cache_key":null,"prompt_cache_retention":"in_memory","reasoning":{"context":null,"effort":null,"summary":null},"safety_identifier":null,"service_tier":"auto","store":true,"temperature":1.0,"text":{"format":{"type":"text"},"verbosity":"medium"},"tool_choice":"auto","tool_usage":{"image_gen":{"input_tokens":0,"input_tokens_details":{"image_tokens":0,"text_tokens":0},"output_tokens":0,"output_tokens_details":{"image_tokens":0,"text_tokens":0},"total_tokens":0},"web_search":{"num_requests":0}},"tools":[],"top_logprobs":0,"top_p":1.0,"truncation":"disabled","usage":null,"user":null,"metadata":{}},"sequence_number":0} + + ' + - ' + + ' + - 'event: response.in_progress + + ' + - 'data: {"type":"response.in_progress","response":{"id":"resp_0f78024076088eaa006adb03f3e7ac8196a6895584da7e1e39","object":"response","created_at":1792738293,"status":"in_progress","access_programs":null,"background":false,"completed_at":null,"conversation":{"id":"conv_6adb03f135508196bb37728642fa17e60f78024076088eaa"},"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"max_tool_calls":null,"model":"gpt-4.1-2025-04-14","moderation":null,"output":[],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":null,"prompt_cache_key":null,"prompt_cache_retention":"in_memory","reasoning":{"context":null,"effort":null,"summary":null},"safety_identifier":null,"service_tier":"auto","store":true,"temperature":1.0,"text":{"format":{"type":"text"},"verbosity":"medium"},"tool_choice":"auto","tool_usage":{"image_gen":{"input_tokens":0,"input_tokens_details":{"image_tokens":0,"text_tokens":0},"output_tokens":0,"output_tokens_details":{"image_tokens":0,"text_tokens":0},"total_tokens":0},"web_search":{"num_requests":0}},"tools":[],"top_logprobs":0,"top_p":1.0,"truncation":"disabled","usage":null,"user":null,"metadata":{}},"sequence_number":1} + + ' + - ' + + ' + - 'event: response.output_item.added + + ' + - 'data: {"type":"response.output_item.added","item":{"id":"msg_0f78024076088eaa006adb03f61cdc8196b66272355833fc56","type":"message","status":"in_progress","content":[],"role":"assistant"},"output_index":0,"sequence_number":2} + + ' + - ' + + ' + - 'event: response.content_part.added + + ' + - 'data: {"type":"response.content_part.added","content_index":0,"item_id":"msg_0f78024076088eaa006adb03f61cdc8196b66272355833fc56","output_index":0,"part":{"type":"output_text","annotations":[],"logprobs":[],"text":""},"sequence_number":3} + + ' + - ' + + ' + - 'event: response.output_text.delta + + ' + - 'data: {"type":"response.output_text.delta","content_index":0,"delta":"S","item_id":"msg_0f78024076088eaa006adb03f61cdc8196b66272355833fc56","logprobs":[],"obfuscation":"TsBVXJQWviGCDwx","output_index":0,"sequence_number":4} + + ' + - ' + + ' + - 'event: response.output_text.delta + + ' + - 'data: {"type":"response.output_text.delta","content_index":0,"delta":"APP","item_id":"msg_0f78024076088eaa006adb03f61cdc8196b66272355833fc56","logprobs":[],"obfuscation":"2fwzBmRdvpTQv","output_index":0,"sequence_number":5} + + ' + - ' + + ' + - 'event: response.output_text.delta + + ' + - 'data: {"type":"response.output_text.delta","content_index":0,"delta":"H","item_id":"msg_0f78024076088eaa006adb03f61cdc8196b66272355833fc56","logprobs":[],"obfuscation":"Tr5pB4XqwqZmH5z","output_index":0,"sequence_number":6} + + ' + - ' + + ' + - 'event: response.output_text.delta + + ' + - 'data: {"type":"response.output_text.delta","content_index":0,"delta":"IRE","item_id":"msg_0f78024076088eaa006adb03f61cdc8196b66272355833fc56","logprobs":[],"obfuscation":"zV9kMk9ooz56Q","output_index":0,"sequence_number":7} + + ' + - ' + + ' + - 'event: response.output_text.delta + + ' + - 'data: {"type":"response.output_text.delta","content_index":0,"delta":".","item_id":"msg_0f78024076088eaa006adb03f61cdc8196b66272355833fc56","logprobs":[],"obfuscation":"Syk58FLNMeZZDyQ","output_index":0,"sequence_number":8} + + ' + - ' + + ' + - 'event: response.output_text.done + + ' + - 'data: {"type":"response.output_text.done","content_index":0,"item_id":"msg_0f78024076088eaa006adb03f61cdc8196b66272355833fc56","logprobs":[],"output_index":0,"sequence_number":9,"text":"SAPPHIRE."} + + ' + - ' + + ' + - 'event: response.content_part.done + + ' + - 'data: {"type":"response.content_part.done","content_index":0,"item_id":"msg_0f78024076088eaa006adb03f61cdc8196b66272355833fc56","output_index":0,"part":{"type":"output_text","annotations":[],"logprobs":[],"text":"SAPPHIRE."},"sequence_number":10} + + ' + - ' + + ' + - 'event: response.output_item.done + + ' + - 'data: {"type":"response.output_item.done","item":{"id":"msg_0f78024076088eaa006adb03f61cdc8196b66272355833fc56","type":"message","status":"completed","content":[{"type":"output_text","annotations":[],"logprobs":[],"text":"SAPPHIRE."}],"role":"assistant"},"output_index":0,"sequence_number":11} + + ' + - ' + + ' + - 'event: response.completed + + ' + - 'data: {"type":"response.completed","response":{"id":"resp_0f78024076088eaa006adb03f3e7ac8196a6895584da7e1e39","object":"response","created_at":1792738293,"status":"completed","access_programs":null,"background":false,"completed_at":1792738294,"conversation":{"id":"conv_6adb03f135508196bb37728642fa17e60f78024076088eaa"},"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"max_tool_calls":null,"model":"gpt-4.1-2025-04-14","moderation":null,"output":[{"id":"msg_0f78024076088eaa006adb03f61cdc8196b66272355833fc56","type":"message","status":"completed","content":[{"type":"output_text","annotations":[],"logprobs":[],"text":"SAPPHIRE."}],"role":"assistant"}],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":null,"prompt_cache_key":null,"prompt_cache_retention":"in_memory","reasoning":{"context":null,"effort":null,"summary":null},"safety_identifier":null,"service_tier":"default","store":true,"temperature":1.0,"text":{"format":{"type":"text"},"verbosity":"medium"},"tool_choice":"auto","tool_usage":{"image_gen":{"input_tokens":0,"input_tokens_details":{"image_tokens":0,"text_tokens":0},"output_tokens":0,"output_tokens_details":{"image_tokens":0,"text_tokens":0},"total_tokens":0},"web_search":{"num_requests":0}},"tools":[],"top_logprobs":0,"top_p":1.0,"truncation":"disabled","usage":{"input_tokens":25,"input_tokens_details":{"cache_write_tokens":0,"cached_tokens":0},"output_tokens":6,"output_tokens_details":{"reasoning_tokens":0},"total_tokens":31},"user":null,"metadata":{}},"sequence_number":12} + + ' + - ' + + ' + status_code: 200 +- filename: t4 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_0f78024076088eaa006adb03f3e7ac8196a6895584da7e1e39/input_items + query_params: + order: asc + response: + body: + data: + - content: + - text: Remember SAPPHIRE. + type: input_text + id: msg_6adb03f273008196a7793f98b07f32600f78024076088eaa + role: user + status: completed + type: message + - content: + - text: Reply with only SAPPHIRE. + type: input_text + id: msg_0f78024076088eaa006adb03f5d6108196907067f973abbba5 + role: user + status: completed + type: message + first_id: msg_6adb03f273008196a7793f98b07f32600f78024076088eaa + has_more: false + last_id: msg_0f78024076088eaa006adb03f5d6108196907067f973abbba5 + object: list + headers: + content-type: application/json + status_code: 200 +- filename: t5 + request: + body: + items: + - content: Now remember ORCHID. + role: user + headers: + accept: '*/*' + authorization: Bearer *** + content-type: application/json + user-agent: python-httpx/0.28.1 + method: POST + path: /v1/conversations/conv_6adb03f135508196bb37728642fa17e60f78024076088eaa/items + query_params: {} + response: + body: + data: + - content: + - text: Now remember ORCHID. + type: input_text + id: msg_6adb03f7285c8196998034551c5b636c0f78024076088eaa + role: user + status: completed + type: message + first_id: msg_6adb03f7285c8196998034551c5b636c0f78024076088eaa + has_more: false + last_id: msg_6adb03f7285c8196998034551c5b636c0f78024076088eaa + object: list + headers: + content-type: application/json + status_code: 200 +- filename: t6 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_0f78024076088eaa006adb03f3e7ac8196a6895584da7e1e39/input_items + query_params: + order: asc + response: + body: + data: + - content: + - text: Remember SAPPHIRE. + type: input_text + id: msg_6adb03f273008196a7793f98b07f32600f78024076088eaa + role: user + status: completed + type: message + - content: + - text: Reply with only SAPPHIRE. + type: input_text + id: msg_0f78024076088eaa006adb03f5d6108196907067f973abbba5 + role: user + status: completed + type: message + first_id: msg_6adb03f273008196a7793f98b07f32600f78024076088eaa + has_more: false + last_id: msg_0f78024076088eaa006adb03f5d6108196907067f973abbba5 + object: list + headers: + content-type: application/json + status_code: 200 +- filename: t7 + request: + body: + conversation: conv_6adb03f135508196bb37728642fa17e60f78024076088eaa + input: + - content: Reply with only ORCHID. + role: user + model: gpt-4.1 + store: true + stream: true + headers: + accept: '*/*' + authorization: Bearer *** + content-type: application/json + user-agent: python-httpx/0.28.1 + method: POST + path: /v1/responses + query_params: {} + response: + headers: + content-type: text/event-stream; charset=utf-8 + sse: + - 'event: response.created + + ' + - 'data: {"type":"response.created","response":{"id":"resp_0f78024076088eaa006adb03f824048196a91ba8418fef53fc","object":"response","created_at":1792738296,"status":"in_progress","access_programs":null,"background":false,"completed_at":null,"conversation":{"id":"conv_6adb03f135508196bb37728642fa17e60f78024076088eaa"},"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"max_tool_calls":null,"model":"gpt-4.1-2025-04-14","moderation":null,"output":[],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":null,"prompt_cache_key":null,"prompt_cache_retention":"in_memory","reasoning":{"context":null,"effort":null,"summary":null},"safety_identifier":null,"service_tier":"auto","store":true,"temperature":1.0,"text":{"format":{"type":"text"},"verbosity":"medium"},"tool_choice":"auto","tool_usage":{"image_gen":{"input_tokens":0,"input_tokens_details":{"image_tokens":0,"text_tokens":0},"output_tokens":0,"output_tokens_details":{"image_tokens":0,"text_tokens":0},"total_tokens":0},"web_search":{"num_requests":0}},"tools":[],"top_logprobs":0,"top_p":1.0,"truncation":"disabled","usage":null,"user":null,"metadata":{}},"sequence_number":0} + + ' + - ' + + ' + - 'event: response.in_progress + + ' + - 'data: {"type":"response.in_progress","response":{"id":"resp_0f78024076088eaa006adb03f824048196a91ba8418fef53fc","object":"response","created_at":1792738296,"status":"in_progress","access_programs":null,"background":false,"completed_at":null,"conversation":{"id":"conv_6adb03f135508196bb37728642fa17e60f78024076088eaa"},"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"max_tool_calls":null,"model":"gpt-4.1-2025-04-14","moderation":null,"output":[],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":null,"prompt_cache_key":null,"prompt_cache_retention":"in_memory","reasoning":{"context":null,"effort":null,"summary":null},"safety_identifier":null,"service_tier":"auto","store":true,"temperature":1.0,"text":{"format":{"type":"text"},"verbosity":"medium"},"tool_choice":"auto","tool_usage":{"image_gen":{"input_tokens":0,"input_tokens_details":{"image_tokens":0,"text_tokens":0},"output_tokens":0,"output_tokens_details":{"image_tokens":0,"text_tokens":0},"total_tokens":0},"web_search":{"num_requests":0}},"tools":[],"top_logprobs":0,"top_p":1.0,"truncation":"disabled","usage":null,"user":null,"metadata":{}},"sequence_number":1} + + ' + - ' + + ' + - 'event: response.output_item.added + + ' + - 'data: {"type":"response.output_item.added","item":{"id":"msg_0f78024076088eaa006adb03f887d08196873f5faaafb7a88b","type":"message","status":"in_progress","content":[],"role":"assistant"},"output_index":0,"sequence_number":2} + + ' + - ' + + ' + - 'event: response.content_part.added + + ' + - 'data: {"type":"response.content_part.added","content_index":0,"item_id":"msg_0f78024076088eaa006adb03f887d08196873f5faaafb7a88b","output_index":0,"part":{"type":"output_text","annotations":[],"logprobs":[],"text":""},"sequence_number":3} + + ' + - ' + + ' + - 'event: response.output_text.delta + + ' + - 'data: {"type":"response.output_text.delta","content_index":0,"delta":"OR","item_id":"msg_0f78024076088eaa006adb03f887d08196873f5faaafb7a88b","logprobs":[],"obfuscation":"25ftE9TeQslu4q","output_index":0,"sequence_number":4} + + ' + - ' + + ' + - 'event: response.output_text.delta + + ' + - 'data: {"type":"response.output_text.delta","content_index":0,"delta":"CH","item_id":"msg_0f78024076088eaa006adb03f887d08196873f5faaafb7a88b","logprobs":[],"obfuscation":"6jwmf7J5tUAsoA","output_index":0,"sequence_number":5} + + ' + - ' + + ' + - 'event: response.output_text.delta + + ' + - 'data: {"type":"response.output_text.delta","content_index":0,"delta":"ID","item_id":"msg_0f78024076088eaa006adb03f887d08196873f5faaafb7a88b","logprobs":[],"obfuscation":"2jjjZUWynCM2Dr","output_index":0,"sequence_number":6} + + ' + - ' + + ' + - 'event: response.output_text.delta + + ' + - 'data: {"type":"response.output_text.delta","content_index":0,"delta":".","item_id":"msg_0f78024076088eaa006adb03f887d08196873f5faaafb7a88b","logprobs":[],"obfuscation":"jlltGZ06BgFsw5j","output_index":0,"sequence_number":7} + + ' + - ' + + ' + - 'event: response.output_text.done + + ' + - 'data: {"type":"response.output_text.done","content_index":0,"item_id":"msg_0f78024076088eaa006adb03f887d08196873f5faaafb7a88b","logprobs":[],"output_index":0,"sequence_number":8,"text":"ORCHID."} + + ' + - ' + + ' + - 'event: response.content_part.done + + ' + - 'data: {"type":"response.content_part.done","content_index":0,"item_id":"msg_0f78024076088eaa006adb03f887d08196873f5faaafb7a88b","output_index":0,"part":{"type":"output_text","annotations":[],"logprobs":[],"text":"ORCHID."},"sequence_number":9} + + ' + - ' + + ' + - 'event: response.output_item.done + + ' + - 'data: {"type":"response.output_item.done","item":{"id":"msg_0f78024076088eaa006adb03f887d08196873f5faaafb7a88b","type":"message","status":"completed","content":[{"type":"output_text","annotations":[],"logprobs":[],"text":"ORCHID."}],"role":"assistant"},"output_index":0,"sequence_number":10} + + ' + - ' + + ' + - 'event: response.completed + + ' + - 'data: {"type":"response.completed","response":{"id":"resp_0f78024076088eaa006adb03f824048196a91ba8418fef53fc","object":"response","created_at":1792738296,"status":"completed","access_programs":null,"background":false,"completed_at":1792738296,"conversation":{"id":"conv_6adb03f135508196bb37728642fa17e60f78024076088eaa"},"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"max_tool_calls":null,"model":"gpt-4.1-2025-04-14","moderation":null,"output":[{"id":"msg_0f78024076088eaa006adb03f887d08196873f5faaafb7a88b","type":"message","status":"completed","content":[{"type":"output_text","annotations":[],"logprobs":[],"text":"ORCHID."}],"role":"assistant"}],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":null,"prompt_cache_key":null,"prompt_cache_retention":"in_memory","reasoning":{"context":null,"effort":null,"summary":null},"safety_identifier":null,"service_tier":"default","store":true,"temperature":1.0,"text":{"format":{"type":"text"},"verbosity":"medium"},"tool_choice":"auto","tool_usage":{"image_gen":{"input_tokens":0,"input_tokens_details":{"image_tokens":0,"text_tokens":0},"output_tokens":0,"output_tokens_details":{"image_tokens":0,"text_tokens":0},"total_tokens":0},"web_search":{"num_requests":0}},"tools":[],"top_logprobs":0,"top_p":1.0,"truncation":"disabled","usage":{"input_tokens":55,"input_tokens_details":{"cache_write_tokens":0,"cached_tokens":0},"output_tokens":5,"output_tokens_details":{"reasoning_tokens":0},"total_tokens":60},"user":null,"metadata":{}},"sequence_number":11} + + ' + - ' + + ' + status_code: 200 +- filename: t8 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_0f78024076088eaa006adb03f824048196a91ba8418fef53fc/input_items + query_params: + order: asc + response: + body: + data: + - content: + - text: Remember SAPPHIRE. + type: input_text + id: msg_6adb03f273008196a7793f98b07f32600f78024076088eaa + role: user + status: completed + type: message + - content: + - text: Reply with only SAPPHIRE. + type: input_text + id: msg_0f78024076088eaa006adb03f5d6108196907067f973abbba5 + role: user + status: completed + type: message + - content: + - annotations: [] + logprobs: [] + text: SAPPHIRE. + type: output_text + id: msg_0f78024076088eaa006adb03f61cdc8196b66272355833fc56 + role: assistant + status: completed + type: message + - content: + - text: Now remember ORCHID. + type: input_text + id: msg_6adb03f7285c8196998034551c5b636c0f78024076088eaa + role: user + status: completed + type: message + - content: + - text: Reply with only ORCHID. + type: input_text + id: msg_0f78024076088eaa006adb03f84bb8819681b38ebce384f460 + role: user + status: completed + type: message + first_id: msg_6adb03f273008196a7793f98b07f32600f78024076088eaa + has_more: false + last_id: msg_0f78024076088eaa006adb03f84bb8819681b38ebce384f460 + object: list + headers: + content-type: application/json + status_code: 200 +- filename: t9 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/conversations/conv_6adb03f135508196bb37728642fa17e60f78024076088eaa/items + query_params: + order: asc + response: + body: + data: + - content: + - text: Remember SAPPHIRE. + type: input_text + id: msg_6adb03f273008196a7793f98b07f32600f78024076088eaa + role: user + status: completed + type: message + - content: + - text: Reply with only SAPPHIRE. + type: input_text + id: msg_0f78024076088eaa006adb03f5d6108196907067f973abbba5 + role: user + status: completed + type: message + - content: + - annotations: [] + logprobs: [] + text: SAPPHIRE. + type: output_text + id: msg_0f78024076088eaa006adb03f61cdc8196b66272355833fc56 + role: assistant + status: completed + type: message + - content: + - text: Now remember ORCHID. + type: input_text + id: msg_6adb03f7285c8196998034551c5b636c0f78024076088eaa + role: user + status: completed + type: message + - content: + - text: Reply with only ORCHID. + type: input_text + id: msg_0f78024076088eaa006adb03f84bb8819681b38ebce384f460 + role: user + status: completed + type: message + - content: + - annotations: [] + logprobs: [] + text: ORCHID. + type: output_text + id: msg_0f78024076088eaa006adb03f887d08196873f5faaafb7a88b + role: assistant + status: completed + type: message + first_id: msg_6adb03f273008196a7793f98b07f32600f78024076088eaa + has_more: false + last_id: msg_0f78024076088eaa006adb03f887d08196873f5faaafb7a88b + object: list + headers: + content-type: application/json + status_code: 200 +- filename: t10 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: DELETE + path: /v1/conversations/conv_6adb03f135508196bb37728642fa17e60f78024076088eaa/items/msg_6adb03f7285c8196998034551c5b636c0f78024076088eaa + query_params: {} + response: + body: + created_at: 1792738289 + id: conv_6adb03f135508196bb37728642fa17e60f78024076088eaa + metadata: {} + object: conversation + headers: + content-type: application/json + status_code: 200 +- filename: t11 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_0f78024076088eaa006adb03f824048196a91ba8418fef53fc/input_items + query_params: + order: asc + response: + body: + data: + - content: + - text: Remember SAPPHIRE. + type: input_text + id: msg_6adb03f273008196a7793f98b07f32600f78024076088eaa + role: user + status: completed + type: message + - content: + - text: Reply with only SAPPHIRE. + type: input_text + id: msg_0f78024076088eaa006adb03f5d6108196907067f973abbba5 + role: user + status: completed + type: message + - content: + - annotations: [] + logprobs: [] + text: SAPPHIRE. + type: output_text + id: msg_0f78024076088eaa006adb03f61cdc8196b66272355833fc56 + role: assistant + status: completed + type: message + - content: + - text: Now remember ORCHID. + type: input_text + id: msg_6adb03f7285c8196998034551c5b636c0f78024076088eaa + role: user + status: completed + type: message + - content: + - text: Reply with only ORCHID. + type: input_text + id: msg_0f78024076088eaa006adb03f84bb8819681b38ebce384f460 + role: user + status: completed + type: message + first_id: msg_6adb03f273008196a7793f98b07f32600f78024076088eaa + has_more: false + last_id: msg_0f78024076088eaa006adb03f84bb8819681b38ebce384f460 + object: list + headers: + content-type: application/json + status_code: 200 +- filename: t12 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_0f78024076088eaa006adb03f3e7ac8196a6895584da7e1e39/input_items + query_params: + order: asc + response: + body: + data: + - content: + - text: Remember SAPPHIRE. + type: input_text + id: msg_6adb03f273008196a7793f98b07f32600f78024076088eaa + role: user + status: completed + type: message + - content: + - text: Reply with only SAPPHIRE. + type: input_text + id: msg_0f78024076088eaa006adb03f5d6108196907067f973abbba5 + role: user + status: completed + type: message + first_id: msg_6adb03f273008196a7793f98b07f32600f78024076088eaa + has_more: false + last_id: msg_0f78024076088eaa006adb03f5d6108196907067f973abbba5 + object: list + headers: + content-type: application/json + status_code: 200 +- filename: t13 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: DELETE + path: /v1/responses/resp_0f78024076088eaa006adb03f3e7ac8196a6895584da7e1e39 + query_params: {} + response: + body: + deleted: true + id: resp_0f78024076088eaa006adb03f3e7ac8196a6895584da7e1e39 + object: response.deleted + headers: + content-type: application/json + status_code: 200 +- filename: t14 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_0f78024076088eaa006adb03f824048196a91ba8418fef53fc/input_items + query_params: + order: asc + response: + body: + data: + - content: + - text: Remember SAPPHIRE. + type: input_text + id: msg_6adb03f273008196a7793f98b07f32600f78024076088eaa + role: user + status: completed + type: message + - content: + - text: Reply with only SAPPHIRE. + type: input_text + id: msg_0f78024076088eaa006adb03f5d6108196907067f973abbba5 + role: user + status: completed + type: message + - content: + - annotations: [] + logprobs: [] + text: SAPPHIRE. + type: output_text + id: msg_0f78024076088eaa006adb03f61cdc8196b66272355833fc56 + role: assistant + status: completed + type: message + - content: + - text: Now remember ORCHID. + type: input_text + id: msg_6adb03f7285c8196998034551c5b636c0f78024076088eaa + role: user + status: completed + type: message + - content: + - text: Reply with only ORCHID. + type: input_text + id: msg_0f78024076088eaa006adb03f84bb8819681b38ebce384f460 + role: user + status: completed + type: message + first_id: msg_6adb03f273008196a7793f98b07f32600f78024076088eaa + has_more: false + last_id: msg_0f78024076088eaa006adb03f84bb8819681b38ebce384f460 + object: list + headers: + content-type: application/json + status_code: 200 +- filename: t15 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/conversations/conv_6adb03f135508196bb37728642fa17e60f78024076088eaa/items + query_params: + order: asc + response: + body: + data: + - content: + - text: Remember SAPPHIRE. + type: input_text + id: msg_6adb03f273008196a7793f98b07f32600f78024076088eaa + role: user + status: completed + type: message + - content: + - text: Reply with only SAPPHIRE. + type: input_text + id: msg_0f78024076088eaa006adb03f5d6108196907067f973abbba5 + role: user + status: completed + type: message + - content: + - annotations: [] + logprobs: [] + text: SAPPHIRE. + type: output_text + id: msg_0f78024076088eaa006adb03f61cdc8196b66272355833fc56 + role: assistant + status: completed + type: message + - content: + - text: Reply with only ORCHID. + type: input_text + id: msg_0f78024076088eaa006adb03f84bb8819681b38ebce384f460 + role: user + status: completed + type: message + - content: + - annotations: [] + logprobs: [] + text: ORCHID. + type: output_text + id: msg_0f78024076088eaa006adb03f887d08196873f5faaafb7a88b + role: assistant + status: completed + type: message + first_id: msg_6adb03f273008196a7793f98b07f32600f78024076088eaa + has_more: false + last_id: msg_0f78024076088eaa006adb03f887d08196873f5faaafb7a88b + object: list + headers: + content-type: application/json + status_code: 200 +- filename: t16 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_0f78024076088eaa006adb03f824048196a91ba8418fef53fc + query_params: {} + response: + body: + access_programs: null + background: false + billing: + payer: developer + completed_at: 1792738296 + conversation: + id: conv_6adb03f135508196bb37728642fa17e60f78024076088eaa + created_at: 1792738296 + error: null + frequency_penalty: 0.0 + id: resp_0f78024076088eaa006adb03f824048196a91ba8418fef53fc + incomplete_details: null + instructions: null + max_output_tokens: null + max_tool_calls: null + metadata: {} + model: gpt-4.1-2025-04-14 + moderation: null + object: response + output: + - content: + - annotations: [] + logprobs: [] + text: ORCHID. + type: output_text + id: msg_0f78024076088eaa006adb03f887d08196873f5faaafb7a88b + role: assistant + status: completed + type: message + parallel_tool_calls: true + presence_penalty: 0.0 + previous_response_id: null + prompt_cache_key: null + prompt_cache_retention: in_memory + reasoning: + context: null + effort: null + summary: null + safety_identifier: null + service_tier: default + status: completed + store: true + temperature: 1.0 + text: + format: + type: text + verbosity: medium + tool_choice: auto + tool_usage: + image_gen: + input_tokens: 0 + input_tokens_details: + image_tokens: 0 + text_tokens: 0 + output_tokens: 0 + output_tokens_details: + image_tokens: 0 + text_tokens: 0 + total_tokens: 0 + web_search: + num_requests: 0 + tools: [] + top_logprobs: 0 + top_p: 1.0 + truncation: disabled + usage: + input_tokens: 55 + input_tokens_details: + cache_write_tokens: 0 + cached_tokens: 0 + output_tokens: 5 + output_tokens_details: + reasoning_tokens: 0 + total_tokens: 60 + user: null + headers: + content-type: application/json + status_code: 200 +- filename: t17 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: DELETE + path: /v1/conversations/conv_6adb03f135508196bb37728642fa17e60f78024076088eaa + query_params: {} + response: + body: + deleted: true + id: conv_6adb03f135508196bb37728642fa17e60f78024076088eaa + object: conversation.deleted + headers: + content-type: application/json + status_code: 200 +- filename: t18 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_0f78024076088eaa006adb03f824048196a91ba8418fef53fc/input_items + query_params: {} + response: + body: + data: + - content: + - text: Reply with only ORCHID. + type: input_text + id: msg_0f78024076088eaa006adb03f84bb8819681b38ebce384f460 + role: user + status: completed + type: message + - content: + - text: Now remember ORCHID. + type: input_text + id: msg_6adb03f7285c8196998034551c5b636c0f78024076088eaa + role: user + status: completed + type: message + - content: + - annotations: [] + logprobs: [] + text: SAPPHIRE. + type: output_text + id: msg_0f78024076088eaa006adb03f61cdc8196b66272355833fc56 + role: assistant + status: completed + type: message + - content: + - text: Reply with only SAPPHIRE. + type: input_text + id: msg_0f78024076088eaa006adb03f5d6108196907067f973abbba5 + role: user + status: completed + type: message + - content: + - text: Remember SAPPHIRE. + type: input_text + id: msg_6adb03f273008196a7793f98b07f32600f78024076088eaa + role: user + status: completed + type: message + first_id: msg_0f78024076088eaa006adb03f84bb8819681b38ebce384f460 + has_more: false + last_id: msg_6adb03f273008196a7793f98b07f32600f78024076088eaa + object: list + headers: + content-type: application/json + status_code: 200 +- filename: t19 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_0f78024076088eaa006adb03f824048196a91ba8418fef53fc + query_params: {} + response: + body: + access_programs: null + background: false + billing: + payer: developer + completed_at: 1792738296 + conversation: + id: conv_6adb03f135508196bb37728642fa17e60f78024076088eaa + created_at: 1792738296 + error: null + frequency_penalty: 0.0 + id: resp_0f78024076088eaa006adb03f824048196a91ba8418fef53fc + incomplete_details: null + instructions: null + max_output_tokens: null + max_tool_calls: null + metadata: {} + model: gpt-4.1-2025-04-14 + moderation: null + object: response + output: + - content: + - annotations: [] + logprobs: [] + text: ORCHID. + type: output_text + id: msg_0f78024076088eaa006adb03f887d08196873f5faaafb7a88b + role: assistant + status: completed + type: message + parallel_tool_calls: true + presence_penalty: 0.0 + previous_response_id: null + prompt_cache_key: null + prompt_cache_retention: in_memory + reasoning: + context: null + effort: null + summary: null + safety_identifier: null + service_tier: default + status: completed + store: true + temperature: 1.0 + text: + format: + type: text + verbosity: medium + tool_choice: auto + tool_usage: + image_gen: + input_tokens: 0 + input_tokens_details: + image_tokens: 0 + text_tokens: 0 + output_tokens: 0 + output_tokens_details: + image_tokens: 0 + text_tokens: 0 + total_tokens: 0 + web_search: + num_requests: 0 + tools: [] + top_logprobs: 0 + top_p: 1.0 + truncation: disabled + usage: + input_tokens: 55 + input_tokens_details: + cache_write_tokens: 0 + cached_tokens: 0 + output_tokens: 5 + output_tokens_details: + reasoning_tokens: 0 + total_tokens: 60 + user: null + headers: + content-type: application/json + status_code: 200 diff --git a/crates/agentic-server-core/tests/cassettes/responses/response-edge-cases-gateway.yaml b/crates/agentic-server-core/tests/cassettes/responses/response-edge-cases-gateway.yaml new file mode 100644 index 000000000..3235c57d9 --- /dev/null +++ b/crates/agentic-server-core/tests/cassettes/responses/response-edge-cases-gateway.yaml @@ -0,0 +1,640 @@ +turns: +- filename: t1 + request: + body: + input: + - content: Reply with only SAPPHIRE. + role: user + model: Qwen/Qwen3.8-27B-FP8 + store: false + stream: false + headers: + accept: '*/*' + authorization: Bearer *** + content-type: application/json + user-agent: python-httpx/0.28.1 + method: POST + path: /v1/responses + query_params: {} + response: + body: + background: false + created_at: 1792748289 + ec_transfer_params: null + frequency_penalty: 0.0 + id: resp_afb7c16e4290a0d2 + incomplete_details: null + input_messages: null + instructions: null + kv_transfer_params: null + max_output_tokens: 65489 + max_tool_calls: null + metadata: null + model: Qwen/Qwen3.8-27B-FP8 + object: response + output: + - content: + - text: 'The user wants me to reply with only the word "SAPPHIRE". + + ' + type: reasoning_text + encrypted_content: null + id: rs_8895056f462f79ad + status: null + summary: [] + type: reasoning + - content: + - annotations: [] + logprobs: null + text: ' + + + SAPPHIRE' + type: output_text + id: msg_86bf767304965ea4 + phase: null + role: assistant + status: completed + type: message + output_messages: null + parallel_tool_calls: true + presence_penalty: 0.0 + previous_response_id: null + prompt: null + reasoning: null + service_tier: auto + status: completed + temperature: 1.0 + text: null + tool_choice: none + tools: [] + top_logprobs: null + top_p: 0.95 + truncation: disabled + usage: + input_tokens: 47 + input_tokens_details: + cache_write_tokens: 0 + cached_tokens: 0 + cached_tokens_per_turn: [] + input_tokens_per_turn: [] + output_tokens: 24 + output_tokens_details: + output_tokens_per_turn: [] + reasoning_tokens: 17 + tool_output_tokens: 0 + tool_output_tokens_per_turn: [] + total_tokens: 71 + user: null + headers: + content-type: application/json + status_code: 200 +- filename: t2 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_afb7c16e4290a0d2 + query_params: {} + response: + body: + error: + code: null + message: 'storage error: not found: Response with id ''resp_afb7c16e4290a0d2''' + param: null + type: invalid_request_error + headers: + content-type: application/json + status_code: 404 +- filename: t3 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_afb7c16e4290a0d2/input_items + query_params: {} + response: + body: + error: + code: null + message: 'storage error: not found: Response with id ''resp_afb7c16e4290a0d2''' + param: null + type: invalid_request_error + headers: + content-type: application/json + status_code: 404 +- filename: t4 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: DELETE + path: /v1/responses/resp_afb7c16e4290a0d2 + query_params: {} + response: + body: + error: + code: null + message: 'storage error: not found: Response with id ''resp_afb7c16e4290a0d2''' + param: null + type: invalid_request_error + headers: + content-type: application/json + status_code: 404 +- filename: t5 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_missing + query_params: {} + response: + body: + error: + code: null + message: 'storage error: not found: Response with id ''resp_missing''' + param: null + type: invalid_request_error + headers: + content-type: application/json + status_code: 404 +- filename: t6 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_missing/input_items + query_params: {} + response: + body: + error: + code: null + message: 'storage error: not found: Response with id ''resp_missing''' + param: null + type: invalid_request_error + headers: + content-type: application/json + status_code: 404 +- filename: t7 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: DELETE + path: /v1/responses/resp_missing + query_params: {} + response: + body: + error: + code: null + message: 'storage error: not found: Response with id ''resp_missing''' + param: null + type: invalid_request_error + headers: + content-type: application/json + status_code: 404 +- filename: t8 + request: + body: + input: + - content: Reply with only ORCHID. + role: user + model: Qwen/Qwen3.8-27B-FP8 + previous_response_id: resp_missing + store: true + stream: false + headers: + accept: '*/*' + authorization: Bearer *** + content-type: application/json + user-agent: python-httpx/0.28.1 + method: POST + path: /v1/responses + query_params: {} + response: + body: + error: + code: previous_response_not_found + message: Previous response with id 'resp_missing' not found. + param: previous_response_id + type: invalid_request_error + headers: + content-type: application/json + status_code: 400 +- filename: t9 + request: + body: + input: + - content: Reply with only ORCHID. + role: user + model: Qwen/Qwen3.8-27B-FP8 + store: true + stream: false + headers: + accept: '*/*' + authorization: Bearer *** + content-type: application/json + user-agent: python-httpx/0.28.1 + method: POST + path: /v1/responses + query_params: {} + response: + body: + background: false + completed_at: 1792748290 + created_at: 1792748290 + error: null + frequency_penalty: 0.0 + id: resp_01a16820-0157-7fb2-9533-3e564b318881 + incomplete_details: null + instructions: null + max_output_tokens: null + max_tool_calls: null + metadata: {} + model: Qwen/Qwen3.8-27B-FP8 + object: response + output: + - content: + - text: 'The user wants me to reply with only the word "ORCHID". + + ' + type: reasoning_text + id: rs_a24b3a74045cbd54 + summary: [] + type: reasoning + - content: + - annotations: [] + text: ' + + + ORCHID' + type: output_text + id: msg_be10834c08f1f3e4 + role: assistant + status: completed + type: message + parallel_tool_calls: false + presence_penalty: 0.0 + previous_response_id: null + prompt_cache_key: null + prompt_cache_options: null + reasoning: null + safety_identifier: null + service_tier: auto + status: completed + store: true + temperature: 1.0 + text: + format: + type: text + tool_choice: auto + tools: [] + top_logprobs: 0 + top_p: 1.0 + truncation: disabled + usage: + input_tokens: 47 + input_tokens_details: + cache_write_tokens: 0 + cached_tokens: 0 + output_tokens: 22 + output_tokens_details: + reasoning_tokens: 16 + total_tokens: 69 + headers: + content-type: application/json + status_code: 200 +- filename: t10 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_01a16820-0157-7fb2-9533-3e564b318881/input_items + query_params: + limit: '0' + response: + body: + data: [] + first_id: null + has_more: true + last_id: null + object: list + headers: + content-type: application/json + status_code: 200 +- filename: t11 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_01a16820-0157-7fb2-9533-3e564b318881/input_items + query_params: + limit: '101' + response: + body: + error: + code: integer_above_max_value + message: limit must be at most 100 + param: limit + type: invalid_request_error + headers: + content-type: application/json + status_code: 400 +- filename: t12 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_01a16820-0157-7fb2-9533-3e564b318881/input_items + query_params: + order: sideways + response: + body: + error: + code: invalid_value + message: unknown variant `sideways`, expected `asc` or `desc` + param: order + type: invalid_request_error + headers: + content-type: application/json + status_code: 400 +- filename: t13 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_01a16820-0157-7fb2-9533-3e564b318881/input_items + query_params: + after: msg_missing + response: + body: + error: + code: null + message: No item found with id 'msg_missing' + param: after + type: invalid_request_error + headers: + content-type: application/json + status_code: 404 +- filename: t14 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_01a16820-0157-7fb2-9533-3e564b318881/input_items + query_params: + include[]: web_search_call.results + response: + body: + data: + - content: + - text: Reply with only ORCHID. + type: input_text + id: msg_01a16820-0376-7952-9c78-b48a50a7e4c5 + role: user + status: completed + type: message + first_id: msg_01a16820-0376-7952-9c78-b48a50a7e4c5 + has_more: false + last_id: msg_01a16820-0376-7952-9c78-b48a50a7e4c5 + object: list + headers: + content-type: application/json + status_code: 200 +- filename: t15 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_01a16820-0157-7fb2-9533-3e564b318881/input_items + query_params: + include[]: message.output_text.logprobs + response: + body: + data: + - content: + - text: Reply with only ORCHID. + type: input_text + id: msg_01a16820-0376-7952-9c78-b48a50a7e4c5 + role: user + status: completed + type: message + first_id: msg_01a16820-0376-7952-9c78-b48a50a7e4c5 + has_more: false + last_id: msg_01a16820-0376-7952-9c78-b48a50a7e4c5 + object: list + headers: + content-type: application/json + status_code: 200 +- filename: t16 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_01a16820-0157-7fb2-9533-3e564b318881/input_items + query_params: + limit: '-1' + response: + body: + error: + code: integer_below_min_value + message: limit must be at least 0 + param: limit + type: invalid_request_error + headers: + content-type: application/json + status_code: 400 +- filename: t17 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_01a16820-0157-7fb2-9533-3e564b318881/input_items + query_params: + limit: ten + response: + body: + error: + code: invalid_type + message: limit must be an integer + param: limit + type: invalid_request_error + headers: + content-type: application/json + status_code: 400 +- filename: t18 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_01a16820-0157-7fb2-9533-3e564b318881/input_items + query_params: + after: '' + response: + body: + data: + - content: + - text: Reply with only ORCHID. + type: input_text + id: msg_01a16820-0376-7952-9c78-b48a50a7e4c5 + role: user + status: completed + type: message + first_id: msg_01a16820-0376-7952-9c78-b48a50a7e4c5 + has_more: false + last_id: msg_01a16820-0376-7952-9c78-b48a50a7e4c5 + object: list + headers: + content-type: application/json + status_code: 200 +- filename: t19 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_01a16820-0157-7fb2-9533-3e564b318881/input_items + query_params: + include[]: not.a.valid.include + response: + body: + error: + code: invalid_value + message: unknown variant `not.a.valid.include`, expected one of `file_search_call.results`, + `web_search_call.results`, `web_search_call.action.sources`, `message.input_image.image_url`, + `computer_call_output.output.image_url`, `code_interpreter_call.outputs`, + `reasoning.encrypted_content`, `message.output_text.logprobs` + param: include[0] + type: invalid_request_error + headers: + content-type: application/json + status_code: 400 +- filename: t20 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_01a16820-0157-7fb2-9533-3e564b318881/input_items + query_params: + limit: + - '1' + - '2' + response: + body: + error: + code: duplicate_parameter + message: '''limit'' must be given at most once' + param: limit + type: invalid_request_error + headers: + content-type: application/json + status_code: 400 +- filename: t21 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_01a16820-0157-7fb2-9533-3e564b318881/input_items + query_params: + include[]: + - message.output_text.logprobs + - reasoning.encrypted_content + response: + body: + error: + code: null + message: Encrypted content cannot be requested for persisted responses. + param: include + type: invalid_request_error + headers: + content-type: application/json + status_code: 400 +- filename: t22 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: DELETE + path: /v1/responses/resp_01a16820-0157-7fb2-9533-3e564b318881 + query_params: {} + response: + body: + deleted: true + id: resp_01a16820-0157-7fb2-9533-3e564b318881 + object: response.deleted + headers: + content-type: application/json + status_code: 200 +- filename: t23 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: DELETE + path: /v1/responses/resp_01a16820-0157-7fb2-9533-3e564b318881 + query_params: {} + response: + body: + error: + code: null + message: 'storage error: not found: Response with id ''resp_01a16820-0157-7fb2-9533-3e564b318881''' + param: null + type: invalid_request_error + headers: + content-type: application/json + status_code: 404 diff --git a/crates/agentic-server-core/tests/cassettes/responses/response-edge-cases-openai.yaml b/crates/agentic-server-core/tests/cassettes/responses/response-edge-cases-openai.yaml new file mode 100644 index 000000000..11054dca6 --- /dev/null +++ b/crates/agentic-server-core/tests/cassettes/responses/response-edge-cases-openai.yaml @@ -0,0 +1,666 @@ +turns: +- filename: t1 + request: + body: + input: + - content: Reply with only SAPPHIRE. + role: user + model: gpt-4.1 + store: false + stream: false + headers: + accept: '*/*' + authorization: Bearer *** + content-type: application/json + user-agent: python-httpx/0.28.1 + method: POST + path: /v1/responses + query_params: {} + response: + body: + access_programs: null + background: false + billing: + payer: developer + completed_at: 1792738245 + created_at: 1792738244 + error: null + frequency_penalty: 0.0 + id: resp_0569f94ea43169bf016adb03c48e0087d186182eecca6f321c + incomplete_details: null + instructions: null + max_output_tokens: null + max_tool_calls: null + metadata: {} + model: gpt-4.1-2025-04-14 + moderation: null + object: response + output: + - content: + - annotations: [] + logprobs: [] + text: SAPPHIRE + type: output_text + id: msg_0569f94ea43169bf016adb03c4fb7887d1bda49a6c865bc289 + role: assistant + status: completed + type: message + parallel_tool_calls: true + presence_penalty: 0.0 + previous_response_id: null + prompt_cache_key: null + prompt_cache_retention: in_memory + reasoning: + context: null + effort: null + summary: null + safety_identifier: null + service_tier: default + status: completed + store: false + temperature: 1.0 + text: + format: + type: text + verbosity: medium + tool_choice: auto + tool_usage: + image_gen: + input_tokens: 0 + input_tokens_details: + image_tokens: 0 + text_tokens: 0 + output_tokens: 0 + output_tokens_details: + image_tokens: 0 + text_tokens: 0 + total_tokens: 0 + web_search: + num_requests: 0 + tools: [] + top_logprobs: 0 + top_p: 1.0 + truncation: disabled + usage: + input_tokens: 15 + input_tokens_details: + cache_write_tokens: 0 + cached_tokens: 0 + output_tokens: 5 + output_tokens_details: + reasoning_tokens: 0 + total_tokens: 20 + user: null + headers: + content-type: application/json + status_code: 200 +- filename: t2 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_0569f94ea43169bf016adb03c48e0087d186182eecca6f321c + query_params: {} + response: + body: + error: + code: null + message: Response with id 'resp_0569f94ea43169bf016adb03c48e0087d186182eecca6f321c' + not found. + param: null + type: invalid_request_error + headers: + content-type: application/json + status_code: 404 +- filename: t3 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_0569f94ea43169bf016adb03c48e0087d186182eecca6f321c/input_items + query_params: {} + response: + body: + error: + code: null + message: Response with id 'resp_0569f94ea43169bf016adb03c48e0087d186182eecca6f321c' + not found. + param: null + type: invalid_request_error + headers: + content-type: application/json + status_code: 404 +- filename: t4 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: DELETE + path: /v1/responses/resp_0569f94ea43169bf016adb03c48e0087d186182eecca6f321c + query_params: {} + response: + body: + error: + code: null + message: Response with id 'resp_0569f94ea43169bf016adb03c48e0087d186182eecca6f321c' + not found. + param: null + type: invalid_request_error + headers: + content-type: application/json + status_code: 404 +- filename: t5 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_missing + query_params: {} + response: + body: + error: + code: null + message: Response with id 'resp_missing' not found. + param: null + type: invalid_request_error + headers: + content-type: application/json + status_code: 404 +- filename: t6 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_missing/input_items + query_params: {} + response: + body: + error: + code: null + message: Response with id 'resp_missing' not found. + param: null + type: invalid_request_error + headers: + content-type: application/json + status_code: 404 +- filename: t7 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: DELETE + path: /v1/responses/resp_missing + query_params: {} + response: + body: + error: + code: null + message: Response with id 'resp_missing' not found. + param: null + type: invalid_request_error + headers: + content-type: application/json + status_code: 404 +- filename: t8 + request: + body: + input: + - content: Reply with only ORCHID. + role: user + model: gpt-4.1 + previous_response_id: resp_missing + store: true + stream: false + headers: + accept: '*/*' + authorization: Bearer *** + content-type: application/json + user-agent: python-httpx/0.28.1 + method: POST + path: /v1/responses + query_params: {} + response: + body: + error: + code: previous_response_not_found + message: Previous response with id 'resp_missing' not found. + param: previous_response_id + type: invalid_request_error + headers: + content-type: application/json + status_code: 400 +- filename: t9 + request: + body: + input: + - content: Reply with only ORCHID. + role: user + model: gpt-4.1 + store: true + stream: false + headers: + accept: '*/*' + authorization: Bearer *** + content-type: application/json + user-agent: python-httpx/0.28.1 + method: POST + path: /v1/responses + query_params: {} + response: + body: + access_programs: null + background: false + billing: + payer: developer + completed_at: 1792738249 + created_at: 1792738248 + error: null + frequency_penalty: 0.0 + id: resp_0865073d0b1881b3006adb03c8ab5c87d1958ea23d891129bc + incomplete_details: null + instructions: null + max_output_tokens: null + max_tool_calls: null + metadata: {} + model: gpt-4.1-2025-04-14 + moderation: null + object: response + output: + - content: + - annotations: [] + logprobs: [] + text: ORCHID + type: output_text + id: msg_0865073d0b1881b3006adb03c8f9a487d1adc111a401afb68f + role: assistant + status: completed + type: message + parallel_tool_calls: true + presence_penalty: 0.0 + previous_response_id: null + prompt_cache_key: null + prompt_cache_retention: in_memory + reasoning: + context: null + effort: null + summary: null + safety_identifier: null + service_tier: default + status: completed + store: true + temperature: 1.0 + text: + format: + type: text + verbosity: medium + tool_choice: auto + tool_usage: + image_gen: + input_tokens: 0 + input_tokens_details: + image_tokens: 0 + text_tokens: 0 + output_tokens: 0 + output_tokens_details: + image_tokens: 0 + text_tokens: 0 + total_tokens: 0 + web_search: + num_requests: 0 + tools: [] + top_logprobs: 0 + top_p: 1.0 + truncation: disabled + usage: + input_tokens: 14 + input_tokens_details: + cache_write_tokens: 0 + cached_tokens: 0 + output_tokens: 4 + output_tokens_details: + reasoning_tokens: 0 + total_tokens: 18 + user: null + headers: + content-type: application/json + status_code: 200 +- filename: t10 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_0865073d0b1881b3006adb03c8ab5c87d1958ea23d891129bc/input_items + query_params: + limit: '0' + response: + body: + data: [] + first_id: null + has_more: true + last_id: null + object: list + headers: + content-type: application/json + status_code: 200 +- filename: t11 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_0865073d0b1881b3006adb03c8ab5c87d1958ea23d891129bc/input_items + query_params: + limit: '101' + response: + body: + error: + code: integer_above_max_value + message: 'Invalid ''limit'': integer above maximum value. Expected a value + <= 100, but got 101 instead.' + param: limit + type: invalid_request_error + headers: + content-type: application/json + status_code: 400 +- filename: t12 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_0865073d0b1881b3006adb03c8ab5c87d1958ea23d891129bc/input_items + query_params: + order: sideways + response: + body: + error: + code: invalid_value + message: 'Invalid value: ''sideways''. Supported values are: ''asc'' and ''desc''.' + param: order + type: invalid_request_error + headers: + content-type: application/json + status_code: 400 +- filename: t13 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_0865073d0b1881b3006adb03c8ab5c87d1958ea23d891129bc/input_items + query_params: + after: msg_missing + response: + body: + error: + code: null + message: No item found with id 'msg_missing' + param: after + type: invalid_request_error + headers: + content-type: application/json + status_code: 404 +- filename: t14 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_0865073d0b1881b3006adb03c8ab5c87d1958ea23d891129bc/input_items + query_params: + include[]: web_search_call.results + response: + body: + data: + - content: + - text: Reply with only ORCHID. + type: input_text + id: msg_0865073d0b1881b3006adb03c8b52c87d1a5125622cced8484 + role: user + status: completed + type: message + first_id: msg_0865073d0b1881b3006adb03c8b52c87d1a5125622cced8484 + has_more: false + last_id: msg_0865073d0b1881b3006adb03c8b52c87d1a5125622cced8484 + object: list + headers: + content-type: application/json + status_code: 200 +- filename: t15 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_0865073d0b1881b3006adb03c8ab5c87d1958ea23d891129bc/input_items + query_params: + include[]: message.output_text.logprobs + response: + body: + data: + - content: + - text: Reply with only ORCHID. + type: input_text + id: msg_0865073d0b1881b3006adb03c8b52c87d1a5125622cced8484 + role: user + status: completed + type: message + first_id: msg_0865073d0b1881b3006adb03c8b52c87d1a5125622cced8484 + has_more: false + last_id: msg_0865073d0b1881b3006adb03c8b52c87d1a5125622cced8484 + object: list + headers: + content-type: application/json + status_code: 200 +- filename: t16 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_0865073d0b1881b3006adb03c8ab5c87d1958ea23d891129bc/input_items + query_params: + limit: '-1' + response: + body: + error: + code: integer_below_min_value + message: 'Invalid ''limit'': integer below minimum value. Expected a value + >= 0, but got -1 instead.' + param: limit + type: invalid_request_error + headers: + content-type: application/json + status_code: 400 +- filename: t17 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_0865073d0b1881b3006adb03c8ab5c87d1958ea23d891129bc/input_items + query_params: + limit: ten + response: + body: + error: + code: invalid_type + message: 'Invalid type for ''limit'': expected an integer, but got a string + value that could not be converted into an integer.' + param: limit + type: invalid_request_error + headers: + content-type: application/json + status_code: 400 +- filename: t18 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_0865073d0b1881b3006adb03c8ab5c87d1958ea23d891129bc/input_items + query_params: + after: '' + response: + body: + data: + - content: + - text: Reply with only ORCHID. + type: input_text + id: msg_0865073d0b1881b3006adb03c8b52c87d1a5125622cced8484 + role: user + status: completed + type: message + first_id: msg_0865073d0b1881b3006adb03c8b52c87d1a5125622cced8484 + has_more: false + last_id: msg_0865073d0b1881b3006adb03c8b52c87d1a5125622cced8484 + object: list + headers: + content-type: application/json + status_code: 200 +- filename: t19 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_0865073d0b1881b3006adb03c8ab5c87d1958ea23d891129bc/input_items + query_params: + include[]: not.a.valid.include + response: + body: + error: + code: invalid_value + message: 'Invalid value: ''not.a.valid.include''. Supported values are: ''file_search_call.results'', + ''web_search_call.results'', ''web_search_call.action.sources'', ''message.input_image.image_url'', + ''computer_call_output.output.image_url'', ''code_interpreter_call.outputs'', + ''reasoning.encrypted_content'', and ''message.output_text.logprobs''.' + param: include[0] + type: invalid_request_error + headers: + content-type: application/json + status_code: 400 +- filename: t20 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_0865073d0b1881b3006adb03c8ab5c87d1958ea23d891129bc/input_items + query_params: + limit: + - '1' + - '2' + response: + body: + error: + code: duplicate_parameter + message: 'Duplicate parameter: ''limit''. You provided multiple values for + this parameter, whereas only one is allowed. If you are trying to provide + a list of values, use the array syntax instead e.g. ''limit[]=''.' + param: limit + type: invalid_request_error + headers: + content-type: application/json + status_code: 400 +- filename: t21 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_0865073d0b1881b3006adb03c8ab5c87d1958ea23d891129bc/input_items + query_params: + include[]: + - message.output_text.logprobs + - reasoning.encrypted_content + response: + body: + error: + code: null + message: Encrypted content cannot be requested for persisted responses. + param: include + type: invalid_request_error + headers: + content-type: application/json + status_code: 400 +- filename: t22 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: DELETE + path: /v1/responses/resp_0865073d0b1881b3006adb03c8ab5c87d1958ea23d891129bc + query_params: {} + response: + body: + deleted: true + id: resp_0865073d0b1881b3006adb03c8ab5c87d1958ea23d891129bc + object: response.deleted + headers: + content-type: application/json + status_code: 200 +- filename: t23 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: DELETE + path: /v1/responses/resp_0865073d0b1881b3006adb03c8ab5c87d1958ea23d891129bc + query_params: {} + response: + body: + error: + code: null + message: Response with id 'resp_0865073d0b1881b3006adb03c8ab5c87d1958ea23d891129bc' + not found. + param: null + type: invalid_request_error + headers: + content-type: application/json + status_code: 404 diff --git a/crates/agentic-server-core/tests/cassettes/responses/response-edge-cases-stream-gateway.yaml b/crates/agentic-server-core/tests/cassettes/responses/response-edge-cases-stream-gateway.yaml new file mode 100644 index 000000000..a101ead84 --- /dev/null +++ b/crates/agentic-server-core/tests/cassettes/responses/response-edge-cases-stream-gateway.yaml @@ -0,0 +1,1110 @@ +turns: +- filename: t1 + request: + body: + input: + - content: Reply with only SAPPHIRE. + role: user + model: Qwen/Qwen3.8-27B-FP8 + store: false + stream: true + headers: + accept: '*/*' + authorization: Bearer *** + content-type: application/json + user-agent: python-httpx/0.28.1 + method: POST + path: /v1/responses + query_params: {} + response: + headers: + content-type: text/event-stream; charset=utf-8 + sse: + - 'event: response.created + + ' + - 'data: {"response":{"id":"resp_873a4b1797aa4849","created_at":1792748293,"incomplete_details":null,"instructions":null,"metadata":null,"model":"Qwen/Qwen3.8-27B-FP8","object":"response","output":[],"parallel_tool_calls":true,"temperature":1.0,"tool_choice":"none","tools":[],"top_p":0.95,"background":false,"max_output_tokens":65489,"max_tool_calls":null,"previous_response_id":null,"prompt":null,"reasoning":null,"service_tier":"auto","status":"in_progress","text":null,"top_logprobs":null,"truncation":"disabled","usage":null,"user":null,"presence_penalty":0.0,"frequency_penalty":0.0,"kv_transfer_params":null,"ec_transfer_params":null,"input_messages":null,"output_messages":null},"sequence_number":0,"type":"response.created"} + + ' + - ' + + ' + - 'event: response.in_progress + + ' + - 'data: {"response":{"id":"resp_873a4b1797aa4849","created_at":1792748293,"incomplete_details":null,"instructions":null,"metadata":null,"model":"Qwen/Qwen3.8-27B-FP8","object":"response","output":[],"parallel_tool_calls":true,"temperature":1.0,"tool_choice":"none","tools":[],"top_p":0.95,"background":false,"max_output_tokens":65489,"max_tool_calls":null,"previous_response_id":null,"prompt":null,"reasoning":null,"service_tier":"auto","status":"in_progress","text":null,"top_logprobs":null,"truncation":"disabled","usage":null,"user":null,"presence_penalty":0.0,"frequency_penalty":0.0,"kv_transfer_params":null,"ec_transfer_params":null,"input_messages":null,"output_messages":null},"sequence_number":1,"type":"response.in_progress"} + + ' + - ' + + ' + - 'event: response.output_item.added + + ' + - 'data: {"item":{"id":"rs_86cbe401d979ff9e","summary":[],"type":"reasoning","content":null,"encrypted_content":null,"status":"in_progress"},"output_index":0,"sequence_number":2,"type":"response.output_item.added"} + + ' + - ' + + ' + - 'event: response.content_part.added + + ' + - 'data: {"content_index":0,"item_id":"rs_86cbe401d979ff9e","output_index":0,"part":{"text":"","type":"reasoning_text"},"sequence_number":3,"type":"response.content_part.added"} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"content_index":0,"delta":"The","item_id":"rs_86cbe401d979ff9e","output_index":0,"sequence_number":4,"type":"response.reasoning_text.delta"} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"content_index":0,"delta":" user","item_id":"rs_86cbe401d979ff9e","output_index":0,"sequence_number":5,"type":"response.reasoning_text.delta"} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"content_index":0,"delta":" wants","item_id":"rs_86cbe401d979ff9e","output_index":0,"sequence_number":6,"type":"response.reasoning_text.delta"} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"content_index":0,"delta":" me","item_id":"rs_86cbe401d979ff9e","output_index":0,"sequence_number":7,"type":"response.reasoning_text.delta"} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"content_index":0,"delta":" to","item_id":"rs_86cbe401d979ff9e","output_index":0,"sequence_number":8,"type":"response.reasoning_text.delta"} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"content_index":0,"delta":" reply","item_id":"rs_86cbe401d979ff9e","output_index":0,"sequence_number":9,"type":"response.reasoning_text.delta"} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"content_index":0,"delta":" with","item_id":"rs_86cbe401d979ff9e","output_index":0,"sequence_number":10,"type":"response.reasoning_text.delta"} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"content_index":0,"delta":" only","item_id":"rs_86cbe401d979ff9e","output_index":0,"sequence_number":11,"type":"response.reasoning_text.delta"} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"content_index":0,"delta":" the","item_id":"rs_86cbe401d979ff9e","output_index":0,"sequence_number":12,"type":"response.reasoning_text.delta"} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"content_index":0,"delta":" word","item_id":"rs_86cbe401d979ff9e","output_index":0,"sequence_number":13,"type":"response.reasoning_text.delta"} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"content_index":0,"delta":" \"","item_id":"rs_86cbe401d979ff9e","output_index":0,"sequence_number":14,"type":"response.reasoning_text.delta"} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"content_index":0,"delta":"S","item_id":"rs_86cbe401d979ff9e","output_index":0,"sequence_number":15,"type":"response.reasoning_text.delta"} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"content_index":0,"delta":"AP","item_id":"rs_86cbe401d979ff9e","output_index":0,"sequence_number":16,"type":"response.reasoning_text.delta"} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"content_index":0,"delta":"PH","item_id":"rs_86cbe401d979ff9e","output_index":0,"sequence_number":17,"type":"response.reasoning_text.delta"} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"content_index":0,"delta":"IRE","item_id":"rs_86cbe401d979ff9e","output_index":0,"sequence_number":18,"type":"response.reasoning_text.delta"} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"content_index":0,"delta":"\".","item_id":"rs_86cbe401d979ff9e","output_index":0,"sequence_number":19,"type":"response.reasoning_text.delta"} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"content_index":0,"delta":"\n","item_id":"rs_86cbe401d979ff9e","output_index":0,"sequence_number":20,"type":"response.reasoning_text.delta"} + + ' + - ' + + ' + - 'event: response.reasoning_text.done + + ' + - 'data: {"content_index":0,"item_id":"rs_86cbe401d979ff9e","output_index":0,"sequence_number":21,"text":"The + user wants me to reply with only the word \"SAPPHIRE\".\n","type":"response.reasoning_text.done"} + + ' + - ' + + ' + - 'event: response.content_part.done + + ' + - 'data: {"content_index":0,"item_id":"rs_86cbe401d979ff9e","output_index":0,"part":{"text":"The + user wants me to reply with only the word \"SAPPHIRE\".\n","type":"reasoning_text"},"sequence_number":22,"type":"response.content_part.done"} + + ' + - ' + + ' + - 'event: response.output_item.done + + ' + - 'data: {"item":{"id":"rs_86cbe401d979ff9e","summary":[],"type":"reasoning","content":[{"text":"The + user wants me to reply with only the word \"SAPPHIRE\".\n","type":"reasoning_text"}],"encrypted_content":null,"status":"completed"},"output_index":0,"sequence_number":23,"type":"response.output_item.done"} + + ' + - ' + + ' + - 'event: response.output_item.added + + ' + - 'data: {"item":{"id":"msg_8ca715d6204854f4","content":[],"role":"assistant","status":"in_progress","type":"message","phase":null},"output_index":1,"sequence_number":24,"type":"response.output_item.added"} + + ' + - ' + + ' + - 'event: response.content_part.added + + ' + - 'data: {"content_index":0,"item_id":"msg_8ca715d6204854f4","output_index":1,"part":{"annotations":[],"text":"","type":"output_text","logprobs":[]},"sequence_number":25,"type":"response.content_part.added"} + + ' + - ' + + ' + - 'event: response.output_text.delta + + ' + - 'data: {"content_index":0,"delta":"\n\nS","item_id":"msg_8ca715d6204854f4","logprobs":[],"output_index":1,"sequence_number":26,"type":"response.output_text.delta"} + + ' + - ' + + ' + - 'event: response.output_text.delta + + ' + - 'data: {"content_index":0,"delta":"AP","item_id":"msg_8ca715d6204854f4","logprobs":[],"output_index":1,"sequence_number":27,"type":"response.output_text.delta"} + + ' + - ' + + ' + - 'event: response.output_text.delta + + ' + - 'data: {"content_index":0,"delta":"PH","item_id":"msg_8ca715d6204854f4","logprobs":[],"output_index":1,"sequence_number":28,"type":"response.output_text.delta"} + + ' + - ' + + ' + - 'event: response.output_text.delta + + ' + - 'data: {"content_index":0,"delta":"IRE","item_id":"msg_8ca715d6204854f4","logprobs":[],"output_index":1,"sequence_number":29,"type":"response.output_text.delta"} + + ' + - ' + + ' + - 'event: response.output_text.done + + ' + - 'data: {"content_index":0,"item_id":"msg_8ca715d6204854f4","logprobs":[],"output_index":1,"sequence_number":30,"text":"\n\nSAPPHIRE","type":"response.output_text.done"} + + ' + - ' + + ' + - 'event: response.content_part.done + + ' + - 'data: {"content_index":0,"item_id":"msg_8ca715d6204854f4","output_index":1,"part":{"annotations":[],"text":"\n\nSAPPHIRE","type":"output_text","logprobs":null},"sequence_number":31,"type":"response.content_part.done"} + + ' + - ' + + ' + - 'event: response.output_item.done + + ' + - 'data: {"item":{"id":"msg_8ca715d6204854f4","content":[{"annotations":[],"text":"\n\nSAPPHIRE","type":"output_text","logprobs":null}],"role":"assistant","status":"completed","type":"message","phase":null},"output_index":1,"sequence_number":32,"type":"response.output_item.done"} + + ' + - ' + + ' + - 'event: response.completed + + ' + - 'data: {"response":{"id":"resp_873a4b1797aa4849","created_at":1792748293,"incomplete_details":null,"instructions":null,"metadata":null,"model":"Qwen/Qwen3.8-27B-FP8","object":"response","output":[{"id":"rs_86cbe401d979ff9e","summary":[],"type":"reasoning","content":[{"text":"The + user wants me to reply with only the word \"SAPPHIRE\".\n","type":"reasoning_text"}],"encrypted_content":null,"status":"completed"},{"id":"msg_8ca715d6204854f4","content":[{"annotations":[],"text":"\n\nSAPPHIRE","type":"output_text","logprobs":null}],"role":"assistant","status":"completed","type":"message","phase":null}],"parallel_tool_calls":true,"temperature":1.0,"tool_choice":"none","tools":[],"top_p":0.95,"background":false,"max_output_tokens":65489,"max_tool_calls":null,"previous_response_id":null,"prompt":null,"reasoning":null,"service_tier":"auto","status":"completed","text":null,"top_logprobs":null,"truncation":"disabled","usage":{"input_tokens":47,"input_tokens_details":{"cached_tokens":0,"cache_write_tokens":0,"input_tokens_per_turn":[],"cached_tokens_per_turn":[]},"output_tokens":24,"output_tokens_details":{"reasoning_tokens":17,"tool_output_tokens":0,"output_tokens_per_turn":[],"tool_output_tokens_per_turn":[]},"total_tokens":71},"user":null,"presence_penalty":0.0,"frequency_penalty":0.0,"kv_transfer_params":null,"ec_transfer_params":null,"input_messages":null,"output_messages":null},"sequence_number":33,"type":"response.completed"} + + ' + - ' + + ' + status_code: 200 +- filename: t2 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_873a4b1797aa4849 + query_params: {} + response: + body: + error: + code: null + message: 'storage error: not found: Response with id ''resp_873a4b1797aa4849''' + param: null + type: invalid_request_error + headers: + content-type: application/json + status_code: 404 +- filename: t3 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_873a4b1797aa4849/input_items + query_params: {} + response: + body: + error: + code: null + message: 'storage error: not found: Response with id ''resp_873a4b1797aa4849''' + param: null + type: invalid_request_error + headers: + content-type: application/json + status_code: 404 +- filename: t4 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: DELETE + path: /v1/responses/resp_873a4b1797aa4849 + query_params: {} + response: + body: + error: + code: null + message: 'storage error: not found: Response with id ''resp_873a4b1797aa4849''' + param: null + type: invalid_request_error + headers: + content-type: application/json + status_code: 404 +- filename: t5 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_missing + query_params: {} + response: + body: + error: + code: null + message: 'storage error: not found: Response with id ''resp_missing''' + param: null + type: invalid_request_error + headers: + content-type: application/json + status_code: 404 +- filename: t6 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_missing/input_items + query_params: {} + response: + body: + error: + code: null + message: 'storage error: not found: Response with id ''resp_missing''' + param: null + type: invalid_request_error + headers: + content-type: application/json + status_code: 404 +- filename: t7 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: DELETE + path: /v1/responses/resp_missing + query_params: {} + response: + body: + error: + code: null + message: 'storage error: not found: Response with id ''resp_missing''' + param: null + type: invalid_request_error + headers: + content-type: application/json + status_code: 404 +- filename: t8 + request: + body: + input: + - content: Reply with only ORCHID. + role: user + model: Qwen/Qwen3.8-27B-FP8 + previous_response_id: resp_missing + store: true + stream: false + headers: + accept: '*/*' + authorization: Bearer *** + content-type: application/json + user-agent: python-httpx/0.28.1 + method: POST + path: /v1/responses + query_params: {} + response: + body: + error: + code: previous_response_not_found + message: Previous response with id 'resp_missing' not found. + param: previous_response_id + type: invalid_request_error + headers: + content-type: application/json + status_code: 400 +- filename: t9 + request: + body: + input: + - content: Reply with only ORCHID. + role: user + model: Qwen/Qwen3.8-27B-FP8 + store: true + stream: true + headers: + accept: '*/*' + authorization: Bearer *** + content-type: application/json + user-agent: python-httpx/0.28.1 + method: POST + path: /v1/responses + query_params: {} + response: + headers: + content-type: text/event-stream; charset=utf-8 + sse: + - 'event: response.created + + ' + - 'data: {"type":"response.created","sequence_number":0,"response":{"id":"resp_01a16820-0fd3-7242-84a7-af23630e3345","created_at":1792748294,"incomplete_details":null,"instructions":null,"metadata":{},"model":"Qwen/Qwen3.8-27B-FP8","object":"response","output":[],"parallel_tool_calls":false,"temperature":1.0,"tool_choice":"none","tools":[],"top_p":1.0,"background":false,"max_output_tokens":null,"max_tool_calls":null,"previous_response_id":null,"prompt":null,"reasoning":null,"service_tier":"auto","status":"in_progress","text":{"format":{"type":"text"}},"top_logprobs":0,"truncation":"disabled","usage":null,"user":null,"presence_penalty":0.0,"frequency_penalty":0.0,"kv_transfer_params":null,"ec_transfer_params":null,"input_messages":null,"output_messages":null,"completed_at":null,"store":true,"safety_identifier":null,"prompt_cache_key":null,"prompt_cache_options":null,"error":null}} + + ' + - ' + + ' + - 'event: response.in_progress + + ' + - 'data: {"type":"response.in_progress","sequence_number":1,"response":{"id":"resp_01a16820-0fd3-7242-84a7-af23630e3345","created_at":1792748294,"incomplete_details":null,"instructions":null,"metadata":{},"model":"Qwen/Qwen3.8-27B-FP8","object":"response","output":[],"parallel_tool_calls":false,"temperature":1.0,"tool_choice":"none","tools":[],"top_p":1.0,"background":false,"max_output_tokens":null,"max_tool_calls":null,"previous_response_id":null,"prompt":null,"reasoning":null,"service_tier":"auto","status":"in_progress","text":{"format":{"type":"text"}},"top_logprobs":0,"truncation":"disabled","usage":null,"user":null,"presence_penalty":0.0,"frequency_penalty":0.0,"kv_transfer_params":null,"ec_transfer_params":null,"input_messages":null,"output_messages":null,"completed_at":null,"store":true,"safety_identifier":null,"prompt_cache_key":null,"prompt_cache_options":null,"error":null}} + + ' + - ' + + ' + - 'event: response.output_item.added + + ' + - 'data: {"type":"response.output_item.added","sequence_number":2,"output_index":0,"item":{"id":"rs_8de5e7f820ccd569","summary":[],"type":"reasoning","content":[],"status":"in_progress"}} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"type":"response.reasoning_text.delta","sequence_number":3,"output_index":0,"content_index":0,"delta":"The","item_id":"rs_8de5e7f820ccd569"} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"type":"response.reasoning_text.delta","sequence_number":4,"output_index":0,"content_index":0,"delta":" + user","item_id":"rs_8de5e7f820ccd569"} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"type":"response.reasoning_text.delta","sequence_number":5,"output_index":0,"content_index":0,"delta":" + wants","item_id":"rs_8de5e7f820ccd569"} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"type":"response.reasoning_text.delta","sequence_number":6,"output_index":0,"content_index":0,"delta":" + me","item_id":"rs_8de5e7f820ccd569"} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"type":"response.reasoning_text.delta","sequence_number":7,"output_index":0,"content_index":0,"delta":" + to","item_id":"rs_8de5e7f820ccd569"} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"type":"response.reasoning_text.delta","sequence_number":8,"output_index":0,"content_index":0,"delta":" + reply","item_id":"rs_8de5e7f820ccd569"} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"type":"response.reasoning_text.delta","sequence_number":9,"output_index":0,"content_index":0,"delta":" + with","item_id":"rs_8de5e7f820ccd569"} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"type":"response.reasoning_text.delta","sequence_number":10,"output_index":0,"content_index":0,"delta":" + only","item_id":"rs_8de5e7f820ccd569"} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"type":"response.reasoning_text.delta","sequence_number":11,"output_index":0,"content_index":0,"delta":" + the","item_id":"rs_8de5e7f820ccd569"} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"type":"response.reasoning_text.delta","sequence_number":12,"output_index":0,"content_index":0,"delta":" + word","item_id":"rs_8de5e7f820ccd569"} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"type":"response.reasoning_text.delta","sequence_number":13,"output_index":0,"content_index":0,"delta":" + \"","item_id":"rs_8de5e7f820ccd569"} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"type":"response.reasoning_text.delta","sequence_number":14,"output_index":0,"content_index":0,"delta":"OR","item_id":"rs_8de5e7f820ccd569"} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"type":"response.reasoning_text.delta","sequence_number":15,"output_index":0,"content_index":0,"delta":"CH","item_id":"rs_8de5e7f820ccd569"} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"type":"response.reasoning_text.delta","sequence_number":16,"output_index":0,"content_index":0,"delta":"ID","item_id":"rs_8de5e7f820ccd569"} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"type":"response.reasoning_text.delta","sequence_number":17,"output_index":0,"content_index":0,"delta":"\".","item_id":"rs_8de5e7f820ccd569"} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"type":"response.reasoning_text.delta","sequence_number":18,"output_index":0,"content_index":0,"delta":"\n","item_id":"rs_8de5e7f820ccd569"} + + ' + - ' + + ' + - 'event: response.reasoning_text.done + + ' + - 'data: {"type":"response.reasoning_text.done","sequence_number":19,"output_index":0,"content_index":0,"item_id":"rs_8de5e7f820ccd569","text":"The + user wants me to reply with only the word \"ORCHID\".\n"} + + ' + - ' + + ' + - 'event: response.output_item.done + + ' + - 'data: {"type":"response.output_item.done","sequence_number":20,"output_index":0,"item":{"id":"rs_8de5e7f820ccd569","summary":[],"type":"reasoning","content":[{"text":"The + user wants me to reply with only the word \"ORCHID\".\n","type":"reasoning_text"}],"status":"completed"}} + + ' + - ' + + ' + - 'event: response.output_item.added + + ' + - 'data: {"type":"response.output_item.added","sequence_number":21,"output_index":1,"item":{"id":"msg_83abae8265795305","content":[],"role":"assistant","status":"in_progress","type":"message"}} + + ' + - ' + + ' + - 'event: response.content_part.added + + ' + - 'data: {"type":"response.content_part.added","sequence_number":22,"output_index":1,"content_index":0,"item_id":"msg_83abae8265795305","part":{"annotations":[],"text":"","type":"output_text","logprobs":[]}} + + ' + - ' + + ' + - 'event: response.output_text.delta + + ' + - 'data: {"type":"response.output_text.delta","sequence_number":23,"output_index":1,"content_index":0,"delta":"\n\nOR","item_id":"msg_83abae8265795305","logprobs":[]} + + ' + - ' + + ' + - 'event: response.output_text.delta + + ' + - 'data: {"type":"response.output_text.delta","sequence_number":24,"output_index":1,"content_index":0,"delta":"CH","item_id":"msg_83abae8265795305","logprobs":[]} + + ' + - ' + + ' + - 'event: response.output_text.delta + + ' + - 'data: {"type":"response.output_text.delta","sequence_number":25,"output_index":1,"content_index":0,"delta":"ID","item_id":"msg_83abae8265795305","logprobs":[]} + + ' + - ' + + ' + - 'event: response.output_text.done + + ' + - 'data: {"type":"response.output_text.done","sequence_number":26,"output_index":1,"content_index":0,"item_id":"msg_83abae8265795305","logprobs":[],"text":"\n\nORCHID"} + + ' + - ' + + ' + - 'event: response.content_part.done + + ' + - 'data: {"type":"response.content_part.done","sequence_number":27,"output_index":1,"content_index":0,"item_id":"msg_83abae8265795305","part":{"annotations":[],"text":"\n\nORCHID","type":"output_text","logprobs":[]}} + + ' + - ' + + ' + - 'event: response.output_item.done + + ' + - 'data: {"type":"response.output_item.done","sequence_number":28,"output_index":1,"item":{"id":"msg_83abae8265795305","content":[{"annotations":[],"text":"\n\nORCHID","type":"output_text","logprobs":[]}],"role":"assistant","status":"completed","type":"message"}} + + ' + - ' + + ' + - 'event: response.completed + + ' + - 'data: {"type":"response.completed","sequence_number":29,"response":{"id":"resp_01a16820-0fd3-7242-84a7-af23630e3345","object":"response","created_at":1792748294,"model":"Qwen/Qwen3.8-27B-FP8","status":"completed","output":[{"type":"reasoning","id":"rs_8de5e7f820ccd569","content":[{"type":"reasoning_text","text":"The + user wants me to reply with only the word \"ORCHID\".\n"}],"summary":[],"status":"completed"},{"type":"message","id":"msg_83abae8265795305","role":"assistant","status":"completed","content":[{"type":"output_text","text":"\n\nORCHID","annotations":[]}]}],"usage":{"input_tokens":47,"output_tokens":22,"total_tokens":69,"input_tokens_details":{"cached_tokens":0,"cache_write_tokens":0},"output_tokens_details":{"reasoning_tokens":16}},"incomplete_details":null,"error":null,"previous_response_id":null,"instructions":null,"max_tool_calls":null,"service_tier":"auto","tools":[],"tool_choice":"auto","completed_at":1792748294,"truncation":"disabled","parallel_tool_calls":false,"text":{"format":{"type":"text"}},"top_p":1.0,"presence_penalty":0.0,"frequency_penalty":0.0,"top_logprobs":0,"temperature":1.0,"reasoning":null,"max_output_tokens":null,"store":true,"background":false,"metadata":{},"safety_identifier":null,"prompt_cache_key":null,"prompt_cache_options":null}} + + ' + - ' + + ' + - 'data: [DONE] + + ' + - ' + + ' + status_code: 200 +- filename: t10 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_01a16820-0fd3-7242-84a7-af23630e3345/input_items + query_params: + limit: '0' + response: + body: + data: [] + first_id: null + has_more: true + last_id: null + object: list + headers: + content-type: application/json + status_code: 200 +- filename: t11 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_01a16820-0fd3-7242-84a7-af23630e3345/input_items + query_params: + limit: '101' + response: + body: + error: + code: integer_above_max_value + message: limit must be at most 100 + param: limit + type: invalid_request_error + headers: + content-type: application/json + status_code: 400 +- filename: t12 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_01a16820-0fd3-7242-84a7-af23630e3345/input_items + query_params: + order: sideways + response: + body: + error: + code: invalid_value + message: unknown variant `sideways`, expected `asc` or `desc` + param: order + type: invalid_request_error + headers: + content-type: application/json + status_code: 400 +- filename: t13 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_01a16820-0fd3-7242-84a7-af23630e3345/input_items + query_params: + after: msg_missing + response: + body: + error: + code: null + message: No item found with id 'msg_missing' + param: after + type: invalid_request_error + headers: + content-type: application/json + status_code: 404 +- filename: t14 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_01a16820-0fd3-7242-84a7-af23630e3345/input_items + query_params: + include[]: web_search_call.results + response: + body: + data: + - content: + - text: Reply with only ORCHID. + type: input_text + id: msg_01a16820-11f5-7733-9248-1b0c81f85b9e + role: user + status: completed + type: message + first_id: msg_01a16820-11f5-7733-9248-1b0c81f85b9e + has_more: false + last_id: msg_01a16820-11f5-7733-9248-1b0c81f85b9e + object: list + headers: + content-type: application/json + status_code: 200 +- filename: t15 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_01a16820-0fd3-7242-84a7-af23630e3345/input_items + query_params: + include[]: message.output_text.logprobs + response: + body: + data: + - content: + - text: Reply with only ORCHID. + type: input_text + id: msg_01a16820-11f5-7733-9248-1b0c81f85b9e + role: user + status: completed + type: message + first_id: msg_01a16820-11f5-7733-9248-1b0c81f85b9e + has_more: false + last_id: msg_01a16820-11f5-7733-9248-1b0c81f85b9e + object: list + headers: + content-type: application/json + status_code: 200 +- filename: t16 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_01a16820-0fd3-7242-84a7-af23630e3345/input_items + query_params: + limit: '-1' + response: + body: + error: + code: integer_below_min_value + message: limit must be at least 0 + param: limit + type: invalid_request_error + headers: + content-type: application/json + status_code: 400 +- filename: t17 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_01a16820-0fd3-7242-84a7-af23630e3345/input_items + query_params: + limit: ten + response: + body: + error: + code: invalid_type + message: limit must be an integer + param: limit + type: invalid_request_error + headers: + content-type: application/json + status_code: 400 +- filename: t18 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_01a16820-0fd3-7242-84a7-af23630e3345/input_items + query_params: + after: '' + response: + body: + data: + - content: + - text: Reply with only ORCHID. + type: input_text + id: msg_01a16820-11f5-7733-9248-1b0c81f85b9e + role: user + status: completed + type: message + first_id: msg_01a16820-11f5-7733-9248-1b0c81f85b9e + has_more: false + last_id: msg_01a16820-11f5-7733-9248-1b0c81f85b9e + object: list + headers: + content-type: application/json + status_code: 200 +- filename: t19 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_01a16820-0fd3-7242-84a7-af23630e3345/input_items + query_params: + include[]: not.a.valid.include + response: + body: + error: + code: invalid_value + message: unknown variant `not.a.valid.include`, expected one of `file_search_call.results`, + `web_search_call.results`, `web_search_call.action.sources`, `message.input_image.image_url`, + `computer_call_output.output.image_url`, `code_interpreter_call.outputs`, + `reasoning.encrypted_content`, `message.output_text.logprobs` + param: include[0] + type: invalid_request_error + headers: + content-type: application/json + status_code: 400 +- filename: t20 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_01a16820-0fd3-7242-84a7-af23630e3345/input_items + query_params: + limit: + - '1' + - '2' + response: + body: + error: + code: duplicate_parameter + message: '''limit'' must be given at most once' + param: limit + type: invalid_request_error + headers: + content-type: application/json + status_code: 400 +- filename: t21 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_01a16820-0fd3-7242-84a7-af23630e3345/input_items + query_params: + include[]: + - message.output_text.logprobs + - reasoning.encrypted_content + response: + body: + error: + code: null + message: Encrypted content cannot be requested for persisted responses. + param: include + type: invalid_request_error + headers: + content-type: application/json + status_code: 400 +- filename: t22 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: DELETE + path: /v1/responses/resp_01a16820-0fd3-7242-84a7-af23630e3345 + query_params: {} + response: + body: + deleted: true + id: resp_01a16820-0fd3-7242-84a7-af23630e3345 + object: response.deleted + headers: + content-type: application/json + status_code: 200 +- filename: t23 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: DELETE + path: /v1/responses/resp_01a16820-0fd3-7242-84a7-af23630e3345 + query_params: {} + response: + body: + error: + code: null + message: 'storage error: not found: Response with id ''resp_01a16820-0fd3-7242-84a7-af23630e3345''' + param: null + type: invalid_request_error + headers: + content-type: application/json + status_code: 404 diff --git a/crates/agentic-server-core/tests/cassettes/responses/response-edge-cases-stream-openai.yaml b/crates/agentic-server-core/tests/cassettes/responses/response-edge-cases-stream-openai.yaml new file mode 100644 index 000000000..632d577ab --- /dev/null +++ b/crates/agentic-server-core/tests/cassettes/responses/response-edge-cases-stream-openai.yaml @@ -0,0 +1,727 @@ +turns: +- filename: t1 + request: + body: + input: + - content: Reply with only SAPPHIRE. + role: user + model: gpt-4.1 + store: false + stream: true + headers: + accept: '*/*' + authorization: Bearer *** + content-type: application/json + user-agent: python-httpx/0.28.1 + method: POST + path: /v1/responses + query_params: {} + response: + headers: + content-type: text/event-stream; charset=utf-8 + sse: + - 'event: response.created + + ' + - 'data: {"type":"response.created","response":{"id":"resp_0f47bfd0e0317e53016adb03d1f8a487d1b2315c640bd630df","object":"response","created_at":1792738258,"status":"in_progress","access_programs":null,"background":false,"completed_at":null,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"max_tool_calls":null,"model":"gpt-4.1-2025-04-14","moderation":null,"output":[],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":null,"prompt_cache_key":null,"prompt_cache_retention":"in_memory","reasoning":{"context":null,"effort":null,"summary":null},"safety_identifier":null,"service_tier":"auto","store":false,"temperature":1.0,"text":{"format":{"type":"text"},"verbosity":"medium"},"tool_choice":"auto","tool_usage":{"image_gen":{"input_tokens":0,"input_tokens_details":{"image_tokens":0,"text_tokens":0},"output_tokens":0,"output_tokens_details":{"image_tokens":0,"text_tokens":0},"total_tokens":0},"web_search":{"num_requests":0}},"tools":[],"top_logprobs":0,"top_p":1.0,"truncation":"disabled","usage":null,"user":null,"metadata":{}},"sequence_number":0} + + ' + - ' + + ' + - 'event: response.in_progress + + ' + - 'data: {"type":"response.in_progress","response":{"id":"resp_0f47bfd0e0317e53016adb03d1f8a487d1b2315c640bd630df","object":"response","created_at":1792738258,"status":"in_progress","access_programs":null,"background":false,"completed_at":null,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"max_tool_calls":null,"model":"gpt-4.1-2025-04-14","moderation":null,"output":[],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":null,"prompt_cache_key":null,"prompt_cache_retention":"in_memory","reasoning":{"context":null,"effort":null,"summary":null},"safety_identifier":null,"service_tier":"auto","store":false,"temperature":1.0,"text":{"format":{"type":"text"},"verbosity":"medium"},"tool_choice":"auto","tool_usage":{"image_gen":{"input_tokens":0,"input_tokens_details":{"image_tokens":0,"text_tokens":0},"output_tokens":0,"output_tokens_details":{"image_tokens":0,"text_tokens":0},"total_tokens":0},"web_search":{"num_requests":0}},"tools":[],"top_logprobs":0,"top_p":1.0,"truncation":"disabled","usage":null,"user":null,"metadata":{}},"sequence_number":1} + + ' + - ' + + ' + - 'event: response.output_item.added + + ' + - 'data: {"type":"response.output_item.added","item":{"id":"msg_0f47bfd0e0317e53016adb03d26a9487d18af503cbbdcc2be9","type":"message","status":"in_progress","content":[],"role":"assistant"},"output_index":0,"sequence_number":2} + + ' + - ' + + ' + - 'event: response.content_part.added + + ' + - 'data: {"type":"response.content_part.added","content_index":0,"item_id":"msg_0f47bfd0e0317e53016adb03d26a9487d18af503cbbdcc2be9","output_index":0,"part":{"type":"output_text","annotations":[],"logprobs":[],"text":""},"sequence_number":3} + + ' + - ' + + ' + - 'event: response.output_text.delta + + ' + - 'data: {"type":"response.output_text.delta","content_index":0,"delta":"S","item_id":"msg_0f47bfd0e0317e53016adb03d26a9487d18af503cbbdcc2be9","logprobs":[],"obfuscation":"ZqY080edNefV9Ap","output_index":0,"sequence_number":4} + + ' + - ' + + ' + - 'event: response.output_text.delta + + ' + - 'data: {"type":"response.output_text.delta","content_index":0,"delta":"APP","item_id":"msg_0f47bfd0e0317e53016adb03d26a9487d18af503cbbdcc2be9","logprobs":[],"obfuscation":"dASGF7TgR0MJx","output_index":0,"sequence_number":5} + + ' + - ' + + ' + - 'event: response.output_text.delta + + ' + - 'data: {"type":"response.output_text.delta","content_index":0,"delta":"H","item_id":"msg_0f47bfd0e0317e53016adb03d26a9487d18af503cbbdcc2be9","logprobs":[],"obfuscation":"gYcxcjmeYJQykQk","output_index":0,"sequence_number":6} + + ' + - ' + + ' + - 'event: response.output_text.delta + + ' + - 'data: {"type":"response.output_text.delta","content_index":0,"delta":"IRE","item_id":"msg_0f47bfd0e0317e53016adb03d26a9487d18af503cbbdcc2be9","logprobs":[],"obfuscation":"H9IA6IdRXxi0A","output_index":0,"sequence_number":7} + + ' + - ' + + ' + - 'event: response.output_text.done + + ' + - 'data: {"type":"response.output_text.done","content_index":0,"item_id":"msg_0f47bfd0e0317e53016adb03d26a9487d18af503cbbdcc2be9","logprobs":[],"output_index":0,"sequence_number":8,"text":"SAPPHIRE"} + + ' + - ' + + ' + - 'event: response.content_part.done + + ' + - 'data: {"type":"response.content_part.done","content_index":0,"item_id":"msg_0f47bfd0e0317e53016adb03d26a9487d18af503cbbdcc2be9","output_index":0,"part":{"type":"output_text","annotations":[],"logprobs":[],"text":"SAPPHIRE"},"sequence_number":9} + + ' + - ' + + ' + - 'event: response.output_item.done + + ' + - 'data: {"type":"response.output_item.done","item":{"id":"msg_0f47bfd0e0317e53016adb03d26a9487d18af503cbbdcc2be9","type":"message","status":"completed","content":[{"type":"output_text","annotations":[],"logprobs":[],"text":"SAPPHIRE"}],"role":"assistant"},"output_index":0,"sequence_number":10} + + ' + - ' + + ' + - 'event: response.completed + + ' + - 'data: {"type":"response.completed","response":{"id":"resp_0f47bfd0e0317e53016adb03d1f8a487d1b2315c640bd630df","object":"response","created_at":1792738258,"status":"completed","access_programs":null,"background":false,"completed_at":1792738258,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"max_tool_calls":null,"model":"gpt-4.1-2025-04-14","moderation":null,"output":[{"id":"msg_0f47bfd0e0317e53016adb03d26a9487d18af503cbbdcc2be9","type":"message","status":"completed","content":[{"type":"output_text","annotations":[],"logprobs":[],"text":"SAPPHIRE"}],"role":"assistant"}],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":null,"prompt_cache_key":null,"prompt_cache_retention":"in_memory","reasoning":{"context":null,"effort":null,"summary":null},"safety_identifier":null,"service_tier":"default","store":false,"temperature":1.0,"text":{"format":{"type":"text"},"verbosity":"medium"},"tool_choice":"auto","tool_usage":{"image_gen":{"input_tokens":0,"input_tokens_details":{"image_tokens":0,"text_tokens":0},"output_tokens":0,"output_tokens_details":{"image_tokens":0,"text_tokens":0},"total_tokens":0},"web_search":{"num_requests":0}},"tools":[],"top_logprobs":0,"top_p":1.0,"truncation":"disabled","usage":{"input_tokens":15,"input_tokens_details":{"cache_write_tokens":0,"cached_tokens":0},"output_tokens":5,"output_tokens_details":{"reasoning_tokens":0},"total_tokens":20},"user":null,"metadata":{}},"sequence_number":11} + + ' + - ' + + ' + status_code: 200 +- filename: t2 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_0f47bfd0e0317e53016adb03d1f8a487d1b2315c640bd630df + query_params: {} + response: + body: + error: + code: null + message: Response with id 'resp_0f47bfd0e0317e53016adb03d1f8a487d1b2315c640bd630df' + not found. + param: null + type: invalid_request_error + headers: + content-type: application/json + status_code: 404 +- filename: t3 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_0f47bfd0e0317e53016adb03d1f8a487d1b2315c640bd630df/input_items + query_params: {} + response: + body: + error: + code: null + message: Response with id 'resp_0f47bfd0e0317e53016adb03d1f8a487d1b2315c640bd630df' + not found. + param: null + type: invalid_request_error + headers: + content-type: application/json + status_code: 404 +- filename: t4 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: DELETE + path: /v1/responses/resp_0f47bfd0e0317e53016adb03d1f8a487d1b2315c640bd630df + query_params: {} + response: + body: + error: + code: null + message: Response with id 'resp_0f47bfd0e0317e53016adb03d1f8a487d1b2315c640bd630df' + not found. + param: null + type: invalid_request_error + headers: + content-type: application/json + status_code: 404 +- filename: t5 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_missing + query_params: {} + response: + body: + error: + code: null + message: Response with id 'resp_missing' not found. + param: null + type: invalid_request_error + headers: + content-type: application/json + status_code: 404 +- filename: t6 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_missing/input_items + query_params: {} + response: + body: + error: + code: null + message: Response with id 'resp_missing' not found. + param: null + type: invalid_request_error + headers: + content-type: application/json + status_code: 404 +- filename: t7 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: DELETE + path: /v1/responses/resp_missing + query_params: {} + response: + body: + error: + code: null + message: Response with id 'resp_missing' not found. + param: null + type: invalid_request_error + headers: + content-type: application/json + status_code: 404 +- filename: t8 + request: + body: + input: + - content: Reply with only ORCHID. + role: user + model: gpt-4.1 + previous_response_id: resp_missing + store: true + stream: false + headers: + accept: '*/*' + authorization: Bearer *** + content-type: application/json + user-agent: python-httpx/0.28.1 + method: POST + path: /v1/responses + query_params: {} + response: + body: + error: + code: previous_response_not_found + message: Previous response with id 'resp_missing' not found. + param: previous_response_id + type: invalid_request_error + headers: + content-type: application/json + status_code: 400 +- filename: t9 + request: + body: + input: + - content: Reply with only ORCHID. + role: user + model: gpt-4.1 + store: true + stream: true + headers: + accept: '*/*' + authorization: Bearer *** + content-type: application/json + user-agent: python-httpx/0.28.1 + method: POST + path: /v1/responses + query_params: {} + response: + headers: + content-type: text/event-stream; charset=utf-8 + sse: + - 'event: response.created + + ' + - 'data: {"type":"response.created","response":{"id":"resp_0a0ecb550dc1fa76006adb03d5f93087d19aea460bcbf00370","object":"response","created_at":1792738262,"status":"in_progress","access_programs":null,"background":false,"completed_at":null,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"max_tool_calls":null,"model":"gpt-4.1-2025-04-14","moderation":null,"output":[],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":null,"prompt_cache_key":null,"prompt_cache_retention":"in_memory","reasoning":{"context":null,"effort":null,"summary":null},"safety_identifier":null,"service_tier":"auto","store":true,"temperature":1.0,"text":{"format":{"type":"text"},"verbosity":"medium"},"tool_choice":"auto","tool_usage":{"image_gen":{"input_tokens":0,"input_tokens_details":{"image_tokens":0,"text_tokens":0},"output_tokens":0,"output_tokens_details":{"image_tokens":0,"text_tokens":0},"total_tokens":0},"web_search":{"num_requests":0}},"tools":[],"top_logprobs":0,"top_p":1.0,"truncation":"disabled","usage":null,"user":null,"metadata":{}},"sequence_number":0} + + ' + - ' + + ' + - 'event: response.in_progress + + ' + - 'data: {"type":"response.in_progress","response":{"id":"resp_0a0ecb550dc1fa76006adb03d5f93087d19aea460bcbf00370","object":"response","created_at":1792738262,"status":"in_progress","access_programs":null,"background":false,"completed_at":null,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"max_tool_calls":null,"model":"gpt-4.1-2025-04-14","moderation":null,"output":[],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":null,"prompt_cache_key":null,"prompt_cache_retention":"in_memory","reasoning":{"context":null,"effort":null,"summary":null},"safety_identifier":null,"service_tier":"auto","store":true,"temperature":1.0,"text":{"format":{"type":"text"},"verbosity":"medium"},"tool_choice":"auto","tool_usage":{"image_gen":{"input_tokens":0,"input_tokens_details":{"image_tokens":0,"text_tokens":0},"output_tokens":0,"output_tokens_details":{"image_tokens":0,"text_tokens":0},"total_tokens":0},"web_search":{"num_requests":0}},"tools":[],"top_logprobs":0,"top_p":1.0,"truncation":"disabled","usage":null,"user":null,"metadata":{}},"sequence_number":1} + + ' + - ' + + ' + - 'event: response.output_item.added + + ' + - 'data: {"type":"response.output_item.added","item":{"id":"msg_0a0ecb550dc1fa76006adb03d64a6c87d18b643ed9fbc42324","type":"message","status":"in_progress","content":[],"role":"assistant"},"output_index":0,"sequence_number":2} + + ' + - ' + + ' + - 'event: response.content_part.added + + ' + - 'data: {"type":"response.content_part.added","content_index":0,"item_id":"msg_0a0ecb550dc1fa76006adb03d64a6c87d18b643ed9fbc42324","output_index":0,"part":{"type":"output_text","annotations":[],"logprobs":[],"text":""},"sequence_number":3} + + ' + - ' + + ' + - 'event: response.output_text.delta + + ' + - 'data: {"type":"response.output_text.delta","content_index":0,"delta":"OR","item_id":"msg_0a0ecb550dc1fa76006adb03d64a6c87d18b643ed9fbc42324","logprobs":[],"obfuscation":"78iBqzP21ijgYY","output_index":0,"sequence_number":4} + + ' + - ' + + ' + - 'event: response.output_text.delta + + ' + - 'data: {"type":"response.output_text.delta","content_index":0,"delta":"CH","item_id":"msg_0a0ecb550dc1fa76006adb03d64a6c87d18b643ed9fbc42324","logprobs":[],"obfuscation":"a8t1XHfBMermN9","output_index":0,"sequence_number":5} + + ' + - ' + + ' + - 'event: response.output_text.delta + + ' + - 'data: {"type":"response.output_text.delta","content_index":0,"delta":"ID","item_id":"msg_0a0ecb550dc1fa76006adb03d64a6c87d18b643ed9fbc42324","logprobs":[],"obfuscation":"0qPssj6fzozoaX","output_index":0,"sequence_number":6} + + ' + - ' + + ' + - 'event: response.output_text.done + + ' + - 'data: {"type":"response.output_text.done","content_index":0,"item_id":"msg_0a0ecb550dc1fa76006adb03d64a6c87d18b643ed9fbc42324","logprobs":[],"output_index":0,"sequence_number":7,"text":"ORCHID"} + + ' + - ' + + ' + - 'event: response.content_part.done + + ' + - 'data: {"type":"response.content_part.done","content_index":0,"item_id":"msg_0a0ecb550dc1fa76006adb03d64a6c87d18b643ed9fbc42324","output_index":0,"part":{"type":"output_text","annotations":[],"logprobs":[],"text":"ORCHID"},"sequence_number":8} + + ' + - ' + + ' + - 'event: response.output_item.done + + ' + - 'data: {"type":"response.output_item.done","item":{"id":"msg_0a0ecb550dc1fa76006adb03d64a6c87d18b643ed9fbc42324","type":"message","status":"completed","content":[{"type":"output_text","annotations":[],"logprobs":[],"text":"ORCHID"}],"role":"assistant"},"output_index":0,"sequence_number":9} + + ' + - ' + + ' + - 'event: response.completed + + ' + - 'data: {"type":"response.completed","response":{"id":"resp_0a0ecb550dc1fa76006adb03d5f93087d19aea460bcbf00370","object":"response","created_at":1792738262,"status":"completed","access_programs":null,"background":false,"completed_at":1792738262,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"max_tool_calls":null,"model":"gpt-4.1-2025-04-14","moderation":null,"output":[{"id":"msg_0a0ecb550dc1fa76006adb03d64a6c87d18b643ed9fbc42324","type":"message","status":"completed","content":[{"type":"output_text","annotations":[],"logprobs":[],"text":"ORCHID"}],"role":"assistant"}],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":null,"prompt_cache_key":null,"prompt_cache_retention":"in_memory","reasoning":{"context":null,"effort":null,"summary":null},"safety_identifier":null,"service_tier":"default","store":true,"temperature":1.0,"text":{"format":{"type":"text"},"verbosity":"medium"},"tool_choice":"auto","tool_usage":{"image_gen":{"input_tokens":0,"input_tokens_details":{"image_tokens":0,"text_tokens":0},"output_tokens":0,"output_tokens_details":{"image_tokens":0,"text_tokens":0},"total_tokens":0},"web_search":{"num_requests":0}},"tools":[],"top_logprobs":0,"top_p":1.0,"truncation":"disabled","usage":{"input_tokens":14,"input_tokens_details":{"cache_write_tokens":0,"cached_tokens":0},"output_tokens":4,"output_tokens_details":{"reasoning_tokens":0},"total_tokens":18},"user":null,"metadata":{}},"sequence_number":10} + + ' + - ' + + ' + status_code: 200 +- filename: t10 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_0a0ecb550dc1fa76006adb03d5f93087d19aea460bcbf00370/input_items + query_params: + limit: '0' + response: + body: + data: [] + first_id: null + has_more: true + last_id: null + object: list + headers: + content-type: application/json + status_code: 200 +- filename: t11 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_0a0ecb550dc1fa76006adb03d5f93087d19aea460bcbf00370/input_items + query_params: + limit: '101' + response: + body: + error: + code: integer_above_max_value + message: 'Invalid ''limit'': integer above maximum value. Expected a value + <= 100, but got 101 instead.' + param: limit + type: invalid_request_error + headers: + content-type: application/json + status_code: 400 +- filename: t12 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_0a0ecb550dc1fa76006adb03d5f93087d19aea460bcbf00370/input_items + query_params: + order: sideways + response: + body: + error: + code: invalid_value + message: 'Invalid value: ''sideways''. Supported values are: ''asc'' and ''desc''.' + param: order + type: invalid_request_error + headers: + content-type: application/json + status_code: 400 +- filename: t13 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_0a0ecb550dc1fa76006adb03d5f93087d19aea460bcbf00370/input_items + query_params: + after: msg_missing + response: + body: + error: + code: null + message: No item found with id 'msg_missing' + param: after + type: invalid_request_error + headers: + content-type: application/json + status_code: 404 +- filename: t14 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_0a0ecb550dc1fa76006adb03d5f93087d19aea460bcbf00370/input_items + query_params: + include[]: web_search_call.results + response: + body: + data: + - content: + - text: Reply with only ORCHID. + type: input_text + id: msg_0a0ecb550dc1fa76006adb03d6031487d1b0f57772ac44e6c9 + role: user + status: completed + type: message + first_id: msg_0a0ecb550dc1fa76006adb03d6031487d1b0f57772ac44e6c9 + has_more: false + last_id: msg_0a0ecb550dc1fa76006adb03d6031487d1b0f57772ac44e6c9 + object: list + headers: + content-type: application/json + status_code: 200 +- filename: t15 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_0a0ecb550dc1fa76006adb03d5f93087d19aea460bcbf00370/input_items + query_params: + include[]: message.output_text.logprobs + response: + body: + data: + - content: + - text: Reply with only ORCHID. + type: input_text + id: msg_0a0ecb550dc1fa76006adb03d6031487d1b0f57772ac44e6c9 + role: user + status: completed + type: message + first_id: msg_0a0ecb550dc1fa76006adb03d6031487d1b0f57772ac44e6c9 + has_more: false + last_id: msg_0a0ecb550dc1fa76006adb03d6031487d1b0f57772ac44e6c9 + object: list + headers: + content-type: application/json + status_code: 200 +- filename: t16 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_0a0ecb550dc1fa76006adb03d5f93087d19aea460bcbf00370/input_items + query_params: + limit: '-1' + response: + body: + error: + code: integer_below_min_value + message: 'Invalid ''limit'': integer below minimum value. Expected a value + >= 0, but got -1 instead.' + param: limit + type: invalid_request_error + headers: + content-type: application/json + status_code: 400 +- filename: t17 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_0a0ecb550dc1fa76006adb03d5f93087d19aea460bcbf00370/input_items + query_params: + limit: ten + response: + body: + error: + code: invalid_type + message: 'Invalid type for ''limit'': expected an integer, but got a string + value that could not be converted into an integer.' + param: limit + type: invalid_request_error + headers: + content-type: application/json + status_code: 400 +- filename: t18 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_0a0ecb550dc1fa76006adb03d5f93087d19aea460bcbf00370/input_items + query_params: + after: '' + response: + body: + data: + - content: + - text: Reply with only ORCHID. + type: input_text + id: msg_0a0ecb550dc1fa76006adb03d6031487d1b0f57772ac44e6c9 + role: user + status: completed + type: message + first_id: msg_0a0ecb550dc1fa76006adb03d6031487d1b0f57772ac44e6c9 + has_more: false + last_id: msg_0a0ecb550dc1fa76006adb03d6031487d1b0f57772ac44e6c9 + object: list + headers: + content-type: application/json + status_code: 200 +- filename: t19 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_0a0ecb550dc1fa76006adb03d5f93087d19aea460bcbf00370/input_items + query_params: + include[]: not.a.valid.include + response: + body: + error: + code: invalid_value + message: 'Invalid value: ''not.a.valid.include''. Supported values are: ''file_search_call.results'', + ''web_search_call.results'', ''web_search_call.action.sources'', ''message.input_image.image_url'', + ''computer_call_output.output.image_url'', ''code_interpreter_call.outputs'', + ''reasoning.encrypted_content'', and ''message.output_text.logprobs''.' + param: include[0] + type: invalid_request_error + headers: + content-type: application/json + status_code: 400 +- filename: t20 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_0a0ecb550dc1fa76006adb03d5f93087d19aea460bcbf00370/input_items + query_params: + limit: + - '1' + - '2' + response: + body: + error: + code: duplicate_parameter + message: 'Duplicate parameter: ''limit''. You provided multiple values for + this parameter, whereas only one is allowed. If you are trying to provide + a list of values, use the array syntax instead e.g. ''limit[]=''.' + param: limit + type: invalid_request_error + headers: + content-type: application/json + status_code: 400 +- filename: t21 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_0a0ecb550dc1fa76006adb03d5f93087d19aea460bcbf00370/input_items + query_params: + include[]: + - message.output_text.logprobs + - reasoning.encrypted_content + response: + body: + error: + code: null + message: Encrypted content cannot be requested for persisted responses. + param: include + type: invalid_request_error + headers: + content-type: application/json + status_code: 400 +- filename: t22 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: DELETE + path: /v1/responses/resp_0a0ecb550dc1fa76006adb03d5f93087d19aea460bcbf00370 + query_params: {} + response: + body: + deleted: true + id: resp_0a0ecb550dc1fa76006adb03d5f93087d19aea460bcbf00370 + object: response.deleted + headers: + content-type: application/json + status_code: 200 +- filename: t23 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: DELETE + path: /v1/responses/resp_0a0ecb550dc1fa76006adb03d5f93087d19aea460bcbf00370 + query_params: {} + response: + body: + error: + code: null + message: Response with id 'resp_0a0ecb550dc1fa76006adb03d5f93087d19aea460bcbf00370' + not found. + param: null + type: invalid_request_error + headers: + content-type: application/json + status_code: 404 diff --git a/crates/agentic-server-core/tests/cassettes/responses/response-lifecycle-gateway.yaml b/crates/agentic-server-core/tests/cassettes/responses/response-lifecycle-gateway.yaml new file mode 100644 index 000000000..34f1121f8 --- /dev/null +++ b/crates/agentic-server-core/tests/cassettes/responses/response-lifecycle-gateway.yaml @@ -0,0 +1,785 @@ +turns: +- filename: t1 + request: + body: + input: + - content: Reply with only SAPPHIRE. + role: user + model: Qwen/Qwen3.8-27B-FP8 + store: true + stream: false + headers: + accept: '*/*' + authorization: Bearer *** + content-type: application/json + user-agent: python-httpx/0.28.1 + method: POST + path: /v1/responses + query_params: {} + response: + body: + background: false + completed_at: 1792748270 + created_at: 1792748270 + error: null + frequency_penalty: 0.0 + id: resp_01a1681f-b0a6-7ed1-87d9-dcf12cf72e63 + incomplete_details: null + instructions: null + max_output_tokens: null + max_tool_calls: null + metadata: {} + model: Qwen/Qwen3.8-27B-FP8 + object: response + output: + - content: + - text: 'The user wants me to reply with only the word "SAPPHIRE." + + ' + type: reasoning_text + id: rs_8d45a4c7a23ddd16 + summary: [] + type: reasoning + - content: + - annotations: [] + text: ' + + + SAPPHIRE' + type: output_text + id: msg_93d50f85aaccf87a + role: assistant + status: completed + type: message + parallel_tool_calls: false + presence_penalty: 0.0 + previous_response_id: null + prompt_cache_key: null + prompt_cache_options: null + reasoning: null + safety_identifier: null + service_tier: auto + status: completed + store: true + temperature: 1.0 + text: + format: + type: text + tool_choice: auto + tools: [] + top_logprobs: 0 + top_p: 1.0 + truncation: disabled + usage: + input_tokens: 47 + input_tokens_details: + cache_write_tokens: 0 + cached_tokens: 0 + output_tokens: 24 + output_tokens_details: + reasoning_tokens: 17 + total_tokens: 71 + headers: + content-type: application/json + status_code: 200 +- filename: t2 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_01a1681f-b0a6-7ed1-87d9-dcf12cf72e63/input_items + query_params: {} + response: + body: + data: + - content: + - text: Reply with only SAPPHIRE. + type: input_text + id: msg_01a1681f-b2fb-7de2-b190-8cfd7bf663ea + role: user + status: completed + type: message + first_id: msg_01a1681f-b2fb-7de2-b190-8cfd7bf663ea + has_more: false + last_id: msg_01a1681f-b2fb-7de2-b190-8cfd7bf663ea + object: list + headers: + content-type: application/json + status_code: 200 +- filename: t3 + request: + body: + input: + - content: Reply with only ORCHID. + role: user + model: Qwen/Qwen3.8-27B-FP8 + previous_response_id: resp_01a1681f-b0a6-7ed1-87d9-dcf12cf72e63 + store: true + stream: false + headers: + accept: '*/*' + authorization: Bearer *** + content-type: application/json + user-agent: python-httpx/0.28.1 + method: POST + path: /v1/responses + query_params: {} + response: + body: + background: false + completed_at: 1792748270 + created_at: 1792748270 + error: null + frequency_penalty: 0.0 + id: resp_01a1681f-b326-7743-affc-287260336b36 + incomplete_details: null + instructions: null + max_output_tokens: null + max_tool_calls: null + metadata: {} + model: Qwen/Qwen3.8-27B-FP8 + object: response + output: + - content: + - text: 'The user wants me to reply with only the word "ORCHID." + + ' + type: reasoning_text + id: rs_80e43f4959d5c2f6 + summary: [] + type: reasoning + - content: + - annotations: [] + text: ' + + + ORCHID' + type: output_text + id: msg_8da328936b6052e9 + role: assistant + status: completed + type: message + parallel_tool_calls: false + presence_penalty: 0.0 + previous_response_id: resp_01a1681f-b0a6-7ed1-87d9-dcf12cf72e63 + prompt_cache_key: null + prompt_cache_options: null + reasoning: null + safety_identifier: null + service_tier: auto + status: completed + store: true + temperature: 1.0 + text: + format: + type: text + tool_choice: auto + tools: [] + top_logprobs: 0 + top_p: 1.0 + truncation: disabled + usage: + input_tokens: 89 + input_tokens_details: + cache_write_tokens: 0 + cached_tokens: 0 + output_tokens: 22 + output_tokens_details: + reasoning_tokens: 16 + total_tokens: 111 + headers: + content-type: application/json + status_code: 200 +- filename: t4 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_01a1681f-b326-7743-affc-287260336b36/input_items + query_params: + order: asc + response: + body: + data: + - content: + - text: Reply with only SAPPHIRE. + type: input_text + id: msg_01a1681f-b2fb-7de2-b190-8cfd7bf663ea + role: user + status: completed + type: message + - content: + - text: 'The user wants me to reply with only the word "SAPPHIRE." + + ' + type: reasoning_text + id: rs_8d45a4c7a23ddd16 + summary: [] + type: reasoning + - content: + - annotations: [] + text: ' + + + SAPPHIRE' + type: output_text + id: msg_93d50f85aaccf87a + role: assistant + status: completed + type: message + - content: + - text: Reply with only ORCHID. + type: input_text + id: msg_01a1681f-b549-77f2-9c84-54ff09e5e399 + role: user + status: completed + type: message + first_id: msg_01a1681f-b2fb-7de2-b190-8cfd7bf663ea + has_more: false + last_id: msg_01a1681f-b549-77f2-9c84-54ff09e5e399 + object: list + headers: + content-type: application/json + status_code: 200 +- filename: t5 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_01a1681f-b326-7743-affc-287260336b36/input_items + query_params: + limit: '1' + order: asc + response: + body: + data: + - content: + - text: Reply with only SAPPHIRE. + type: input_text + id: msg_01a1681f-b2fb-7de2-b190-8cfd7bf663ea + role: user + status: completed + type: message + first_id: msg_01a1681f-b2fb-7de2-b190-8cfd7bf663ea + has_more: true + last_id: msg_01a1681f-b2fb-7de2-b190-8cfd7bf663ea + object: list + headers: + content-type: application/json + status_code: 200 +- filename: t6 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_01a1681f-b326-7743-affc-287260336b36/input_items + query_params: + after: msg_01a1681f-b2fb-7de2-b190-8cfd7bf663ea + limit: '1' + order: asc + response: + body: + data: + - content: + - text: 'The user wants me to reply with only the word "SAPPHIRE." + + ' + type: reasoning_text + id: rs_8d45a4c7a23ddd16 + summary: [] + type: reasoning + first_id: rs_8d45a4c7a23ddd16 + has_more: true + last_id: rs_8d45a4c7a23ddd16 + object: list + headers: + content-type: application/json + status_code: 200 +- filename: t7 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_01a1681f-b326-7743-affc-287260336b36 + query_params: {} + response: + body: + background: false + completed_at: 1792748270 + created_at: 1792748270 + error: null + frequency_penalty: 0.0 + id: resp_01a1681f-b326-7743-affc-287260336b36 + incomplete_details: null + instructions: null + max_output_tokens: null + max_tool_calls: null + metadata: {} + model: Qwen/Qwen3.8-27B-FP8 + object: response + output: + - content: + - text: 'The user wants me to reply with only the word "ORCHID." + + ' + type: reasoning_text + id: rs_80e43f4959d5c2f6 + summary: [] + type: reasoning + - content: + - annotations: [] + text: ' + + + ORCHID' + type: output_text + id: msg_8da328936b6052e9 + role: assistant + status: completed + type: message + parallel_tool_calls: false + presence_penalty: 0.0 + previous_response_id: resp_01a1681f-b0a6-7ed1-87d9-dcf12cf72e63 + prompt_cache_key: null + prompt_cache_options: null + reasoning: null + safety_identifier: null + service_tier: auto + status: completed + store: true + temperature: 1.0 + text: + format: + type: text + tool_choice: auto + tools: [] + top_logprobs: 0 + top_p: 1.0 + truncation: disabled + usage: + input_tokens: 89 + input_tokens_details: + cache_write_tokens: 0 + cached_tokens: 0 + output_tokens: 22 + output_tokens_details: + reasoning_tokens: 16 + total_tokens: 111 + headers: + content-type: application/json + status_code: 200 +- filename: t8 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: DELETE + path: /v1/responses/resp_01a1681f-b0a6-7ed1-87d9-dcf12cf72e63 + query_params: {} + response: + body: + deleted: true + id: resp_01a1681f-b0a6-7ed1-87d9-dcf12cf72e63 + object: response.deleted + headers: + content-type: application/json + status_code: 200 +- filename: t9 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_01a1681f-b0a6-7ed1-87d9-dcf12cf72e63 + query_params: {} + response: + body: + error: + code: null + message: 'storage error: not found: Response with id ''resp_01a1681f-b0a6-7ed1-87d9-dcf12cf72e63''' + param: null + type: invalid_request_error + headers: + content-type: application/json + status_code: 404 +- filename: t10 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_01a1681f-b0a6-7ed1-87d9-dcf12cf72e63/input_items + query_params: {} + response: + body: + error: + code: null + message: 'storage error: not found: Response with id ''resp_01a1681f-b0a6-7ed1-87d9-dcf12cf72e63''' + param: null + type: invalid_request_error + headers: + content-type: application/json + status_code: 404 +- filename: t11 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_01a1681f-b326-7743-affc-287260336b36/input_items + query_params: + order: asc + response: + body: + data: + - content: + - text: Reply with only ORCHID. + type: input_text + id: msg_01a1681f-b549-77f2-9c84-54ff09e5e399 + role: user + status: completed + type: message + first_id: msg_01a1681f-b549-77f2-9c84-54ff09e5e399 + has_more: false + last_id: msg_01a1681f-b549-77f2-9c84-54ff09e5e399 + object: list + headers: + content-type: application/json + status_code: 200 +- filename: t12 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_01a1681f-b326-7743-affc-287260336b36 + query_params: {} + response: + body: + background: false + completed_at: 1792748270 + created_at: 1792748270 + error: null + frequency_penalty: 0.0 + id: resp_01a1681f-b326-7743-affc-287260336b36 + incomplete_details: null + instructions: null + max_output_tokens: null + max_tool_calls: null + metadata: {} + model: Qwen/Qwen3.8-27B-FP8 + object: response + output: + - content: + - text: 'The user wants me to reply with only the word "ORCHID." + + ' + type: reasoning_text + id: rs_80e43f4959d5c2f6 + summary: [] + type: reasoning + - content: + - annotations: [] + text: ' + + + ORCHID' + type: output_text + id: msg_8da328936b6052e9 + role: assistant + status: completed + type: message + parallel_tool_calls: false + presence_penalty: 0.0 + previous_response_id: resp_01a1681f-b0a6-7ed1-87d9-dcf12cf72e63 + prompt_cache_key: null + prompt_cache_options: null + reasoning: null + safety_identifier: null + service_tier: auto + status: completed + store: true + temperature: 1.0 + text: + format: + type: text + tool_choice: auto + tools: [] + top_logprobs: 0 + top_p: 1.0 + truncation: disabled + usage: + input_tokens: 89 + input_tokens_details: + cache_write_tokens: 0 + cached_tokens: 0 + output_tokens: 22 + output_tokens_details: + reasoning_tokens: 16 + total_tokens: 111 + headers: + content-type: application/json + status_code: 200 +- filename: t13 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: DELETE + path: /v1/responses/resp_01a1681f-b0a6-7ed1-87d9-dcf12cf72e63 + query_params: {} + response: + body: + error: + code: null + message: 'storage error: not found: Response with id ''resp_01a1681f-b0a6-7ed1-87d9-dcf12cf72e63''' + param: null + type: invalid_request_error + headers: + content-type: application/json + status_code: 404 +- filename: t14 + request: + body: + input: + - content: What exact word did the first user message ask you to reply with? + Reply with only that word. + role: user + model: Qwen/Qwen3.8-27B-FP8 + previous_response_id: resp_01a1681f-b326-7743-affc-287260336b36 + store: true + stream: false + headers: + accept: '*/*' + authorization: Bearer *** + content-type: application/json + user-agent: python-httpx/0.28.1 + method: POST + path: /v1/responses + query_params: {} + response: + body: + background: false + completed_at: 1792748272 + created_at: 1792748272 + error: null + frequency_penalty: 0.0 + id: resp_01a1681f-b783-7862-862d-fa186c5efad1 + incomplete_details: null + instructions: null + max_output_tokens: null + max_tool_calls: null + metadata: {} + model: Qwen/Qwen3.8-27B-FP8 + object: response + output: + - content: + - text: 'The user is asking what exact word the first user message asked me + to reply with. The first user message said "Reply with only ORCHID." So + the word is ORCHID. They want me to reply with only that word. + + ' + type: reasoning_text + id: rs_ae1b45109884f964 + summary: [] + type: reasoning + - content: + - annotations: [] + text: ' + + + ORCHID' + type: output_text + id: msg_a1bfde998fcfe613 + role: assistant + status: completed + type: message + parallel_tool_calls: false + presence_penalty: 0.0 + previous_response_id: resp_01a1681f-b326-7743-affc-287260336b36 + prompt_cache_key: null + prompt_cache_options: null + reasoning: null + safety_identifier: null + service_tier: auto + status: completed + store: true + temperature: 1.0 + text: + format: + type: text + tool_choice: auto + tools: [] + top_logprobs: 0 + top_p: 1.0 + truncation: disabled + usage: + input_tokens: 100 + input_tokens_details: + cache_write_tokens: 0 + cached_tokens: 0 + output_tokens: 55 + output_tokens_details: + reasoning_tokens: 49 + total_tokens: 155 + headers: + content-type: application/json + status_code: 200 +- filename: t15 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_01a1681f-b783-7862-862d-fa186c5efad1/input_items + query_params: + order: asc + response: + body: + data: + - content: + - text: Reply with only ORCHID. + type: input_text + id: msg_01a1681f-b549-77f2-9c84-54ff09e5e399 + role: user + status: completed + type: message + - content: + - text: 'The user wants me to reply with only the word "ORCHID." + + ' + type: reasoning_text + id: rs_80e43f4959d5c2f6 + summary: [] + type: reasoning + - content: + - annotations: [] + text: ' + + + ORCHID' + type: output_text + id: msg_8da328936b6052e9 + role: assistant + status: completed + type: message + - content: + - text: What exact word did the first user message ask you to reply with? + Reply with only that word. + type: input_text + id: msg_01a1681f-bc44-7452-8012-112e41706260 + role: user + status: completed + type: message + first_id: msg_01a1681f-b549-77f2-9c84-54ff09e5e399 + has_more: false + last_id: msg_01a1681f-bc44-7452-8012-112e41706260 + object: list + headers: + content-type: application/json + status_code: 200 +- filename: t16 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: DELETE + path: /v1/responses/resp_01a1681f-b783-7862-862d-fa186c5efad1 + query_params: {} + response: + body: + deleted: true + id: resp_01a1681f-b783-7862-862d-fa186c5efad1 + object: response.deleted + headers: + content-type: application/json + status_code: 200 +- filename: t17 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: DELETE + path: /v1/responses/resp_01a1681f-b326-7743-affc-287260336b36 + query_params: {} + response: + body: + deleted: true + id: resp_01a1681f-b326-7743-affc-287260336b36 + object: response.deleted + headers: + content-type: application/json + status_code: 200 +- filename: t18 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_01a1681f-b326-7743-affc-287260336b36/input_items + query_params: {} + response: + body: + error: + code: null + message: 'storage error: not found: Response with id ''resp_01a1681f-b326-7743-affc-287260336b36''' + param: null + type: invalid_request_error + headers: + content-type: application/json + status_code: 404 +- filename: t19 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_01a1681f-b326-7743-affc-287260336b36 + query_params: {} + response: + body: + error: + code: null + message: 'storage error: not found: Response with id ''resp_01a1681f-b326-7743-affc-287260336b36''' + param: null + type: invalid_request_error + headers: + content-type: application/json + status_code: 404 diff --git a/crates/agentic-server-core/tests/cassettes/responses/response-lifecycle-openai.yaml b/crates/agentic-server-core/tests/cassettes/responses/response-lifecycle-openai.yaml new file mode 100644 index 000000000..8b189136d --- /dev/null +++ b/crates/agentic-server-core/tests/cassettes/responses/response-lifecycle-openai.yaml @@ -0,0 +1,829 @@ +turns: +- filename: t1 + request: + body: + input: + - content: Reply with only SAPPHIRE. + role: user + model: gpt-4.1 + store: true + stream: false + headers: + accept: '*/*' + authorization: Bearer *** + content-type: application/json + user-agent: python-httpx/0.28.1 + method: POST + path: /v1/responses + query_params: {} + response: + body: + access_programs: null + background: false + billing: + payer: developer + completed_at: 1792744697 + created_at: 1792744696 + error: null + frequency_penalty: 0.0 + id: resp_03ec669b52bd3e6f006adb1cf7dbd487d0a9005513573ff901 + incomplete_details: null + instructions: null + max_output_tokens: null + max_tool_calls: null + metadata: {} + model: gpt-4.1-2025-04-14 + moderation: null + object: response + output: + - content: + - annotations: [] + logprobs: [] + text: SAPPHIRE. + type: output_text + id: msg_03ec669b52bd3e6f006adb1cf8f88c87d0b4120e37112d37c1 + role: assistant + status: completed + type: message + parallel_tool_calls: true + presence_penalty: 0.0 + previous_response_id: null + prompt_cache_key: null + prompt_cache_retention: in_memory + reasoning: + context: null + effort: null + summary: null + safety_identifier: null + service_tier: default + status: completed + store: true + temperature: 1.0 + text: + format: + type: text + verbosity: medium + tool_choice: auto + tool_usage: + image_gen: + input_tokens: 0 + input_tokens_details: + image_tokens: 0 + text_tokens: 0 + output_tokens: 0 + output_tokens_details: + image_tokens: 0 + text_tokens: 0 + total_tokens: 0 + web_search: + num_requests: 0 + tools: [] + top_logprobs: 0 + top_p: 1.0 + truncation: disabled + usage: + input_tokens: 15 + input_tokens_details: + cache_write_tokens: 0 + cached_tokens: 0 + output_tokens: 6 + output_tokens_details: + reasoning_tokens: 0 + total_tokens: 21 + user: null + headers: + content-type: application/json + status_code: 200 +- filename: t2 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_03ec669b52bd3e6f006adb1cf7dbd487d0a9005513573ff901/input_items + query_params: {} + response: + body: + data: + - content: + - text: Reply with only SAPPHIRE. + type: input_text + id: msg_03ec669b52bd3e6f006adb1cf81f4487d0b148e69357f5467a + role: user + status: completed + type: message + first_id: msg_03ec669b52bd3e6f006adb1cf81f4487d0b148e69357f5467a + has_more: false + last_id: msg_03ec669b52bd3e6f006adb1cf81f4487d0b148e69357f5467a + object: list + headers: + content-type: application/json + status_code: 200 +- filename: t3 + request: + body: + input: + - content: Reply with only ORCHID. + role: user + model: gpt-4.1 + previous_response_id: resp_03ec669b52bd3e6f006adb1cf7dbd487d0a9005513573ff901 + store: true + stream: false + headers: + accept: '*/*' + authorization: Bearer *** + content-type: application/json + user-agent: python-httpx/0.28.1 + method: POST + path: /v1/responses + query_params: {} + response: + body: + access_programs: null + background: false + billing: + payer: developer + completed_at: 1792744698 + created_at: 1792744698 + error: null + frequency_penalty: 0.0 + id: resp_03ec669b52bd3e6f006adb1cf9ff1087d08e8ec4c1d27292ec + incomplete_details: null + instructions: null + max_output_tokens: null + max_tool_calls: null + metadata: {} + model: gpt-4.1-2025-04-14 + moderation: null + object: response + output: + - content: + - annotations: [] + logprobs: [] + text: ORCHID. + type: output_text + id: msg_03ec669b52bd3e6f006adb1cfa945887d0954d2950bdf34b56 + role: assistant + status: completed + type: message + parallel_tool_calls: true + presence_penalty: 0.0 + previous_response_id: resp_03ec669b52bd3e6f006adb1cf7dbd487d0a9005513573ff901 + prompt_cache_key: null + prompt_cache_retention: in_memory + reasoning: + context: null + effort: null + summary: null + safety_identifier: null + service_tier: default + status: completed + store: true + temperature: 1.0 + text: + format: + type: text + verbosity: medium + tool_choice: auto + tool_usage: + image_gen: + input_tokens: 0 + input_tokens_details: + image_tokens: 0 + text_tokens: 0 + output_tokens: 0 + output_tokens_details: + image_tokens: 0 + text_tokens: 0 + total_tokens: 0 + web_search: + num_requests: 0 + tools: [] + top_logprobs: 0 + top_p: 1.0 + truncation: disabled + usage: + input_tokens: 35 + input_tokens_details: + cache_write_tokens: 0 + cached_tokens: 0 + output_tokens: 5 + output_tokens_details: + reasoning_tokens: 0 + total_tokens: 40 + user: null + headers: + content-type: application/json + status_code: 200 +- filename: t4 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_03ec669b52bd3e6f006adb1cf9ff1087d08e8ec4c1d27292ec/input_items + query_params: + order: asc + response: + body: + data: + - content: + - text: Reply with only SAPPHIRE. + type: input_text + id: msg_03ec669b52bd3e6f006adb1cf81f4487d0b148e69357f5467a + role: user + status: completed + type: message + - content: + - annotations: [] + logprobs: [] + text: SAPPHIRE. + type: output_text + id: msg_03ec669b52bd3e6f006adb1cf8f88c87d0b4120e37112d37c1 + role: assistant + status: completed + type: message + - content: + - text: Reply with only ORCHID. + type: input_text + id: msg_03ec669b52bd3e6f006adb1cfa095487d08e7f1d2d8717d6ac + role: user + status: completed + type: message + first_id: msg_03ec669b52bd3e6f006adb1cf81f4487d0b148e69357f5467a + has_more: false + last_id: msg_03ec669b52bd3e6f006adb1cfa095487d08e7f1d2d8717d6ac + object: list + headers: + content-type: application/json + status_code: 200 +- filename: t5 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_03ec669b52bd3e6f006adb1cf9ff1087d08e8ec4c1d27292ec/input_items + query_params: + limit: '1' + order: asc + response: + body: + data: + - content: + - text: Reply with only SAPPHIRE. + type: input_text + id: msg_03ec669b52bd3e6f006adb1cf81f4487d0b148e69357f5467a + role: user + status: completed + type: message + first_id: msg_03ec669b52bd3e6f006adb1cf81f4487d0b148e69357f5467a + has_more: true + last_id: msg_03ec669b52bd3e6f006adb1cf81f4487d0b148e69357f5467a + object: list + headers: + content-type: application/json + status_code: 200 +- filename: t6 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_03ec669b52bd3e6f006adb1cf9ff1087d08e8ec4c1d27292ec/input_items + query_params: + after: msg_03ec669b52bd3e6f006adb1cf81f4487d0b148e69357f5467a + limit: '1' + order: asc + response: + body: + data: + - content: + - annotations: [] + logprobs: [] + text: SAPPHIRE. + type: output_text + id: msg_03ec669b52bd3e6f006adb1cf8f88c87d0b4120e37112d37c1 + role: assistant + status: completed + type: message + first_id: msg_03ec669b52bd3e6f006adb1cf8f88c87d0b4120e37112d37c1 + has_more: true + last_id: msg_03ec669b52bd3e6f006adb1cf8f88c87d0b4120e37112d37c1 + object: list + headers: + content-type: application/json + status_code: 200 +- filename: t7 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_03ec669b52bd3e6f006adb1cf9ff1087d08e8ec4c1d27292ec + query_params: {} + response: + body: + access_programs: null + background: false + billing: + payer: developer + completed_at: 1792744698 + created_at: 1792744698 + error: null + frequency_penalty: 0.0 + id: resp_03ec669b52bd3e6f006adb1cf9ff1087d08e8ec4c1d27292ec + incomplete_details: null + instructions: null + max_output_tokens: null + max_tool_calls: null + metadata: {} + model: gpt-4.1-2025-04-14 + moderation: null + object: response + output: + - content: + - annotations: [] + logprobs: [] + text: ORCHID. + type: output_text + id: msg_03ec669b52bd3e6f006adb1cfa945887d0954d2950bdf34b56 + role: assistant + status: completed + type: message + parallel_tool_calls: true + presence_penalty: 0.0 + previous_response_id: resp_03ec669b52bd3e6f006adb1cf7dbd487d0a9005513573ff901 + prompt_cache_key: null + prompt_cache_retention: in_memory + reasoning: + context: null + effort: null + summary: null + safety_identifier: null + service_tier: default + status: completed + store: true + temperature: 1.0 + text: + format: + type: text + verbosity: medium + tool_choice: auto + tool_usage: + image_gen: + input_tokens: 0 + input_tokens_details: + image_tokens: 0 + text_tokens: 0 + output_tokens: 0 + output_tokens_details: + image_tokens: 0 + text_tokens: 0 + total_tokens: 0 + web_search: + num_requests: 0 + tools: [] + top_logprobs: 0 + top_p: 1.0 + truncation: disabled + usage: + input_tokens: 35 + input_tokens_details: + cache_write_tokens: 0 + cached_tokens: 0 + output_tokens: 5 + output_tokens_details: + reasoning_tokens: 0 + total_tokens: 40 + user: null + headers: + content-type: application/json + status_code: 200 +- filename: t8 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: DELETE + path: /v1/responses/resp_03ec669b52bd3e6f006adb1cf7dbd487d0a9005513573ff901 + query_params: {} + response: + body: + deleted: true + id: resp_03ec669b52bd3e6f006adb1cf7dbd487d0a9005513573ff901 + object: response.deleted + headers: + content-type: application/json + status_code: 200 +- filename: t9 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_03ec669b52bd3e6f006adb1cf7dbd487d0a9005513573ff901 + query_params: {} + response: + body: + error: + code: null + message: Response with id 'resp_03ec669b52bd3e6f006adb1cf7dbd487d0a9005513573ff901' + not found. + param: null + type: invalid_request_error + headers: + content-type: application/json + status_code: 404 +- filename: t10 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_03ec669b52bd3e6f006adb1cf7dbd487d0a9005513573ff901/input_items + query_params: {} + response: + body: + error: + code: null + message: Response with id 'resp_03ec669b52bd3e6f006adb1cf7dbd487d0a9005513573ff901' + not found. + param: null + type: invalid_request_error + headers: + content-type: application/json + status_code: 404 +- filename: t11 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_03ec669b52bd3e6f006adb1cf9ff1087d08e8ec4c1d27292ec/input_items + query_params: + order: asc + response: + body: + data: + - content: + - text: Reply with only ORCHID. + type: input_text + id: msg_03ec669b52bd3e6f006adb1cfa095487d08e7f1d2d8717d6ac + role: user + status: completed + type: message + first_id: msg_03ec669b52bd3e6f006adb1cfa095487d08e7f1d2d8717d6ac + has_more: false + last_id: msg_03ec669b52bd3e6f006adb1cfa095487d08e7f1d2d8717d6ac + object: list + headers: + content-type: application/json + status_code: 200 +- filename: t12 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_03ec669b52bd3e6f006adb1cf9ff1087d08e8ec4c1d27292ec + query_params: {} + response: + body: + access_programs: null + background: false + billing: + payer: developer + completed_at: 1792744698 + created_at: 1792744698 + error: null + frequency_penalty: 0.0 + id: resp_03ec669b52bd3e6f006adb1cf9ff1087d08e8ec4c1d27292ec + incomplete_details: null + instructions: null + max_output_tokens: null + max_tool_calls: null + metadata: {} + model: gpt-4.1-2025-04-14 + moderation: null + object: response + output: + - content: + - annotations: [] + logprobs: [] + text: ORCHID. + type: output_text + id: msg_03ec669b52bd3e6f006adb1cfa945887d0954d2950bdf34b56 + role: assistant + status: completed + type: message + parallel_tool_calls: true + presence_penalty: 0.0 + previous_response_id: resp_03ec669b52bd3e6f006adb1cf7dbd487d0a9005513573ff901 + prompt_cache_key: null + prompt_cache_retention: in_memory + reasoning: + context: null + effort: null + summary: null + safety_identifier: null + service_tier: default + status: completed + store: true + temperature: 1.0 + text: + format: + type: text + verbosity: medium + tool_choice: auto + tool_usage: + image_gen: + input_tokens: 0 + input_tokens_details: + image_tokens: 0 + text_tokens: 0 + output_tokens: 0 + output_tokens_details: + image_tokens: 0 + text_tokens: 0 + total_tokens: 0 + web_search: + num_requests: 0 + tools: [] + top_logprobs: 0 + top_p: 1.0 + truncation: disabled + usage: + input_tokens: 35 + input_tokens_details: + cache_write_tokens: 0 + cached_tokens: 0 + output_tokens: 5 + output_tokens_details: + reasoning_tokens: 0 + total_tokens: 40 + user: null + headers: + content-type: application/json + status_code: 200 +- filename: t13 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: DELETE + path: /v1/responses/resp_03ec669b52bd3e6f006adb1cf7dbd487d0a9005513573ff901 + query_params: {} + response: + body: + error: + code: null + message: Response with id 'resp_03ec669b52bd3e6f006adb1cf7dbd487d0a9005513573ff901' + not found. + param: null + type: invalid_request_error + headers: + content-type: application/json + status_code: 404 +- filename: t14 + request: + body: + input: + - content: What exact word did the first user message ask you to reply with? + Reply with only that word. + role: user + model: gpt-4.1 + previous_response_id: resp_03ec669b52bd3e6f006adb1cf9ff1087d08e8ec4c1d27292ec + store: true + stream: false + headers: + accept: '*/*' + authorization: Bearer *** + content-type: application/json + user-agent: python-httpx/0.28.1 + method: POST + path: /v1/responses + query_params: {} + response: + body: + access_programs: null + background: false + billing: + payer: developer + completed_at: 1792744703 + created_at: 1792744703 + error: null + frequency_penalty: 0.0 + id: resp_03ec669b52bd3e6f006adb1cff6ab487d0a6c520cdef13e27a + incomplete_details: null + instructions: null + max_output_tokens: null + max_tool_calls: null + metadata: {} + model: gpt-4.1-2025-04-14 + moderation: null + object: response + output: + - content: + - annotations: [] + logprobs: [] + text: ORCHID + type: output_text + id: msg_03ec669b52bd3e6f006adb1cffbf4487d0addfc60124ff76f6 + role: assistant + status: completed + type: message + parallel_tool_calls: true + presence_penalty: 0.0 + previous_response_id: resp_03ec669b52bd3e6f006adb1cf9ff1087d08e8ec4c1d27292ec + prompt_cache_key: null + prompt_cache_retention: in_memory + reasoning: + context: null + effort: null + summary: null + safety_identifier: null + service_tier: default + status: completed + store: true + temperature: 1.0 + text: + format: + type: text + verbosity: medium + tool_choice: auto + tool_usage: + image_gen: + input_tokens: 0 + input_tokens_details: + image_tokens: 0 + text_tokens: 0 + output_tokens: 0 + output_tokens_details: + image_tokens: 0 + text_tokens: 0 + total_tokens: 0 + web_search: + num_requests: 0 + tools: [] + top_logprobs: 0 + top_p: 1.0 + truncation: disabled + usage: + input_tokens: 46 + input_tokens_details: + cache_write_tokens: 0 + cached_tokens: 0 + output_tokens: 4 + output_tokens_details: + reasoning_tokens: 0 + total_tokens: 50 + user: null + headers: + content-type: application/json + status_code: 200 +- filename: t15 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_03ec669b52bd3e6f006adb1cff6ab487d0a6c520cdef13e27a/input_items + query_params: + order: asc + response: + body: + data: + - content: + - text: Reply with only ORCHID. + type: input_text + id: msg_03ec669b52bd3e6f006adb1cfa095487d08e7f1d2d8717d6ac + role: user + status: completed + type: message + - content: + - annotations: [] + logprobs: [] + text: ORCHID. + type: output_text + id: msg_03ec669b52bd3e6f006adb1cfa945887d0954d2950bdf34b56 + role: assistant + status: completed + type: message + - content: + - text: What exact word did the first user message ask you to reply with? + Reply with only that word. + type: input_text + id: msg_03ec669b52bd3e6f006adb1cff76bc87d0ab21d63dec836f8e + role: user + status: completed + type: message + first_id: msg_03ec669b52bd3e6f006adb1cfa095487d08e7f1d2d8717d6ac + has_more: false + last_id: msg_03ec669b52bd3e6f006adb1cff76bc87d0ab21d63dec836f8e + object: list + headers: + content-type: application/json + status_code: 200 +- filename: t16 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: DELETE + path: /v1/responses/resp_03ec669b52bd3e6f006adb1cff6ab487d0a6c520cdef13e27a + query_params: {} + response: + body: + deleted: true + id: resp_03ec669b52bd3e6f006adb1cff6ab487d0a6c520cdef13e27a + object: response.deleted + headers: + content-type: application/json + status_code: 200 +- filename: t17 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: DELETE + path: /v1/responses/resp_03ec669b52bd3e6f006adb1cf9ff1087d08e8ec4c1d27292ec + query_params: {} + response: + body: + deleted: true + id: resp_03ec669b52bd3e6f006adb1cf9ff1087d08e8ec4c1d27292ec + object: response.deleted + headers: + content-type: application/json + status_code: 200 +- filename: t18 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_03ec669b52bd3e6f006adb1cf9ff1087d08e8ec4c1d27292ec/input_items + query_params: {} + response: + body: + error: + code: null + message: Response with id 'resp_03ec669b52bd3e6f006adb1cf9ff1087d08e8ec4c1d27292ec' + not found. + param: null + type: invalid_request_error + headers: + content-type: application/json + status_code: 404 +- filename: t19 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_03ec669b52bd3e6f006adb1cf9ff1087d08e8ec4c1d27292ec + query_params: {} + response: + body: + error: + code: null + message: Response with id 'resp_03ec669b52bd3e6f006adb1cf9ff1087d08e8ec4c1d27292ec' + not found. + param: null + type: invalid_request_error + headers: + content-type: application/json + status_code: 404 diff --git a/crates/agentic-server-core/tests/cassettes/responses/response-lifecycle-stream-gateway.yaml b/crates/agentic-server-core/tests/cassettes/responses/response-lifecycle-stream-gateway.yaml new file mode 100644 index 000000000..796986a80 --- /dev/null +++ b/crates/agentic-server-core/tests/cassettes/responses/response-lifecycle-stream-gateway.yaml @@ -0,0 +1,1831 @@ +turns: +- filename: t1 + request: + body: + input: + - content: Reply with only SAPPHIRE. + role: user + model: Qwen/Qwen3.8-27B-FP8 + store: true + stream: true + headers: + accept: '*/*' + authorization: Bearer *** + content-type: application/json + user-agent: python-httpx/0.28.1 + method: POST + path: /v1/responses + query_params: {} + response: + headers: + content-type: text/event-stream; charset=utf-8 + sse: + - 'event: response.created + + ' + - 'data: {"type":"response.created","sequence_number":0,"response":{"id":"resp_01a1681f-c3c7-77a2-80e5-2f5a0e82f3d7","created_at":1792748274,"incomplete_details":null,"instructions":null,"metadata":{},"model":"Qwen/Qwen3.8-27B-FP8","object":"response","output":[],"parallel_tool_calls":false,"temperature":1.0,"tool_choice":"none","tools":[],"top_p":1.0,"background":false,"max_output_tokens":null,"max_tool_calls":null,"previous_response_id":null,"prompt":null,"reasoning":null,"service_tier":"auto","status":"in_progress","text":{"format":{"type":"text"}},"top_logprobs":0,"truncation":"disabled","usage":null,"user":null,"presence_penalty":0.0,"frequency_penalty":0.0,"kv_transfer_params":null,"ec_transfer_params":null,"input_messages":null,"output_messages":null,"completed_at":null,"store":true,"safety_identifier":null,"prompt_cache_key":null,"prompt_cache_options":null,"error":null}} + + ' + - ' + + ' + - 'event: response.in_progress + + ' + - 'data: {"type":"response.in_progress","sequence_number":1,"response":{"id":"resp_01a1681f-c3c7-77a2-80e5-2f5a0e82f3d7","created_at":1792748274,"incomplete_details":null,"instructions":null,"metadata":{},"model":"Qwen/Qwen3.8-27B-FP8","object":"response","output":[],"parallel_tool_calls":false,"temperature":1.0,"tool_choice":"none","tools":[],"top_p":1.0,"background":false,"max_output_tokens":null,"max_tool_calls":null,"previous_response_id":null,"prompt":null,"reasoning":null,"service_tier":"auto","status":"in_progress","text":{"format":{"type":"text"}},"top_logprobs":0,"truncation":"disabled","usage":null,"user":null,"presence_penalty":0.0,"frequency_penalty":0.0,"kv_transfer_params":null,"ec_transfer_params":null,"input_messages":null,"output_messages":null,"completed_at":null,"store":true,"safety_identifier":null,"prompt_cache_key":null,"prompt_cache_options":null,"error":null}} + + ' + - ' + + ' + - 'event: response.output_item.added + + ' + - 'data: {"type":"response.output_item.added","sequence_number":2,"output_index":0,"item":{"id":"rs_8af01c08c9063798","summary":[],"type":"reasoning","content":[],"status":"in_progress"}} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"type":"response.reasoning_text.delta","sequence_number":3,"output_index":0,"content_index":0,"delta":"The","item_id":"rs_8af01c08c9063798"} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"type":"response.reasoning_text.delta","sequence_number":4,"output_index":0,"content_index":0,"delta":" + user","item_id":"rs_8af01c08c9063798"} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"type":"response.reasoning_text.delta","sequence_number":5,"output_index":0,"content_index":0,"delta":" + wants","item_id":"rs_8af01c08c9063798"} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"type":"response.reasoning_text.delta","sequence_number":6,"output_index":0,"content_index":0,"delta":" + me","item_id":"rs_8af01c08c9063798"} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"type":"response.reasoning_text.delta","sequence_number":7,"output_index":0,"content_index":0,"delta":" + to","item_id":"rs_8af01c08c9063798"} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"type":"response.reasoning_text.delta","sequence_number":8,"output_index":0,"content_index":0,"delta":" + reply","item_id":"rs_8af01c08c9063798"} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"type":"response.reasoning_text.delta","sequence_number":9,"output_index":0,"content_index":0,"delta":" + with","item_id":"rs_8af01c08c9063798"} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"type":"response.reasoning_text.delta","sequence_number":10,"output_index":0,"content_index":0,"delta":" + only","item_id":"rs_8af01c08c9063798"} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"type":"response.reasoning_text.delta","sequence_number":11,"output_index":0,"content_index":0,"delta":" + the","item_id":"rs_8af01c08c9063798"} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"type":"response.reasoning_text.delta","sequence_number":12,"output_index":0,"content_index":0,"delta":" + word","item_id":"rs_8af01c08c9063798"} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"type":"response.reasoning_text.delta","sequence_number":13,"output_index":0,"content_index":0,"delta":" + \"","item_id":"rs_8af01c08c9063798"} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"type":"response.reasoning_text.delta","sequence_number":14,"output_index":0,"content_index":0,"delta":"S","item_id":"rs_8af01c08c9063798"} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"type":"response.reasoning_text.delta","sequence_number":15,"output_index":0,"content_index":0,"delta":"AP","item_id":"rs_8af01c08c9063798"} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"type":"response.reasoning_text.delta","sequence_number":16,"output_index":0,"content_index":0,"delta":"PH","item_id":"rs_8af01c08c9063798"} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"type":"response.reasoning_text.delta","sequence_number":17,"output_index":0,"content_index":0,"delta":"IRE","item_id":"rs_8af01c08c9063798"} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"type":"response.reasoning_text.delta","sequence_number":18,"output_index":0,"content_index":0,"delta":"\".","item_id":"rs_8af01c08c9063798"} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"type":"response.reasoning_text.delta","sequence_number":19,"output_index":0,"content_index":0,"delta":"\n","item_id":"rs_8af01c08c9063798"} + + ' + - ' + + ' + - 'event: response.reasoning_text.done + + ' + - 'data: {"type":"response.reasoning_text.done","sequence_number":20,"output_index":0,"content_index":0,"item_id":"rs_8af01c08c9063798","text":"The + user wants me to reply with only the word \"SAPPHIRE\".\n"} + + ' + - ' + + ' + - 'event: response.output_item.done + + ' + - 'data: {"type":"response.output_item.done","sequence_number":21,"output_index":0,"item":{"id":"rs_8af01c08c9063798","summary":[],"type":"reasoning","content":[{"text":"The + user wants me to reply with only the word \"SAPPHIRE\".\n","type":"reasoning_text"}],"status":"completed"}} + + ' + - ' + + ' + - 'event: response.output_item.added + + ' + - 'data: {"type":"response.output_item.added","sequence_number":22,"output_index":1,"item":{"id":"msg_8da27e2bda189a09","content":[],"role":"assistant","status":"in_progress","type":"message"}} + + ' + - ' + + ' + - 'event: response.content_part.added + + ' + - 'data: {"type":"response.content_part.added","sequence_number":23,"output_index":1,"content_index":0,"item_id":"msg_8da27e2bda189a09","part":{"annotations":[],"text":"","type":"output_text","logprobs":[]}} + + ' + - ' + + ' + - 'event: response.output_text.delta + + ' + - 'data: {"type":"response.output_text.delta","sequence_number":24,"output_index":1,"content_index":0,"delta":"\n\nS","item_id":"msg_8da27e2bda189a09","logprobs":[]} + + ' + - ' + + ' + - 'event: response.output_text.delta + + ' + - 'data: {"type":"response.output_text.delta","sequence_number":25,"output_index":1,"content_index":0,"delta":"AP","item_id":"msg_8da27e2bda189a09","logprobs":[]} + + ' + - ' + + ' + - 'event: response.output_text.delta + + ' + - 'data: {"type":"response.output_text.delta","sequence_number":26,"output_index":1,"content_index":0,"delta":"PH","item_id":"msg_8da27e2bda189a09","logprobs":[]} + + ' + - ' + + ' + - 'event: response.output_text.delta + + ' + - 'data: {"type":"response.output_text.delta","sequence_number":27,"output_index":1,"content_index":0,"delta":"IRE","item_id":"msg_8da27e2bda189a09","logprobs":[]} + + ' + - ' + + ' + - 'event: response.output_text.done + + ' + - 'data: {"type":"response.output_text.done","sequence_number":28,"output_index":1,"content_index":0,"item_id":"msg_8da27e2bda189a09","logprobs":[],"text":"\n\nSAPPHIRE"} + + ' + - ' + + ' + - 'event: response.content_part.done + + ' + - 'data: {"type":"response.content_part.done","sequence_number":29,"output_index":1,"content_index":0,"item_id":"msg_8da27e2bda189a09","part":{"annotations":[],"text":"\n\nSAPPHIRE","type":"output_text","logprobs":[]}} + + ' + - ' + + ' + - 'event: response.output_item.done + + ' + - 'data: {"type":"response.output_item.done","sequence_number":30,"output_index":1,"item":{"id":"msg_8da27e2bda189a09","content":[{"annotations":[],"text":"\n\nSAPPHIRE","type":"output_text","logprobs":[]}],"role":"assistant","status":"completed","type":"message"}} + + ' + - ' + + ' + - 'event: response.completed + + ' + - 'data: {"type":"response.completed","sequence_number":31,"response":{"id":"resp_01a1681f-c3c7-77a2-80e5-2f5a0e82f3d7","object":"response","created_at":1792748275,"model":"Qwen/Qwen3.8-27B-FP8","status":"completed","output":[{"type":"reasoning","id":"rs_8af01c08c9063798","content":[{"type":"reasoning_text","text":"The + user wants me to reply with only the word \"SAPPHIRE\".\n"}],"summary":[],"status":"completed"},{"type":"message","id":"msg_8da27e2bda189a09","role":"assistant","status":"completed","content":[{"type":"output_text","text":"\n\nSAPPHIRE","annotations":[]}]}],"usage":{"input_tokens":47,"output_tokens":24,"total_tokens":71,"input_tokens_details":{"cached_tokens":0,"cache_write_tokens":0},"output_tokens_details":{"reasoning_tokens":17}},"incomplete_details":null,"error":null,"previous_response_id":null,"instructions":null,"max_tool_calls":null,"service_tier":"auto","tools":[],"tool_choice":"auto","completed_at":1792748275,"truncation":"disabled","parallel_tool_calls":false,"text":{"format":{"type":"text"}},"top_p":1.0,"presence_penalty":0.0,"frequency_penalty":0.0,"top_logprobs":0,"temperature":1.0,"reasoning":null,"max_output_tokens":null,"store":true,"background":false,"metadata":{},"safety_identifier":null,"prompt_cache_key":null,"prompt_cache_options":null}} + + ' + - ' + + ' + - 'data: [DONE] + + ' + - ' + + ' + status_code: 200 +- filename: t2 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_01a1681f-c3c7-77a2-80e5-2f5a0e82f3d7/input_items + query_params: {} + response: + body: + data: + - content: + - text: Reply with only SAPPHIRE. + type: input_text + id: msg_01a1681f-c610-71b3-aae5-c823b78c016b + role: user + status: completed + type: message + first_id: msg_01a1681f-c610-71b3-aae5-c823b78c016b + has_more: false + last_id: msg_01a1681f-c610-71b3-aae5-c823b78c016b + object: list + headers: + content-type: application/json + status_code: 200 +- filename: t3 + request: + body: + input: + - content: Reply with only ORCHID. + role: user + model: Qwen/Qwen3.8-27B-FP8 + previous_response_id: resp_01a1681f-c3c7-77a2-80e5-2f5a0e82f3d7 + store: true + stream: true + headers: + accept: '*/*' + authorization: Bearer *** + content-type: application/json + user-agent: python-httpx/0.28.1 + method: POST + path: /v1/responses + query_params: {} + response: + headers: + content-type: text/event-stream; charset=utf-8 + sse: + - 'event: response.created + + ' + - 'data: {"type":"response.created","sequence_number":0,"response":{"id":"resp_01a1681f-c648-74d1-a2fa-98a0612dbb89","created_at":1792748275,"incomplete_details":null,"instructions":null,"metadata":{},"model":"Qwen/Qwen3.8-27B-FP8","object":"response","output":[],"parallel_tool_calls":false,"temperature":1.0,"tool_choice":"none","tools":[],"top_p":1.0,"background":false,"max_output_tokens":null,"max_tool_calls":null,"previous_response_id":"resp_01a1681f-c3c7-77a2-80e5-2f5a0e82f3d7","prompt":null,"reasoning":null,"service_tier":"auto","status":"in_progress","text":{"format":{"type":"text"}},"top_logprobs":0,"truncation":"disabled","usage":null,"user":null,"presence_penalty":0.0,"frequency_penalty":0.0,"kv_transfer_params":null,"ec_transfer_params":null,"input_messages":null,"output_messages":null,"completed_at":null,"store":true,"safety_identifier":null,"prompt_cache_key":null,"prompt_cache_options":null,"error":null}} + + ' + - ' + + ' + - 'event: response.in_progress + + ' + - 'data: {"type":"response.in_progress","sequence_number":1,"response":{"id":"resp_01a1681f-c648-74d1-a2fa-98a0612dbb89","created_at":1792748275,"incomplete_details":null,"instructions":null,"metadata":{},"model":"Qwen/Qwen3.8-27B-FP8","object":"response","output":[],"parallel_tool_calls":false,"temperature":1.0,"tool_choice":"none","tools":[],"top_p":1.0,"background":false,"max_output_tokens":null,"max_tool_calls":null,"previous_response_id":"resp_01a1681f-c3c7-77a2-80e5-2f5a0e82f3d7","prompt":null,"reasoning":null,"service_tier":"auto","status":"in_progress","text":{"format":{"type":"text"}},"top_logprobs":0,"truncation":"disabled","usage":null,"user":null,"presence_penalty":0.0,"frequency_penalty":0.0,"kv_transfer_params":null,"ec_transfer_params":null,"input_messages":null,"output_messages":null,"completed_at":null,"store":true,"safety_identifier":null,"prompt_cache_key":null,"prompt_cache_options":null,"error":null}} + + ' + - ' + + ' + - 'event: response.output_item.added + + ' + - 'data: {"type":"response.output_item.added","sequence_number":2,"output_index":0,"item":{"id":"rs_b200b8226f4c0bfc","summary":[],"type":"reasoning","content":[],"status":"in_progress"}} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"type":"response.reasoning_text.delta","sequence_number":3,"output_index":0,"content_index":0,"delta":"The","item_id":"rs_b200b8226f4c0bfc"} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"type":"response.reasoning_text.delta","sequence_number":4,"output_index":0,"content_index":0,"delta":" + user","item_id":"rs_b200b8226f4c0bfc"} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"type":"response.reasoning_text.delta","sequence_number":5,"output_index":0,"content_index":0,"delta":" + wants","item_id":"rs_b200b8226f4c0bfc"} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"type":"response.reasoning_text.delta","sequence_number":6,"output_index":0,"content_index":0,"delta":" + me","item_id":"rs_b200b8226f4c0bfc"} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"type":"response.reasoning_text.delta","sequence_number":7,"output_index":0,"content_index":0,"delta":" + to","item_id":"rs_b200b8226f4c0bfc"} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"type":"response.reasoning_text.delta","sequence_number":8,"output_index":0,"content_index":0,"delta":" + reply","item_id":"rs_b200b8226f4c0bfc"} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"type":"response.reasoning_text.delta","sequence_number":9,"output_index":0,"content_index":0,"delta":" + with","item_id":"rs_b200b8226f4c0bfc"} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"type":"response.reasoning_text.delta","sequence_number":10,"output_index":0,"content_index":0,"delta":" + only","item_id":"rs_b200b8226f4c0bfc"} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"type":"response.reasoning_text.delta","sequence_number":11,"output_index":0,"content_index":0,"delta":" + the","item_id":"rs_b200b8226f4c0bfc"} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"type":"response.reasoning_text.delta","sequence_number":12,"output_index":0,"content_index":0,"delta":" + word","item_id":"rs_b200b8226f4c0bfc"} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"type":"response.reasoning_text.delta","sequence_number":13,"output_index":0,"content_index":0,"delta":" + \"","item_id":"rs_b200b8226f4c0bfc"} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"type":"response.reasoning_text.delta","sequence_number":14,"output_index":0,"content_index":0,"delta":"OR","item_id":"rs_b200b8226f4c0bfc"} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"type":"response.reasoning_text.delta","sequence_number":15,"output_index":0,"content_index":0,"delta":"CH","item_id":"rs_b200b8226f4c0bfc"} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"type":"response.reasoning_text.delta","sequence_number":16,"output_index":0,"content_index":0,"delta":"ID","item_id":"rs_b200b8226f4c0bfc"} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"type":"response.reasoning_text.delta","sequence_number":17,"output_index":0,"content_index":0,"delta":"\".","item_id":"rs_b200b8226f4c0bfc"} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"type":"response.reasoning_text.delta","sequence_number":18,"output_index":0,"content_index":0,"delta":"\n","item_id":"rs_b200b8226f4c0bfc"} + + ' + - ' + + ' + - 'event: response.reasoning_text.done + + ' + - 'data: {"type":"response.reasoning_text.done","sequence_number":19,"output_index":0,"content_index":0,"item_id":"rs_b200b8226f4c0bfc","text":"The + user wants me to reply with only the word \"ORCHID\".\n"} + + ' + - ' + + ' + - 'event: response.output_item.done + + ' + - 'data: {"type":"response.output_item.done","sequence_number":20,"output_index":0,"item":{"id":"rs_b200b8226f4c0bfc","summary":[],"type":"reasoning","content":[{"text":"The + user wants me to reply with only the word \"ORCHID\".\n","type":"reasoning_text"}],"status":"completed"}} + + ' + - ' + + ' + - 'event: response.output_item.added + + ' + - 'data: {"type":"response.output_item.added","sequence_number":21,"output_index":1,"item":{"id":"msg_85767da589130597","content":[],"role":"assistant","status":"in_progress","type":"message"}} + + ' + - ' + + ' + - 'event: response.content_part.added + + ' + - 'data: {"type":"response.content_part.added","sequence_number":22,"output_index":1,"content_index":0,"item_id":"msg_85767da589130597","part":{"annotations":[],"text":"","type":"output_text","logprobs":[]}} + + ' + - ' + + ' + - 'event: response.output_text.delta + + ' + - 'data: {"type":"response.output_text.delta","sequence_number":23,"output_index":1,"content_index":0,"delta":"\n\nOR","item_id":"msg_85767da589130597","logprobs":[]} + + ' + - ' + + ' + - 'event: response.output_text.delta + + ' + - 'data: {"type":"response.output_text.delta","sequence_number":24,"output_index":1,"content_index":0,"delta":"CH","item_id":"msg_85767da589130597","logprobs":[]} + + ' + - ' + + ' + - 'event: response.output_text.delta + + ' + - 'data: {"type":"response.output_text.delta","sequence_number":25,"output_index":1,"content_index":0,"delta":"ID","item_id":"msg_85767da589130597","logprobs":[]} + + ' + - ' + + ' + - 'event: response.output_text.done + + ' + - 'data: {"type":"response.output_text.done","sequence_number":26,"output_index":1,"content_index":0,"item_id":"msg_85767da589130597","logprobs":[],"text":"\n\nORCHID"} + + ' + - ' + + ' + - 'event: response.content_part.done + + ' + - 'data: {"type":"response.content_part.done","sequence_number":27,"output_index":1,"content_index":0,"item_id":"msg_85767da589130597","part":{"annotations":[],"text":"\n\nORCHID","type":"output_text","logprobs":[]}} + + ' + - ' + + ' + - 'event: response.output_item.done + + ' + - 'data: {"type":"response.output_item.done","sequence_number":28,"output_index":1,"item":{"id":"msg_85767da589130597","content":[{"annotations":[],"text":"\n\nORCHID","type":"output_text","logprobs":[]}],"role":"assistant","status":"completed","type":"message"}} + + ' + - ' + + ' + - 'event: response.completed + + ' + - 'data: {"type":"response.completed","sequence_number":29,"response":{"id":"resp_01a1681f-c648-74d1-a2fa-98a0612dbb89","object":"response","created_at":1792748275,"model":"Qwen/Qwen3.8-27B-FP8","status":"completed","output":[{"type":"reasoning","id":"rs_b200b8226f4c0bfc","content":[{"type":"reasoning_text","text":"The + user wants me to reply with only the word \"ORCHID\".\n"}],"summary":[],"status":"completed"},{"type":"message","id":"msg_85767da589130597","role":"assistant","status":"completed","content":[{"type":"output_text","text":"\n\nORCHID","annotations":[]}]}],"usage":{"input_tokens":89,"output_tokens":22,"total_tokens":111,"input_tokens_details":{"cached_tokens":0,"cache_write_tokens":0},"output_tokens_details":{"reasoning_tokens":16}},"incomplete_details":null,"error":null,"previous_response_id":"resp_01a1681f-c3c7-77a2-80e5-2f5a0e82f3d7","instructions":null,"max_tool_calls":null,"service_tier":"auto","tools":[],"tool_choice":"auto","completed_at":1792748275,"truncation":"disabled","parallel_tool_calls":false,"text":{"format":{"type":"text"}},"top_p":1.0,"presence_penalty":0.0,"frequency_penalty":0.0,"top_logprobs":0,"temperature":1.0,"reasoning":null,"max_output_tokens":null,"store":true,"background":false,"metadata":{},"safety_identifier":null,"prompt_cache_key":null,"prompt_cache_options":null}} + + ' + - ' + + ' + - 'data: [DONE] + + ' + - ' + + ' + status_code: 200 +- filename: t4 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_01a1681f-c648-74d1-a2fa-98a0612dbb89/input_items + query_params: + order: asc + response: + body: + data: + - content: + - text: Reply with only SAPPHIRE. + type: input_text + id: msg_01a1681f-c610-71b3-aae5-c823b78c016b + role: user + status: completed + type: message + - content: + - text: 'The user wants me to reply with only the word "SAPPHIRE". + + ' + type: reasoning_text + id: rs_8af01c08c9063798 + status: completed + summary: [] + type: reasoning + - content: + - annotations: [] + text: ' + + + SAPPHIRE' + type: output_text + id: msg_8da27e2bda189a09 + role: assistant + status: completed + type: message + - content: + - text: Reply with only ORCHID. + type: input_text + id: msg_01a1681f-c86b-71f1-a429-939cdc0277e8 + role: user + status: completed + type: message + first_id: msg_01a1681f-c610-71b3-aae5-c823b78c016b + has_more: false + last_id: msg_01a1681f-c86b-71f1-a429-939cdc0277e8 + object: list + headers: + content-type: application/json + status_code: 200 +- filename: t5 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_01a1681f-c648-74d1-a2fa-98a0612dbb89/input_items + query_params: + limit: '1' + order: asc + response: + body: + data: + - content: + - text: Reply with only SAPPHIRE. + type: input_text + id: msg_01a1681f-c610-71b3-aae5-c823b78c016b + role: user + status: completed + type: message + first_id: msg_01a1681f-c610-71b3-aae5-c823b78c016b + has_more: true + last_id: msg_01a1681f-c610-71b3-aae5-c823b78c016b + object: list + headers: + content-type: application/json + status_code: 200 +- filename: t6 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_01a1681f-c648-74d1-a2fa-98a0612dbb89/input_items + query_params: + after: msg_01a1681f-c610-71b3-aae5-c823b78c016b + limit: '1' + order: asc + response: + body: + data: + - content: + - text: 'The user wants me to reply with only the word "SAPPHIRE". + + ' + type: reasoning_text + id: rs_8af01c08c9063798 + status: completed + summary: [] + type: reasoning + first_id: rs_8af01c08c9063798 + has_more: true + last_id: rs_8af01c08c9063798 + object: list + headers: + content-type: application/json + status_code: 200 +- filename: t7 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_01a1681f-c648-74d1-a2fa-98a0612dbb89 + query_params: {} + response: + body: + background: false + completed_at: 1792748275 + created_at: 1792748275 + error: null + frequency_penalty: 0.0 + id: resp_01a1681f-c648-74d1-a2fa-98a0612dbb89 + incomplete_details: null + instructions: null + max_output_tokens: null + max_tool_calls: null + metadata: {} + model: Qwen/Qwen3.8-27B-FP8 + object: response + output: + - content: + - text: 'The user wants me to reply with only the word "ORCHID". + + ' + type: reasoning_text + id: rs_b200b8226f4c0bfc + status: completed + summary: [] + type: reasoning + - content: + - annotations: [] + text: ' + + + ORCHID' + type: output_text + id: msg_85767da589130597 + role: assistant + status: completed + type: message + parallel_tool_calls: false + presence_penalty: 0.0 + previous_response_id: resp_01a1681f-c3c7-77a2-80e5-2f5a0e82f3d7 + prompt_cache_key: null + prompt_cache_options: null + reasoning: null + safety_identifier: null + service_tier: auto + status: completed + store: true + temperature: 1.0 + text: + format: + type: text + tool_choice: auto + tools: [] + top_logprobs: 0 + top_p: 1.0 + truncation: disabled + usage: + input_tokens: 89 + input_tokens_details: + cache_write_tokens: 0 + cached_tokens: 0 + output_tokens: 22 + output_tokens_details: + reasoning_tokens: 16 + total_tokens: 111 + headers: + content-type: application/json + status_code: 200 +- filename: t8 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: DELETE + path: /v1/responses/resp_01a1681f-c3c7-77a2-80e5-2f5a0e82f3d7 + query_params: {} + response: + body: + deleted: true + id: resp_01a1681f-c3c7-77a2-80e5-2f5a0e82f3d7 + object: response.deleted + headers: + content-type: application/json + status_code: 200 +- filename: t9 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_01a1681f-c3c7-77a2-80e5-2f5a0e82f3d7 + query_params: {} + response: + body: + error: + code: null + message: 'storage error: not found: Response with id ''resp_01a1681f-c3c7-77a2-80e5-2f5a0e82f3d7''' + param: null + type: invalid_request_error + headers: + content-type: application/json + status_code: 404 +- filename: t10 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_01a1681f-c3c7-77a2-80e5-2f5a0e82f3d7/input_items + query_params: {} + response: + body: + error: + code: null + message: 'storage error: not found: Response with id ''resp_01a1681f-c3c7-77a2-80e5-2f5a0e82f3d7''' + param: null + type: invalid_request_error + headers: + content-type: application/json + status_code: 404 +- filename: t11 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_01a1681f-c648-74d1-a2fa-98a0612dbb89/input_items + query_params: + order: asc + response: + body: + data: + - content: + - text: Reply with only ORCHID. + type: input_text + id: msg_01a1681f-c86b-71f1-a429-939cdc0277e8 + role: user + status: completed + type: message + first_id: msg_01a1681f-c86b-71f1-a429-939cdc0277e8 + has_more: false + last_id: msg_01a1681f-c86b-71f1-a429-939cdc0277e8 + object: list + headers: + content-type: application/json + status_code: 200 +- filename: t12 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_01a1681f-c648-74d1-a2fa-98a0612dbb89 + query_params: {} + response: + body: + background: false + completed_at: 1792748275 + created_at: 1792748275 + error: null + frequency_penalty: 0.0 + id: resp_01a1681f-c648-74d1-a2fa-98a0612dbb89 + incomplete_details: null + instructions: null + max_output_tokens: null + max_tool_calls: null + metadata: {} + model: Qwen/Qwen3.8-27B-FP8 + object: response + output: + - content: + - text: 'The user wants me to reply with only the word "ORCHID". + + ' + type: reasoning_text + id: rs_b200b8226f4c0bfc + status: completed + summary: [] + type: reasoning + - content: + - annotations: [] + text: ' + + + ORCHID' + type: output_text + id: msg_85767da589130597 + role: assistant + status: completed + type: message + parallel_tool_calls: false + presence_penalty: 0.0 + previous_response_id: resp_01a1681f-c3c7-77a2-80e5-2f5a0e82f3d7 + prompt_cache_key: null + prompt_cache_options: null + reasoning: null + safety_identifier: null + service_tier: auto + status: completed + store: true + temperature: 1.0 + text: + format: + type: text + tool_choice: auto + tools: [] + top_logprobs: 0 + top_p: 1.0 + truncation: disabled + usage: + input_tokens: 89 + input_tokens_details: + cache_write_tokens: 0 + cached_tokens: 0 + output_tokens: 22 + output_tokens_details: + reasoning_tokens: 16 + total_tokens: 111 + headers: + content-type: application/json + status_code: 200 +- filename: t13 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: DELETE + path: /v1/responses/resp_01a1681f-c3c7-77a2-80e5-2f5a0e82f3d7 + query_params: {} + response: + body: + error: + code: null + message: 'storage error: not found: Response with id ''resp_01a1681f-c3c7-77a2-80e5-2f5a0e82f3d7''' + param: null + type: invalid_request_error + headers: + content-type: application/json + status_code: 404 +- filename: t14 + request: + body: + input: + - content: What exact word did the first user message ask you to reply with? + Reply with only that word. + role: user + model: Qwen/Qwen3.8-27B-FP8 + previous_response_id: resp_01a1681f-c648-74d1-a2fa-98a0612dbb89 + store: true + stream: true + headers: + accept: '*/*' + authorization: Bearer *** + content-type: application/json + user-agent: python-httpx/0.28.1 + method: POST + path: /v1/responses + query_params: {} + response: + headers: + content-type: text/event-stream; charset=utf-8 + sse: + - 'event: response.created + + ' + - 'data: {"type":"response.created","sequence_number":0,"response":{"id":"resp_01a1681f-cba2-7081-b883-9947138e73d6","created_at":1792748276,"incomplete_details":null,"instructions":null,"metadata":{},"model":"Qwen/Qwen3.8-27B-FP8","object":"response","output":[],"parallel_tool_calls":false,"temperature":1.0,"tool_choice":"none","tools":[],"top_p":1.0,"background":false,"max_output_tokens":null,"max_tool_calls":null,"previous_response_id":"resp_01a1681f-c648-74d1-a2fa-98a0612dbb89","prompt":null,"reasoning":null,"service_tier":"auto","status":"in_progress","text":{"format":{"type":"text"}},"top_logprobs":0,"truncation":"disabled","usage":null,"user":null,"presence_penalty":0.0,"frequency_penalty":0.0,"kv_transfer_params":null,"ec_transfer_params":null,"input_messages":null,"output_messages":null,"completed_at":null,"store":true,"safety_identifier":null,"prompt_cache_key":null,"prompt_cache_options":null,"error":null}} + + ' + - ' + + ' + - 'event: response.in_progress + + ' + - 'data: {"type":"response.in_progress","sequence_number":1,"response":{"id":"resp_01a1681f-cba2-7081-b883-9947138e73d6","created_at":1792748276,"incomplete_details":null,"instructions":null,"metadata":{},"model":"Qwen/Qwen3.8-27B-FP8","object":"response","output":[],"parallel_tool_calls":false,"temperature":1.0,"tool_choice":"none","tools":[],"top_p":1.0,"background":false,"max_output_tokens":null,"max_tool_calls":null,"previous_response_id":"resp_01a1681f-c648-74d1-a2fa-98a0612dbb89","prompt":null,"reasoning":null,"service_tier":"auto","status":"in_progress","text":{"format":{"type":"text"}},"top_logprobs":0,"truncation":"disabled","usage":null,"user":null,"presence_penalty":0.0,"frequency_penalty":0.0,"kv_transfer_params":null,"ec_transfer_params":null,"input_messages":null,"output_messages":null,"completed_at":null,"store":true,"safety_identifier":null,"prompt_cache_key":null,"prompt_cache_options":null,"error":null}} + + ' + - ' + + ' + - 'event: response.output_item.added + + ' + - 'data: {"type":"response.output_item.added","sequence_number":2,"output_index":0,"item":{"id":"rs_84709161e21da2c9","summary":[],"type":"reasoning","content":[],"status":"in_progress"}} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"type":"response.reasoning_text.delta","sequence_number":3,"output_index":0,"content_index":0,"delta":"The","item_id":"rs_84709161e21da2c9"} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"type":"response.reasoning_text.delta","sequence_number":4,"output_index":0,"content_index":0,"delta":" + user","item_id":"rs_84709161e21da2c9"} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"type":"response.reasoning_text.delta","sequence_number":5,"output_index":0,"content_index":0,"delta":" + is","item_id":"rs_84709161e21da2c9"} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"type":"response.reasoning_text.delta","sequence_number":6,"output_index":0,"content_index":0,"delta":" + asking","item_id":"rs_84709161e21da2c9"} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"type":"response.reasoning_text.delta","sequence_number":7,"output_index":0,"content_index":0,"delta":" + me","item_id":"rs_84709161e21da2c9"} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"type":"response.reasoning_text.delta","sequence_number":8,"output_index":0,"content_index":0,"delta":" + what","item_id":"rs_84709161e21da2c9"} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"type":"response.reasoning_text.delta","sequence_number":9,"output_index":0,"content_index":0,"delta":" + exact","item_id":"rs_84709161e21da2c9"} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"type":"response.reasoning_text.delta","sequence_number":10,"output_index":0,"content_index":0,"delta":" + word","item_id":"rs_84709161e21da2c9"} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"type":"response.reasoning_text.delta","sequence_number":11,"output_index":0,"content_index":0,"delta":" + the","item_id":"rs_84709161e21da2c9"} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"type":"response.reasoning_text.delta","sequence_number":12,"output_index":0,"content_index":0,"delta":" + first","item_id":"rs_84709161e21da2c9"} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"type":"response.reasoning_text.delta","sequence_number":13,"output_index":0,"content_index":0,"delta":" + user","item_id":"rs_84709161e21da2c9"} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"type":"response.reasoning_text.delta","sequence_number":14,"output_index":0,"content_index":0,"delta":" + message","item_id":"rs_84709161e21da2c9"} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"type":"response.reasoning_text.delta","sequence_number":15,"output_index":0,"content_index":0,"delta":" + asked","item_id":"rs_84709161e21da2c9"} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"type":"response.reasoning_text.delta","sequence_number":16,"output_index":0,"content_index":0,"delta":" + me","item_id":"rs_84709161e21da2c9"} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"type":"response.reasoning_text.delta","sequence_number":17,"output_index":0,"content_index":0,"delta":" + to","item_id":"rs_84709161e21da2c9"} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"type":"response.reasoning_text.delta","sequence_number":18,"output_index":0,"content_index":0,"delta":" + reply","item_id":"rs_84709161e21da2c9"} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"type":"response.reasoning_text.delta","sequence_number":19,"output_index":0,"content_index":0,"delta":" + with","item_id":"rs_84709161e21da2c9"} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"type":"response.reasoning_text.delta","sequence_number":20,"output_index":0,"content_index":0,"delta":".","item_id":"rs_84709161e21da2c9"} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"type":"response.reasoning_text.delta","sequence_number":21,"output_index":0,"content_index":0,"delta":" + The","item_id":"rs_84709161e21da2c9"} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"type":"response.reasoning_text.delta","sequence_number":22,"output_index":0,"content_index":0,"delta":" + first","item_id":"rs_84709161e21da2c9"} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"type":"response.reasoning_text.delta","sequence_number":23,"output_index":0,"content_index":0,"delta":" + user","item_id":"rs_84709161e21da2c9"} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"type":"response.reasoning_text.delta","sequence_number":24,"output_index":0,"content_index":0,"delta":" + message","item_id":"rs_84709161e21da2c9"} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"type":"response.reasoning_text.delta","sequence_number":25,"output_index":0,"content_index":0,"delta":" + said","item_id":"rs_84709161e21da2c9"} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"type":"response.reasoning_text.delta","sequence_number":26,"output_index":0,"content_index":0,"delta":" + \"","item_id":"rs_84709161e21da2c9"} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"type":"response.reasoning_text.delta","sequence_number":27,"output_index":0,"content_index":0,"delta":"Reply","item_id":"rs_84709161e21da2c9"} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"type":"response.reasoning_text.delta","sequence_number":28,"output_index":0,"content_index":0,"delta":" + with","item_id":"rs_84709161e21da2c9"} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"type":"response.reasoning_text.delta","sequence_number":29,"output_index":0,"content_index":0,"delta":" + only","item_id":"rs_84709161e21da2c9"} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"type":"response.reasoning_text.delta","sequence_number":30,"output_index":0,"content_index":0,"delta":" + OR","item_id":"rs_84709161e21da2c9"} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"type":"response.reasoning_text.delta","sequence_number":31,"output_index":0,"content_index":0,"delta":"CH","item_id":"rs_84709161e21da2c9"} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"type":"response.reasoning_text.delta","sequence_number":32,"output_index":0,"content_index":0,"delta":"ID","item_id":"rs_84709161e21da2c9"} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"type":"response.reasoning_text.delta","sequence_number":33,"output_index":0,"content_index":0,"delta":".\"","item_id":"rs_84709161e21da2c9"} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"type":"response.reasoning_text.delta","sequence_number":34,"output_index":0,"content_index":0,"delta":" + So","item_id":"rs_84709161e21da2c9"} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"type":"response.reasoning_text.delta","sequence_number":35,"output_index":0,"content_index":0,"delta":" + the","item_id":"rs_84709161e21da2c9"} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"type":"response.reasoning_text.delta","sequence_number":36,"output_index":0,"content_index":0,"delta":" + word","item_id":"rs_84709161e21da2c9"} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"type":"response.reasoning_text.delta","sequence_number":37,"output_index":0,"content_index":0,"delta":" + is","item_id":"rs_84709161e21da2c9"} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"type":"response.reasoning_text.delta","sequence_number":38,"output_index":0,"content_index":0,"delta":" + OR","item_id":"rs_84709161e21da2c9"} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"type":"response.reasoning_text.delta","sequence_number":39,"output_index":0,"content_index":0,"delta":"CH","item_id":"rs_84709161e21da2c9"} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"type":"response.reasoning_text.delta","sequence_number":40,"output_index":0,"content_index":0,"delta":"ID","item_id":"rs_84709161e21da2c9"} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"type":"response.reasoning_text.delta","sequence_number":41,"output_index":0,"content_index":0,"delta":".","item_id":"rs_84709161e21da2c9"} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"type":"response.reasoning_text.delta","sequence_number":42,"output_index":0,"content_index":0,"delta":" + They","item_id":"rs_84709161e21da2c9"} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"type":"response.reasoning_text.delta","sequence_number":43,"output_index":0,"content_index":0,"delta":" + want","item_id":"rs_84709161e21da2c9"} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"type":"response.reasoning_text.delta","sequence_number":44,"output_index":0,"content_index":0,"delta":" + me","item_id":"rs_84709161e21da2c9"} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"type":"response.reasoning_text.delta","sequence_number":45,"output_index":0,"content_index":0,"delta":" + to","item_id":"rs_84709161e21da2c9"} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"type":"response.reasoning_text.delta","sequence_number":46,"output_index":0,"content_index":0,"delta":" + reply","item_id":"rs_84709161e21da2c9"} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"type":"response.reasoning_text.delta","sequence_number":47,"output_index":0,"content_index":0,"delta":" + with","item_id":"rs_84709161e21da2c9"} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"type":"response.reasoning_text.delta","sequence_number":48,"output_index":0,"content_index":0,"delta":" + only","item_id":"rs_84709161e21da2c9"} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"type":"response.reasoning_text.delta","sequence_number":49,"output_index":0,"content_index":0,"delta":" + that","item_id":"rs_84709161e21da2c9"} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"type":"response.reasoning_text.delta","sequence_number":50,"output_index":0,"content_index":0,"delta":" + word","item_id":"rs_84709161e21da2c9"} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"type":"response.reasoning_text.delta","sequence_number":51,"output_index":0,"content_index":0,"delta":".","item_id":"rs_84709161e21da2c9"} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"type":"response.reasoning_text.delta","sequence_number":52,"output_index":0,"content_index":0,"delta":"\n","item_id":"rs_84709161e21da2c9"} + + ' + - ' + + ' + - 'event: response.reasoning_text.done + + ' + - 'data: {"type":"response.reasoning_text.done","sequence_number":53,"output_index":0,"content_index":0,"item_id":"rs_84709161e21da2c9","text":"The + user is asking me what exact word the first user message asked me to reply with. + The first user message said \"Reply with only ORCHID.\" So the word is ORCHID. + They want me to reply with only that word.\n"} + + ' + - ' + + ' + - 'event: response.output_item.done + + ' + - 'data: {"type":"response.output_item.done","sequence_number":54,"output_index":0,"item":{"id":"rs_84709161e21da2c9","summary":[],"type":"reasoning","content":[{"text":"The + user is asking me what exact word the first user message asked me to reply with. + The first user message said \"Reply with only ORCHID.\" So the word is ORCHID. + They want me to reply with only that word.\n","type":"reasoning_text"}],"status":"completed"}} + + ' + - ' + + ' + - 'event: response.output_item.added + + ' + - 'data: {"type":"response.output_item.added","sequence_number":55,"output_index":1,"item":{"id":"msg_9dded234346ad83a","content":[],"role":"assistant","status":"in_progress","type":"message"}} + + ' + - ' + + ' + - 'event: response.content_part.added + + ' + - 'data: {"type":"response.content_part.added","sequence_number":56,"output_index":1,"content_index":0,"item_id":"msg_9dded234346ad83a","part":{"annotations":[],"text":"","type":"output_text","logprobs":[]}} + + ' + - ' + + ' + - 'event: response.output_text.delta + + ' + - 'data: {"type":"response.output_text.delta","sequence_number":57,"output_index":1,"content_index":0,"delta":"\n\nOR","item_id":"msg_9dded234346ad83a","logprobs":[]} + + ' + - ' + + ' + - 'event: response.output_text.delta + + ' + - 'data: {"type":"response.output_text.delta","sequence_number":58,"output_index":1,"content_index":0,"delta":"CH","item_id":"msg_9dded234346ad83a","logprobs":[]} + + ' + - ' + + ' + - 'event: response.output_text.delta + + ' + - 'data: {"type":"response.output_text.delta","sequence_number":59,"output_index":1,"content_index":0,"delta":"ID","item_id":"msg_9dded234346ad83a","logprobs":[]} + + ' + - ' + + ' + - 'event: response.output_text.done + + ' + - 'data: {"type":"response.output_text.done","sequence_number":60,"output_index":1,"content_index":0,"item_id":"msg_9dded234346ad83a","logprobs":[],"text":"\n\nORCHID"} + + ' + - ' + + ' + - 'event: response.content_part.done + + ' + - 'data: {"type":"response.content_part.done","sequence_number":61,"output_index":1,"content_index":0,"item_id":"msg_9dded234346ad83a","part":{"annotations":[],"text":"\n\nORCHID","type":"output_text","logprobs":[]}} + + ' + - ' + + ' + - 'event: response.output_item.done + + ' + - 'data: {"type":"response.output_item.done","sequence_number":62,"output_index":1,"item":{"id":"msg_9dded234346ad83a","content":[{"annotations":[],"text":"\n\nORCHID","type":"output_text","logprobs":[]}],"role":"assistant","status":"completed","type":"message"}} + + ' + - ' + + ' + - 'event: response.completed + + ' + - 'data: {"type":"response.completed","sequence_number":63,"response":{"id":"resp_01a1681f-cba2-7081-b883-9947138e73d6","object":"response","created_at":1792748277,"model":"Qwen/Qwen3.8-27B-FP8","status":"completed","output":[{"type":"reasoning","id":"rs_84709161e21da2c9","content":[{"type":"reasoning_text","text":"The + user is asking me what exact word the first user message asked me to reply with. + The first user message said \"Reply with only ORCHID.\" So the word is ORCHID. + They want me to reply with only that word.\n"}],"summary":[],"status":"completed"},{"type":"message","id":"msg_9dded234346ad83a","role":"assistant","status":"completed","content":[{"type":"output_text","text":"\n\nORCHID","annotations":[]}]}],"usage":{"input_tokens":100,"output_tokens":56,"total_tokens":156,"input_tokens_details":{"cached_tokens":0,"cache_write_tokens":0},"output_tokens_details":{"reasoning_tokens":50}},"incomplete_details":null,"error":null,"previous_response_id":"resp_01a1681f-c648-74d1-a2fa-98a0612dbb89","instructions":null,"max_tool_calls":null,"service_tier":"auto","tools":[],"tool_choice":"auto","completed_at":1792748277,"truncation":"disabled","parallel_tool_calls":false,"text":{"format":{"type":"text"}},"top_p":1.0,"presence_penalty":0.0,"frequency_penalty":0.0,"top_logprobs":0,"temperature":1.0,"reasoning":null,"max_output_tokens":null,"store":true,"background":false,"metadata":{},"safety_identifier":null,"prompt_cache_key":null,"prompt_cache_options":null}} + + ' + - ' + + ' + - 'data: [DONE] + + ' + - ' + + ' + status_code: 200 +- filename: t15 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_01a1681f-cba2-7081-b883-9947138e73d6/input_items + query_params: + order: asc + response: + body: + data: + - content: + - text: Reply with only ORCHID. + type: input_text + id: msg_01a1681f-c86b-71f1-a429-939cdc0277e8 + role: user + status: completed + type: message + - content: + - text: 'The user wants me to reply with only the word "ORCHID". + + ' + type: reasoning_text + id: rs_b200b8226f4c0bfc + status: completed + summary: [] + type: reasoning + - content: + - annotations: [] + text: ' + + + ORCHID' + type: output_text + id: msg_85767da589130597 + role: assistant + status: completed + type: message + - content: + - text: What exact word did the first user message ask you to reply with? + Reply with only that word. + type: input_text + id: msg_01a1681f-d076-7202-84df-99c102a6e6c9 + role: user + status: completed + type: message + first_id: msg_01a1681f-c86b-71f1-a429-939cdc0277e8 + has_more: false + last_id: msg_01a1681f-d076-7202-84df-99c102a6e6c9 + object: list + headers: + content-type: application/json + status_code: 200 +- filename: t16 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: DELETE + path: /v1/responses/resp_01a1681f-cba2-7081-b883-9947138e73d6 + query_params: {} + response: + body: + deleted: true + id: resp_01a1681f-cba2-7081-b883-9947138e73d6 + object: response.deleted + headers: + content-type: application/json + status_code: 200 +- filename: t17 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: DELETE + path: /v1/responses/resp_01a1681f-c648-74d1-a2fa-98a0612dbb89 + query_params: {} + response: + body: + deleted: true + id: resp_01a1681f-c648-74d1-a2fa-98a0612dbb89 + object: response.deleted + headers: + content-type: application/json + status_code: 200 +- filename: t18 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_01a1681f-c648-74d1-a2fa-98a0612dbb89/input_items + query_params: {} + response: + body: + error: + code: null + message: 'storage error: not found: Response with id ''resp_01a1681f-c648-74d1-a2fa-98a0612dbb89''' + param: null + type: invalid_request_error + headers: + content-type: application/json + status_code: 404 +- filename: t19 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_01a1681f-c648-74d1-a2fa-98a0612dbb89 + query_params: {} + response: + body: + error: + code: null + message: 'storage error: not found: Response with id ''resp_01a1681f-c648-74d1-a2fa-98a0612dbb89''' + param: null + type: invalid_request_error + headers: + content-type: application/json + status_code: 404 diff --git a/crates/agentic-server-core/tests/cassettes/responses/response-lifecycle-stream-openai.yaml b/crates/agentic-server-core/tests/cassettes/responses/response-lifecycle-stream-openai.yaml new file mode 100644 index 000000000..f47d2a615 --- /dev/null +++ b/crates/agentic-server-core/tests/cassettes/responses/response-lifecycle-stream-openai.yaml @@ -0,0 +1,916 @@ +turns: +- filename: t1 + request: + body: + input: + - content: Reply with only SAPPHIRE. + role: user + model: gpt-4.1 + store: true + stream: true + headers: + accept: '*/*' + authorization: Bearer *** + content-type: application/json + user-agent: python-httpx/0.28.1 + method: POST + path: /v1/responses + query_params: {} + response: + headers: + content-type: text/event-stream; charset=utf-8 + sse: + - 'event: response.created + + ' + - 'data: {"type":"response.created","response":{"id":"resp_0f7f14a9fb88d556006adb1d0437f087d0a8522e2bac32031a","object":"response","created_at":1792744708,"status":"in_progress","access_programs":null,"background":false,"completed_at":null,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"max_tool_calls":null,"model":"gpt-4.1-2025-04-14","moderation":null,"output":[],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":null,"prompt_cache_key":null,"prompt_cache_retention":"in_memory","reasoning":{"context":null,"effort":null,"summary":null},"safety_identifier":null,"service_tier":"auto","store":true,"temperature":1.0,"text":{"format":{"type":"text"},"verbosity":"medium"},"tool_choice":"auto","tool_usage":{"image_gen":{"input_tokens":0,"input_tokens_details":{"image_tokens":0,"text_tokens":0},"output_tokens":0,"output_tokens_details":{"image_tokens":0,"text_tokens":0},"total_tokens":0},"web_search":{"num_requests":0}},"tools":[],"top_logprobs":0,"top_p":1.0,"truncation":"disabled","usage":null,"user":null,"metadata":{}},"sequence_number":0} + + ' + - ' + + ' + - 'event: response.in_progress + + ' + - 'data: {"type":"response.in_progress","response":{"id":"resp_0f7f14a9fb88d556006adb1d0437f087d0a8522e2bac32031a","object":"response","created_at":1792744708,"status":"in_progress","access_programs":null,"background":false,"completed_at":null,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"max_tool_calls":null,"model":"gpt-4.1-2025-04-14","moderation":null,"output":[],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":null,"prompt_cache_key":null,"prompt_cache_retention":"in_memory","reasoning":{"context":null,"effort":null,"summary":null},"safety_identifier":null,"service_tier":"auto","store":true,"temperature":1.0,"text":{"format":{"type":"text"},"verbosity":"medium"},"tool_choice":"auto","tool_usage":{"image_gen":{"input_tokens":0,"input_tokens_details":{"image_tokens":0,"text_tokens":0},"output_tokens":0,"output_tokens_details":{"image_tokens":0,"text_tokens":0},"total_tokens":0},"web_search":{"num_requests":0}},"tools":[],"top_logprobs":0,"top_p":1.0,"truncation":"disabled","usage":null,"user":null,"metadata":{}},"sequence_number":1} + + ' + - ' + + ' + - 'event: response.output_item.added + + ' + - 'data: {"type":"response.output_item.added","item":{"id":"msg_0f7f14a9fb88d556006adb1d04ef1c87d0b30cc1c9e836ae1b","type":"message","status":"in_progress","content":[],"role":"assistant"},"output_index":0,"sequence_number":2} + + ' + - ' + + ' + - 'event: response.content_part.added + + ' + - 'data: {"type":"response.content_part.added","content_index":0,"item_id":"msg_0f7f14a9fb88d556006adb1d04ef1c87d0b30cc1c9e836ae1b","output_index":0,"part":{"type":"output_text","annotations":[],"logprobs":[],"text":""},"sequence_number":3} + + ' + - ' + + ' + - 'event: response.output_text.delta + + ' + - 'data: {"type":"response.output_text.delta","content_index":0,"delta":"S","item_id":"msg_0f7f14a9fb88d556006adb1d04ef1c87d0b30cc1c9e836ae1b","logprobs":[],"obfuscation":"byqqdV1zH6DQNnR","output_index":0,"sequence_number":4} + + ' + - ' + + ' + - 'event: response.output_text.delta + + ' + - 'data: {"type":"response.output_text.delta","content_index":0,"delta":"APP","item_id":"msg_0f7f14a9fb88d556006adb1d04ef1c87d0b30cc1c9e836ae1b","logprobs":[],"obfuscation":"fpKjXxn6OAeDZ","output_index":0,"sequence_number":5} + + ' + - ' + + ' + - 'event: response.output_text.delta + + ' + - 'data: {"type":"response.output_text.delta","content_index":0,"delta":"H","item_id":"msg_0f7f14a9fb88d556006adb1d04ef1c87d0b30cc1c9e836ae1b","logprobs":[],"obfuscation":"bm7vkTowiMR4i6a","output_index":0,"sequence_number":6} + + ' + - ' + + ' + - 'event: response.output_text.delta + + ' + - 'data: {"type":"response.output_text.delta","content_index":0,"delta":"IRE","item_id":"msg_0f7f14a9fb88d556006adb1d04ef1c87d0b30cc1c9e836ae1b","logprobs":[],"obfuscation":"sA8lJo5PKn2vV","output_index":0,"sequence_number":7} + + ' + - ' + + ' + - 'event: response.output_text.done + + ' + - 'data: {"type":"response.output_text.done","content_index":0,"item_id":"msg_0f7f14a9fb88d556006adb1d04ef1c87d0b30cc1c9e836ae1b","logprobs":[],"output_index":0,"sequence_number":8,"text":"SAPPHIRE"} + + ' + - ' + + ' + - 'event: response.content_part.done + + ' + - 'data: {"type":"response.content_part.done","content_index":0,"item_id":"msg_0f7f14a9fb88d556006adb1d04ef1c87d0b30cc1c9e836ae1b","output_index":0,"part":{"type":"output_text","annotations":[],"logprobs":[],"text":"SAPPHIRE"},"sequence_number":9} + + ' + - ' + + ' + - 'event: response.output_item.done + + ' + - 'data: {"type":"response.output_item.done","item":{"id":"msg_0f7f14a9fb88d556006adb1d04ef1c87d0b30cc1c9e836ae1b","type":"message","status":"completed","content":[{"type":"output_text","annotations":[],"logprobs":[],"text":"SAPPHIRE"}],"role":"assistant"},"output_index":0,"sequence_number":10} + + ' + - ' + + ' + - 'event: response.completed + + ' + - 'data: {"type":"response.completed","response":{"id":"resp_0f7f14a9fb88d556006adb1d0437f087d0a8522e2bac32031a","object":"response","created_at":1792744708,"status":"completed","access_programs":null,"background":false,"completed_at":1792744708,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"max_tool_calls":null,"model":"gpt-4.1-2025-04-14","moderation":null,"output":[{"id":"msg_0f7f14a9fb88d556006adb1d04ef1c87d0b30cc1c9e836ae1b","type":"message","status":"completed","content":[{"type":"output_text","annotations":[],"logprobs":[],"text":"SAPPHIRE"}],"role":"assistant"}],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":null,"prompt_cache_key":null,"prompt_cache_retention":"in_memory","reasoning":{"context":null,"effort":null,"summary":null},"safety_identifier":null,"service_tier":"default","store":true,"temperature":1.0,"text":{"format":{"type":"text"},"verbosity":"medium"},"tool_choice":"auto","tool_usage":{"image_gen":{"input_tokens":0,"input_tokens_details":{"image_tokens":0,"text_tokens":0},"output_tokens":0,"output_tokens_details":{"image_tokens":0,"text_tokens":0},"total_tokens":0},"web_search":{"num_requests":0}},"tools":[],"top_logprobs":0,"top_p":1.0,"truncation":"disabled","usage":{"input_tokens":15,"input_tokens_details":{"cache_write_tokens":0,"cached_tokens":0},"output_tokens":5,"output_tokens_details":{"reasoning_tokens":0},"total_tokens":20},"user":null,"metadata":{}},"sequence_number":11} + + ' + - ' + + ' + status_code: 200 +- filename: t2 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_0f7f14a9fb88d556006adb1d0437f087d0a8522e2bac32031a/input_items + query_params: {} + response: + body: + data: + - content: + - text: Reply with only SAPPHIRE. + type: input_text + id: msg_0f7f14a9fb88d556006adb1d043eac87d093aaa8468c4e0d31 + role: user + status: completed + type: message + first_id: msg_0f7f14a9fb88d556006adb1d043eac87d093aaa8468c4e0d31 + has_more: false + last_id: msg_0f7f14a9fb88d556006adb1d043eac87d093aaa8468c4e0d31 + object: list + headers: + content-type: application/json + status_code: 200 +- filename: t3 + request: + body: + input: + - content: Reply with only ORCHID. + role: user + model: gpt-4.1 + previous_response_id: resp_0f7f14a9fb88d556006adb1d0437f087d0a8522e2bac32031a + store: true + stream: true + headers: + accept: '*/*' + authorization: Bearer *** + content-type: application/json + user-agent: python-httpx/0.28.1 + method: POST + path: /v1/responses + query_params: {} + response: + headers: + content-type: text/event-stream; charset=utf-8 + sse: + - 'event: response.created + + ' + - 'data: {"type":"response.created","response":{"id":"resp_0f7f14a9fb88d556006adb1d05cddc87d0999cee73f7651890","object":"response","created_at":1792744709,"status":"in_progress","access_programs":null,"background":false,"completed_at":null,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"max_tool_calls":null,"model":"gpt-4.1-2025-04-14","moderation":null,"output":[],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":"resp_0f7f14a9fb88d556006adb1d0437f087d0a8522e2bac32031a","prompt_cache_key":null,"prompt_cache_retention":"in_memory","reasoning":{"context":null,"effort":null,"summary":null},"safety_identifier":null,"service_tier":"auto","store":true,"temperature":1.0,"text":{"format":{"type":"text"},"verbosity":"medium"},"tool_choice":"auto","tool_usage":{"image_gen":{"input_tokens":0,"input_tokens_details":{"image_tokens":0,"text_tokens":0},"output_tokens":0,"output_tokens_details":{"image_tokens":0,"text_tokens":0},"total_tokens":0},"web_search":{"num_requests":0}},"tools":[],"top_logprobs":0,"top_p":1.0,"truncation":"disabled","usage":null,"user":null,"metadata":{}},"sequence_number":0} + + ' + - ' + + ' + - 'event: response.in_progress + + ' + - 'data: {"type":"response.in_progress","response":{"id":"resp_0f7f14a9fb88d556006adb1d05cddc87d0999cee73f7651890","object":"response","created_at":1792744709,"status":"in_progress","access_programs":null,"background":false,"completed_at":null,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"max_tool_calls":null,"model":"gpt-4.1-2025-04-14","moderation":null,"output":[],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":"resp_0f7f14a9fb88d556006adb1d0437f087d0a8522e2bac32031a","prompt_cache_key":null,"prompt_cache_retention":"in_memory","reasoning":{"context":null,"effort":null,"summary":null},"safety_identifier":null,"service_tier":"auto","store":true,"temperature":1.0,"text":{"format":{"type":"text"},"verbosity":"medium"},"tool_choice":"auto","tool_usage":{"image_gen":{"input_tokens":0,"input_tokens_details":{"image_tokens":0,"text_tokens":0},"output_tokens":0,"output_tokens_details":{"image_tokens":0,"text_tokens":0},"total_tokens":0},"web_search":{"num_requests":0}},"tools":[],"top_logprobs":0,"top_p":1.0,"truncation":"disabled","usage":null,"user":null,"metadata":{}},"sequence_number":1} + + ' + - ' + + ' + - 'event: response.output_item.added + + ' + - 'data: {"type":"response.output_item.added","item":{"id":"msg_0f7f14a9fb88d556006adb1d06c60887d09899a87dad211585","type":"message","status":"in_progress","content":[],"role":"assistant"},"output_index":0,"sequence_number":2} + + ' + - ' + + ' + - 'event: response.content_part.added + + ' + - 'data: {"type":"response.content_part.added","content_index":0,"item_id":"msg_0f7f14a9fb88d556006adb1d06c60887d09899a87dad211585","output_index":0,"part":{"type":"output_text","annotations":[],"logprobs":[],"text":""},"sequence_number":3} + + ' + - ' + + ' + - 'event: response.output_text.delta + + ' + - 'data: {"type":"response.output_text.delta","content_index":0,"delta":"OR","item_id":"msg_0f7f14a9fb88d556006adb1d06c60887d09899a87dad211585","logprobs":[],"obfuscation":"VIXvIHClXXxQoh","output_index":0,"sequence_number":4} + + ' + - ' + + ' + - 'event: response.output_text.delta + + ' + - 'data: {"type":"response.output_text.delta","content_index":0,"delta":"CH","item_id":"msg_0f7f14a9fb88d556006adb1d06c60887d09899a87dad211585","logprobs":[],"obfuscation":"4ICuUvySCXkL6G","output_index":0,"sequence_number":5} + + ' + - ' + + ' + - 'event: response.output_text.delta + + ' + - 'data: {"type":"response.output_text.delta","content_index":0,"delta":"ID","item_id":"msg_0f7f14a9fb88d556006adb1d06c60887d09899a87dad211585","logprobs":[],"obfuscation":"c20DjKACTcMP8i","output_index":0,"sequence_number":6} + + ' + - ' + + ' + - 'event: response.output_text.done + + ' + - 'data: {"type":"response.output_text.done","content_index":0,"item_id":"msg_0f7f14a9fb88d556006adb1d06c60887d09899a87dad211585","logprobs":[],"output_index":0,"sequence_number":7,"text":"ORCHID"} + + ' + - ' + + ' + - 'event: response.content_part.done + + ' + - 'data: {"type":"response.content_part.done","content_index":0,"item_id":"msg_0f7f14a9fb88d556006adb1d06c60887d09899a87dad211585","output_index":0,"part":{"type":"output_text","annotations":[],"logprobs":[],"text":"ORCHID"},"sequence_number":8} + + ' + - ' + + ' + - 'event: response.output_item.done + + ' + - 'data: {"type":"response.output_item.done","item":{"id":"msg_0f7f14a9fb88d556006adb1d06c60887d09899a87dad211585","type":"message","status":"completed","content":[{"type":"output_text","annotations":[],"logprobs":[],"text":"ORCHID"}],"role":"assistant"},"output_index":0,"sequence_number":9} + + ' + - ' + + ' + - 'event: response.completed + + ' + - 'data: {"type":"response.completed","response":{"id":"resp_0f7f14a9fb88d556006adb1d05cddc87d0999cee73f7651890","object":"response","created_at":1792744709,"status":"completed","access_programs":null,"background":false,"completed_at":1792744710,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"max_tool_calls":null,"model":"gpt-4.1-2025-04-14","moderation":null,"output":[{"id":"msg_0f7f14a9fb88d556006adb1d06c60887d09899a87dad211585","type":"message","status":"completed","content":[{"type":"output_text","annotations":[],"logprobs":[],"text":"ORCHID"}],"role":"assistant"}],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":"resp_0f7f14a9fb88d556006adb1d0437f087d0a8522e2bac32031a","prompt_cache_key":null,"prompt_cache_retention":"in_memory","reasoning":{"context":null,"effort":null,"summary":null},"safety_identifier":null,"service_tier":"default","store":true,"temperature":1.0,"text":{"format":{"type":"text"},"verbosity":"medium"},"tool_choice":"auto","tool_usage":{"image_gen":{"input_tokens":0,"input_tokens_details":{"image_tokens":0,"text_tokens":0},"output_tokens":0,"output_tokens_details":{"image_tokens":0,"text_tokens":0},"total_tokens":0},"web_search":{"num_requests":0}},"tools":[],"top_logprobs":0,"top_p":1.0,"truncation":"disabled","usage":{"input_tokens":34,"input_tokens_details":{"cache_write_tokens":0,"cached_tokens":0},"output_tokens":4,"output_tokens_details":{"reasoning_tokens":0},"total_tokens":38},"user":null,"metadata":{}},"sequence_number":10} + + ' + - ' + + ' + status_code: 200 +- filename: t4 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_0f7f14a9fb88d556006adb1d05cddc87d0999cee73f7651890/input_items + query_params: + order: asc + response: + body: + data: + - content: + - text: Reply with only SAPPHIRE. + type: input_text + id: msg_0f7f14a9fb88d556006adb1d043eac87d093aaa8468c4e0d31 + role: user + status: completed + type: message + - content: + - annotations: [] + logprobs: [] + text: SAPPHIRE + type: output_text + id: msg_0f7f14a9fb88d556006adb1d04ef1c87d0b30cc1c9e836ae1b + role: assistant + status: completed + type: message + - content: + - text: Reply with only ORCHID. + type: input_text + id: msg_0f7f14a9fb88d556006adb1d05dc9487d0a9eb9c2fdc5163a2 + role: user + status: completed + type: message + first_id: msg_0f7f14a9fb88d556006adb1d043eac87d093aaa8468c4e0d31 + has_more: false + last_id: msg_0f7f14a9fb88d556006adb1d05dc9487d0a9eb9c2fdc5163a2 + object: list + headers: + content-type: application/json + status_code: 200 +- filename: t5 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_0f7f14a9fb88d556006adb1d05cddc87d0999cee73f7651890/input_items + query_params: + limit: '1' + order: asc + response: + body: + data: + - content: + - text: Reply with only SAPPHIRE. + type: input_text + id: msg_0f7f14a9fb88d556006adb1d043eac87d093aaa8468c4e0d31 + role: user + status: completed + type: message + first_id: msg_0f7f14a9fb88d556006adb1d043eac87d093aaa8468c4e0d31 + has_more: true + last_id: msg_0f7f14a9fb88d556006adb1d043eac87d093aaa8468c4e0d31 + object: list + headers: + content-type: application/json + status_code: 200 +- filename: t6 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_0f7f14a9fb88d556006adb1d05cddc87d0999cee73f7651890/input_items + query_params: + after: msg_0f7f14a9fb88d556006adb1d043eac87d093aaa8468c4e0d31 + limit: '1' + order: asc + response: + body: + data: + - content: + - annotations: [] + logprobs: [] + text: SAPPHIRE + type: output_text + id: msg_0f7f14a9fb88d556006adb1d04ef1c87d0b30cc1c9e836ae1b + role: assistant + status: completed + type: message + first_id: msg_0f7f14a9fb88d556006adb1d04ef1c87d0b30cc1c9e836ae1b + has_more: true + last_id: msg_0f7f14a9fb88d556006adb1d04ef1c87d0b30cc1c9e836ae1b + object: list + headers: + content-type: application/json + status_code: 200 +- filename: t7 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_0f7f14a9fb88d556006adb1d05cddc87d0999cee73f7651890 + query_params: {} + response: + body: + access_programs: null + background: false + billing: + payer: developer + completed_at: 1792744710 + created_at: 1792744709 + error: null + frequency_penalty: 0.0 + id: resp_0f7f14a9fb88d556006adb1d05cddc87d0999cee73f7651890 + incomplete_details: null + instructions: null + max_output_tokens: null + max_tool_calls: null + metadata: {} + model: gpt-4.1-2025-04-14 + moderation: null + object: response + output: + - content: + - annotations: [] + logprobs: [] + text: ORCHID + type: output_text + id: msg_0f7f14a9fb88d556006adb1d06c60887d09899a87dad211585 + role: assistant + status: completed + type: message + parallel_tool_calls: true + presence_penalty: 0.0 + previous_response_id: resp_0f7f14a9fb88d556006adb1d0437f087d0a8522e2bac32031a + prompt_cache_key: null + prompt_cache_retention: in_memory + reasoning: + context: null + effort: null + summary: null + safety_identifier: null + service_tier: default + status: completed + store: true + temperature: 1.0 + text: + format: + type: text + verbosity: medium + tool_choice: auto + tool_usage: + image_gen: + input_tokens: 0 + input_tokens_details: + image_tokens: 0 + text_tokens: 0 + output_tokens: 0 + output_tokens_details: + image_tokens: 0 + text_tokens: 0 + total_tokens: 0 + web_search: + num_requests: 0 + tools: [] + top_logprobs: 0 + top_p: 1.0 + truncation: disabled + usage: + input_tokens: 34 + input_tokens_details: + cache_write_tokens: 0 + cached_tokens: 0 + output_tokens: 4 + output_tokens_details: + reasoning_tokens: 0 + total_tokens: 38 + user: null + headers: + content-type: application/json + status_code: 200 +- filename: t8 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: DELETE + path: /v1/responses/resp_0f7f14a9fb88d556006adb1d0437f087d0a8522e2bac32031a + query_params: {} + response: + body: + deleted: true + id: resp_0f7f14a9fb88d556006adb1d0437f087d0a8522e2bac32031a + object: response.deleted + headers: + content-type: application/json + status_code: 200 +- filename: t9 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_0f7f14a9fb88d556006adb1d0437f087d0a8522e2bac32031a + query_params: {} + response: + body: + error: + code: null + message: Response with id 'resp_0f7f14a9fb88d556006adb1d0437f087d0a8522e2bac32031a' + not found. + param: null + type: invalid_request_error + headers: + content-type: application/json + status_code: 404 +- filename: t10 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_0f7f14a9fb88d556006adb1d0437f087d0a8522e2bac32031a/input_items + query_params: {} + response: + body: + error: + code: null + message: Response with id 'resp_0f7f14a9fb88d556006adb1d0437f087d0a8522e2bac32031a' + not found. + param: null + type: invalid_request_error + headers: + content-type: application/json + status_code: 404 +- filename: t11 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_0f7f14a9fb88d556006adb1d05cddc87d0999cee73f7651890/input_items + query_params: + order: asc + response: + body: + data: + - content: + - text: Reply with only ORCHID. + type: input_text + id: msg_0f7f14a9fb88d556006adb1d05dc9487d0a9eb9c2fdc5163a2 + role: user + status: completed + type: message + first_id: msg_0f7f14a9fb88d556006adb1d05dc9487d0a9eb9c2fdc5163a2 + has_more: false + last_id: msg_0f7f14a9fb88d556006adb1d05dc9487d0a9eb9c2fdc5163a2 + object: list + headers: + content-type: application/json + status_code: 200 +- filename: t12 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_0f7f14a9fb88d556006adb1d05cddc87d0999cee73f7651890 + query_params: {} + response: + body: + access_programs: null + background: false + billing: + payer: developer + completed_at: 1792744710 + created_at: 1792744709 + error: null + frequency_penalty: 0.0 + id: resp_0f7f14a9fb88d556006adb1d05cddc87d0999cee73f7651890 + incomplete_details: null + instructions: null + max_output_tokens: null + max_tool_calls: null + metadata: {} + model: gpt-4.1-2025-04-14 + moderation: null + object: response + output: + - content: + - annotations: [] + logprobs: [] + text: ORCHID + type: output_text + id: msg_0f7f14a9fb88d556006adb1d06c60887d09899a87dad211585 + role: assistant + status: completed + type: message + parallel_tool_calls: true + presence_penalty: 0.0 + previous_response_id: resp_0f7f14a9fb88d556006adb1d0437f087d0a8522e2bac32031a + prompt_cache_key: null + prompt_cache_retention: in_memory + reasoning: + context: null + effort: null + summary: null + safety_identifier: null + service_tier: default + status: completed + store: true + temperature: 1.0 + text: + format: + type: text + verbosity: medium + tool_choice: auto + tool_usage: + image_gen: + input_tokens: 0 + input_tokens_details: + image_tokens: 0 + text_tokens: 0 + output_tokens: 0 + output_tokens_details: + image_tokens: 0 + text_tokens: 0 + total_tokens: 0 + web_search: + num_requests: 0 + tools: [] + top_logprobs: 0 + top_p: 1.0 + truncation: disabled + usage: + input_tokens: 34 + input_tokens_details: + cache_write_tokens: 0 + cached_tokens: 0 + output_tokens: 4 + output_tokens_details: + reasoning_tokens: 0 + total_tokens: 38 + user: null + headers: + content-type: application/json + status_code: 200 +- filename: t13 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: DELETE + path: /v1/responses/resp_0f7f14a9fb88d556006adb1d0437f087d0a8522e2bac32031a + query_params: {} + response: + body: + error: + code: null + message: Response with id 'resp_0f7f14a9fb88d556006adb1d0437f087d0a8522e2bac32031a' + not found. + param: null + type: invalid_request_error + headers: + content-type: application/json + status_code: 404 +- filename: t14 + request: + body: + input: + - content: What exact word did the first user message ask you to reply with? + Reply with only that word. + role: user + model: gpt-4.1 + previous_response_id: resp_0f7f14a9fb88d556006adb1d05cddc87d0999cee73f7651890 + store: true + stream: true + headers: + accept: '*/*' + authorization: Bearer *** + content-type: application/json + user-agent: python-httpx/0.28.1 + method: POST + path: /v1/responses + query_params: {} + response: + headers: + content-type: text/event-stream; charset=utf-8 + sse: + - 'event: response.created + + ' + - 'data: {"type":"response.created","response":{"id":"resp_0f7f14a9fb88d556006adb1d0b9c2087d084d208f6061a1f01","object":"response","created_at":1792744715,"status":"in_progress","access_programs":null,"background":false,"completed_at":null,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"max_tool_calls":null,"model":"gpt-4.1-2025-04-14","moderation":null,"output":[],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":"resp_0f7f14a9fb88d556006adb1d05cddc87d0999cee73f7651890","prompt_cache_key":null,"prompt_cache_retention":"in_memory","reasoning":{"context":null,"effort":null,"summary":null},"safety_identifier":null,"service_tier":"auto","store":true,"temperature":1.0,"text":{"format":{"type":"text"},"verbosity":"medium"},"tool_choice":"auto","tool_usage":{"image_gen":{"input_tokens":0,"input_tokens_details":{"image_tokens":0,"text_tokens":0},"output_tokens":0,"output_tokens_details":{"image_tokens":0,"text_tokens":0},"total_tokens":0},"web_search":{"num_requests":0}},"tools":[],"top_logprobs":0,"top_p":1.0,"truncation":"disabled","usage":null,"user":null,"metadata":{}},"sequence_number":0} + + ' + - ' + + ' + - 'event: response.in_progress + + ' + - 'data: {"type":"response.in_progress","response":{"id":"resp_0f7f14a9fb88d556006adb1d0b9c2087d084d208f6061a1f01","object":"response","created_at":1792744715,"status":"in_progress","access_programs":null,"background":false,"completed_at":null,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"max_tool_calls":null,"model":"gpt-4.1-2025-04-14","moderation":null,"output":[],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":"resp_0f7f14a9fb88d556006adb1d05cddc87d0999cee73f7651890","prompt_cache_key":null,"prompt_cache_retention":"in_memory","reasoning":{"context":null,"effort":null,"summary":null},"safety_identifier":null,"service_tier":"auto","store":true,"temperature":1.0,"text":{"format":{"type":"text"},"verbosity":"medium"},"tool_choice":"auto","tool_usage":{"image_gen":{"input_tokens":0,"input_tokens_details":{"image_tokens":0,"text_tokens":0},"output_tokens":0,"output_tokens_details":{"image_tokens":0,"text_tokens":0},"total_tokens":0},"web_search":{"num_requests":0}},"tools":[],"top_logprobs":0,"top_p":1.0,"truncation":"disabled","usage":null,"user":null,"metadata":{}},"sequence_number":1} + + ' + - ' + + ' + - 'event: response.output_item.added + + ' + - 'data: {"type":"response.output_item.added","item":{"id":"msg_0f7f14a9fb88d556006adb1d0c014c87d0986d7759e3e3726e","type":"message","status":"in_progress","content":[],"role":"assistant"},"output_index":0,"sequence_number":2} + + ' + - ' + + ' + - 'event: response.content_part.added + + ' + - 'data: {"type":"response.content_part.added","content_index":0,"item_id":"msg_0f7f14a9fb88d556006adb1d0c014c87d0986d7759e3e3726e","output_index":0,"part":{"type":"output_text","annotations":[],"logprobs":[],"text":""},"sequence_number":3} + + ' + - ' + + ' + - 'event: response.output_text.delta + + ' + - 'data: {"type":"response.output_text.delta","content_index":0,"delta":"OR","item_id":"msg_0f7f14a9fb88d556006adb1d0c014c87d0986d7759e3e3726e","logprobs":[],"obfuscation":"YWiKUTUJ6iyQ9U","output_index":0,"sequence_number":4} + + ' + - ' + + ' + - 'event: response.output_text.delta + + ' + - 'data: {"type":"response.output_text.delta","content_index":0,"delta":"CH","item_id":"msg_0f7f14a9fb88d556006adb1d0c014c87d0986d7759e3e3726e","logprobs":[],"obfuscation":"CTkgJw813ZOrUv","output_index":0,"sequence_number":5} + + ' + - ' + + ' + - 'event: response.output_text.delta + + ' + - 'data: {"type":"response.output_text.delta","content_index":0,"delta":"ID","item_id":"msg_0f7f14a9fb88d556006adb1d0c014c87d0986d7759e3e3726e","logprobs":[],"obfuscation":"zuHfBakyJbZLZ6","output_index":0,"sequence_number":6} + + ' + - ' + + ' + - 'event: response.output_text.done + + ' + - 'data: {"type":"response.output_text.done","content_index":0,"item_id":"msg_0f7f14a9fb88d556006adb1d0c014c87d0986d7759e3e3726e","logprobs":[],"output_index":0,"sequence_number":7,"text":"ORCHID"} + + ' + - ' + + ' + - 'event: response.content_part.done + + ' + - 'data: {"type":"response.content_part.done","content_index":0,"item_id":"msg_0f7f14a9fb88d556006adb1d0c014c87d0986d7759e3e3726e","output_index":0,"part":{"type":"output_text","annotations":[],"logprobs":[],"text":"ORCHID"},"sequence_number":8} + + ' + - ' + + ' + - 'event: response.output_item.done + + ' + - 'data: {"type":"response.output_item.done","item":{"id":"msg_0f7f14a9fb88d556006adb1d0c014c87d0986d7759e3e3726e","type":"message","status":"completed","content":[{"type":"output_text","annotations":[],"logprobs":[],"text":"ORCHID"}],"role":"assistant"},"output_index":0,"sequence_number":9} + + ' + - ' + + ' + - 'event: response.completed + + ' + - 'data: {"type":"response.completed","response":{"id":"resp_0f7f14a9fb88d556006adb1d0b9c2087d084d208f6061a1f01","object":"response","created_at":1792744715,"status":"completed","access_programs":null,"background":false,"completed_at":1792744716,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"max_tool_calls":null,"model":"gpt-4.1-2025-04-14","moderation":null,"output":[{"id":"msg_0f7f14a9fb88d556006adb1d0c014c87d0986d7759e3e3726e","type":"message","status":"completed","content":[{"type":"output_text","annotations":[],"logprobs":[],"text":"ORCHID"}],"role":"assistant"}],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":"resp_0f7f14a9fb88d556006adb1d05cddc87d0999cee73f7651890","prompt_cache_key":null,"prompt_cache_retention":"in_memory","reasoning":{"context":null,"effort":null,"summary":null},"safety_identifier":null,"service_tier":"default","store":true,"temperature":1.0,"text":{"format":{"type":"text"},"verbosity":"medium"},"tool_choice":"auto","tool_usage":{"image_gen":{"input_tokens":0,"input_tokens_details":{"image_tokens":0,"text_tokens":0},"output_tokens":0,"output_tokens_details":{"image_tokens":0,"text_tokens":0},"total_tokens":0},"web_search":{"num_requests":0}},"tools":[],"top_logprobs":0,"top_p":1.0,"truncation":"disabled","usage":{"input_tokens":45,"input_tokens_details":{"cache_write_tokens":0,"cached_tokens":0},"output_tokens":4,"output_tokens_details":{"reasoning_tokens":0},"total_tokens":49},"user":null,"metadata":{}},"sequence_number":10} + + ' + - ' + + ' + status_code: 200 +- filename: t15 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_0f7f14a9fb88d556006adb1d0b9c2087d084d208f6061a1f01/input_items + query_params: + order: asc + response: + body: + data: + - content: + - text: Reply with only ORCHID. + type: input_text + id: msg_0f7f14a9fb88d556006adb1d05dc9487d0a9eb9c2fdc5163a2 + role: user + status: completed + type: message + - content: + - annotations: [] + logprobs: [] + text: ORCHID + type: output_text + id: msg_0f7f14a9fb88d556006adb1d06c60887d09899a87dad211585 + role: assistant + status: completed + type: message + - content: + - text: What exact word did the first user message ask you to reply with? + Reply with only that word. + type: input_text + id: msg_0f7f14a9fb88d556006adb1d0ba41487d08486b01cc6dc73c0 + role: user + status: completed + type: message + first_id: msg_0f7f14a9fb88d556006adb1d05dc9487d0a9eb9c2fdc5163a2 + has_more: false + last_id: msg_0f7f14a9fb88d556006adb1d0ba41487d08486b01cc6dc73c0 + object: list + headers: + content-type: application/json + status_code: 200 +- filename: t16 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: DELETE + path: /v1/responses/resp_0f7f14a9fb88d556006adb1d0b9c2087d084d208f6061a1f01 + query_params: {} + response: + body: + deleted: true + id: resp_0f7f14a9fb88d556006adb1d0b9c2087d084d208f6061a1f01 + object: response.deleted + headers: + content-type: application/json + status_code: 200 +- filename: t17 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: DELETE + path: /v1/responses/resp_0f7f14a9fb88d556006adb1d05cddc87d0999cee73f7651890 + query_params: {} + response: + body: + deleted: true + id: resp_0f7f14a9fb88d556006adb1d05cddc87d0999cee73f7651890 + object: response.deleted + headers: + content-type: application/json + status_code: 200 +- filename: t18 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_0f7f14a9fb88d556006adb1d05cddc87d0999cee73f7651890/input_items + query_params: {} + response: + body: + error: + code: null + message: Response with id 'resp_0f7f14a9fb88d556006adb1d05cddc87d0999cee73f7651890' + not found. + param: null + type: invalid_request_error + headers: + content-type: application/json + status_code: 404 +- filename: t19 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_0f7f14a9fb88d556006adb1d05cddc87d0999cee73f7651890 + query_params: {} + response: + body: + error: + code: null + message: Response with id 'resp_0f7f14a9fb88d556006adb1d05cddc87d0999cee73f7651890' + not found. + param: null + type: invalid_request_error + headers: + content-type: application/json + status_code: 404 diff --git a/crates/agentic-server-core/tests/cassettes/responses/response-pagination-gateway.yaml b/crates/agentic-server-core/tests/cassettes/responses/response-pagination-gateway.yaml new file mode 100644 index 000000000..95831e8d6 --- /dev/null +++ b/crates/agentic-server-core/tests/cassettes/responses/response-pagination-gateway.yaml @@ -0,0 +1,737 @@ +turns: +- filename: t1 + request: + body: + input: + - content: Reply with only SAPPHIRE. + role: user + model: Qwen/Qwen3.8-27B-FP8 + store: true + stream: false + headers: + accept: '*/*' + authorization: Bearer *** + content-type: application/json + user-agent: python-httpx/0.28.1 + method: POST + path: /v1/responses + query_params: {} + response: + body: + background: false + completed_at: 1792748280 + created_at: 1792748280 + error: null + frequency_penalty: 0.0 + id: resp_01a1681f-d907-7202-86b7-552d54678efd + incomplete_details: null + instructions: null + max_output_tokens: null + max_tool_calls: null + metadata: {} + model: Qwen/Qwen3.8-27B-FP8 + object: response + output: + - content: + - text: 'The user wants me to reply with only the word "SAPPHIRE". + + ' + type: reasoning_text + id: rs_83623ec2e77c29e2 + summary: [] + type: reasoning + - content: + - annotations: [] + text: ' + + + SAPPHIRE' + type: output_text + id: msg_9a636063e7beff44 + role: assistant + status: completed + type: message + parallel_tool_calls: false + presence_penalty: 0.0 + previous_response_id: null + prompt_cache_key: null + prompt_cache_options: null + reasoning: null + safety_identifier: null + service_tier: auto + status: completed + store: true + temperature: 1.0 + text: + format: + type: text + tool_choice: auto + tools: [] + top_logprobs: 0 + top_p: 1.0 + truncation: disabled + usage: + input_tokens: 47 + input_tokens_details: + cache_write_tokens: 0 + cached_tokens: 0 + output_tokens: 24 + output_tokens_details: + reasoning_tokens: 17 + total_tokens: 71 + headers: + content-type: application/json + status_code: 200 +- filename: t2 + request: + body: + input: + - content: Reply with only ORCHID. + role: user + model: Qwen/Qwen3.8-27B-FP8 + previous_response_id: resp_01a1681f-d907-7202-86b7-552d54678efd + store: true + stream: false + headers: + accept: '*/*' + authorization: Bearer *** + content-type: application/json + user-agent: python-httpx/0.28.1 + method: POST + path: /v1/responses + query_params: {} + response: + body: + background: false + completed_at: 1792748281 + created_at: 1792748281 + error: null + frequency_penalty: 0.0 + id: resp_01a1681f-db5e-7c62-9a8b-1164306878bb + incomplete_details: null + instructions: null + max_output_tokens: null + max_tool_calls: null + metadata: {} + model: Qwen/Qwen3.8-27B-FP8 + object: response + output: + - content: + - text: 'The user wants me to reply with only the word "ORCHID". + + ' + type: reasoning_text + id: rs_843dbb18167c5c52 + summary: [] + type: reasoning + - content: + - annotations: [] + text: ' + + + ORCHID' + type: output_text + id: msg_8096b62420788c7d + role: assistant + status: completed + type: message + parallel_tool_calls: false + presence_penalty: 0.0 + previous_response_id: resp_01a1681f-d907-7202-86b7-552d54678efd + prompt_cache_key: null + prompt_cache_options: null + reasoning: null + safety_identifier: null + service_tier: auto + status: completed + store: true + temperature: 1.0 + text: + format: + type: text + tool_choice: auto + tools: [] + top_logprobs: 0 + top_p: 1.0 + truncation: disabled + usage: + input_tokens: 89 + input_tokens_details: + cache_write_tokens: 0 + cached_tokens: 0 + output_tokens: 22 + output_tokens_details: + reasoning_tokens: 16 + total_tokens: 111 + headers: + content-type: application/json + status_code: 200 +- filename: t3 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_01a1681f-db5e-7c62-9a8b-1164306878bb/input_items + query_params: + order: asc + response: + body: + data: + - content: + - text: Reply with only SAPPHIRE. + type: input_text + id: msg_01a1681f-db4e-71e1-b7e1-91ff4f94de8e + role: user + status: completed + type: message + - content: + - text: 'The user wants me to reply with only the word "SAPPHIRE". + + ' + type: reasoning_text + id: rs_83623ec2e77c29e2 + summary: [] + type: reasoning + - content: + - annotations: [] + text: ' + + + SAPPHIRE' + type: output_text + id: msg_9a636063e7beff44 + role: assistant + status: completed + type: message + - content: + - text: Reply with only ORCHID. + type: input_text + id: msg_01a1681f-dd7c-76a2-b880-e86c8fc606a6 + role: user + status: completed + type: message + first_id: msg_01a1681f-db4e-71e1-b7e1-91ff4f94de8e + has_more: false + last_id: msg_01a1681f-dd7c-76a2-b880-e86c8fc606a6 + object: list + headers: + content-type: application/json + status_code: 200 +- filename: t4 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_01a1681f-db5e-7c62-9a8b-1164306878bb/input_items + query_params: + order: desc + response: + body: + data: + - content: + - text: Reply with only ORCHID. + type: input_text + id: msg_01a1681f-dd7c-76a2-b880-e86c8fc606a6 + role: user + status: completed + type: message + - content: + - annotations: [] + text: ' + + + SAPPHIRE' + type: output_text + id: msg_9a636063e7beff44 + role: assistant + status: completed + type: message + - content: + - text: 'The user wants me to reply with only the word "SAPPHIRE". + + ' + type: reasoning_text + id: rs_83623ec2e77c29e2 + summary: [] + type: reasoning + - content: + - text: Reply with only SAPPHIRE. + type: input_text + id: msg_01a1681f-db4e-71e1-b7e1-91ff4f94de8e + role: user + status: completed + type: message + first_id: msg_01a1681f-dd7c-76a2-b880-e86c8fc606a6 + has_more: false + last_id: msg_01a1681f-db4e-71e1-b7e1-91ff4f94de8e + object: list + headers: + content-type: application/json + status_code: 200 +- filename: t5 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_01a1681f-db5e-7c62-9a8b-1164306878bb/input_items + query_params: + limit: '1' + order: asc + response: + body: + data: + - content: + - text: Reply with only SAPPHIRE. + type: input_text + id: msg_01a1681f-db4e-71e1-b7e1-91ff4f94de8e + role: user + status: completed + type: message + first_id: msg_01a1681f-db4e-71e1-b7e1-91ff4f94de8e + has_more: true + last_id: msg_01a1681f-db4e-71e1-b7e1-91ff4f94de8e + object: list + headers: + content-type: application/json + status_code: 200 +- filename: t6 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_01a1681f-db5e-7c62-9a8b-1164306878bb/input_items + query_params: + after: msg_01a1681f-db4e-71e1-b7e1-91ff4f94de8e + limit: '1' + order: asc + response: + body: + data: + - content: + - text: 'The user wants me to reply with only the word "SAPPHIRE". + + ' + type: reasoning_text + id: rs_83623ec2e77c29e2 + summary: [] + type: reasoning + first_id: rs_83623ec2e77c29e2 + has_more: true + last_id: rs_83623ec2e77c29e2 + object: list + headers: + content-type: application/json + status_code: 200 +- filename: t7 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_01a1681f-db5e-7c62-9a8b-1164306878bb/input_items + query_params: + limit: '1' + order: desc + response: + body: + data: + - content: + - text: Reply with only ORCHID. + type: input_text + id: msg_01a1681f-dd7c-76a2-b880-e86c8fc606a6 + role: user + status: completed + type: message + first_id: msg_01a1681f-dd7c-76a2-b880-e86c8fc606a6 + has_more: true + last_id: msg_01a1681f-dd7c-76a2-b880-e86c8fc606a6 + object: list + headers: + content-type: application/json + status_code: 200 +- filename: t8 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_01a1681f-db5e-7c62-9a8b-1164306878bb/input_items + query_params: + after: msg_01a1681f-dd7c-76a2-b880-e86c8fc606a6 + limit: '1' + order: desc + response: + body: + data: + - content: + - annotations: [] + text: ' + + + SAPPHIRE' + type: output_text + id: msg_9a636063e7beff44 + role: assistant + status: completed + type: message + first_id: msg_9a636063e7beff44 + has_more: true + last_id: msg_9a636063e7beff44 + object: list + headers: + content-type: application/json + status_code: 200 +- filename: t9 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_01a1681f-db5e-7c62-9a8b-1164306878bb/input_items + query_params: {} + response: + body: + data: + - content: + - text: Reply with only ORCHID. + type: input_text + id: msg_01a1681f-dd7c-76a2-b880-e86c8fc606a6 + role: user + status: completed + type: message + - content: + - annotations: [] + text: ' + + + SAPPHIRE' + type: output_text + id: msg_9a636063e7beff44 + role: assistant + status: completed + type: message + - content: + - text: 'The user wants me to reply with only the word "SAPPHIRE". + + ' + type: reasoning_text + id: rs_83623ec2e77c29e2 + summary: [] + type: reasoning + - content: + - text: Reply with only SAPPHIRE. + type: input_text + id: msg_01a1681f-db4e-71e1-b7e1-91ff4f94de8e + role: user + status: completed + type: message + first_id: msg_01a1681f-dd7c-76a2-b880-e86c8fc606a6 + has_more: false + last_id: msg_01a1681f-db4e-71e1-b7e1-91ff4f94de8e + object: list + headers: + content-type: application/json + status_code: 200 +- filename: t10 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_01a1681f-db5e-7c62-9a8b-1164306878bb/input_items + query_params: + limit: '100' + order: asc + response: + body: + data: + - content: + - text: Reply with only SAPPHIRE. + type: input_text + id: msg_01a1681f-db4e-71e1-b7e1-91ff4f94de8e + role: user + status: completed + type: message + - content: + - text: 'The user wants me to reply with only the word "SAPPHIRE". + + ' + type: reasoning_text + id: rs_83623ec2e77c29e2 + summary: [] + type: reasoning + - content: + - annotations: [] + text: ' + + + SAPPHIRE' + type: output_text + id: msg_9a636063e7beff44 + role: assistant + status: completed + type: message + - content: + - text: Reply with only ORCHID. + type: input_text + id: msg_01a1681f-dd7c-76a2-b880-e86c8fc606a6 + role: user + status: completed + type: message + first_id: msg_01a1681f-db4e-71e1-b7e1-91ff4f94de8e + has_more: false + last_id: msg_01a1681f-dd7c-76a2-b880-e86c8fc606a6 + object: list + headers: + content-type: application/json + status_code: 200 +- filename: t11 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_01a1681f-db5e-7c62-9a8b-1164306878bb/input_items + query_params: + after: msg_01a1681f-dd7c-76a2-b880-e86c8fc606a6 + order: asc + response: + body: + data: [] + first_id: null + has_more: false + last_id: null + object: list + headers: + content-type: application/json + status_code: 200 +- filename: t12 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_01a1681f-db5e-7c62-9a8b-1164306878bb/input_items + query_params: + limit: '100' + order: desc + response: + body: + data: + - content: + - text: Reply with only ORCHID. + type: input_text + id: msg_01a1681f-dd7c-76a2-b880-e86c8fc606a6 + role: user + status: completed + type: message + - content: + - annotations: [] + text: ' + + + SAPPHIRE' + type: output_text + id: msg_9a636063e7beff44 + role: assistant + status: completed + type: message + - content: + - text: 'The user wants me to reply with only the word "SAPPHIRE". + + ' + type: reasoning_text + id: rs_83623ec2e77c29e2 + summary: [] + type: reasoning + - content: + - text: Reply with only SAPPHIRE. + type: input_text + id: msg_01a1681f-db4e-71e1-b7e1-91ff4f94de8e + role: user + status: completed + type: message + first_id: msg_01a1681f-dd7c-76a2-b880-e86c8fc606a6 + has_more: false + last_id: msg_01a1681f-db4e-71e1-b7e1-91ff4f94de8e + object: list + headers: + content-type: application/json + status_code: 200 +- filename: t13 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_01a1681f-db5e-7c62-9a8b-1164306878bb/input_items + query_params: + after: msg_01a1681f-db4e-71e1-b7e1-91ff4f94de8e + order: desc + response: + body: + data: [] + first_id: null + has_more: false + last_id: null + object: list + headers: + content-type: application/json + status_code: 200 +- filename: t14 + request: + body: + input: + - content: Reply with only VIOLET. + role: user + model: Qwen/Qwen3.8-27B-FP8 + store: true + stream: false + headers: + accept: '*/*' + authorization: Bearer *** + content-type: application/json + user-agent: python-httpx/0.28.1 + method: POST + path: /v1/responses + query_params: {} + response: + body: + background: false + completed_at: 1792748283 + created_at: 1792748283 + error: null + frequency_penalty: 0.0 + id: resp_01a1681f-e3c7-7832-94bf-689225129b05 + incomplete_details: null + instructions: null + max_output_tokens: null + max_tool_calls: null + metadata: {} + model: Qwen/Qwen3.8-27B-FP8 + object: response + output: + - content: + - text: 'The user wants me to reply with only the word "VIOLET". + + ' + type: reasoning_text + id: rs_ab97ab7ec598edfa + summary: [] + type: reasoning + - content: + - annotations: [] + text: ' + + + VIOLET' + type: output_text + id: msg_958708764e616442 + role: assistant + status: completed + type: message + parallel_tool_calls: false + presence_penalty: 0.0 + previous_response_id: null + prompt_cache_key: null + prompt_cache_options: null + reasoning: null + safety_identifier: null + service_tier: auto + status: completed + store: true + temperature: 1.0 + text: + format: + type: text + tool_choice: auto + tools: [] + top_logprobs: 0 + top_p: 1.0 + truncation: disabled + usage: + input_tokens: 47 + input_tokens_details: + cache_write_tokens: 0 + cached_tokens: 0 + output_tokens: 22 + output_tokens_details: + reasoning_tokens: 16 + total_tokens: 69 + headers: + content-type: application/json + status_code: 200 +- filename: t15 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_01a1681f-e3c7-7832-94bf-689225129b05/input_items + query_params: {} + response: + body: + data: + - content: + - text: Reply with only VIOLET. + type: input_text + id: msg_01a1681f-e5e8-76c2-b2af-87f6f9272b13 + role: user + status: completed + type: message + first_id: msg_01a1681f-e5e8-76c2-b2af-87f6f9272b13 + has_more: false + last_id: msg_01a1681f-e5e8-76c2-b2af-87f6f9272b13 + object: list + headers: + content-type: application/json + status_code: 200 +- filename: t16 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_01a1681f-db5e-7c62-9a8b-1164306878bb/input_items + query_params: + after: msg_01a1681f-e5e8-76c2-b2af-87f6f9272b13 + response: + body: + error: + code: null + message: No item found with id 'msg_01a1681f-e5e8-76c2-b2af-87f6f9272b13' + param: after + type: invalid_request_error + headers: + content-type: application/json + status_code: 404 diff --git a/crates/agentic-server-core/tests/cassettes/responses/response-pagination-openai.yaml b/crates/agentic-server-core/tests/cassettes/responses/response-pagination-openai.yaml new file mode 100644 index 000000000..daca9d673 --- /dev/null +++ b/crates/agentic-server-core/tests/cassettes/responses/response-pagination-openai.yaml @@ -0,0 +1,722 @@ +turns: +- filename: t1 + request: + body: + input: + - content: Reply with only SAPPHIRE. + role: user + model: gpt-4.1 + store: true + stream: false + headers: + accept: '*/*' + authorization: Bearer *** + content-type: application/json + user-agent: python-httpx/0.28.1 + method: POST + path: /v1/responses + query_params: {} + response: + body: + access_programs: null + background: false + billing: + payer: developer + completed_at: 1792738222 + created_at: 1792738221 + error: null + frequency_penalty: 0.0 + id: resp_0095165ba269388d006adb03ad4fdc87d1baca8e5a7332a895 + incomplete_details: null + instructions: null + max_output_tokens: null + max_tool_calls: null + metadata: {} + model: gpt-4.1-2025-04-14 + moderation: null + object: response + output: + - content: + - annotations: [] + logprobs: [] + text: SAPPHIRE + type: output_text + id: msg_0095165ba269388d006adb03ae0d9887d19c099d280a40e1e1 + role: assistant + status: completed + type: message + parallel_tool_calls: true + presence_penalty: 0.0 + previous_response_id: null + prompt_cache_key: null + prompt_cache_retention: in_memory + reasoning: + context: null + effort: null + summary: null + safety_identifier: null + service_tier: default + status: completed + store: true + temperature: 1.0 + text: + format: + type: text + verbosity: medium + tool_choice: auto + tool_usage: + image_gen: + input_tokens: 0 + input_tokens_details: + image_tokens: 0 + text_tokens: 0 + output_tokens: 0 + output_tokens_details: + image_tokens: 0 + text_tokens: 0 + total_tokens: 0 + web_search: + num_requests: 0 + tools: [] + top_logprobs: 0 + top_p: 1.0 + truncation: disabled + usage: + input_tokens: 15 + input_tokens_details: + cache_write_tokens: 0 + cached_tokens: 0 + output_tokens: 5 + output_tokens_details: + reasoning_tokens: 0 + total_tokens: 20 + user: null + headers: + content-type: application/json + status_code: 200 +- filename: t2 + request: + body: + input: + - content: Reply with only ORCHID. + role: user + model: gpt-4.1 + previous_response_id: resp_0095165ba269388d006adb03ad4fdc87d1baca8e5a7332a895 + store: true + stream: false + headers: + accept: '*/*' + authorization: Bearer *** + content-type: application/json + user-agent: python-httpx/0.28.1 + method: POST + path: /v1/responses + query_params: {} + response: + body: + access_programs: null + background: false + billing: + payer: developer + completed_at: 1792738223 + created_at: 1792738222 + error: null + frequency_penalty: 0.0 + id: resp_0095165ba269388d006adb03ae8eb887d199b2f01d6ee3471f + incomplete_details: null + instructions: null + max_output_tokens: null + max_tool_calls: null + metadata: {} + model: gpt-4.1-2025-04-14 + moderation: null + object: response + output: + - content: + - annotations: [] + logprobs: [] + text: ORCHID + type: output_text + id: msg_0095165ba269388d006adb03af3f0487d1a39936ac86f05b2b + role: assistant + status: completed + type: message + parallel_tool_calls: true + presence_penalty: 0.0 + previous_response_id: resp_0095165ba269388d006adb03ad4fdc87d1baca8e5a7332a895 + prompt_cache_key: null + prompt_cache_retention: in_memory + reasoning: + context: null + effort: null + summary: null + safety_identifier: null + service_tier: default + status: completed + store: true + temperature: 1.0 + text: + format: + type: text + verbosity: medium + tool_choice: auto + tool_usage: + image_gen: + input_tokens: 0 + input_tokens_details: + image_tokens: 0 + text_tokens: 0 + output_tokens: 0 + output_tokens_details: + image_tokens: 0 + text_tokens: 0 + total_tokens: 0 + web_search: + num_requests: 0 + tools: [] + top_logprobs: 0 + top_p: 1.0 + truncation: disabled + usage: + input_tokens: 34 + input_tokens_details: + cache_write_tokens: 0 + cached_tokens: 0 + output_tokens: 4 + output_tokens_details: + reasoning_tokens: 0 + total_tokens: 38 + user: null + headers: + content-type: application/json + status_code: 200 +- filename: t3 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_0095165ba269388d006adb03ae8eb887d199b2f01d6ee3471f/input_items + query_params: + order: asc + response: + body: + data: + - content: + - text: Reply with only SAPPHIRE. + type: input_text + id: msg_0095165ba269388d006adb03ad574487d1b0f7cef0c9d24564 + role: user + status: completed + type: message + - content: + - annotations: [] + logprobs: [] + text: SAPPHIRE + type: output_text + id: msg_0095165ba269388d006adb03ae0d9887d19c099d280a40e1e1 + role: assistant + status: completed + type: message + - content: + - text: Reply with only ORCHID. + type: input_text + id: msg_0095165ba269388d006adb03aea00087d1913d32d66f0d9126 + role: user + status: completed + type: message + first_id: msg_0095165ba269388d006adb03ad574487d1b0f7cef0c9d24564 + has_more: false + last_id: msg_0095165ba269388d006adb03aea00087d1913d32d66f0d9126 + object: list + headers: + content-type: application/json + status_code: 200 +- filename: t4 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_0095165ba269388d006adb03ae8eb887d199b2f01d6ee3471f/input_items + query_params: + order: desc + response: + body: + data: + - content: + - text: Reply with only ORCHID. + type: input_text + id: msg_0095165ba269388d006adb03aea00087d1913d32d66f0d9126 + role: user + status: completed + type: message + - content: + - annotations: [] + logprobs: [] + text: SAPPHIRE + type: output_text + id: msg_0095165ba269388d006adb03ae0d9887d19c099d280a40e1e1 + role: assistant + status: completed + type: message + - content: + - text: Reply with only SAPPHIRE. + type: input_text + id: msg_0095165ba269388d006adb03ad574487d1b0f7cef0c9d24564 + role: user + status: completed + type: message + first_id: msg_0095165ba269388d006adb03aea00087d1913d32d66f0d9126 + has_more: false + last_id: msg_0095165ba269388d006adb03ad574487d1b0f7cef0c9d24564 + object: list + headers: + content-type: application/json + status_code: 200 +- filename: t5 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_0095165ba269388d006adb03ae8eb887d199b2f01d6ee3471f/input_items + query_params: + limit: '1' + order: asc + response: + body: + data: + - content: + - text: Reply with only SAPPHIRE. + type: input_text + id: msg_0095165ba269388d006adb03ad574487d1b0f7cef0c9d24564 + role: user + status: completed + type: message + first_id: msg_0095165ba269388d006adb03ad574487d1b0f7cef0c9d24564 + has_more: true + last_id: msg_0095165ba269388d006adb03ad574487d1b0f7cef0c9d24564 + object: list + headers: + content-type: application/json + status_code: 200 +- filename: t6 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_0095165ba269388d006adb03ae8eb887d199b2f01d6ee3471f/input_items + query_params: + after: msg_0095165ba269388d006adb03ad574487d1b0f7cef0c9d24564 + limit: '1' + order: asc + response: + body: + data: + - content: + - annotations: [] + logprobs: [] + text: SAPPHIRE + type: output_text + id: msg_0095165ba269388d006adb03ae0d9887d19c099d280a40e1e1 + role: assistant + status: completed + type: message + first_id: msg_0095165ba269388d006adb03ae0d9887d19c099d280a40e1e1 + has_more: true + last_id: msg_0095165ba269388d006adb03ae0d9887d19c099d280a40e1e1 + object: list + headers: + content-type: application/json + status_code: 200 +- filename: t7 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_0095165ba269388d006adb03ae8eb887d199b2f01d6ee3471f/input_items + query_params: + limit: '1' + order: desc + response: + body: + data: + - content: + - text: Reply with only ORCHID. + type: input_text + id: msg_0095165ba269388d006adb03aea00087d1913d32d66f0d9126 + role: user + status: completed + type: message + first_id: msg_0095165ba269388d006adb03aea00087d1913d32d66f0d9126 + has_more: true + last_id: msg_0095165ba269388d006adb03aea00087d1913d32d66f0d9126 + object: list + headers: + content-type: application/json + status_code: 200 +- filename: t8 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_0095165ba269388d006adb03ae8eb887d199b2f01d6ee3471f/input_items + query_params: + after: msg_0095165ba269388d006adb03aea00087d1913d32d66f0d9126 + limit: '1' + order: desc + response: + body: + data: + - content: + - annotations: [] + logprobs: [] + text: SAPPHIRE + type: output_text + id: msg_0095165ba269388d006adb03ae0d9887d19c099d280a40e1e1 + role: assistant + status: completed + type: message + first_id: msg_0095165ba269388d006adb03ae0d9887d19c099d280a40e1e1 + has_more: true + last_id: msg_0095165ba269388d006adb03ae0d9887d19c099d280a40e1e1 + object: list + headers: + content-type: application/json + status_code: 200 +- filename: t9 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_0095165ba269388d006adb03ae8eb887d199b2f01d6ee3471f/input_items + query_params: {} + response: + body: + data: + - content: + - text: Reply with only ORCHID. + type: input_text + id: msg_0095165ba269388d006adb03aea00087d1913d32d66f0d9126 + role: user + status: completed + type: message + - content: + - annotations: [] + logprobs: [] + text: SAPPHIRE + type: output_text + id: msg_0095165ba269388d006adb03ae0d9887d19c099d280a40e1e1 + role: assistant + status: completed + type: message + - content: + - text: Reply with only SAPPHIRE. + type: input_text + id: msg_0095165ba269388d006adb03ad574487d1b0f7cef0c9d24564 + role: user + status: completed + type: message + first_id: msg_0095165ba269388d006adb03aea00087d1913d32d66f0d9126 + has_more: false + last_id: msg_0095165ba269388d006adb03ad574487d1b0f7cef0c9d24564 + object: list + headers: + content-type: application/json + status_code: 200 +- filename: t10 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_0095165ba269388d006adb03ae8eb887d199b2f01d6ee3471f/input_items + query_params: + limit: '100' + order: asc + response: + body: + data: + - content: + - text: Reply with only SAPPHIRE. + type: input_text + id: msg_0095165ba269388d006adb03ad574487d1b0f7cef0c9d24564 + role: user + status: completed + type: message + - content: + - annotations: [] + logprobs: [] + text: SAPPHIRE + type: output_text + id: msg_0095165ba269388d006adb03ae0d9887d19c099d280a40e1e1 + role: assistant + status: completed + type: message + - content: + - text: Reply with only ORCHID. + type: input_text + id: msg_0095165ba269388d006adb03aea00087d1913d32d66f0d9126 + role: user + status: completed + type: message + first_id: msg_0095165ba269388d006adb03ad574487d1b0f7cef0c9d24564 + has_more: false + last_id: msg_0095165ba269388d006adb03aea00087d1913d32d66f0d9126 + object: list + headers: + content-type: application/json + status_code: 200 +- filename: t11 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_0095165ba269388d006adb03ae8eb887d199b2f01d6ee3471f/input_items + query_params: + after: msg_0095165ba269388d006adb03aea00087d1913d32d66f0d9126 + order: asc + response: + body: + data: [] + first_id: null + has_more: false + last_id: null + object: list + headers: + content-type: application/json + status_code: 200 +- filename: t12 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_0095165ba269388d006adb03ae8eb887d199b2f01d6ee3471f/input_items + query_params: + limit: '100' + order: desc + response: + body: + data: + - content: + - text: Reply with only ORCHID. + type: input_text + id: msg_0095165ba269388d006adb03aea00087d1913d32d66f0d9126 + role: user + status: completed + type: message + - content: + - annotations: [] + logprobs: [] + text: SAPPHIRE + type: output_text + id: msg_0095165ba269388d006adb03ae0d9887d19c099d280a40e1e1 + role: assistant + status: completed + type: message + - content: + - text: Reply with only SAPPHIRE. + type: input_text + id: msg_0095165ba269388d006adb03ad574487d1b0f7cef0c9d24564 + role: user + status: completed + type: message + first_id: msg_0095165ba269388d006adb03aea00087d1913d32d66f0d9126 + has_more: false + last_id: msg_0095165ba269388d006adb03ad574487d1b0f7cef0c9d24564 + object: list + headers: + content-type: application/json + status_code: 200 +- filename: t13 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_0095165ba269388d006adb03ae8eb887d199b2f01d6ee3471f/input_items + query_params: + after: msg_0095165ba269388d006adb03ad574487d1b0f7cef0c9d24564 + order: desc + response: + body: + data: [] + first_id: null + has_more: false + last_id: null + object: list + headers: + content-type: application/json + status_code: 200 +- filename: t14 + request: + body: + input: + - content: Reply with only VIOLET. + role: user + model: gpt-4.1 + store: true + stream: false + headers: + accept: '*/*' + authorization: Bearer *** + content-type: application/json + user-agent: python-httpx/0.28.1 + method: POST + path: /v1/responses + query_params: {} + response: + body: + access_programs: null + background: false + billing: + payer: developer + completed_at: 1792738229 + created_at: 1792738229 + error: null + frequency_penalty: 0.0 + id: resp_0b2c1b8500100c1c006adb03b51fc087d1a7322a0675a93dcc + incomplete_details: null + instructions: null + max_output_tokens: null + max_tool_calls: null + metadata: {} + model: gpt-4.1-2025-04-14 + moderation: null + object: response + output: + - content: + - annotations: [] + logprobs: [] + text: VIOLET + type: output_text + id: msg_0b2c1b8500100c1c006adb03b57f5087d19f594e7097d821e2 + role: assistant + status: completed + type: message + parallel_tool_calls: true + presence_penalty: 0.0 + previous_response_id: null + prompt_cache_key: null + prompt_cache_retention: in_memory + reasoning: + context: null + effort: null + summary: null + safety_identifier: null + service_tier: default + status: completed + store: true + temperature: 1.0 + text: + format: + type: text + verbosity: medium + tool_choice: auto + tool_usage: + image_gen: + input_tokens: 0 + input_tokens_details: + image_tokens: 0 + text_tokens: 0 + output_tokens: 0 + output_tokens_details: + image_tokens: 0 + text_tokens: 0 + total_tokens: 0 + web_search: + num_requests: 0 + tools: [] + top_logprobs: 0 + top_p: 1.0 + truncation: disabled + usage: + input_tokens: 14 + input_tokens_details: + cache_write_tokens: 0 + cached_tokens: 0 + output_tokens: 4 + output_tokens_details: + reasoning_tokens: 0 + total_tokens: 18 + user: null + headers: + content-type: application/json + status_code: 200 +- filename: t15 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_0b2c1b8500100c1c006adb03b51fc087d1a7322a0675a93dcc/input_items + query_params: {} + response: + body: + data: + - content: + - text: Reply with only VIOLET. + type: input_text + id: msg_0b2c1b8500100c1c006adb03b52cfc87d1b1279cc883cd4075 + role: user + status: completed + type: message + first_id: msg_0b2c1b8500100c1c006adb03b52cfc87d1b1279cc883cd4075 + has_more: false + last_id: msg_0b2c1b8500100c1c006adb03b52cfc87d1b1279cc883cd4075 + object: list + headers: + content-type: application/json + status_code: 200 +- filename: t16 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_0095165ba269388d006adb03ae8eb887d199b2f01d6ee3471f/input_items + query_params: + after: msg_0b2c1b8500100c1c006adb03b52cfc87d1b1279cc883cd4075 + response: + body: + error: + code: null + message: No item found with id 'msg_0b2c1b8500100c1c006adb03b52cfc87d1b1279cc883cd4075' + param: after + type: invalid_request_error + headers: + content-type: application/json + status_code: 404 diff --git a/crates/agentic-server-core/tests/cassettes/responses/response-pagination-stream-gateway.yaml b/crates/agentic-server-core/tests/cassettes/responses/response-pagination-stream-gateway.yaml new file mode 100644 index 000000000..6c0ae06f9 --- /dev/null +++ b/crates/agentic-server-core/tests/cassettes/responses/response-pagination-stream-gateway.yaml @@ -0,0 +1,1582 @@ +turns: +- filename: t1 + request: + body: + input: + - content: Reply with only SAPPHIRE. + role: user + model: Qwen/Qwen3.8-27B-FP8 + store: true + stream: true + headers: + accept: '*/*' + authorization: Bearer *** + content-type: application/json + user-agent: python-httpx/0.28.1 + method: POST + path: /v1/responses + query_params: {} + response: + headers: + content-type: text/event-stream; charset=utf-8 + sse: + - 'event: response.created + + ' + - 'data: {"type":"response.created","sequence_number":0,"response":{"id":"resp_01a1681f-ec13-7ee1-b141-101d5f4946e0","created_at":1792748284,"incomplete_details":null,"instructions":null,"metadata":{},"model":"Qwen/Qwen3.8-27B-FP8","object":"response","output":[],"parallel_tool_calls":false,"temperature":1.0,"tool_choice":"none","tools":[],"top_p":1.0,"background":false,"max_output_tokens":null,"max_tool_calls":null,"previous_response_id":null,"prompt":null,"reasoning":null,"service_tier":"auto","status":"in_progress","text":{"format":{"type":"text"}},"top_logprobs":0,"truncation":"disabled","usage":null,"user":null,"presence_penalty":0.0,"frequency_penalty":0.0,"kv_transfer_params":null,"ec_transfer_params":null,"input_messages":null,"output_messages":null,"completed_at":null,"store":true,"safety_identifier":null,"prompt_cache_key":null,"prompt_cache_options":null,"error":null}} + + ' + - ' + + ' + - 'event: response.in_progress + + ' + - 'data: {"type":"response.in_progress","sequence_number":1,"response":{"id":"resp_01a1681f-ec13-7ee1-b141-101d5f4946e0","created_at":1792748284,"incomplete_details":null,"instructions":null,"metadata":{},"model":"Qwen/Qwen3.8-27B-FP8","object":"response","output":[],"parallel_tool_calls":false,"temperature":1.0,"tool_choice":"none","tools":[],"top_p":1.0,"background":false,"max_output_tokens":null,"max_tool_calls":null,"previous_response_id":null,"prompt":null,"reasoning":null,"service_tier":"auto","status":"in_progress","text":{"format":{"type":"text"}},"top_logprobs":0,"truncation":"disabled","usage":null,"user":null,"presence_penalty":0.0,"frequency_penalty":0.0,"kv_transfer_params":null,"ec_transfer_params":null,"input_messages":null,"output_messages":null,"completed_at":null,"store":true,"safety_identifier":null,"prompt_cache_key":null,"prompt_cache_options":null,"error":null}} + + ' + - ' + + ' + - 'event: response.output_item.added + + ' + - 'data: {"type":"response.output_item.added","sequence_number":2,"output_index":0,"item":{"id":"rs_aefea1220c1acaf2","summary":[],"type":"reasoning","content":[],"status":"in_progress"}} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"type":"response.reasoning_text.delta","sequence_number":3,"output_index":0,"content_index":0,"delta":"The","item_id":"rs_aefea1220c1acaf2"} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"type":"response.reasoning_text.delta","sequence_number":4,"output_index":0,"content_index":0,"delta":" + user","item_id":"rs_aefea1220c1acaf2"} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"type":"response.reasoning_text.delta","sequence_number":5,"output_index":0,"content_index":0,"delta":" + wants","item_id":"rs_aefea1220c1acaf2"} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"type":"response.reasoning_text.delta","sequence_number":6,"output_index":0,"content_index":0,"delta":" + me","item_id":"rs_aefea1220c1acaf2"} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"type":"response.reasoning_text.delta","sequence_number":7,"output_index":0,"content_index":0,"delta":" + to","item_id":"rs_aefea1220c1acaf2"} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"type":"response.reasoning_text.delta","sequence_number":8,"output_index":0,"content_index":0,"delta":" + reply","item_id":"rs_aefea1220c1acaf2"} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"type":"response.reasoning_text.delta","sequence_number":9,"output_index":0,"content_index":0,"delta":" + with","item_id":"rs_aefea1220c1acaf2"} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"type":"response.reasoning_text.delta","sequence_number":10,"output_index":0,"content_index":0,"delta":" + only","item_id":"rs_aefea1220c1acaf2"} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"type":"response.reasoning_text.delta","sequence_number":11,"output_index":0,"content_index":0,"delta":" + the","item_id":"rs_aefea1220c1acaf2"} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"type":"response.reasoning_text.delta","sequence_number":12,"output_index":0,"content_index":0,"delta":" + word","item_id":"rs_aefea1220c1acaf2"} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"type":"response.reasoning_text.delta","sequence_number":13,"output_index":0,"content_index":0,"delta":" + \"","item_id":"rs_aefea1220c1acaf2"} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"type":"response.reasoning_text.delta","sequence_number":14,"output_index":0,"content_index":0,"delta":"S","item_id":"rs_aefea1220c1acaf2"} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"type":"response.reasoning_text.delta","sequence_number":15,"output_index":0,"content_index":0,"delta":"AP","item_id":"rs_aefea1220c1acaf2"} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"type":"response.reasoning_text.delta","sequence_number":16,"output_index":0,"content_index":0,"delta":"PH","item_id":"rs_aefea1220c1acaf2"} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"type":"response.reasoning_text.delta","sequence_number":17,"output_index":0,"content_index":0,"delta":"IRE","item_id":"rs_aefea1220c1acaf2"} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"type":"response.reasoning_text.delta","sequence_number":18,"output_index":0,"content_index":0,"delta":"\".","item_id":"rs_aefea1220c1acaf2"} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"type":"response.reasoning_text.delta","sequence_number":19,"output_index":0,"content_index":0,"delta":" + This","item_id":"rs_aefea1220c1acaf2"} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"type":"response.reasoning_text.delta","sequence_number":20,"output_index":0,"content_index":0,"delta":" + is","item_id":"rs_aefea1220c1acaf2"} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"type":"response.reasoning_text.delta","sequence_number":21,"output_index":0,"content_index":0,"delta":" + a","item_id":"rs_aefea1220c1acaf2"} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"type":"response.reasoning_text.delta","sequence_number":22,"output_index":0,"content_index":0,"delta":" + simple","item_id":"rs_aefea1220c1acaf2"} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"type":"response.reasoning_text.delta","sequence_number":23,"output_index":0,"content_index":0,"delta":" + and","item_id":"rs_aefea1220c1acaf2"} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"type":"response.reasoning_text.delta","sequence_number":24,"output_index":0,"content_index":0,"delta":" + direct","item_id":"rs_aefea1220c1acaf2"} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"type":"response.reasoning_text.delta","sequence_number":25,"output_index":0,"content_index":0,"delta":" + request","item_id":"rs_aefea1220c1acaf2"} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"type":"response.reasoning_text.delta","sequence_number":26,"output_index":0,"content_index":0,"delta":".","item_id":"rs_aefea1220c1acaf2"} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"type":"response.reasoning_text.delta","sequence_number":27,"output_index":0,"content_index":0,"delta":"\n","item_id":"rs_aefea1220c1acaf2"} + + ' + - ' + + ' + - 'event: response.reasoning_text.done + + ' + - 'data: {"type":"response.reasoning_text.done","sequence_number":28,"output_index":0,"content_index":0,"item_id":"rs_aefea1220c1acaf2","text":"The + user wants me to reply with only the word \"SAPPHIRE\". This is a simple and + direct request.\n"} + + ' + - ' + + ' + - 'event: response.output_item.done + + ' + - 'data: {"type":"response.output_item.done","sequence_number":29,"output_index":0,"item":{"id":"rs_aefea1220c1acaf2","summary":[],"type":"reasoning","content":[{"text":"The + user wants me to reply with only the word \"SAPPHIRE\". This is a simple and + direct request.\n","type":"reasoning_text"}],"status":"completed"}} + + ' + - ' + + ' + - 'event: response.output_item.added + + ' + - 'data: {"type":"response.output_item.added","sequence_number":30,"output_index":1,"item":{"id":"msg_b41da4ad9a54c8c5","content":[],"role":"assistant","status":"in_progress","type":"message"}} + + ' + - ' + + ' + - 'event: response.content_part.added + + ' + - 'data: {"type":"response.content_part.added","sequence_number":31,"output_index":1,"content_index":0,"item_id":"msg_b41da4ad9a54c8c5","part":{"annotations":[],"text":"","type":"output_text","logprobs":[]}} + + ' + - ' + + ' + - 'event: response.output_text.delta + + ' + - 'data: {"type":"response.output_text.delta","sequence_number":32,"output_index":1,"content_index":0,"delta":"\n\nS","item_id":"msg_b41da4ad9a54c8c5","logprobs":[]} + + ' + - ' + + ' + - 'event: response.output_text.delta + + ' + - 'data: {"type":"response.output_text.delta","sequence_number":33,"output_index":1,"content_index":0,"delta":"AP","item_id":"msg_b41da4ad9a54c8c5","logprobs":[]} + + ' + - ' + + ' + - 'event: response.output_text.delta + + ' + - 'data: {"type":"response.output_text.delta","sequence_number":34,"output_index":1,"content_index":0,"delta":"PH","item_id":"msg_b41da4ad9a54c8c5","logprobs":[]} + + ' + - ' + + ' + - 'event: response.output_text.delta + + ' + - 'data: {"type":"response.output_text.delta","sequence_number":35,"output_index":1,"content_index":0,"delta":"IRE","item_id":"msg_b41da4ad9a54c8c5","logprobs":[]} + + ' + - ' + + ' + - 'event: response.output_text.done + + ' + - 'data: {"type":"response.output_text.done","sequence_number":36,"output_index":1,"content_index":0,"item_id":"msg_b41da4ad9a54c8c5","logprobs":[],"text":"\n\nSAPPHIRE"} + + ' + - ' + + ' + - 'event: response.content_part.done + + ' + - 'data: {"type":"response.content_part.done","sequence_number":37,"output_index":1,"content_index":0,"item_id":"msg_b41da4ad9a54c8c5","part":{"annotations":[],"text":"\n\nSAPPHIRE","type":"output_text","logprobs":[]}} + + ' + - ' + + ' + - 'event: response.output_item.done + + ' + - 'data: {"type":"response.output_item.done","sequence_number":38,"output_index":1,"item":{"id":"msg_b41da4ad9a54c8c5","content":[{"annotations":[],"text":"\n\nSAPPHIRE","type":"output_text","logprobs":[]}],"role":"assistant","status":"completed","type":"message"}} + + ' + - ' + + ' + - 'event: response.completed + + ' + - 'data: {"type":"response.completed","sequence_number":39,"response":{"id":"resp_01a1681f-ec13-7ee1-b141-101d5f4946e0","object":"response","created_at":1792748285,"model":"Qwen/Qwen3.8-27B-FP8","status":"completed","output":[{"type":"reasoning","id":"rs_aefea1220c1acaf2","content":[{"type":"reasoning_text","text":"The + user wants me to reply with only the word \"SAPPHIRE\". This is a simple and + direct request.\n"}],"summary":[],"status":"completed"},{"type":"message","id":"msg_b41da4ad9a54c8c5","role":"assistant","status":"completed","content":[{"type":"output_text","text":"\n\nSAPPHIRE","annotations":[]}]}],"usage":{"input_tokens":47,"output_tokens":32,"total_tokens":79,"input_tokens_details":{"cached_tokens":0,"cache_write_tokens":0},"output_tokens_details":{"reasoning_tokens":25}},"incomplete_details":null,"error":null,"previous_response_id":null,"instructions":null,"max_tool_calls":null,"service_tier":"auto","tools":[],"tool_choice":"auto","completed_at":1792748285,"truncation":"disabled","parallel_tool_calls":false,"text":{"format":{"type":"text"}},"top_p":1.0,"presence_penalty":0.0,"frequency_penalty":0.0,"top_logprobs":0,"temperature":1.0,"reasoning":null,"max_output_tokens":null,"store":true,"background":false,"metadata":{},"safety_identifier":null,"prompt_cache_key":null,"prompt_cache_options":null}} + + ' + - ' + + ' + - 'data: [DONE] + + ' + - ' + + ' + status_code: 200 +- filename: t2 + request: + body: + input: + - content: Reply with only ORCHID. + role: user + model: Qwen/Qwen3.8-27B-FP8 + previous_response_id: resp_01a1681f-ec13-7ee1-b141-101d5f4946e0 + store: true + stream: true + headers: + accept: '*/*' + authorization: Bearer *** + content-type: application/json + user-agent: python-httpx/0.28.1 + method: POST + path: /v1/responses + query_params: {} + response: + headers: + content-type: text/event-stream; charset=utf-8 + sse: + - 'event: response.created + + ' + - 'data: {"type":"response.created","sequence_number":0,"response":{"id":"resp_01a1681f-ef15-7b91-a366-b9658ae97c12","created_at":1792748285,"incomplete_details":null,"instructions":null,"metadata":{},"model":"Qwen/Qwen3.8-27B-FP8","object":"response","output":[],"parallel_tool_calls":false,"temperature":1.0,"tool_choice":"none","tools":[],"top_p":1.0,"background":false,"max_output_tokens":null,"max_tool_calls":null,"previous_response_id":"resp_01a1681f-ec13-7ee1-b141-101d5f4946e0","prompt":null,"reasoning":null,"service_tier":"auto","status":"in_progress","text":{"format":{"type":"text"}},"top_logprobs":0,"truncation":"disabled","usage":null,"user":null,"presence_penalty":0.0,"frequency_penalty":0.0,"kv_transfer_params":null,"ec_transfer_params":null,"input_messages":null,"output_messages":null,"completed_at":null,"store":true,"safety_identifier":null,"prompt_cache_key":null,"prompt_cache_options":null,"error":null}} + + ' + - ' + + ' + - 'event: response.in_progress + + ' + - 'data: {"type":"response.in_progress","sequence_number":1,"response":{"id":"resp_01a1681f-ef15-7b91-a366-b9658ae97c12","created_at":1792748285,"incomplete_details":null,"instructions":null,"metadata":{},"model":"Qwen/Qwen3.8-27B-FP8","object":"response","output":[],"parallel_tool_calls":false,"temperature":1.0,"tool_choice":"none","tools":[],"top_p":1.0,"background":false,"max_output_tokens":null,"max_tool_calls":null,"previous_response_id":"resp_01a1681f-ec13-7ee1-b141-101d5f4946e0","prompt":null,"reasoning":null,"service_tier":"auto","status":"in_progress","text":{"format":{"type":"text"}},"top_logprobs":0,"truncation":"disabled","usage":null,"user":null,"presence_penalty":0.0,"frequency_penalty":0.0,"kv_transfer_params":null,"ec_transfer_params":null,"input_messages":null,"output_messages":null,"completed_at":null,"store":true,"safety_identifier":null,"prompt_cache_key":null,"prompt_cache_options":null,"error":null}} + + ' + - ' + + ' + - 'event: response.output_item.added + + ' + - 'data: {"type":"response.output_item.added","sequence_number":2,"output_index":0,"item":{"id":"rs_b5addb64a5a713d0","summary":[],"type":"reasoning","content":[],"status":"in_progress"}} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"type":"response.reasoning_text.delta","sequence_number":3,"output_index":0,"content_index":0,"delta":"The","item_id":"rs_b5addb64a5a713d0"} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"type":"response.reasoning_text.delta","sequence_number":4,"output_index":0,"content_index":0,"delta":" + user","item_id":"rs_b5addb64a5a713d0"} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"type":"response.reasoning_text.delta","sequence_number":5,"output_index":0,"content_index":0,"delta":" + wants","item_id":"rs_b5addb64a5a713d0"} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"type":"response.reasoning_text.delta","sequence_number":6,"output_index":0,"content_index":0,"delta":" + me","item_id":"rs_b5addb64a5a713d0"} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"type":"response.reasoning_text.delta","sequence_number":7,"output_index":0,"content_index":0,"delta":" + to","item_id":"rs_b5addb64a5a713d0"} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"type":"response.reasoning_text.delta","sequence_number":8,"output_index":0,"content_index":0,"delta":" + reply","item_id":"rs_b5addb64a5a713d0"} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"type":"response.reasoning_text.delta","sequence_number":9,"output_index":0,"content_index":0,"delta":" + with","item_id":"rs_b5addb64a5a713d0"} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"type":"response.reasoning_text.delta","sequence_number":10,"output_index":0,"content_index":0,"delta":" + only","item_id":"rs_b5addb64a5a713d0"} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"type":"response.reasoning_text.delta","sequence_number":11,"output_index":0,"content_index":0,"delta":" + the","item_id":"rs_b5addb64a5a713d0"} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"type":"response.reasoning_text.delta","sequence_number":12,"output_index":0,"content_index":0,"delta":" + word","item_id":"rs_b5addb64a5a713d0"} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"type":"response.reasoning_text.delta","sequence_number":13,"output_index":0,"content_index":0,"delta":" + \"","item_id":"rs_b5addb64a5a713d0"} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"type":"response.reasoning_text.delta","sequence_number":14,"output_index":0,"content_index":0,"delta":"OR","item_id":"rs_b5addb64a5a713d0"} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"type":"response.reasoning_text.delta","sequence_number":15,"output_index":0,"content_index":0,"delta":"CH","item_id":"rs_b5addb64a5a713d0"} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"type":"response.reasoning_text.delta","sequence_number":16,"output_index":0,"content_index":0,"delta":"ID","item_id":"rs_b5addb64a5a713d0"} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"type":"response.reasoning_text.delta","sequence_number":17,"output_index":0,"content_index":0,"delta":"\".","item_id":"rs_b5addb64a5a713d0"} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"type":"response.reasoning_text.delta","sequence_number":18,"output_index":0,"content_index":0,"delta":" + Simple","item_id":"rs_b5addb64a5a713d0"} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"type":"response.reasoning_text.delta","sequence_number":19,"output_index":0,"content_index":0,"delta":" + and","item_id":"rs_b5addb64a5a713d0"} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"type":"response.reasoning_text.delta","sequence_number":20,"output_index":0,"content_index":0,"delta":" + direct","item_id":"rs_b5addb64a5a713d0"} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"type":"response.reasoning_text.delta","sequence_number":21,"output_index":0,"content_index":0,"delta":" + request","item_id":"rs_b5addb64a5a713d0"} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"type":"response.reasoning_text.delta","sequence_number":22,"output_index":0,"content_index":0,"delta":".","item_id":"rs_b5addb64a5a713d0"} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"type":"response.reasoning_text.delta","sequence_number":23,"output_index":0,"content_index":0,"delta":"\n","item_id":"rs_b5addb64a5a713d0"} + + ' + - ' + + ' + - 'event: response.reasoning_text.done + + ' + - 'data: {"type":"response.reasoning_text.done","sequence_number":24,"output_index":0,"content_index":0,"item_id":"rs_b5addb64a5a713d0","text":"The + user wants me to reply with only the word \"ORCHID\". Simple and direct request.\n"} + + ' + - ' + + ' + - 'event: response.output_item.done + + ' + - 'data: {"type":"response.output_item.done","sequence_number":25,"output_index":0,"item":{"id":"rs_b5addb64a5a713d0","summary":[],"type":"reasoning","content":[{"text":"The + user wants me to reply with only the word \"ORCHID\". Simple and direct request.\n","type":"reasoning_text"}],"status":"completed"}} + + ' + - ' + + ' + - 'event: response.output_item.added + + ' + - 'data: {"type":"response.output_item.added","sequence_number":26,"output_index":1,"item":{"id":"msg_8c26bd66c2d95ded","content":[],"role":"assistant","status":"in_progress","type":"message"}} + + ' + - ' + + ' + - 'event: response.content_part.added + + ' + - 'data: {"type":"response.content_part.added","sequence_number":27,"output_index":1,"content_index":0,"item_id":"msg_8c26bd66c2d95ded","part":{"annotations":[],"text":"","type":"output_text","logprobs":[]}} + + ' + - ' + + ' + - 'event: response.output_text.delta + + ' + - 'data: {"type":"response.output_text.delta","sequence_number":28,"output_index":1,"content_index":0,"delta":"\n\nOR","item_id":"msg_8c26bd66c2d95ded","logprobs":[]} + + ' + - ' + + ' + - 'event: response.output_text.delta + + ' + - 'data: {"type":"response.output_text.delta","sequence_number":29,"output_index":1,"content_index":0,"delta":"CH","item_id":"msg_8c26bd66c2d95ded","logprobs":[]} + + ' + - ' + + ' + - 'event: response.output_text.delta + + ' + - 'data: {"type":"response.output_text.delta","sequence_number":30,"output_index":1,"content_index":0,"delta":"ID","item_id":"msg_8c26bd66c2d95ded","logprobs":[]} + + ' + - ' + + ' + - 'event: response.output_text.done + + ' + - 'data: {"type":"response.output_text.done","sequence_number":31,"output_index":1,"content_index":0,"item_id":"msg_8c26bd66c2d95ded","logprobs":[],"text":"\n\nORCHID"} + + ' + - ' + + ' + - 'event: response.content_part.done + + ' + - 'data: {"type":"response.content_part.done","sequence_number":32,"output_index":1,"content_index":0,"item_id":"msg_8c26bd66c2d95ded","part":{"annotations":[],"text":"\n\nORCHID","type":"output_text","logprobs":[]}} + + ' + - ' + + ' + - 'event: response.output_item.done + + ' + - 'data: {"type":"response.output_item.done","sequence_number":33,"output_index":1,"item":{"id":"msg_8c26bd66c2d95ded","content":[{"annotations":[],"text":"\n\nORCHID","type":"output_text","logprobs":[]}],"role":"assistant","status":"completed","type":"message"}} + + ' + - ' + + ' + - 'event: response.completed + + ' + - 'data: {"type":"response.completed","sequence_number":34,"response":{"id":"resp_01a1681f-ef15-7b91-a366-b9658ae97c12","object":"response","created_at":1792748286,"model":"Qwen/Qwen3.8-27B-FP8","status":"completed","output":[{"type":"reasoning","id":"rs_b5addb64a5a713d0","content":[{"type":"reasoning_text","text":"The + user wants me to reply with only the word \"ORCHID\". Simple and direct request.\n"}],"summary":[],"status":"completed"},{"type":"message","id":"msg_8c26bd66c2d95ded","role":"assistant","status":"completed","content":[{"type":"output_text","text":"\n\nORCHID","annotations":[]}]}],"usage":{"input_tokens":97,"output_tokens":27,"total_tokens":124,"input_tokens_details":{"cached_tokens":0,"cache_write_tokens":0},"output_tokens_details":{"reasoning_tokens":21}},"incomplete_details":null,"error":null,"previous_response_id":"resp_01a1681f-ec13-7ee1-b141-101d5f4946e0","instructions":null,"max_tool_calls":null,"service_tier":"auto","tools":[],"tool_choice":"auto","completed_at":1792748286,"truncation":"disabled","parallel_tool_calls":false,"text":{"format":{"type":"text"}},"top_p":1.0,"presence_penalty":0.0,"frequency_penalty":0.0,"top_logprobs":0,"temperature":1.0,"reasoning":null,"max_output_tokens":null,"store":true,"background":false,"metadata":{},"safety_identifier":null,"prompt_cache_key":null,"prompt_cache_options":null}} + + ' + - ' + + ' + - 'data: [DONE] + + ' + - ' + + ' + status_code: 200 +- filename: t3 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_01a1681f-ef15-7b91-a366-b9658ae97c12/input_items + query_params: + order: asc + response: + body: + data: + - content: + - text: Reply with only SAPPHIRE. + type: input_text + id: msg_01a1681f-eefa-7952-bfca-800cf0bee98c + role: user + status: completed + type: message + - content: + - text: 'The user wants me to reply with only the word "SAPPHIRE". This is + a simple and direct request. + + ' + type: reasoning_text + id: rs_aefea1220c1acaf2 + status: completed + summary: [] + type: reasoning + - content: + - annotations: [] + text: ' + + + SAPPHIRE' + type: output_text + id: msg_b41da4ad9a54c8c5 + role: assistant + status: completed + type: message + - content: + - text: Reply with only ORCHID. + type: input_text + id: msg_01a1681f-f198-7493-b44d-54c00ca93a94 + role: user + status: completed + type: message + first_id: msg_01a1681f-eefa-7952-bfca-800cf0bee98c + has_more: false + last_id: msg_01a1681f-f198-7493-b44d-54c00ca93a94 + object: list + headers: + content-type: application/json + status_code: 200 +- filename: t4 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_01a1681f-ef15-7b91-a366-b9658ae97c12/input_items + query_params: + order: desc + response: + body: + data: + - content: + - text: Reply with only ORCHID. + type: input_text + id: msg_01a1681f-f198-7493-b44d-54c00ca93a94 + role: user + status: completed + type: message + - content: + - annotations: [] + text: ' + + + SAPPHIRE' + type: output_text + id: msg_b41da4ad9a54c8c5 + role: assistant + status: completed + type: message + - content: + - text: 'The user wants me to reply with only the word "SAPPHIRE". This is + a simple and direct request. + + ' + type: reasoning_text + id: rs_aefea1220c1acaf2 + status: completed + summary: [] + type: reasoning + - content: + - text: Reply with only SAPPHIRE. + type: input_text + id: msg_01a1681f-eefa-7952-bfca-800cf0bee98c + role: user + status: completed + type: message + first_id: msg_01a1681f-f198-7493-b44d-54c00ca93a94 + has_more: false + last_id: msg_01a1681f-eefa-7952-bfca-800cf0bee98c + object: list + headers: + content-type: application/json + status_code: 200 +- filename: t5 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_01a1681f-ef15-7b91-a366-b9658ae97c12/input_items + query_params: + limit: '1' + order: asc + response: + body: + data: + - content: + - text: Reply with only SAPPHIRE. + type: input_text + id: msg_01a1681f-eefa-7952-bfca-800cf0bee98c + role: user + status: completed + type: message + first_id: msg_01a1681f-eefa-7952-bfca-800cf0bee98c + has_more: true + last_id: msg_01a1681f-eefa-7952-bfca-800cf0bee98c + object: list + headers: + content-type: application/json + status_code: 200 +- filename: t6 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_01a1681f-ef15-7b91-a366-b9658ae97c12/input_items + query_params: + after: msg_01a1681f-eefa-7952-bfca-800cf0bee98c + limit: '1' + order: asc + response: + body: + data: + - content: + - text: 'The user wants me to reply with only the word "SAPPHIRE". This is + a simple and direct request. + + ' + type: reasoning_text + id: rs_aefea1220c1acaf2 + status: completed + summary: [] + type: reasoning + first_id: rs_aefea1220c1acaf2 + has_more: true + last_id: rs_aefea1220c1acaf2 + object: list + headers: + content-type: application/json + status_code: 200 +- filename: t7 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_01a1681f-ef15-7b91-a366-b9658ae97c12/input_items + query_params: + limit: '1' + order: desc + response: + body: + data: + - content: + - text: Reply with only ORCHID. + type: input_text + id: msg_01a1681f-f198-7493-b44d-54c00ca93a94 + role: user + status: completed + type: message + first_id: msg_01a1681f-f198-7493-b44d-54c00ca93a94 + has_more: true + last_id: msg_01a1681f-f198-7493-b44d-54c00ca93a94 + object: list + headers: + content-type: application/json + status_code: 200 +- filename: t8 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_01a1681f-ef15-7b91-a366-b9658ae97c12/input_items + query_params: + after: msg_01a1681f-f198-7493-b44d-54c00ca93a94 + limit: '1' + order: desc + response: + body: + data: + - content: + - annotations: [] + text: ' + + + SAPPHIRE' + type: output_text + id: msg_b41da4ad9a54c8c5 + role: assistant + status: completed + type: message + first_id: msg_b41da4ad9a54c8c5 + has_more: true + last_id: msg_b41da4ad9a54c8c5 + object: list + headers: + content-type: application/json + status_code: 200 +- filename: t9 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_01a1681f-ef15-7b91-a366-b9658ae97c12/input_items + query_params: {} + response: + body: + data: + - content: + - text: Reply with only ORCHID. + type: input_text + id: msg_01a1681f-f198-7493-b44d-54c00ca93a94 + role: user + status: completed + type: message + - content: + - annotations: [] + text: ' + + + SAPPHIRE' + type: output_text + id: msg_b41da4ad9a54c8c5 + role: assistant + status: completed + type: message + - content: + - text: 'The user wants me to reply with only the word "SAPPHIRE". This is + a simple and direct request. + + ' + type: reasoning_text + id: rs_aefea1220c1acaf2 + status: completed + summary: [] + type: reasoning + - content: + - text: Reply with only SAPPHIRE. + type: input_text + id: msg_01a1681f-eefa-7952-bfca-800cf0bee98c + role: user + status: completed + type: message + first_id: msg_01a1681f-f198-7493-b44d-54c00ca93a94 + has_more: false + last_id: msg_01a1681f-eefa-7952-bfca-800cf0bee98c + object: list + headers: + content-type: application/json + status_code: 200 +- filename: t10 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_01a1681f-ef15-7b91-a366-b9658ae97c12/input_items + query_params: + limit: '100' + order: asc + response: + body: + data: + - content: + - text: Reply with only SAPPHIRE. + type: input_text + id: msg_01a1681f-eefa-7952-bfca-800cf0bee98c + role: user + status: completed + type: message + - content: + - text: 'The user wants me to reply with only the word "SAPPHIRE". This is + a simple and direct request. + + ' + type: reasoning_text + id: rs_aefea1220c1acaf2 + status: completed + summary: [] + type: reasoning + - content: + - annotations: [] + text: ' + + + SAPPHIRE' + type: output_text + id: msg_b41da4ad9a54c8c5 + role: assistant + status: completed + type: message + - content: + - text: Reply with only ORCHID. + type: input_text + id: msg_01a1681f-f198-7493-b44d-54c00ca93a94 + role: user + status: completed + type: message + first_id: msg_01a1681f-eefa-7952-bfca-800cf0bee98c + has_more: false + last_id: msg_01a1681f-f198-7493-b44d-54c00ca93a94 + object: list + headers: + content-type: application/json + status_code: 200 +- filename: t11 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_01a1681f-ef15-7b91-a366-b9658ae97c12/input_items + query_params: + after: msg_01a1681f-f198-7493-b44d-54c00ca93a94 + order: asc + response: + body: + data: [] + first_id: null + has_more: false + last_id: null + object: list + headers: + content-type: application/json + status_code: 200 +- filename: t12 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_01a1681f-ef15-7b91-a366-b9658ae97c12/input_items + query_params: + limit: '100' + order: desc + response: + body: + data: + - content: + - text: Reply with only ORCHID. + type: input_text + id: msg_01a1681f-f198-7493-b44d-54c00ca93a94 + role: user + status: completed + type: message + - content: + - annotations: [] + text: ' + + + SAPPHIRE' + type: output_text + id: msg_b41da4ad9a54c8c5 + role: assistant + status: completed + type: message + - content: + - text: 'The user wants me to reply with only the word "SAPPHIRE". This is + a simple and direct request. + + ' + type: reasoning_text + id: rs_aefea1220c1acaf2 + status: completed + summary: [] + type: reasoning + - content: + - text: Reply with only SAPPHIRE. + type: input_text + id: msg_01a1681f-eefa-7952-bfca-800cf0bee98c + role: user + status: completed + type: message + first_id: msg_01a1681f-f198-7493-b44d-54c00ca93a94 + has_more: false + last_id: msg_01a1681f-eefa-7952-bfca-800cf0bee98c + object: list + headers: + content-type: application/json + status_code: 200 +- filename: t13 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_01a1681f-ef15-7b91-a366-b9658ae97c12/input_items + query_params: + after: msg_01a1681f-eefa-7952-bfca-800cf0bee98c + order: desc + response: + body: + data: [] + first_id: null + has_more: false + last_id: null + object: list + headers: + content-type: application/json + status_code: 200 +- filename: t14 + request: + body: + input: + - content: Reply with only VIOLET. + role: user + model: Qwen/Qwen3.8-27B-FP8 + store: true + stream: true + headers: + accept: '*/*' + authorization: Bearer *** + content-type: application/json + user-agent: python-httpx/0.28.1 + method: POST + path: /v1/responses + query_params: {} + response: + headers: + content-type: text/event-stream; charset=utf-8 + sse: + - 'event: response.created + + ' + - 'data: {"type":"response.created","sequence_number":0,"response":{"id":"resp_01a1681f-f595-7982-859e-51bccb69f1e3","created_at":1792748287,"incomplete_details":null,"instructions":null,"metadata":{},"model":"Qwen/Qwen3.8-27B-FP8","object":"response","output":[],"parallel_tool_calls":false,"temperature":1.0,"tool_choice":"none","tools":[],"top_p":1.0,"background":false,"max_output_tokens":null,"max_tool_calls":null,"previous_response_id":null,"prompt":null,"reasoning":null,"service_tier":"auto","status":"in_progress","text":{"format":{"type":"text"}},"top_logprobs":0,"truncation":"disabled","usage":null,"user":null,"presence_penalty":0.0,"frequency_penalty":0.0,"kv_transfer_params":null,"ec_transfer_params":null,"input_messages":null,"output_messages":null,"completed_at":null,"store":true,"safety_identifier":null,"prompt_cache_key":null,"prompt_cache_options":null,"error":null}} + + ' + - ' + + ' + - 'event: response.in_progress + + ' + - 'data: {"type":"response.in_progress","sequence_number":1,"response":{"id":"resp_01a1681f-f595-7982-859e-51bccb69f1e3","created_at":1792748287,"incomplete_details":null,"instructions":null,"metadata":{},"model":"Qwen/Qwen3.8-27B-FP8","object":"response","output":[],"parallel_tool_calls":false,"temperature":1.0,"tool_choice":"none","tools":[],"top_p":1.0,"background":false,"max_output_tokens":null,"max_tool_calls":null,"previous_response_id":null,"prompt":null,"reasoning":null,"service_tier":"auto","status":"in_progress","text":{"format":{"type":"text"}},"top_logprobs":0,"truncation":"disabled","usage":null,"user":null,"presence_penalty":0.0,"frequency_penalty":0.0,"kv_transfer_params":null,"ec_transfer_params":null,"input_messages":null,"output_messages":null,"completed_at":null,"store":true,"safety_identifier":null,"prompt_cache_key":null,"prompt_cache_options":null,"error":null}} + + ' + - ' + + ' + - 'event: response.output_item.added + + ' + - 'data: {"type":"response.output_item.added","sequence_number":2,"output_index":0,"item":{"id":"rs_9f11d7be9b86827b","summary":[],"type":"reasoning","content":[],"status":"in_progress"}} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"type":"response.reasoning_text.delta","sequence_number":3,"output_index":0,"content_index":0,"delta":"The","item_id":"rs_9f11d7be9b86827b"} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"type":"response.reasoning_text.delta","sequence_number":4,"output_index":0,"content_index":0,"delta":" + user","item_id":"rs_9f11d7be9b86827b"} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"type":"response.reasoning_text.delta","sequence_number":5,"output_index":0,"content_index":0,"delta":" + wants","item_id":"rs_9f11d7be9b86827b"} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"type":"response.reasoning_text.delta","sequence_number":6,"output_index":0,"content_index":0,"delta":" + me","item_id":"rs_9f11d7be9b86827b"} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"type":"response.reasoning_text.delta","sequence_number":7,"output_index":0,"content_index":0,"delta":" + to","item_id":"rs_9f11d7be9b86827b"} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"type":"response.reasoning_text.delta","sequence_number":8,"output_index":0,"content_index":0,"delta":" + reply","item_id":"rs_9f11d7be9b86827b"} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"type":"response.reasoning_text.delta","sequence_number":9,"output_index":0,"content_index":0,"delta":" + with","item_id":"rs_9f11d7be9b86827b"} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"type":"response.reasoning_text.delta","sequence_number":10,"output_index":0,"content_index":0,"delta":" + only","item_id":"rs_9f11d7be9b86827b"} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"type":"response.reasoning_text.delta","sequence_number":11,"output_index":0,"content_index":0,"delta":" + the","item_id":"rs_9f11d7be9b86827b"} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"type":"response.reasoning_text.delta","sequence_number":12,"output_index":0,"content_index":0,"delta":" + word","item_id":"rs_9f11d7be9b86827b"} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"type":"response.reasoning_text.delta","sequence_number":13,"output_index":0,"content_index":0,"delta":" + \"","item_id":"rs_9f11d7be9b86827b"} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"type":"response.reasoning_text.delta","sequence_number":14,"output_index":0,"content_index":0,"delta":"V","item_id":"rs_9f11d7be9b86827b"} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"type":"response.reasoning_text.delta","sequence_number":15,"output_index":0,"content_index":0,"delta":"IO","item_id":"rs_9f11d7be9b86827b"} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"type":"response.reasoning_text.delta","sequence_number":16,"output_index":0,"content_index":0,"delta":"LET","item_id":"rs_9f11d7be9b86827b"} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"type":"response.reasoning_text.delta","sequence_number":17,"output_index":0,"content_index":0,"delta":"\".","item_id":"rs_9f11d7be9b86827b"} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"type":"response.reasoning_text.delta","sequence_number":18,"output_index":0,"content_index":0,"delta":"\n","item_id":"rs_9f11d7be9b86827b"} + + ' + - ' + + ' + - 'event: response.reasoning_text.done + + ' + - 'data: {"type":"response.reasoning_text.done","sequence_number":19,"output_index":0,"content_index":0,"item_id":"rs_9f11d7be9b86827b","text":"The + user wants me to reply with only the word \"VIOLET\".\n"} + + ' + - ' + + ' + - 'event: response.output_item.done + + ' + - 'data: {"type":"response.output_item.done","sequence_number":20,"output_index":0,"item":{"id":"rs_9f11d7be9b86827b","summary":[],"type":"reasoning","content":[{"text":"The + user wants me to reply with only the word \"VIOLET\".\n","type":"reasoning_text"}],"status":"completed"}} + + ' + - ' + + ' + - 'event: response.output_item.added + + ' + - 'data: {"type":"response.output_item.added","sequence_number":21,"output_index":1,"item":{"id":"msg_a8ab98d299a26512","content":[],"role":"assistant","status":"in_progress","type":"message"}} + + ' + - ' + + ' + - 'event: response.content_part.added + + ' + - 'data: {"type":"response.content_part.added","sequence_number":22,"output_index":1,"content_index":0,"item_id":"msg_a8ab98d299a26512","part":{"annotations":[],"text":"","type":"output_text","logprobs":[]}} + + ' + - ' + + ' + - 'event: response.output_text.delta + + ' + - 'data: {"type":"response.output_text.delta","sequence_number":23,"output_index":1,"content_index":0,"delta":"\n\nV","item_id":"msg_a8ab98d299a26512","logprobs":[]} + + ' + - ' + + ' + - 'event: response.output_text.delta + + ' + - 'data: {"type":"response.output_text.delta","sequence_number":24,"output_index":1,"content_index":0,"delta":"IO","item_id":"msg_a8ab98d299a26512","logprobs":[]} + + ' + - ' + + ' + - 'event: response.output_text.delta + + ' + - 'data: {"type":"response.output_text.delta","sequence_number":25,"output_index":1,"content_index":0,"delta":"LET","item_id":"msg_a8ab98d299a26512","logprobs":[]} + + ' + - ' + + ' + - 'event: response.output_text.done + + ' + - 'data: {"type":"response.output_text.done","sequence_number":26,"output_index":1,"content_index":0,"item_id":"msg_a8ab98d299a26512","logprobs":[],"text":"\n\nVIOLET"} + + ' + - ' + + ' + - 'event: response.content_part.done + + ' + - 'data: {"type":"response.content_part.done","sequence_number":27,"output_index":1,"content_index":0,"item_id":"msg_a8ab98d299a26512","part":{"annotations":[],"text":"\n\nVIOLET","type":"output_text","logprobs":[]}} + + ' + - ' + + ' + - 'event: response.output_item.done + + ' + - 'data: {"type":"response.output_item.done","sequence_number":28,"output_index":1,"item":{"id":"msg_a8ab98d299a26512","content":[{"annotations":[],"text":"\n\nVIOLET","type":"output_text","logprobs":[]}],"role":"assistant","status":"completed","type":"message"}} + + ' + - ' + + ' + - 'event: response.completed + + ' + - 'data: {"type":"response.completed","sequence_number":29,"response":{"id":"resp_01a1681f-f595-7982-859e-51bccb69f1e3","object":"response","created_at":1792748287,"model":"Qwen/Qwen3.8-27B-FP8","status":"completed","output":[{"type":"reasoning","id":"rs_9f11d7be9b86827b","content":[{"type":"reasoning_text","text":"The + user wants me to reply with only the word \"VIOLET\".\n"}],"summary":[],"status":"completed"},{"type":"message","id":"msg_a8ab98d299a26512","role":"assistant","status":"completed","content":[{"type":"output_text","text":"\n\nVIOLET","annotations":[]}]}],"usage":{"input_tokens":47,"output_tokens":22,"total_tokens":69,"input_tokens_details":{"cached_tokens":0,"cache_write_tokens":0},"output_tokens_details":{"reasoning_tokens":16}},"incomplete_details":null,"error":null,"previous_response_id":null,"instructions":null,"max_tool_calls":null,"service_tier":"auto","tools":[],"tool_choice":"auto","completed_at":1792748287,"truncation":"disabled","parallel_tool_calls":false,"text":{"format":{"type":"text"}},"top_p":1.0,"presence_penalty":0.0,"frequency_penalty":0.0,"top_logprobs":0,"temperature":1.0,"reasoning":null,"max_output_tokens":null,"store":true,"background":false,"metadata":{},"safety_identifier":null,"prompt_cache_key":null,"prompt_cache_options":null}} + + ' + - ' + + ' + - 'data: [DONE] + + ' + - ' + + ' + status_code: 200 +- filename: t15 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_01a1681f-f595-7982-859e-51bccb69f1e3/input_items + query_params: {} + response: + body: + data: + - content: + - text: Reply with only VIOLET. + type: input_text + id: msg_01a1681f-f7ad-7b73-8fe2-fdf22cff3f79 + role: user + status: completed + type: message + first_id: msg_01a1681f-f7ad-7b73-8fe2-fdf22cff3f79 + has_more: false + last_id: msg_01a1681f-f7ad-7b73-8fe2-fdf22cff3f79 + object: list + headers: + content-type: application/json + status_code: 200 +- filename: t16 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_01a1681f-ef15-7b91-a366-b9658ae97c12/input_items + query_params: + after: msg_01a1681f-f7ad-7b73-8fe2-fdf22cff3f79 + response: + body: + error: + code: null + message: No item found with id 'msg_01a1681f-f7ad-7b73-8fe2-fdf22cff3f79' + param: after + type: invalid_request_error + headers: + content-type: application/json + status_code: 404 diff --git a/crates/agentic-server-core/tests/cassettes/responses/response-pagination-stream-openai.yaml b/crates/agentic-server-core/tests/cassettes/responses/response-pagination-stream-openai.yaml new file mode 100644 index 000000000..c16574a18 --- /dev/null +++ b/crates/agentic-server-core/tests/cassettes/responses/response-pagination-stream-openai.yaml @@ -0,0 +1,809 @@ +turns: +- filename: t1 + request: + body: + input: + - content: Reply with only SAPPHIRE. + role: user + model: gpt-4.1 + store: true + stream: true + headers: + accept: '*/*' + authorization: Bearer *** + content-type: application/json + user-agent: python-httpx/0.28.1 + method: POST + path: /v1/responses + query_params: {} + response: + headers: + content-type: text/event-stream; charset=utf-8 + sse: + - 'event: response.created + + ' + - 'data: {"type":"response.created","response":{"id":"resp_0a200e2f1f716972006adb03b8839887d1af0aa02050a9343c","object":"response","created_at":1792738232,"status":"in_progress","access_programs":null,"background":false,"completed_at":null,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"max_tool_calls":null,"model":"gpt-4.1-2025-04-14","moderation":null,"output":[],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":null,"prompt_cache_key":null,"prompt_cache_retention":"in_memory","reasoning":{"context":null,"effort":null,"summary":null},"safety_identifier":null,"service_tier":"auto","store":true,"temperature":1.0,"text":{"format":{"type":"text"},"verbosity":"medium"},"tool_choice":"auto","tool_usage":{"image_gen":{"input_tokens":0,"input_tokens_details":{"image_tokens":0,"text_tokens":0},"output_tokens":0,"output_tokens_details":{"image_tokens":0,"text_tokens":0},"total_tokens":0},"web_search":{"num_requests":0}},"tools":[],"top_logprobs":0,"top_p":1.0,"truncation":"disabled","usage":null,"user":null,"metadata":{}},"sequence_number":0} + + ' + - ' + + ' + - 'event: response.in_progress + + ' + - 'data: {"type":"response.in_progress","response":{"id":"resp_0a200e2f1f716972006adb03b8839887d1af0aa02050a9343c","object":"response","created_at":1792738232,"status":"in_progress","access_programs":null,"background":false,"completed_at":null,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"max_tool_calls":null,"model":"gpt-4.1-2025-04-14","moderation":null,"output":[],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":null,"prompt_cache_key":null,"prompt_cache_retention":"in_memory","reasoning":{"context":null,"effort":null,"summary":null},"safety_identifier":null,"service_tier":"auto","store":true,"temperature":1.0,"text":{"format":{"type":"text"},"verbosity":"medium"},"tool_choice":"auto","tool_usage":{"image_gen":{"input_tokens":0,"input_tokens_details":{"image_tokens":0,"text_tokens":0},"output_tokens":0,"output_tokens_details":{"image_tokens":0,"text_tokens":0},"total_tokens":0},"web_search":{"num_requests":0}},"tools":[],"top_logprobs":0,"top_p":1.0,"truncation":"disabled","usage":null,"user":null,"metadata":{}},"sequence_number":1} + + ' + - ' + + ' + - 'event: response.output_item.added + + ' + - 'data: {"type":"response.output_item.added","item":{"id":"msg_0a200e2f1f716972006adb03b9066487d1bb41d02dbd938416","type":"message","status":"in_progress","content":[],"role":"assistant"},"output_index":0,"sequence_number":2} + + ' + - ' + + ' + - 'event: response.content_part.added + + ' + - 'data: {"type":"response.content_part.added","content_index":0,"item_id":"msg_0a200e2f1f716972006adb03b9066487d1bb41d02dbd938416","output_index":0,"part":{"type":"output_text","annotations":[],"logprobs":[],"text":""},"sequence_number":3} + + ' + - ' + + ' + - 'event: response.output_text.delta + + ' + - 'data: {"type":"response.output_text.delta","content_index":0,"delta":"S","item_id":"msg_0a200e2f1f716972006adb03b9066487d1bb41d02dbd938416","logprobs":[],"obfuscation":"fL0BugJFlxfAM13","output_index":0,"sequence_number":4} + + ' + - ' + + ' + - 'event: response.output_text.delta + + ' + - 'data: {"type":"response.output_text.delta","content_index":0,"delta":"APP","item_id":"msg_0a200e2f1f716972006adb03b9066487d1bb41d02dbd938416","logprobs":[],"obfuscation":"MmDLzl28h65SA","output_index":0,"sequence_number":5} + + ' + - ' + + ' + - 'event: response.output_text.delta + + ' + - 'data: {"type":"response.output_text.delta","content_index":0,"delta":"H","item_id":"msg_0a200e2f1f716972006adb03b9066487d1bb41d02dbd938416","logprobs":[],"obfuscation":"stgyzm7cVzB2XAx","output_index":0,"sequence_number":6} + + ' + - ' + + ' + - 'event: response.output_text.delta + + ' + - 'data: {"type":"response.output_text.delta","content_index":0,"delta":"IRE","item_id":"msg_0a200e2f1f716972006adb03b9066487d1bb41d02dbd938416","logprobs":[],"obfuscation":"InOUGNwxNNBBA","output_index":0,"sequence_number":7} + + ' + - ' + + ' + - 'event: response.output_text.done + + ' + - 'data: {"type":"response.output_text.done","content_index":0,"item_id":"msg_0a200e2f1f716972006adb03b9066487d1bb41d02dbd938416","logprobs":[],"output_index":0,"sequence_number":8,"text":"SAPPHIRE"} + + ' + - ' + + ' + - 'event: response.content_part.done + + ' + - 'data: {"type":"response.content_part.done","content_index":0,"item_id":"msg_0a200e2f1f716972006adb03b9066487d1bb41d02dbd938416","output_index":0,"part":{"type":"output_text","annotations":[],"logprobs":[],"text":"SAPPHIRE"},"sequence_number":9} + + ' + - ' + + ' + - 'event: response.output_item.done + + ' + - 'data: {"type":"response.output_item.done","item":{"id":"msg_0a200e2f1f716972006adb03b9066487d1bb41d02dbd938416","type":"message","status":"completed","content":[{"type":"output_text","annotations":[],"logprobs":[],"text":"SAPPHIRE"}],"role":"assistant"},"output_index":0,"sequence_number":10} + + ' + - ' + + ' + - 'event: response.completed + + ' + - 'data: {"type":"response.completed","response":{"id":"resp_0a200e2f1f716972006adb03b8839887d1af0aa02050a9343c","object":"response","created_at":1792738232,"status":"completed","access_programs":null,"background":false,"completed_at":1792738233,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"max_tool_calls":null,"model":"gpt-4.1-2025-04-14","moderation":null,"output":[{"id":"msg_0a200e2f1f716972006adb03b9066487d1bb41d02dbd938416","type":"message","status":"completed","content":[{"type":"output_text","annotations":[],"logprobs":[],"text":"SAPPHIRE"}],"role":"assistant"}],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":null,"prompt_cache_key":null,"prompt_cache_retention":"in_memory","reasoning":{"context":null,"effort":null,"summary":null},"safety_identifier":null,"service_tier":"default","store":true,"temperature":1.0,"text":{"format":{"type":"text"},"verbosity":"medium"},"tool_choice":"auto","tool_usage":{"image_gen":{"input_tokens":0,"input_tokens_details":{"image_tokens":0,"text_tokens":0},"output_tokens":0,"output_tokens_details":{"image_tokens":0,"text_tokens":0},"total_tokens":0},"web_search":{"num_requests":0}},"tools":[],"top_logprobs":0,"top_p":1.0,"truncation":"disabled","usage":{"input_tokens":15,"input_tokens_details":{"cache_write_tokens":0,"cached_tokens":0},"output_tokens":5,"output_tokens_details":{"reasoning_tokens":0},"total_tokens":20},"user":null,"metadata":{}},"sequence_number":11} + + ' + - ' + + ' + status_code: 200 +- filename: t2 + request: + body: + input: + - content: Reply with only ORCHID. + role: user + model: gpt-4.1 + previous_response_id: resp_0a200e2f1f716972006adb03b8839887d1af0aa02050a9343c + store: true + stream: true + headers: + accept: '*/*' + authorization: Bearer *** + content-type: application/json + user-agent: python-httpx/0.28.1 + method: POST + path: /v1/responses + query_params: {} + response: + headers: + content-type: text/event-stream; charset=utf-8 + sse: + - 'event: response.created + + ' + - 'data: {"type":"response.created","response":{"id":"resp_0a200e2f1f716972006adb03b9a8c487d19acc32ff2238c399","object":"response","created_at":1792738233,"status":"in_progress","access_programs":null,"background":false,"completed_at":null,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"max_tool_calls":null,"model":"gpt-4.1-2025-04-14","moderation":null,"output":[],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":"resp_0a200e2f1f716972006adb03b8839887d1af0aa02050a9343c","prompt_cache_key":null,"prompt_cache_retention":"in_memory","reasoning":{"context":null,"effort":null,"summary":null},"safety_identifier":null,"service_tier":"auto","store":true,"temperature":1.0,"text":{"format":{"type":"text"},"verbosity":"medium"},"tool_choice":"auto","tool_usage":{"image_gen":{"input_tokens":0,"input_tokens_details":{"image_tokens":0,"text_tokens":0},"output_tokens":0,"output_tokens_details":{"image_tokens":0,"text_tokens":0},"total_tokens":0},"web_search":{"num_requests":0}},"tools":[],"top_logprobs":0,"top_p":1.0,"truncation":"disabled","usage":null,"user":null,"metadata":{}},"sequence_number":0} + + ' + - ' + + ' + - 'event: response.in_progress + + ' + - 'data: {"type":"response.in_progress","response":{"id":"resp_0a200e2f1f716972006adb03b9a8c487d19acc32ff2238c399","object":"response","created_at":1792738233,"status":"in_progress","access_programs":null,"background":false,"completed_at":null,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"max_tool_calls":null,"model":"gpt-4.1-2025-04-14","moderation":null,"output":[],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":"resp_0a200e2f1f716972006adb03b8839887d1af0aa02050a9343c","prompt_cache_key":null,"prompt_cache_retention":"in_memory","reasoning":{"context":null,"effort":null,"summary":null},"safety_identifier":null,"service_tier":"auto","store":true,"temperature":1.0,"text":{"format":{"type":"text"},"verbosity":"medium"},"tool_choice":"auto","tool_usage":{"image_gen":{"input_tokens":0,"input_tokens_details":{"image_tokens":0,"text_tokens":0},"output_tokens":0,"output_tokens_details":{"image_tokens":0,"text_tokens":0},"total_tokens":0},"web_search":{"num_requests":0}},"tools":[],"top_logprobs":0,"top_p":1.0,"truncation":"disabled","usage":null,"user":null,"metadata":{}},"sequence_number":1} + + ' + - ' + + ' + - 'event: response.output_item.added + + ' + - 'data: {"type":"response.output_item.added","item":{"id":"msg_0a200e2f1f716972006adb03ba3a7487d18280bd61ee58fe77","type":"message","status":"in_progress","content":[],"role":"assistant"},"output_index":0,"sequence_number":2} + + ' + - ' + + ' + - 'event: response.content_part.added + + ' + - 'data: {"type":"response.content_part.added","content_index":0,"item_id":"msg_0a200e2f1f716972006adb03ba3a7487d18280bd61ee58fe77","output_index":0,"part":{"type":"output_text","annotations":[],"logprobs":[],"text":""},"sequence_number":3} + + ' + - ' + + ' + - 'event: response.output_text.delta + + ' + - 'data: {"type":"response.output_text.delta","content_index":0,"delta":"OR","item_id":"msg_0a200e2f1f716972006adb03ba3a7487d18280bd61ee58fe77","logprobs":[],"obfuscation":"jZYteudj06HFKC","output_index":0,"sequence_number":4} + + ' + - ' + + ' + - 'event: response.output_text.delta + + ' + - 'data: {"type":"response.output_text.delta","content_index":0,"delta":"CH","item_id":"msg_0a200e2f1f716972006adb03ba3a7487d18280bd61ee58fe77","logprobs":[],"obfuscation":"3pVgiIeuCYIpZh","output_index":0,"sequence_number":5} + + ' + - ' + + ' + - 'event: response.output_text.delta + + ' + - 'data: {"type":"response.output_text.delta","content_index":0,"delta":"ID","item_id":"msg_0a200e2f1f716972006adb03ba3a7487d18280bd61ee58fe77","logprobs":[],"obfuscation":"g8Y0OfLVtyIxqI","output_index":0,"sequence_number":6} + + ' + - ' + + ' + - 'event: response.output_text.done + + ' + - 'data: {"type":"response.output_text.done","content_index":0,"item_id":"msg_0a200e2f1f716972006adb03ba3a7487d18280bd61ee58fe77","logprobs":[],"output_index":0,"sequence_number":7,"text":"ORCHID"} + + ' + - ' + + ' + - 'event: response.content_part.done + + ' + - 'data: {"type":"response.content_part.done","content_index":0,"item_id":"msg_0a200e2f1f716972006adb03ba3a7487d18280bd61ee58fe77","output_index":0,"part":{"type":"output_text","annotations":[],"logprobs":[],"text":"ORCHID"},"sequence_number":8} + + ' + - ' + + ' + - 'event: response.output_item.done + + ' + - 'data: {"type":"response.output_item.done","item":{"id":"msg_0a200e2f1f716972006adb03ba3a7487d18280bd61ee58fe77","type":"message","status":"completed","content":[{"type":"output_text","annotations":[],"logprobs":[],"text":"ORCHID"}],"role":"assistant"},"output_index":0,"sequence_number":9} + + ' + - ' + + ' + - 'event: response.completed + + ' + - 'data: {"type":"response.completed","response":{"id":"resp_0a200e2f1f716972006adb03b9a8c487d19acc32ff2238c399","object":"response","created_at":1792738233,"status":"completed","access_programs":null,"background":false,"completed_at":1792738234,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"max_tool_calls":null,"model":"gpt-4.1-2025-04-14","moderation":null,"output":[{"id":"msg_0a200e2f1f716972006adb03ba3a7487d18280bd61ee58fe77","type":"message","status":"completed","content":[{"type":"output_text","annotations":[],"logprobs":[],"text":"ORCHID"}],"role":"assistant"}],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":"resp_0a200e2f1f716972006adb03b8839887d1af0aa02050a9343c","prompt_cache_key":null,"prompt_cache_retention":"in_memory","reasoning":{"context":null,"effort":null,"summary":null},"safety_identifier":null,"service_tier":"default","store":true,"temperature":1.0,"text":{"format":{"type":"text"},"verbosity":"medium"},"tool_choice":"auto","tool_usage":{"image_gen":{"input_tokens":0,"input_tokens_details":{"image_tokens":0,"text_tokens":0},"output_tokens":0,"output_tokens_details":{"image_tokens":0,"text_tokens":0},"total_tokens":0},"web_search":{"num_requests":0}},"tools":[],"top_logprobs":0,"top_p":1.0,"truncation":"disabled","usage":{"input_tokens":34,"input_tokens_details":{"cache_write_tokens":0,"cached_tokens":0},"output_tokens":4,"output_tokens_details":{"reasoning_tokens":0},"total_tokens":38},"user":null,"metadata":{}},"sequence_number":10} + + ' + - ' + + ' + status_code: 200 +- filename: t3 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_0a200e2f1f716972006adb03b9a8c487d19acc32ff2238c399/input_items + query_params: + order: asc + response: + body: + data: + - content: + - text: Reply with only SAPPHIRE. + type: input_text + id: msg_0a200e2f1f716972006adb03b88df887d1b2904e9da6c338a3 + role: user + status: completed + type: message + - content: + - annotations: [] + logprobs: [] + text: SAPPHIRE + type: output_text + id: msg_0a200e2f1f716972006adb03b9066487d1bb41d02dbd938416 + role: assistant + status: completed + type: message + - content: + - text: Reply with only ORCHID. + type: input_text + id: msg_0a200e2f1f716972006adb03b9b13887d1be38ba8a5e9f154f + role: user + status: completed + type: message + first_id: msg_0a200e2f1f716972006adb03b88df887d1b2904e9da6c338a3 + has_more: false + last_id: msg_0a200e2f1f716972006adb03b9b13887d1be38ba8a5e9f154f + object: list + headers: + content-type: application/json + status_code: 200 +- filename: t4 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_0a200e2f1f716972006adb03b9a8c487d19acc32ff2238c399/input_items + query_params: + order: desc + response: + body: + data: + - content: + - text: Reply with only ORCHID. + type: input_text + id: msg_0a200e2f1f716972006adb03b9b13887d1be38ba8a5e9f154f + role: user + status: completed + type: message + - content: + - annotations: [] + logprobs: [] + text: SAPPHIRE + type: output_text + id: msg_0a200e2f1f716972006adb03b9066487d1bb41d02dbd938416 + role: assistant + status: completed + type: message + - content: + - text: Reply with only SAPPHIRE. + type: input_text + id: msg_0a200e2f1f716972006adb03b88df887d1b2904e9da6c338a3 + role: user + status: completed + type: message + first_id: msg_0a200e2f1f716972006adb03b9b13887d1be38ba8a5e9f154f + has_more: false + last_id: msg_0a200e2f1f716972006adb03b88df887d1b2904e9da6c338a3 + object: list + headers: + content-type: application/json + status_code: 200 +- filename: t5 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_0a200e2f1f716972006adb03b9a8c487d19acc32ff2238c399/input_items + query_params: + limit: '1' + order: asc + response: + body: + data: + - content: + - text: Reply with only SAPPHIRE. + type: input_text + id: msg_0a200e2f1f716972006adb03b88df887d1b2904e9da6c338a3 + role: user + status: completed + type: message + first_id: msg_0a200e2f1f716972006adb03b88df887d1b2904e9da6c338a3 + has_more: true + last_id: msg_0a200e2f1f716972006adb03b88df887d1b2904e9da6c338a3 + object: list + headers: + content-type: application/json + status_code: 200 +- filename: t6 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_0a200e2f1f716972006adb03b9a8c487d19acc32ff2238c399/input_items + query_params: + after: msg_0a200e2f1f716972006adb03b88df887d1b2904e9da6c338a3 + limit: '1' + order: asc + response: + body: + data: + - content: + - annotations: [] + logprobs: [] + text: SAPPHIRE + type: output_text + id: msg_0a200e2f1f716972006adb03b9066487d1bb41d02dbd938416 + role: assistant + status: completed + type: message + first_id: msg_0a200e2f1f716972006adb03b9066487d1bb41d02dbd938416 + has_more: true + last_id: msg_0a200e2f1f716972006adb03b9066487d1bb41d02dbd938416 + object: list + headers: + content-type: application/json + status_code: 200 +- filename: t7 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_0a200e2f1f716972006adb03b9a8c487d19acc32ff2238c399/input_items + query_params: + limit: '1' + order: desc + response: + body: + data: + - content: + - text: Reply with only ORCHID. + type: input_text + id: msg_0a200e2f1f716972006adb03b9b13887d1be38ba8a5e9f154f + role: user + status: completed + type: message + first_id: msg_0a200e2f1f716972006adb03b9b13887d1be38ba8a5e9f154f + has_more: true + last_id: msg_0a200e2f1f716972006adb03b9b13887d1be38ba8a5e9f154f + object: list + headers: + content-type: application/json + status_code: 200 +- filename: t8 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_0a200e2f1f716972006adb03b9a8c487d19acc32ff2238c399/input_items + query_params: + after: msg_0a200e2f1f716972006adb03b9b13887d1be38ba8a5e9f154f + limit: '1' + order: desc + response: + body: + data: + - content: + - annotations: [] + logprobs: [] + text: SAPPHIRE + type: output_text + id: msg_0a200e2f1f716972006adb03b9066487d1bb41d02dbd938416 + role: assistant + status: completed + type: message + first_id: msg_0a200e2f1f716972006adb03b9066487d1bb41d02dbd938416 + has_more: true + last_id: msg_0a200e2f1f716972006adb03b9066487d1bb41d02dbd938416 + object: list + headers: + content-type: application/json + status_code: 200 +- filename: t9 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_0a200e2f1f716972006adb03b9a8c487d19acc32ff2238c399/input_items + query_params: {} + response: + body: + data: + - content: + - text: Reply with only ORCHID. + type: input_text + id: msg_0a200e2f1f716972006adb03b9b13887d1be38ba8a5e9f154f + role: user + status: completed + type: message + - content: + - annotations: [] + logprobs: [] + text: SAPPHIRE + type: output_text + id: msg_0a200e2f1f716972006adb03b9066487d1bb41d02dbd938416 + role: assistant + status: completed + type: message + - content: + - text: Reply with only SAPPHIRE. + type: input_text + id: msg_0a200e2f1f716972006adb03b88df887d1b2904e9da6c338a3 + role: user + status: completed + type: message + first_id: msg_0a200e2f1f716972006adb03b9b13887d1be38ba8a5e9f154f + has_more: false + last_id: msg_0a200e2f1f716972006adb03b88df887d1b2904e9da6c338a3 + object: list + headers: + content-type: application/json + status_code: 200 +- filename: t10 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_0a200e2f1f716972006adb03b9a8c487d19acc32ff2238c399/input_items + query_params: + limit: '100' + order: asc + response: + body: + data: + - content: + - text: Reply with only SAPPHIRE. + type: input_text + id: msg_0a200e2f1f716972006adb03b88df887d1b2904e9da6c338a3 + role: user + status: completed + type: message + - content: + - annotations: [] + logprobs: [] + text: SAPPHIRE + type: output_text + id: msg_0a200e2f1f716972006adb03b9066487d1bb41d02dbd938416 + role: assistant + status: completed + type: message + - content: + - text: Reply with only ORCHID. + type: input_text + id: msg_0a200e2f1f716972006adb03b9b13887d1be38ba8a5e9f154f + role: user + status: completed + type: message + first_id: msg_0a200e2f1f716972006adb03b88df887d1b2904e9da6c338a3 + has_more: false + last_id: msg_0a200e2f1f716972006adb03b9b13887d1be38ba8a5e9f154f + object: list + headers: + content-type: application/json + status_code: 200 +- filename: t11 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_0a200e2f1f716972006adb03b9a8c487d19acc32ff2238c399/input_items + query_params: + after: msg_0a200e2f1f716972006adb03b9b13887d1be38ba8a5e9f154f + order: asc + response: + body: + data: [] + first_id: null + has_more: false + last_id: null + object: list + headers: + content-type: application/json + status_code: 200 +- filename: t12 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_0a200e2f1f716972006adb03b9a8c487d19acc32ff2238c399/input_items + query_params: + limit: '100' + order: desc + response: + body: + data: + - content: + - text: Reply with only ORCHID. + type: input_text + id: msg_0a200e2f1f716972006adb03b9b13887d1be38ba8a5e9f154f + role: user + status: completed + type: message + - content: + - annotations: [] + logprobs: [] + text: SAPPHIRE + type: output_text + id: msg_0a200e2f1f716972006adb03b9066487d1bb41d02dbd938416 + role: assistant + status: completed + type: message + - content: + - text: Reply with only SAPPHIRE. + type: input_text + id: msg_0a200e2f1f716972006adb03b88df887d1b2904e9da6c338a3 + role: user + status: completed + type: message + first_id: msg_0a200e2f1f716972006adb03b9b13887d1be38ba8a5e9f154f + has_more: false + last_id: msg_0a200e2f1f716972006adb03b88df887d1b2904e9da6c338a3 + object: list + headers: + content-type: application/json + status_code: 200 +- filename: t13 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_0a200e2f1f716972006adb03b9a8c487d19acc32ff2238c399/input_items + query_params: + after: msg_0a200e2f1f716972006adb03b88df887d1b2904e9da6c338a3 + order: desc + response: + body: + data: [] + first_id: null + has_more: false + last_id: null + object: list + headers: + content-type: application/json + status_code: 200 +- filename: t14 + request: + body: + input: + - content: Reply with only VIOLET. + role: user + model: gpt-4.1 + store: true + stream: true + headers: + accept: '*/*' + authorization: Bearer *** + content-type: application/json + user-agent: python-httpx/0.28.1 + method: POST + path: /v1/responses + query_params: {} + response: + headers: + content-type: text/event-stream; charset=utf-8 + sse: + - 'event: response.created + + ' + - 'data: {"type":"response.created","response":{"id":"resp_071f39d6a547e429006adb03c0f8d487d1bf8a2e29a176c475","object":"response","created_at":1792738241,"status":"in_progress","access_programs":null,"background":false,"completed_at":null,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"max_tool_calls":null,"model":"gpt-4.1-2025-04-14","moderation":null,"output":[],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":null,"prompt_cache_key":null,"prompt_cache_retention":"in_memory","reasoning":{"context":null,"effort":null,"summary":null},"safety_identifier":null,"service_tier":"auto","store":true,"temperature":1.0,"text":{"format":{"type":"text"},"verbosity":"medium"},"tool_choice":"auto","tool_usage":{"image_gen":{"input_tokens":0,"input_tokens_details":{"image_tokens":0,"text_tokens":0},"output_tokens":0,"output_tokens_details":{"image_tokens":0,"text_tokens":0},"total_tokens":0},"web_search":{"num_requests":0}},"tools":[],"top_logprobs":0,"top_p":1.0,"truncation":"disabled","usage":null,"user":null,"metadata":{}},"sequence_number":0} + + ' + - ' + + ' + - 'event: response.in_progress + + ' + - 'data: {"type":"response.in_progress","response":{"id":"resp_071f39d6a547e429006adb03c0f8d487d1bf8a2e29a176c475","object":"response","created_at":1792738241,"status":"in_progress","access_programs":null,"background":false,"completed_at":null,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"max_tool_calls":null,"model":"gpt-4.1-2025-04-14","moderation":null,"output":[],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":null,"prompt_cache_key":null,"prompt_cache_retention":"in_memory","reasoning":{"context":null,"effort":null,"summary":null},"safety_identifier":null,"service_tier":"auto","store":true,"temperature":1.0,"text":{"format":{"type":"text"},"verbosity":"medium"},"tool_choice":"auto","tool_usage":{"image_gen":{"input_tokens":0,"input_tokens_details":{"image_tokens":0,"text_tokens":0},"output_tokens":0,"output_tokens_details":{"image_tokens":0,"text_tokens":0},"total_tokens":0},"web_search":{"num_requests":0}},"tools":[],"top_logprobs":0,"top_p":1.0,"truncation":"disabled","usage":null,"user":null,"metadata":{}},"sequence_number":1} + + ' + - ' + + ' + - 'event: response.output_item.added + + ' + - 'data: {"type":"response.output_item.added","item":{"id":"msg_071f39d6a547e429006adb03c18fd087d18506739d3702d1aa","type":"message","status":"in_progress","content":[],"role":"assistant"},"output_index":0,"sequence_number":2} + + ' + - ' + + ' + - 'event: response.content_part.added + + ' + - 'data: {"type":"response.content_part.added","content_index":0,"item_id":"msg_071f39d6a547e429006adb03c18fd087d18506739d3702d1aa","output_index":0,"part":{"type":"output_text","annotations":[],"logprobs":[],"text":""},"sequence_number":3} + + ' + - ' + + ' + - 'event: response.output_text.delta + + ' + - 'data: {"type":"response.output_text.delta","content_index":0,"delta":"V","item_id":"msg_071f39d6a547e429006adb03c18fd087d18506739d3702d1aa","logprobs":[],"obfuscation":"Y4GBgztgbDks6O5","output_index":0,"sequence_number":4} + + ' + - ' + + ' + - 'event: response.output_text.delta + + ' + - 'data: {"type":"response.output_text.delta","content_index":0,"delta":"IO","item_id":"msg_071f39d6a547e429006adb03c18fd087d18506739d3702d1aa","logprobs":[],"obfuscation":"uIzugyqt1zVyWr","output_index":0,"sequence_number":5} + + ' + - ' + + ' + - 'event: response.output_text.delta + + ' + - 'data: {"type":"response.output_text.delta","content_index":0,"delta":"LET","item_id":"msg_071f39d6a547e429006adb03c18fd087d18506739d3702d1aa","logprobs":[],"obfuscation":"X4WegZ1gLBTBO","output_index":0,"sequence_number":6} + + ' + - ' + + ' + - 'event: response.output_text.done + + ' + - 'data: {"type":"response.output_text.done","content_index":0,"item_id":"msg_071f39d6a547e429006adb03c18fd087d18506739d3702d1aa","logprobs":[],"output_index":0,"sequence_number":7,"text":"VIOLET"} + + ' + - ' + + ' + - 'event: response.content_part.done + + ' + - 'data: {"type":"response.content_part.done","content_index":0,"item_id":"msg_071f39d6a547e429006adb03c18fd087d18506739d3702d1aa","output_index":0,"part":{"type":"output_text","annotations":[],"logprobs":[],"text":"VIOLET"},"sequence_number":8} + + ' + - ' + + ' + - 'event: response.output_item.done + + ' + - 'data: {"type":"response.output_item.done","item":{"id":"msg_071f39d6a547e429006adb03c18fd087d18506739d3702d1aa","type":"message","status":"completed","content":[{"type":"output_text","annotations":[],"logprobs":[],"text":"VIOLET"}],"role":"assistant"},"output_index":0,"sequence_number":9} + + ' + - ' + + ' + - 'event: response.completed + + ' + - 'data: {"type":"response.completed","response":{"id":"resp_071f39d6a547e429006adb03c0f8d487d1bf8a2e29a176c475","object":"response","created_at":1792738241,"status":"completed","access_programs":null,"background":false,"completed_at":1792738241,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"max_tool_calls":null,"model":"gpt-4.1-2025-04-14","moderation":null,"output":[{"id":"msg_071f39d6a547e429006adb03c18fd087d18506739d3702d1aa","type":"message","status":"completed","content":[{"type":"output_text","annotations":[],"logprobs":[],"text":"VIOLET"}],"role":"assistant"}],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":null,"prompt_cache_key":null,"prompt_cache_retention":"in_memory","reasoning":{"context":null,"effort":null,"summary":null},"safety_identifier":null,"service_tier":"default","store":true,"temperature":1.0,"text":{"format":{"type":"text"},"verbosity":"medium"},"tool_choice":"auto","tool_usage":{"image_gen":{"input_tokens":0,"input_tokens_details":{"image_tokens":0,"text_tokens":0},"output_tokens":0,"output_tokens_details":{"image_tokens":0,"text_tokens":0},"total_tokens":0},"web_search":{"num_requests":0}},"tools":[],"top_logprobs":0,"top_p":1.0,"truncation":"disabled","usage":{"input_tokens":14,"input_tokens_details":{"cache_write_tokens":0,"cached_tokens":0},"output_tokens":4,"output_tokens_details":{"reasoning_tokens":0},"total_tokens":18},"user":null,"metadata":{}},"sequence_number":10} + + ' + - ' + + ' + status_code: 200 +- filename: t15 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_071f39d6a547e429006adb03c0f8d487d1bf8a2e29a176c475/input_items + query_params: {} + response: + body: + data: + - content: + - text: Reply with only VIOLET. + type: input_text + id: msg_071f39d6a547e429006adb03c1010487d1a299303a6dc6ea55 + role: user + status: completed + type: message + first_id: msg_071f39d6a547e429006adb03c1010487d1a299303a6dc6ea55 + has_more: false + last_id: msg_071f39d6a547e429006adb03c1010487d1a299303a6dc6ea55 + object: list + headers: + content-type: application/json + status_code: 200 +- filename: t16 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_0a200e2f1f716972006adb03b9a8c487d19acc32ff2238c399/input_items + query_params: + after: msg_071f39d6a547e429006adb03c1010487d1a299303a6dc6ea55 + response: + body: + error: + code: null + message: No item found with id 'msg_071f39d6a547e429006adb03c1010487d1a299303a6dc6ea55' + param: after + type: invalid_request_error + headers: + content-type: application/json + status_code: 404 diff --git a/crates/agentic-server-core/tests/cassettes/responses/response-replayed-items-gateway.yaml b/crates/agentic-server-core/tests/cassettes/responses/response-replayed-items-gateway.yaml new file mode 100644 index 000000000..19324b4f8 --- /dev/null +++ b/crates/agentic-server-core/tests/cassettes/responses/response-replayed-items-gateway.yaml @@ -0,0 +1,584 @@ +turns: +- filename: t1 + request: + body: + input: + - content: Reply with only SAPPHIRE. + role: user + model: Qwen/Qwen3.8-27B-FP8 + store: true + stream: false + headers: + accept: '*/*' + authorization: Bearer *** + content-type: application/json + user-agent: python-httpx/0.28.1 + method: POST + path: /v1/responses + query_params: {} + response: + body: + background: false + completed_at: 1792748305 + created_at: 1792748305 + error: null + frequency_penalty: 0.0 + id: resp_01a16820-3b48-7372-bd98-214486197122 + incomplete_details: null + instructions: null + max_output_tokens: null + max_tool_calls: null + metadata: {} + model: Qwen/Qwen3.8-27B-FP8 + object: response + output: + - content: + - text: 'The user wants me to reply with only the word "SAPPHIRE". + + ' + type: reasoning_text + id: rs_a593f79b2097fe2d + summary: [] + type: reasoning + - content: + - annotations: [] + text: ' + + + SAPPHIRE' + type: output_text + id: msg_9548042b171a269a + role: assistant + status: completed + type: message + parallel_tool_calls: false + presence_penalty: 0.0 + previous_response_id: null + prompt_cache_key: null + prompt_cache_options: null + reasoning: null + safety_identifier: null + service_tier: auto + status: completed + store: true + temperature: 1.0 + text: + format: + type: text + tool_choice: auto + tools: [] + top_logprobs: 0 + top_p: 1.0 + truncation: disabled + usage: + input_tokens: 47 + input_tokens_details: + cache_write_tokens: 0 + cached_tokens: 0 + output_tokens: 24 + output_tokens_details: + reasoning_tokens: 17 + total_tokens: 71 + headers: + content-type: application/json + status_code: 200 +- filename: t2 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_01a16820-3b48-7372-bd98-214486197122/input_items + query_params: + order: asc + response: + body: + data: + - content: + - text: Reply with only SAPPHIRE. + type: input_text + id: msg_01a16820-3d8b-7a11-b157-3c11de042d72 + role: user + status: completed + type: message + first_id: msg_01a16820-3d8b-7a11-b157-3c11de042d72 + has_more: false + last_id: msg_01a16820-3d8b-7a11-b157-3c11de042d72 + object: list + headers: + content-type: application/json + status_code: 200 +- filename: t3 + request: + body: + input: + - content: Reply with only ORCHID. + id: msg_01a16820-3d8b-7a11-b157-3c11de042d72 + role: user + type: message + model: Qwen/Qwen3.8-27B-FP8 + store: true + stream: false + headers: + accept: '*/*' + authorization: Bearer *** + content-type: application/json + user-agent: python-httpx/0.28.1 + method: POST + path: /v1/responses + query_params: {} + response: + body: + background: false + completed_at: 1792748306 + created_at: 1792748306 + error: null + frequency_penalty: 0.0 + id: resp_01a16820-3dae-7192-985f-b0b8cc948278 + incomplete_details: null + instructions: null + max_output_tokens: null + max_tool_calls: null + metadata: {} + model: Qwen/Qwen3.8-27B-FP8 + object: response + output: + - content: + - text: 'The user is asking me to reply with only the word "SAPPHIRE." + + ' + type: reasoning_text + id: rs_a3eb5300385d8c5a + summary: [] + type: reasoning + - content: + - annotations: [] + text: ' + + + SAPPHIRE' + type: output_text + id: msg_97f8cea357370a3f + role: assistant + status: completed + type: message + parallel_tool_calls: false + presence_penalty: 0.0 + previous_response_id: null + prompt_cache_key: null + prompt_cache_options: null + reasoning: null + safety_identifier: null + service_tier: auto + status: completed + store: true + temperature: 1.0 + text: + format: + type: text + tool_choice: auto + tools: [] + top_logprobs: 0 + top_p: 1.0 + truncation: disabled + usage: + input_tokens: 47 + input_tokens_details: + cache_write_tokens: 0 + cached_tokens: 0 + output_tokens: 25 + output_tokens_details: + reasoning_tokens: 18 + total_tokens: 72 + headers: + content-type: application/json + status_code: 200 +- filename: t4 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_01a16820-3dae-7192-985f-b0b8cc948278/input_items + query_params: + order: asc + response: + body: + data: + - content: + - text: Reply with only SAPPHIRE. + type: input_text + id: msg_01a16820-3d8b-7a11-b157-3c11de042d72 + role: user + status: completed + type: message + first_id: msg_01a16820-3d8b-7a11-b157-3c11de042d72 + has_more: false + last_id: msg_01a16820-3d8b-7a11-b157-3c11de042d72 + object: list + headers: + content-type: application/json + status_code: 200 +- filename: t5 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_01a16820-3b48-7372-bd98-214486197122/input_items + query_params: + order: asc + response: + body: + data: + - content: + - text: Reply with only SAPPHIRE. + type: input_text + id: msg_01a16820-3d8b-7a11-b157-3c11de042d72 + role: user + status: completed + type: message + first_id: msg_01a16820-3d8b-7a11-b157-3c11de042d72 + has_more: false + last_id: msg_01a16820-3d8b-7a11-b157-3c11de042d72 + object: list + headers: + content-type: application/json + status_code: 200 +- filename: t6 + request: + body: + input: + - content: Reply with only ORCHID. + id: msg_01a16820-3d8b-7a11-b157-3c11de042d72 + role: user + type: message + - content: Reply with only VIOLET. + id: msg_01a16820-3d8b-7a11-b157-3c11de042d72 + role: user + type: message + model: Qwen/Qwen3.8-27B-FP8 + store: true + stream: false + headers: + accept: '*/*' + authorization: Bearer *** + content-type: application/json + user-agent: python-httpx/0.28.1 + method: POST + path: /v1/responses + query_params: {} + response: + body: + error: + code: null + message: Duplicate item found with id msg_01a16820-3d8b-7a11-b157-3c11de042d72. + Remove duplicate items from your input and try again. + param: input + type: invalid_request_error + headers: + content-type: application/json + status_code: 400 +- filename: t7 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_01a16820-3b48-7372-bd98-214486197122/input_items + query_params: + order: asc + response: + body: + data: + - content: + - text: Reply with only SAPPHIRE. + type: input_text + id: msg_01a16820-3d8b-7a11-b157-3c11de042d72 + role: user + status: completed + type: message + first_id: msg_01a16820-3d8b-7a11-b157-3c11de042d72 + has_more: false + last_id: msg_01a16820-3d8b-7a11-b157-3c11de042d72 + object: list + headers: + content-type: application/json + status_code: 200 +- filename: t8 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_01a16820-3b48-7372-bd98-214486197122/input_items + query_params: + order: asc + response: + body: + data: + - content: + - text: Reply with only SAPPHIRE. + type: input_text + id: msg_01a16820-3d8b-7a11-b157-3c11de042d72 + role: user + status: completed + type: message + first_id: msg_01a16820-3d8b-7a11-b157-3c11de042d72 + has_more: false + last_id: msg_01a16820-3d8b-7a11-b157-3c11de042d72 + object: list + headers: + content-type: application/json + status_code: 200 +- filename: t9 + request: + body: + input: + - content: Reply with only ORCHID. + id: item_wrongprefix_d71598b4bf20d34f + role: user + type: message + model: Qwen/Qwen3.8-27B-FP8 + store: true + stream: false + headers: + accept: '*/*' + authorization: Bearer *** + content-type: application/json + user-agent: python-httpx/0.28.1 + method: POST + path: /v1/responses + query_params: {} + response: + body: + error: + code: invalid_value + message: 'Invalid ''input[0].id'': ''item_wrongprefix_d71598b4bf20d34f''. + Expected an ID that begins with ''msg''.' + param: input[0].id + type: invalid_request_error + headers: + content-type: application/json + status_code: 400 +- filename: t10 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_01a16820-3b48-7372-bd98-214486197122/input_items + query_params: + order: asc + response: + body: + data: + - content: + - text: Reply with only SAPPHIRE. + type: input_text + id: msg_01a16820-3d8b-7a11-b157-3c11de042d72 + role: user + status: completed + type: message + first_id: msg_01a16820-3d8b-7a11-b157-3c11de042d72 + has_more: false + last_id: msg_01a16820-3d8b-7a11-b157-3c11de042d72 + object: list + headers: + content-type: application/json + status_code: 200 +- filename: t11 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_01a16820-3b48-7372-bd98-214486197122/input_items + query_params: + order: asc + response: + body: + data: + - content: + - text: Reply with only SAPPHIRE. + type: input_text + id: msg_01a16820-3d8b-7a11-b157-3c11de042d72 + role: user + status: completed + type: message + first_id: msg_01a16820-3d8b-7a11-b157-3c11de042d72 + has_more: false + last_id: msg_01a16820-3d8b-7a11-b157-3c11de042d72 + object: list + headers: + content-type: application/json + status_code: 200 +- filename: t12 + request: + body: + input: + - arguments: '{}' + call_id: call_history_probe + name: lookup + type: function_call + - call_id: call_history_probe + output: SAPPHIRE + type: function_call_output + - content: Reply with only the lookup result. + role: user + model: Qwen/Qwen3.8-27B-FP8 + store: true + stream: false + headers: + accept: '*/*' + authorization: Bearer *** + content-type: application/json + user-agent: python-httpx/0.28.1 + method: POST + path: /v1/responses + query_params: {} + response: + body: + background: false + completed_at: 1792748307 + created_at: 1792748307 + error: null + frequency_penalty: 0.0 + id: resp_01a16820-4190-7cf3-aed2-e40d5f1b45da + incomplete_details: null + instructions: null + max_output_tokens: null + max_tool_calls: null + metadata: {} + model: Qwen/Qwen3.8-27B-FP8 + object: response + output: + - content: + - text: 'The user wants me to reply with only the lookup result from the previous + turn. The lookup result was "SAPPHIRE". + + ' + type: reasoning_text + id: rs_982d339e9f98aca5 + summary: [] + type: reasoning + - content: + - annotations: [] + text: ' + + + SAPPHIRE' + type: output_text + id: msg_8082f76f0614422c + role: assistant + status: completed + type: message + parallel_tool_calls: false + presence_penalty: 0.0 + previous_response_id: null + prompt_cache_key: null + prompt_cache_options: null + reasoning: null + safety_identifier: null + service_tier: auto + status: completed + store: true + temperature: 1.0 + text: + format: + type: text + tool_choice: auto + tools: [] + top_logprobs: 0 + top_p: 1.0 + truncation: disabled + usage: + input_tokens: 82 + input_tokens_details: + cache_write_tokens: 0 + cached_tokens: 0 + output_tokens: 34 + output_tokens_details: + reasoning_tokens: 27 + total_tokens: 116 + headers: + content-type: application/json + status_code: 200 +- filename: t13 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_01a16820-4190-7cf3-aed2-e40d5f1b45da/input_items + query_params: + order: asc + response: + body: + data: + - arguments: '{}' + call_id: call_history_probe + id: fc_01a16820-44a1-7dd1-8914-80ffa744f5a0 + name: lookup + type: function_call + - call_id: call_history_probe + output: SAPPHIRE + type: function_call_output + - content: + - text: Reply with only the lookup result. + type: input_text + id: msg_01a16820-44a1-7dd1-8914-8112e1445097 + role: user + status: completed + type: message + first_id: fc_01a16820-44a1-7dd1-8914-80ffa744f5a0 + has_more: false + last_id: msg_01a16820-44a1-7dd1-8914-8112e1445097 + object: list + headers: + content-type: application/json + status_code: 200 +- filename: t14 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_01a16820-3b48-7372-bd98-214486197122/input_items + query_params: + order: asc + response: + body: + data: + - content: + - text: Reply with only SAPPHIRE. + type: input_text + id: msg_01a16820-3d8b-7a11-b157-3c11de042d72 + role: user + status: completed + type: message + first_id: msg_01a16820-3d8b-7a11-b157-3c11de042d72 + has_more: false + last_id: msg_01a16820-3d8b-7a11-b157-3c11de042d72 + object: list + headers: + content-type: application/json + status_code: 200 diff --git a/crates/agentic-server-core/tests/cassettes/responses/response-replayed-items-openai.yaml b/crates/agentic-server-core/tests/cassettes/responses/response-replayed-items-openai.yaml new file mode 100644 index 000000000..ead901e85 --- /dev/null +++ b/crates/agentic-server-core/tests/cassettes/responses/response-replayed-items-openai.yaml @@ -0,0 +1,622 @@ +turns: +- filename: t1 + request: + body: + input: + - content: Reply with only SAPPHIRE. + role: user + model: gpt-4.1 + store: true + stream: false + headers: + accept: '*/*' + authorization: Bearer *** + content-type: application/json + user-agent: python-httpx/0.28.1 + method: POST + path: /v1/responses + query_params: {} + response: + body: + access_programs: null + background: false + billing: + payer: developer + completed_at: 1792738307 + created_at: 1792738306 + error: null + frequency_penalty: 0.0 + id: resp_0d0ddf1849dc41d3006adb0402ae7c87d19358aa976725cab0 + incomplete_details: null + instructions: null + max_output_tokens: null + max_tool_calls: null + metadata: {} + model: gpt-4.1-2025-04-14 + moderation: null + object: response + output: + - content: + - annotations: [] + logprobs: [] + text: SAPPHIRE + type: output_text + id: msg_0d0ddf1849dc41d3006adb04032c1887d1ac3ab98ee608ec78 + role: assistant + status: completed + type: message + parallel_tool_calls: true + presence_penalty: 0.0 + previous_response_id: null + prompt_cache_key: null + prompt_cache_retention: in_memory + reasoning: + context: null + effort: null + summary: null + safety_identifier: null + service_tier: default + status: completed + store: true + temperature: 1.0 + text: + format: + type: text + verbosity: medium + tool_choice: auto + tool_usage: + image_gen: + input_tokens: 0 + input_tokens_details: + image_tokens: 0 + text_tokens: 0 + output_tokens: 0 + output_tokens_details: + image_tokens: 0 + text_tokens: 0 + total_tokens: 0 + web_search: + num_requests: 0 + tools: [] + top_logprobs: 0 + top_p: 1.0 + truncation: disabled + usage: + input_tokens: 15 + input_tokens_details: + cache_write_tokens: 0 + cached_tokens: 0 + output_tokens: 5 + output_tokens_details: + reasoning_tokens: 0 + total_tokens: 20 + user: null + headers: + content-type: application/json + status_code: 200 +- filename: t2 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_0d0ddf1849dc41d3006adb0402ae7c87d19358aa976725cab0/input_items + query_params: + order: asc + response: + body: + data: + - content: + - text: Reply with only SAPPHIRE. + type: input_text + id: msg_0d0ddf1849dc41d3006adb0402b89c87d18d5ce807b0ef4e7c + role: user + status: completed + type: message + first_id: msg_0d0ddf1849dc41d3006adb0402b89c87d18d5ce807b0ef4e7c + has_more: false + last_id: msg_0d0ddf1849dc41d3006adb0402b89c87d18d5ce807b0ef4e7c + object: list + headers: + content-type: application/json + status_code: 200 +- filename: t3 + request: + body: + input: + - content: Reply with only ORCHID. + id: msg_0d0ddf1849dc41d3006adb0402b89c87d18d5ce807b0ef4e7c + role: user + type: message + model: gpt-4.1 + store: true + stream: false + headers: + accept: '*/*' + authorization: Bearer *** + content-type: application/json + user-agent: python-httpx/0.28.1 + method: POST + path: /v1/responses + query_params: {} + response: + body: + access_programs: null + background: false + billing: + payer: developer + completed_at: 1792738308 + created_at: 1792738308 + error: null + frequency_penalty: 0.0 + id: resp_0d0ddf1849dc41d3006adb04043eb487d1a24119a6ddfe941f + incomplete_details: null + instructions: null + max_output_tokens: null + max_tool_calls: null + metadata: {} + model: gpt-4.1-2025-04-14 + moderation: null + object: response + output: + - content: + - annotations: [] + logprobs: [] + text: SAPPHIRE. + type: output_text + id: msg_0d0ddf1849dc41d3006adb0404e0d487d191e40d604fc5c9de + role: assistant + status: completed + type: message + parallel_tool_calls: true + presence_penalty: 0.0 + previous_response_id: null + prompt_cache_key: null + prompt_cache_retention: in_memory + reasoning: + context: null + effort: null + summary: null + safety_identifier: null + service_tier: default + status: completed + store: true + temperature: 1.0 + text: + format: + type: text + verbosity: medium + tool_choice: auto + tool_usage: + image_gen: + input_tokens: 0 + input_tokens_details: + image_tokens: 0 + text_tokens: 0 + output_tokens: 0 + output_tokens_details: + image_tokens: 0 + text_tokens: 0 + total_tokens: 0 + web_search: + num_requests: 0 + tools: [] + top_logprobs: 0 + top_p: 1.0 + truncation: disabled + usage: + input_tokens: 15 + input_tokens_details: + cache_write_tokens: 0 + cached_tokens: 0 + output_tokens: 6 + output_tokens_details: + reasoning_tokens: 0 + total_tokens: 21 + user: null + headers: + content-type: application/json + status_code: 200 +- filename: t4 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_0d0ddf1849dc41d3006adb04043eb487d1a24119a6ddfe941f/input_items + query_params: + order: asc + response: + body: + data: + - content: + - text: Reply with only SAPPHIRE. + type: input_text + id: msg_0d0ddf1849dc41d3006adb0402b89c87d18d5ce807b0ef4e7c + role: user + status: completed + type: message + first_id: msg_0d0ddf1849dc41d3006adb0402b89c87d18d5ce807b0ef4e7c + has_more: false + last_id: msg_0d0ddf1849dc41d3006adb0402b89c87d18d5ce807b0ef4e7c + object: list + headers: + content-type: application/json + status_code: 200 +- filename: t5 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_0d0ddf1849dc41d3006adb0402ae7c87d19358aa976725cab0/input_items + query_params: + order: asc + response: + body: + data: + - content: + - text: Reply with only SAPPHIRE. + type: input_text + id: msg_0d0ddf1849dc41d3006adb0402b89c87d18d5ce807b0ef4e7c + role: user + status: completed + type: message + first_id: msg_0d0ddf1849dc41d3006adb0402b89c87d18d5ce807b0ef4e7c + has_more: false + last_id: msg_0d0ddf1849dc41d3006adb0402b89c87d18d5ce807b0ef4e7c + object: list + headers: + content-type: application/json + status_code: 200 +- filename: t6 + request: + body: + input: + - content: Reply with only ORCHID. + id: msg_0d0ddf1849dc41d3006adb0402b89c87d18d5ce807b0ef4e7c + role: user + type: message + - content: Reply with only VIOLET. + id: msg_0d0ddf1849dc41d3006adb0402b89c87d18d5ce807b0ef4e7c + role: user + type: message + model: gpt-4.1 + store: true + stream: false + headers: + accept: '*/*' + authorization: Bearer *** + content-type: application/json + user-agent: python-httpx/0.28.1 + method: POST + path: /v1/responses + query_params: {} + response: + body: + error: + code: null + message: Duplicate item found with id msg_0d0ddf1849dc41d3006adb0402b89c87d18d5ce807b0ef4e7c. + Remove duplicate items from your input and try again. + param: input + type: invalid_request_error + headers: + content-type: application/json + status_code: 400 +- filename: t7 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_0d0ddf1849dc41d3006adb0402ae7c87d19358aa976725cab0/input_items + query_params: + order: asc + response: + body: + data: + - content: + - text: Reply with only SAPPHIRE. + type: input_text + id: msg_0d0ddf1849dc41d3006adb0402b89c87d18d5ce807b0ef4e7c + role: user + status: completed + type: message + first_id: msg_0d0ddf1849dc41d3006adb0402b89c87d18d5ce807b0ef4e7c + has_more: false + last_id: msg_0d0ddf1849dc41d3006adb0402b89c87d18d5ce807b0ef4e7c + object: list + headers: + content-type: application/json + status_code: 200 +- filename: t8 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_0d0ddf1849dc41d3006adb0402ae7c87d19358aa976725cab0/input_items + query_params: + order: asc + response: + body: + data: + - content: + - text: Reply with only SAPPHIRE. + type: input_text + id: msg_0d0ddf1849dc41d3006adb0402b89c87d18d5ce807b0ef4e7c + role: user + status: completed + type: message + first_id: msg_0d0ddf1849dc41d3006adb0402b89c87d18d5ce807b0ef4e7c + has_more: false + last_id: msg_0d0ddf1849dc41d3006adb0402b89c87d18d5ce807b0ef4e7c + object: list + headers: + content-type: application/json + status_code: 200 +- filename: t9 + request: + body: + input: + - content: Reply with only ORCHID. + id: item_wrongprefix_1ee813b549f151e7 + role: user + type: message + model: gpt-4.1 + store: true + stream: false + headers: + accept: '*/*' + authorization: Bearer *** + content-type: application/json + user-agent: python-httpx/0.28.1 + method: POST + path: /v1/responses + query_params: {} + response: + body: + error: + code: invalid_value + message: 'Invalid ''input[0].id'': ''item_wrongprefix_1ee813b549f151e7''. + Expected an ID that begins with ''msg''.' + param: input[0].id + type: invalid_request_error + headers: + content-type: application/json + status_code: 400 +- filename: t10 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_0d0ddf1849dc41d3006adb0402ae7c87d19358aa976725cab0/input_items + query_params: + order: asc + response: + body: + data: + - content: + - text: Reply with only SAPPHIRE. + type: input_text + id: msg_0d0ddf1849dc41d3006adb0402b89c87d18d5ce807b0ef4e7c + role: user + status: completed + type: message + first_id: msg_0d0ddf1849dc41d3006adb0402b89c87d18d5ce807b0ef4e7c + has_more: false + last_id: msg_0d0ddf1849dc41d3006adb0402b89c87d18d5ce807b0ef4e7c + object: list + headers: + content-type: application/json + status_code: 200 +- filename: t11 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_0d0ddf1849dc41d3006adb0402ae7c87d19358aa976725cab0/input_items + query_params: + order: asc + response: + body: + data: + - content: + - text: Reply with only SAPPHIRE. + type: input_text + id: msg_0d0ddf1849dc41d3006adb0402b89c87d18d5ce807b0ef4e7c + role: user + status: completed + type: message + first_id: msg_0d0ddf1849dc41d3006adb0402b89c87d18d5ce807b0ef4e7c + has_more: false + last_id: msg_0d0ddf1849dc41d3006adb0402b89c87d18d5ce807b0ef4e7c + object: list + headers: + content-type: application/json + status_code: 200 +- filename: t12 + request: + body: + input: + - arguments: '{}' + call_id: call_history_probe + name: lookup + type: function_call + - call_id: call_history_probe + output: SAPPHIRE + type: function_call_output + - content: Reply with only the lookup result. + role: user + model: gpt-4.1 + store: true + stream: false + headers: + accept: '*/*' + authorization: Bearer *** + content-type: application/json + user-agent: python-httpx/0.28.1 + method: POST + path: /v1/responses + query_params: {} + response: + body: + access_programs: null + background: false + billing: + payer: developer + completed_at: 1792738313 + created_at: 1792738313 + error: null + frequency_penalty: 0.0 + id: resp_03872222178b552a006adb04095b6c87d1bca5ff94e6a26f88 + incomplete_details: null + instructions: null + max_output_tokens: null + max_tool_calls: null + metadata: {} + model: gpt-4.1-2025-04-14 + moderation: null + object: response + output: + - content: + - annotations: [] + logprobs: [] + text: SAPPHIRE + type: output_text + id: msg_03872222178b552a006adb0409ae2887d1abd9cdfec30b3b7d + role: assistant + status: completed + type: message + parallel_tool_calls: true + presence_penalty: 0.0 + previous_response_id: null + prompt_cache_key: null + prompt_cache_retention: in_memory + reasoning: + context: null + effort: null + summary: null + safety_identifier: null + service_tier: default + status: completed + store: true + temperature: 1.0 + text: + format: + type: text + verbosity: medium + tool_choice: auto + tool_usage: + image_gen: + input_tokens: 0 + input_tokens_details: + image_tokens: 0 + text_tokens: 0 + output_tokens: 0 + output_tokens_details: + image_tokens: 0 + text_tokens: 0 + total_tokens: 0 + web_search: + num_requests: 0 + tools: [] + top_logprobs: 0 + top_p: 1.0 + truncation: disabled + usage: + input_tokens: 32 + input_tokens_details: + cache_write_tokens: 0 + cached_tokens: 0 + output_tokens: 5 + output_tokens_details: + reasoning_tokens: 0 + total_tokens: 37 + user: null + headers: + content-type: application/json + status_code: 200 +- filename: t13 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_03872222178b552a006adb04095b6c87d1bca5ff94e6a26f88/input_items + query_params: + order: asc + response: + body: + data: + - arguments: '{}' + call_id: call_history_probe + id: fc_03872222178b552a006adb0409621087d1ad182bf8c2d3d7ec + name: lookup + status: in_progress + type: function_call + - call_id: call_history_probe + id: fc_03872222178b552a006adb0409622c87d1a56cb8e7d8ed31f7 + output: SAPPHIRE + status: completed + type: function_call_output + - content: + - text: Reply with only the lookup result. + type: input_text + id: msg_03872222178b552a006adb0409624487d1bcf6af6e89f7851d + role: user + status: completed + type: message + first_id: fc_03872222178b552a006adb0409621087d1ad182bf8c2d3d7ec + has_more: false + last_id: msg_03872222178b552a006adb0409624487d1bcf6af6e89f7851d + object: list + headers: + content-type: application/json + status_code: 200 +- filename: t14 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_0d0ddf1849dc41d3006adb0402ae7c87d19358aa976725cab0/input_items + query_params: + order: asc + response: + body: + data: + - content: + - text: Reply with only SAPPHIRE. + type: input_text + id: msg_0d0ddf1849dc41d3006adb0402b89c87d18d5ce807b0ef4e7c + role: user + status: completed + type: message + first_id: msg_0d0ddf1849dc41d3006adb0402b89c87d18d5ce807b0ef4e7c + has_more: false + last_id: msg_0d0ddf1849dc41d3006adb0402b89c87d18d5ce807b0ef4e7c + object: list + headers: + content-type: application/json + status_code: 200 diff --git a/crates/agentic-server-core/tests/cassettes/responses/response-replayed-items-stream-gateway.yaml b/crates/agentic-server-core/tests/cassettes/responses/response-replayed-items-stream-gateway.yaml new file mode 100644 index 000000000..52eb2cd89 --- /dev/null +++ b/crates/agentic-server-core/tests/cassettes/responses/response-replayed-items-stream-gateway.yaml @@ -0,0 +1,830 @@ +turns: +- filename: t1 + request: + body: + input: + - content: Reply with only SAPPHIRE. + role: user + model: Qwen/Qwen3.8-27B-FP8 + store: true + stream: true + headers: + accept: '*/*' + authorization: Bearer *** + content-type: application/json + user-agent: python-httpx/0.28.1 + method: POST + path: /v1/responses + query_params: {} + response: + headers: + content-type: text/event-stream; charset=utf-8 + sse: + - 'event: response.created + + ' + - 'data: {"type":"response.created","sequence_number":0,"response":{"id":"resp_01a16820-4a84-7ac2-86de-a8608839d611","created_at":1792748309,"incomplete_details":null,"instructions":null,"metadata":{},"model":"Qwen/Qwen3.8-27B-FP8","object":"response","output":[],"parallel_tool_calls":false,"temperature":1.0,"tool_choice":"none","tools":[],"top_p":1.0,"background":false,"max_output_tokens":null,"max_tool_calls":null,"previous_response_id":null,"prompt":null,"reasoning":null,"service_tier":"auto","status":"in_progress","text":{"format":{"type":"text"}},"top_logprobs":0,"truncation":"disabled","usage":null,"user":null,"presence_penalty":0.0,"frequency_penalty":0.0,"kv_transfer_params":null,"ec_transfer_params":null,"input_messages":null,"output_messages":null,"completed_at":null,"store":true,"safety_identifier":null,"prompt_cache_key":null,"prompt_cache_options":null,"error":null}} + + ' + - ' + + ' + - 'event: response.in_progress + + ' + - 'data: {"type":"response.in_progress","sequence_number":1,"response":{"id":"resp_01a16820-4a84-7ac2-86de-a8608839d611","created_at":1792748309,"incomplete_details":null,"instructions":null,"metadata":{},"model":"Qwen/Qwen3.8-27B-FP8","object":"response","output":[],"parallel_tool_calls":false,"temperature":1.0,"tool_choice":"none","tools":[],"top_p":1.0,"background":false,"max_output_tokens":null,"max_tool_calls":null,"previous_response_id":null,"prompt":null,"reasoning":null,"service_tier":"auto","status":"in_progress","text":{"format":{"type":"text"}},"top_logprobs":0,"truncation":"disabled","usage":null,"user":null,"presence_penalty":0.0,"frequency_penalty":0.0,"kv_transfer_params":null,"ec_transfer_params":null,"input_messages":null,"output_messages":null,"completed_at":null,"store":true,"safety_identifier":null,"prompt_cache_key":null,"prompt_cache_options":null,"error":null}} + + ' + - ' + + ' + - 'event: response.output_item.added + + ' + - 'data: {"type":"response.output_item.added","sequence_number":2,"output_index":0,"item":{"id":"rs_a4cd688dbf81fe1f","summary":[],"type":"reasoning","content":[],"status":"in_progress"}} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"type":"response.reasoning_text.delta","sequence_number":3,"output_index":0,"content_index":0,"delta":"The","item_id":"rs_a4cd688dbf81fe1f"} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"type":"response.reasoning_text.delta","sequence_number":4,"output_index":0,"content_index":0,"delta":" + user","item_id":"rs_a4cd688dbf81fe1f"} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"type":"response.reasoning_text.delta","sequence_number":5,"output_index":0,"content_index":0,"delta":" + wants","item_id":"rs_a4cd688dbf81fe1f"} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"type":"response.reasoning_text.delta","sequence_number":6,"output_index":0,"content_index":0,"delta":" + me","item_id":"rs_a4cd688dbf81fe1f"} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"type":"response.reasoning_text.delta","sequence_number":7,"output_index":0,"content_index":0,"delta":" + to","item_id":"rs_a4cd688dbf81fe1f"} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"type":"response.reasoning_text.delta","sequence_number":8,"output_index":0,"content_index":0,"delta":" + reply","item_id":"rs_a4cd688dbf81fe1f"} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"type":"response.reasoning_text.delta","sequence_number":9,"output_index":0,"content_index":0,"delta":" + with","item_id":"rs_a4cd688dbf81fe1f"} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"type":"response.reasoning_text.delta","sequence_number":10,"output_index":0,"content_index":0,"delta":" + only","item_id":"rs_a4cd688dbf81fe1f"} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"type":"response.reasoning_text.delta","sequence_number":11,"output_index":0,"content_index":0,"delta":" + the","item_id":"rs_a4cd688dbf81fe1f"} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"type":"response.reasoning_text.delta","sequence_number":12,"output_index":0,"content_index":0,"delta":" + word","item_id":"rs_a4cd688dbf81fe1f"} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"type":"response.reasoning_text.delta","sequence_number":13,"output_index":0,"content_index":0,"delta":" + \"","item_id":"rs_a4cd688dbf81fe1f"} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"type":"response.reasoning_text.delta","sequence_number":14,"output_index":0,"content_index":0,"delta":"S","item_id":"rs_a4cd688dbf81fe1f"} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"type":"response.reasoning_text.delta","sequence_number":15,"output_index":0,"content_index":0,"delta":"AP","item_id":"rs_a4cd688dbf81fe1f"} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"type":"response.reasoning_text.delta","sequence_number":16,"output_index":0,"content_index":0,"delta":"PH","item_id":"rs_a4cd688dbf81fe1f"} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"type":"response.reasoning_text.delta","sequence_number":17,"output_index":0,"content_index":0,"delta":"IRE","item_id":"rs_a4cd688dbf81fe1f"} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"type":"response.reasoning_text.delta","sequence_number":18,"output_index":0,"content_index":0,"delta":".\"","item_id":"rs_a4cd688dbf81fe1f"} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"type":"response.reasoning_text.delta","sequence_number":19,"output_index":0,"content_index":0,"delta":"\n","item_id":"rs_a4cd688dbf81fe1f"} + + ' + - ' + + ' + - 'event: response.reasoning_text.done + + ' + - 'data: {"type":"response.reasoning_text.done","sequence_number":20,"output_index":0,"content_index":0,"item_id":"rs_a4cd688dbf81fe1f","text":"The + user wants me to reply with only the word \"SAPPHIRE.\"\n"} + + ' + - ' + + ' + - 'event: response.output_item.done + + ' + - 'data: {"type":"response.output_item.done","sequence_number":21,"output_index":0,"item":{"id":"rs_a4cd688dbf81fe1f","summary":[],"type":"reasoning","content":[{"text":"The + user wants me to reply with only the word \"SAPPHIRE.\"\n","type":"reasoning_text"}],"status":"completed"}} + + ' + - ' + + ' + - 'event: response.output_item.added + + ' + - 'data: {"type":"response.output_item.added","sequence_number":22,"output_index":1,"item":{"id":"msg_baaee0fee3e10a0d","content":[],"role":"assistant","status":"in_progress","type":"message"}} + + ' + - ' + + ' + - 'event: response.content_part.added + + ' + - 'data: {"type":"response.content_part.added","sequence_number":23,"output_index":1,"content_index":0,"item_id":"msg_baaee0fee3e10a0d","part":{"annotations":[],"text":"","type":"output_text","logprobs":[]}} + + ' + - ' + + ' + - 'event: response.output_text.delta + + ' + - 'data: {"type":"response.output_text.delta","sequence_number":24,"output_index":1,"content_index":0,"delta":"\n\nS","item_id":"msg_baaee0fee3e10a0d","logprobs":[]} + + ' + - ' + + ' + - 'event: response.output_text.delta + + ' + - 'data: {"type":"response.output_text.delta","sequence_number":25,"output_index":1,"content_index":0,"delta":"AP","item_id":"msg_baaee0fee3e10a0d","logprobs":[]} + + ' + - ' + + ' + - 'event: response.output_text.delta + + ' + - 'data: {"type":"response.output_text.delta","sequence_number":26,"output_index":1,"content_index":0,"delta":"PH","item_id":"msg_baaee0fee3e10a0d","logprobs":[]} + + ' + - ' + + ' + - 'event: response.output_text.delta + + ' + - 'data: {"type":"response.output_text.delta","sequence_number":27,"output_index":1,"content_index":0,"delta":"IRE","item_id":"msg_baaee0fee3e10a0d","logprobs":[]} + + ' + - ' + + ' + - 'event: response.output_text.done + + ' + - 'data: {"type":"response.output_text.done","sequence_number":28,"output_index":1,"content_index":0,"item_id":"msg_baaee0fee3e10a0d","logprobs":[],"text":"\n\nSAPPHIRE"} + + ' + - ' + + ' + - 'event: response.content_part.done + + ' + - 'data: {"type":"response.content_part.done","sequence_number":29,"output_index":1,"content_index":0,"item_id":"msg_baaee0fee3e10a0d","part":{"annotations":[],"text":"\n\nSAPPHIRE","type":"output_text","logprobs":[]}} + + ' + - ' + + ' + - 'event: response.output_item.done + + ' + - 'data: {"type":"response.output_item.done","sequence_number":30,"output_index":1,"item":{"id":"msg_baaee0fee3e10a0d","content":[{"annotations":[],"text":"\n\nSAPPHIRE","type":"output_text","logprobs":[]}],"role":"assistant","status":"completed","type":"message"}} + + ' + - ' + + ' + - 'event: response.completed + + ' + - 'data: {"type":"response.completed","sequence_number":31,"response":{"id":"resp_01a16820-4a84-7ac2-86de-a8608839d611","object":"response","created_at":1792748309,"model":"Qwen/Qwen3.8-27B-FP8","status":"completed","output":[{"type":"reasoning","id":"rs_a4cd688dbf81fe1f","content":[{"type":"reasoning_text","text":"The + user wants me to reply with only the word \"SAPPHIRE.\"\n"}],"summary":[],"status":"completed"},{"type":"message","id":"msg_baaee0fee3e10a0d","role":"assistant","status":"completed","content":[{"type":"output_text","text":"\n\nSAPPHIRE","annotations":[]}]}],"usage":{"input_tokens":47,"output_tokens":24,"total_tokens":71,"input_tokens_details":{"cached_tokens":0,"cache_write_tokens":0},"output_tokens_details":{"reasoning_tokens":17}},"incomplete_details":null,"error":null,"previous_response_id":null,"instructions":null,"max_tool_calls":null,"service_tier":"auto","tools":[],"tool_choice":"auto","completed_at":1792748309,"truncation":"disabled","parallel_tool_calls":false,"text":{"format":{"type":"text"}},"top_p":1.0,"presence_penalty":0.0,"frequency_penalty":0.0,"top_logprobs":0,"temperature":1.0,"reasoning":null,"max_output_tokens":null,"store":true,"background":false,"metadata":{},"safety_identifier":null,"prompt_cache_key":null,"prompt_cache_options":null}} + + ' + - ' + + ' + - 'data: [DONE] + + ' + - ' + + ' + status_code: 200 +- filename: t2 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_01a16820-4a84-7ac2-86de-a8608839d611/input_items + query_params: + order: asc + response: + body: + data: + - content: + - text: Reply with only SAPPHIRE. + type: input_text + id: msg_01a16820-4cc9-7541-b7d9-55e4add4cbe4 + role: user + status: completed + type: message + first_id: msg_01a16820-4cc9-7541-b7d9-55e4add4cbe4 + has_more: false + last_id: msg_01a16820-4cc9-7541-b7d9-55e4add4cbe4 + object: list + headers: + content-type: application/json + status_code: 200 +- filename: t3 + request: + body: + input: + - content: Reply with only ORCHID. + id: msg_01a16820-4cc9-7541-b7d9-55e4add4cbe4 + role: user + type: message + model: Qwen/Qwen3.8-27B-FP8 + store: true + stream: false + headers: + accept: '*/*' + authorization: Bearer *** + content-type: application/json + user-agent: python-httpx/0.28.1 + method: POST + path: /v1/responses + query_params: {} + response: + body: + background: false + completed_at: 1792748310 + created_at: 1792748310 + error: null + frequency_penalty: 0.0 + id: resp_01a16820-4d06-72e2-98b8-4426fea978c9 + incomplete_details: null + instructions: null + max_output_tokens: null + max_tool_calls: null + metadata: {} + model: Qwen/Qwen3.8-27B-FP8 + object: response + output: + - content: + - text: 'The user wants me to reply with only the word "SAPPHIRE". + + ' + type: reasoning_text + id: rs_bfa9f6bd06e01a21 + summary: [] + type: reasoning + - content: + - annotations: [] + text: ' + + + SAPPHIRE' + type: output_text + id: msg_b1f359add9782112 + role: assistant + status: completed + type: message + parallel_tool_calls: false + presence_penalty: 0.0 + previous_response_id: null + prompt_cache_key: null + prompt_cache_options: null + reasoning: null + safety_identifier: null + service_tier: auto + status: completed + store: true + temperature: 1.0 + text: + format: + type: text + tool_choice: auto + tools: [] + top_logprobs: 0 + top_p: 1.0 + truncation: disabled + usage: + input_tokens: 47 + input_tokens_details: + cache_write_tokens: 0 + cached_tokens: 0 + output_tokens: 24 + output_tokens_details: + reasoning_tokens: 17 + total_tokens: 71 + headers: + content-type: application/json + status_code: 200 +- filename: t4 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_01a16820-4d06-72e2-98b8-4426fea978c9/input_items + query_params: + order: asc + response: + body: + data: + - content: + - text: Reply with only SAPPHIRE. + type: input_text + id: msg_01a16820-4cc9-7541-b7d9-55e4add4cbe4 + role: user + status: completed + type: message + first_id: msg_01a16820-4cc9-7541-b7d9-55e4add4cbe4 + has_more: false + last_id: msg_01a16820-4cc9-7541-b7d9-55e4add4cbe4 + object: list + headers: + content-type: application/json + status_code: 200 +- filename: t5 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_01a16820-4a84-7ac2-86de-a8608839d611/input_items + query_params: + order: asc + response: + body: + data: + - content: + - text: Reply with only SAPPHIRE. + type: input_text + id: msg_01a16820-4cc9-7541-b7d9-55e4add4cbe4 + role: user + status: completed + type: message + first_id: msg_01a16820-4cc9-7541-b7d9-55e4add4cbe4 + has_more: false + last_id: msg_01a16820-4cc9-7541-b7d9-55e4add4cbe4 + object: list + headers: + content-type: application/json + status_code: 200 +- filename: t6 + request: + body: + input: + - content: Reply with only ORCHID. + id: msg_01a16820-4cc9-7541-b7d9-55e4add4cbe4 + role: user + type: message + - content: Reply with only VIOLET. + id: msg_01a16820-4cc9-7541-b7d9-55e4add4cbe4 + role: user + type: message + model: Qwen/Qwen3.8-27B-FP8 + store: true + stream: false + headers: + accept: '*/*' + authorization: Bearer *** + content-type: application/json + user-agent: python-httpx/0.28.1 + method: POST + path: /v1/responses + query_params: {} + response: + body: + error: + code: null + message: Duplicate item found with id msg_01a16820-4cc9-7541-b7d9-55e4add4cbe4. + Remove duplicate items from your input and try again. + param: input + type: invalid_request_error + headers: + content-type: application/json + status_code: 400 +- filename: t7 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_01a16820-4a84-7ac2-86de-a8608839d611/input_items + query_params: + order: asc + response: + body: + data: + - content: + - text: Reply with only SAPPHIRE. + type: input_text + id: msg_01a16820-4cc9-7541-b7d9-55e4add4cbe4 + role: user + status: completed + type: message + first_id: msg_01a16820-4cc9-7541-b7d9-55e4add4cbe4 + has_more: false + last_id: msg_01a16820-4cc9-7541-b7d9-55e4add4cbe4 + object: list + headers: + content-type: application/json + status_code: 200 +- filename: t8 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_01a16820-4a84-7ac2-86de-a8608839d611/input_items + query_params: + order: asc + response: + body: + data: + - content: + - text: Reply with only SAPPHIRE. + type: input_text + id: msg_01a16820-4cc9-7541-b7d9-55e4add4cbe4 + role: user + status: completed + type: message + first_id: msg_01a16820-4cc9-7541-b7d9-55e4add4cbe4 + has_more: false + last_id: msg_01a16820-4cc9-7541-b7d9-55e4add4cbe4 + object: list + headers: + content-type: application/json + status_code: 200 +- filename: t9 + request: + body: + input: + - content: Reply with only ORCHID. + id: item_wrongprefix_89b8b67d44667ef6 + role: user + type: message + model: Qwen/Qwen3.8-27B-FP8 + store: true + stream: false + headers: + accept: '*/*' + authorization: Bearer *** + content-type: application/json + user-agent: python-httpx/0.28.1 + method: POST + path: /v1/responses + query_params: {} + response: + body: + error: + code: invalid_value + message: 'Invalid ''input[0].id'': ''item_wrongprefix_89b8b67d44667ef6''. + Expected an ID that begins with ''msg''.' + param: input[0].id + type: invalid_request_error + headers: + content-type: application/json + status_code: 400 +- filename: t10 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_01a16820-4a84-7ac2-86de-a8608839d611/input_items + query_params: + order: asc + response: + body: + data: + - content: + - text: Reply with only SAPPHIRE. + type: input_text + id: msg_01a16820-4cc9-7541-b7d9-55e4add4cbe4 + role: user + status: completed + type: message + first_id: msg_01a16820-4cc9-7541-b7d9-55e4add4cbe4 + has_more: false + last_id: msg_01a16820-4cc9-7541-b7d9-55e4add4cbe4 + object: list + headers: + content-type: application/json + status_code: 200 +- filename: t11 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_01a16820-4a84-7ac2-86de-a8608839d611/input_items + query_params: + order: asc + response: + body: + data: + - content: + - text: Reply with only SAPPHIRE. + type: input_text + id: msg_01a16820-4cc9-7541-b7d9-55e4add4cbe4 + role: user + status: completed + type: message + first_id: msg_01a16820-4cc9-7541-b7d9-55e4add4cbe4 + has_more: false + last_id: msg_01a16820-4cc9-7541-b7d9-55e4add4cbe4 + object: list + headers: + content-type: application/json + status_code: 200 +- filename: t12 + request: + body: + input: + - arguments: '{}' + call_id: call_history_probe + name: lookup + type: function_call + - call_id: call_history_probe + output: SAPPHIRE + type: function_call_output + - content: Reply with only the lookup result. + role: user + model: Qwen/Qwen3.8-27B-FP8 + store: true + stream: false + headers: + accept: '*/*' + authorization: Bearer *** + content-type: application/json + user-agent: python-httpx/0.28.1 + method: POST + path: /v1/responses + query_params: {} + response: + body: + background: false + completed_at: 1792748311 + created_at: 1792748311 + error: null + frequency_penalty: 0.0 + id: resp_01a16820-5138-7cc1-9558-14011b3410b4 + incomplete_details: null + instructions: null + max_output_tokens: null + max_tool_calls: null + metadata: {} + model: Qwen/Qwen3.8-27B-FP8 + object: response + output: + - content: + - text: 'The user wants me to reply with only the lookup result, which was + "SAPPHIRE". + + ' + type: reasoning_text + id: rs_83b3dbf08db452a7 + summary: [] + type: reasoning + - content: + - annotations: [] + text: ' + + + SAPPHIRE' + type: output_text + id: msg_b3e0297184259a99 + role: assistant + status: completed + type: message + parallel_tool_calls: false + presence_penalty: 0.0 + previous_response_id: null + prompt_cache_key: null + prompt_cache_options: null + reasoning: null + safety_identifier: null + service_tier: auto + status: completed + store: true + temperature: 1.0 + text: + format: + type: text + tool_choice: auto + tools: [] + top_logprobs: 0 + top_p: 1.0 + truncation: disabled + usage: + input_tokens: 82 + input_tokens_details: + cache_write_tokens: 0 + cached_tokens: 0 + output_tokens: 28 + output_tokens_details: + reasoning_tokens: 21 + total_tokens: 110 + headers: + content-type: application/json + status_code: 200 +- filename: t13 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_01a16820-5138-7cc1-9558-14011b3410b4/input_items + query_params: + order: asc + response: + body: + data: + - arguments: '{}' + call_id: call_history_probe + id: fc_01a16820-53d1-7583-851b-b15b6d9fd689 + name: lookup + type: function_call + - call_id: call_history_probe + output: SAPPHIRE + type: function_call_output + - content: + - text: Reply with only the lookup result. + type: input_text + id: msg_01a16820-53d1-7583-851b-b17055be1005 + role: user + status: completed + type: message + first_id: fc_01a16820-53d1-7583-851b-b15b6d9fd689 + has_more: false + last_id: msg_01a16820-53d1-7583-851b-b17055be1005 + object: list + headers: + content-type: application/json + status_code: 200 +- filename: t14 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_01a16820-4a84-7ac2-86de-a8608839d611/input_items + query_params: + order: asc + response: + body: + data: + - content: + - text: Reply with only SAPPHIRE. + type: input_text + id: msg_01a16820-4cc9-7541-b7d9-55e4add4cbe4 + role: user + status: completed + type: message + first_id: msg_01a16820-4cc9-7541-b7d9-55e4add4cbe4 + has_more: false + last_id: msg_01a16820-4cc9-7541-b7d9-55e4add4cbe4 + object: list + headers: + content-type: application/json + status_code: 200 diff --git a/crates/agentic-server-core/tests/cassettes/responses/response-replayed-items-stream-openai.yaml b/crates/agentic-server-core/tests/cassettes/responses/response-replayed-items-stream-openai.yaml new file mode 100644 index 000000000..88549e2f8 --- /dev/null +++ b/crates/agentic-server-core/tests/cassettes/responses/response-replayed-items-stream-openai.yaml @@ -0,0 +1,657 @@ +turns: +- filename: t1 + request: + body: + input: + - content: Reply with only SAPPHIRE. + role: user + model: gpt-4.1 + store: true + stream: true + headers: + accept: '*/*' + authorization: Bearer *** + content-type: application/json + user-agent: python-httpx/0.28.1 + method: POST + path: /v1/responses + query_params: {} + response: + headers: + content-type: text/event-stream; charset=utf-8 + sse: + - 'event: response.created + + ' + - 'data: {"type":"response.created","response":{"id":"resp_0e216db7dd114c74006adb040d012887d191fcf7e9076c5065","object":"response","created_at":1792738317,"status":"in_progress","access_programs":null,"background":false,"completed_at":null,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"max_tool_calls":null,"model":"gpt-4.1-2025-04-14","moderation":null,"output":[],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":null,"prompt_cache_key":null,"prompt_cache_retention":"in_memory","reasoning":{"context":null,"effort":null,"summary":null},"safety_identifier":null,"service_tier":"auto","store":true,"temperature":1.0,"text":{"format":{"type":"text"},"verbosity":"medium"},"tool_choice":"auto","tool_usage":{"image_gen":{"input_tokens":0,"input_tokens_details":{"image_tokens":0,"text_tokens":0},"output_tokens":0,"output_tokens_details":{"image_tokens":0,"text_tokens":0},"total_tokens":0},"web_search":{"num_requests":0}},"tools":[],"top_logprobs":0,"top_p":1.0,"truncation":"disabled","usage":null,"user":null,"metadata":{}},"sequence_number":0} + + ' + - ' + + ' + - 'event: response.in_progress + + ' + - 'data: {"type":"response.in_progress","response":{"id":"resp_0e216db7dd114c74006adb040d012887d191fcf7e9076c5065","object":"response","created_at":1792738317,"status":"in_progress","access_programs":null,"background":false,"completed_at":null,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"max_tool_calls":null,"model":"gpt-4.1-2025-04-14","moderation":null,"output":[],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":null,"prompt_cache_key":null,"prompt_cache_retention":"in_memory","reasoning":{"context":null,"effort":null,"summary":null},"safety_identifier":null,"service_tier":"auto","store":true,"temperature":1.0,"text":{"format":{"type":"text"},"verbosity":"medium"},"tool_choice":"auto","tool_usage":{"image_gen":{"input_tokens":0,"input_tokens_details":{"image_tokens":0,"text_tokens":0},"output_tokens":0,"output_tokens_details":{"image_tokens":0,"text_tokens":0},"total_tokens":0},"web_search":{"num_requests":0}},"tools":[],"top_logprobs":0,"top_p":1.0,"truncation":"disabled","usage":null,"user":null,"metadata":{}},"sequence_number":1} + + ' + - ' + + ' + - 'event: response.output_item.added + + ' + - 'data: {"type":"response.output_item.added","item":{"id":"msg_0e216db7dd114c74006adb040d86bc87d185232eff15c99472","type":"message","status":"in_progress","content":[],"role":"assistant"},"output_index":0,"sequence_number":2} + + ' + - ' + + ' + - 'event: response.content_part.added + + ' + - 'data: {"type":"response.content_part.added","content_index":0,"item_id":"msg_0e216db7dd114c74006adb040d86bc87d185232eff15c99472","output_index":0,"part":{"type":"output_text","annotations":[],"logprobs":[],"text":""},"sequence_number":3} + + ' + - ' + + ' + - 'event: response.output_text.delta + + ' + - 'data: {"type":"response.output_text.delta","content_index":0,"delta":"S","item_id":"msg_0e216db7dd114c74006adb040d86bc87d185232eff15c99472","logprobs":[],"obfuscation":"jDUVS0PoO3xRaqe","output_index":0,"sequence_number":4} + + ' + - ' + + ' + - 'event: response.output_text.delta + + ' + - 'data: {"type":"response.output_text.delta","content_index":0,"delta":"APP","item_id":"msg_0e216db7dd114c74006adb040d86bc87d185232eff15c99472","logprobs":[],"obfuscation":"4AYenFhaKfbhZ","output_index":0,"sequence_number":5} + + ' + - ' + + ' + - 'event: response.output_text.delta + + ' + - 'data: {"type":"response.output_text.delta","content_index":0,"delta":"H","item_id":"msg_0e216db7dd114c74006adb040d86bc87d185232eff15c99472","logprobs":[],"obfuscation":"kHedfu7aXYcdNzr","output_index":0,"sequence_number":6} + + ' + - ' + + ' + - 'event: response.output_text.delta + + ' + - 'data: {"type":"response.output_text.delta","content_index":0,"delta":"IRE","item_id":"msg_0e216db7dd114c74006adb040d86bc87d185232eff15c99472","logprobs":[],"obfuscation":"KpMbzksiWxTXX","output_index":0,"sequence_number":7} + + ' + - ' + + ' + - 'event: response.output_text.done + + ' + - 'data: {"type":"response.output_text.done","content_index":0,"item_id":"msg_0e216db7dd114c74006adb040d86bc87d185232eff15c99472","logprobs":[],"output_index":0,"sequence_number":8,"text":"SAPPHIRE"} + + ' + - ' + + ' + - 'event: response.content_part.done + + ' + - 'data: {"type":"response.content_part.done","content_index":0,"item_id":"msg_0e216db7dd114c74006adb040d86bc87d185232eff15c99472","output_index":0,"part":{"type":"output_text","annotations":[],"logprobs":[],"text":"SAPPHIRE"},"sequence_number":9} + + ' + - ' + + ' + - 'event: response.output_item.done + + ' + - 'data: {"type":"response.output_item.done","item":{"id":"msg_0e216db7dd114c74006adb040d86bc87d185232eff15c99472","type":"message","status":"completed","content":[{"type":"output_text","annotations":[],"logprobs":[],"text":"SAPPHIRE"}],"role":"assistant"},"output_index":0,"sequence_number":10} + + ' + - ' + + ' + - 'event: response.completed + + ' + - 'data: {"type":"response.completed","response":{"id":"resp_0e216db7dd114c74006adb040d012887d191fcf7e9076c5065","object":"response","created_at":1792738317,"status":"completed","access_programs":null,"background":false,"completed_at":1792738317,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"max_tool_calls":null,"model":"gpt-4.1-2025-04-14","moderation":null,"output":[{"id":"msg_0e216db7dd114c74006adb040d86bc87d185232eff15c99472","type":"message","status":"completed","content":[{"type":"output_text","annotations":[],"logprobs":[],"text":"SAPPHIRE"}],"role":"assistant"}],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":null,"prompt_cache_key":null,"prompt_cache_retention":"in_memory","reasoning":{"context":null,"effort":null,"summary":null},"safety_identifier":null,"service_tier":"default","store":true,"temperature":1.0,"text":{"format":{"type":"text"},"verbosity":"medium"},"tool_choice":"auto","tool_usage":{"image_gen":{"input_tokens":0,"input_tokens_details":{"image_tokens":0,"text_tokens":0},"output_tokens":0,"output_tokens_details":{"image_tokens":0,"text_tokens":0},"total_tokens":0},"web_search":{"num_requests":0}},"tools":[],"top_logprobs":0,"top_p":1.0,"truncation":"disabled","usage":{"input_tokens":15,"input_tokens_details":{"cache_write_tokens":0,"cached_tokens":0},"output_tokens":5,"output_tokens_details":{"reasoning_tokens":0},"total_tokens":20},"user":null,"metadata":{}},"sequence_number":11} + + ' + - ' + + ' + status_code: 200 +- filename: t2 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_0e216db7dd114c74006adb040d012887d191fcf7e9076c5065/input_items + query_params: + order: asc + response: + body: + data: + - content: + - text: Reply with only SAPPHIRE. + type: input_text + id: msg_0e216db7dd114c74006adb040d115087d1a56c09556fcd9c28 + role: user + status: completed + type: message + first_id: msg_0e216db7dd114c74006adb040d115087d1a56c09556fcd9c28 + has_more: false + last_id: msg_0e216db7dd114c74006adb040d115087d1a56c09556fcd9c28 + object: list + headers: + content-type: application/json + status_code: 200 +- filename: t3 + request: + body: + input: + - content: Reply with only ORCHID. + id: msg_0e216db7dd114c74006adb040d115087d1a56c09556fcd9c28 + role: user + type: message + model: gpt-4.1 + store: true + stream: false + headers: + accept: '*/*' + authorization: Bearer *** + content-type: application/json + user-agent: python-httpx/0.28.1 + method: POST + path: /v1/responses + query_params: {} + response: + body: + access_programs: null + background: false + billing: + payer: developer + completed_at: 1792738319 + created_at: 1792738319 + error: null + frequency_penalty: 0.0 + id: resp_0e216db7dd114c74006adb040efc3087d1b2dbe55b54238b63 + incomplete_details: null + instructions: null + max_output_tokens: null + max_tool_calls: null + metadata: {} + model: gpt-4.1-2025-04-14 + moderation: null + object: response + output: + - content: + - annotations: [] + logprobs: [] + text: SAPPHIRE + type: output_text + id: msg_0e216db7dd114c74006adb040f7c8087d18261391f23edd41b + role: assistant + status: completed + type: message + parallel_tool_calls: true + presence_penalty: 0.0 + previous_response_id: null + prompt_cache_key: null + prompt_cache_retention: in_memory + reasoning: + context: null + effort: null + summary: null + safety_identifier: null + service_tier: default + status: completed + store: true + temperature: 1.0 + text: + format: + type: text + verbosity: medium + tool_choice: auto + tool_usage: + image_gen: + input_tokens: 0 + input_tokens_details: + image_tokens: 0 + text_tokens: 0 + output_tokens: 0 + output_tokens_details: + image_tokens: 0 + text_tokens: 0 + total_tokens: 0 + web_search: + num_requests: 0 + tools: [] + top_logprobs: 0 + top_p: 1.0 + truncation: disabled + usage: + input_tokens: 15 + input_tokens_details: + cache_write_tokens: 0 + cached_tokens: 0 + output_tokens: 5 + output_tokens_details: + reasoning_tokens: 0 + total_tokens: 20 + user: null + headers: + content-type: application/json + status_code: 200 +- filename: t4 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_0e216db7dd114c74006adb040efc3087d1b2dbe55b54238b63/input_items + query_params: + order: asc + response: + body: + data: + - content: + - text: Reply with only SAPPHIRE. + type: input_text + id: msg_0e216db7dd114c74006adb040d115087d1a56c09556fcd9c28 + role: user + status: completed + type: message + first_id: msg_0e216db7dd114c74006adb040d115087d1a56c09556fcd9c28 + has_more: false + last_id: msg_0e216db7dd114c74006adb040d115087d1a56c09556fcd9c28 + object: list + headers: + content-type: application/json + status_code: 200 +- filename: t5 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_0e216db7dd114c74006adb040d012887d191fcf7e9076c5065/input_items + query_params: + order: asc + response: + body: + data: + - content: + - text: Reply with only SAPPHIRE. + type: input_text + id: msg_0e216db7dd114c74006adb040d115087d1a56c09556fcd9c28 + role: user + status: completed + type: message + first_id: msg_0e216db7dd114c74006adb040d115087d1a56c09556fcd9c28 + has_more: false + last_id: msg_0e216db7dd114c74006adb040d115087d1a56c09556fcd9c28 + object: list + headers: + content-type: application/json + status_code: 200 +- filename: t6 + request: + body: + input: + - content: Reply with only ORCHID. + id: msg_0e216db7dd114c74006adb040d115087d1a56c09556fcd9c28 + role: user + type: message + - content: Reply with only VIOLET. + id: msg_0e216db7dd114c74006adb040d115087d1a56c09556fcd9c28 + role: user + type: message + model: gpt-4.1 + store: true + stream: false + headers: + accept: '*/*' + authorization: Bearer *** + content-type: application/json + user-agent: python-httpx/0.28.1 + method: POST + path: /v1/responses + query_params: {} + response: + body: + error: + code: null + message: Duplicate item found with id msg_0e216db7dd114c74006adb040d115087d1a56c09556fcd9c28. + Remove duplicate items from your input and try again. + param: input + type: invalid_request_error + headers: + content-type: application/json + status_code: 400 +- filename: t7 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_0e216db7dd114c74006adb040d012887d191fcf7e9076c5065/input_items + query_params: + order: asc + response: + body: + data: + - content: + - text: Reply with only SAPPHIRE. + type: input_text + id: msg_0e216db7dd114c74006adb040d115087d1a56c09556fcd9c28 + role: user + status: completed + type: message + first_id: msg_0e216db7dd114c74006adb040d115087d1a56c09556fcd9c28 + has_more: false + last_id: msg_0e216db7dd114c74006adb040d115087d1a56c09556fcd9c28 + object: list + headers: + content-type: application/json + status_code: 200 +- filename: t8 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_0e216db7dd114c74006adb040d012887d191fcf7e9076c5065/input_items + query_params: + order: asc + response: + body: + data: + - content: + - text: Reply with only SAPPHIRE. + type: input_text + id: msg_0e216db7dd114c74006adb040d115087d1a56c09556fcd9c28 + role: user + status: completed + type: message + first_id: msg_0e216db7dd114c74006adb040d115087d1a56c09556fcd9c28 + has_more: false + last_id: msg_0e216db7dd114c74006adb040d115087d1a56c09556fcd9c28 + object: list + headers: + content-type: application/json + status_code: 200 +- filename: t9 + request: + body: + input: + - content: Reply with only ORCHID. + id: item_wrongprefix_ac26da7b8747efee + role: user + type: message + model: gpt-4.1 + store: true + stream: false + headers: + accept: '*/*' + authorization: Bearer *** + content-type: application/json + user-agent: python-httpx/0.28.1 + method: POST + path: /v1/responses + query_params: {} + response: + body: + error: + code: invalid_value + message: 'Invalid ''input[0].id'': ''item_wrongprefix_ac26da7b8747efee''. + Expected an ID that begins with ''msg''.' + param: input[0].id + type: invalid_request_error + headers: + content-type: application/json + status_code: 400 +- filename: t10 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_0e216db7dd114c74006adb040d012887d191fcf7e9076c5065/input_items + query_params: + order: asc + response: + body: + data: + - content: + - text: Reply with only SAPPHIRE. + type: input_text + id: msg_0e216db7dd114c74006adb040d115087d1a56c09556fcd9c28 + role: user + status: completed + type: message + first_id: msg_0e216db7dd114c74006adb040d115087d1a56c09556fcd9c28 + has_more: false + last_id: msg_0e216db7dd114c74006adb040d115087d1a56c09556fcd9c28 + object: list + headers: + content-type: application/json + status_code: 200 +- filename: t11 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_0e216db7dd114c74006adb040d012887d191fcf7e9076c5065/input_items + query_params: + order: asc + response: + body: + data: + - content: + - text: Reply with only SAPPHIRE. + type: input_text + id: msg_0e216db7dd114c74006adb040d115087d1a56c09556fcd9c28 + role: user + status: completed + type: message + first_id: msg_0e216db7dd114c74006adb040d115087d1a56c09556fcd9c28 + has_more: false + last_id: msg_0e216db7dd114c74006adb040d115087d1a56c09556fcd9c28 + object: list + headers: + content-type: application/json + status_code: 200 +- filename: t12 + request: + body: + input: + - arguments: '{}' + call_id: call_history_probe + name: lookup + type: function_call + - call_id: call_history_probe + output: SAPPHIRE + type: function_call_output + - content: Reply with only the lookup result. + role: user + model: gpt-4.1 + store: true + stream: false + headers: + accept: '*/*' + authorization: Bearer *** + content-type: application/json + user-agent: python-httpx/0.28.1 + method: POST + path: /v1/responses + query_params: {} + response: + body: + access_programs: null + background: false + billing: + payer: developer + completed_at: 1792738324 + created_at: 1792738323 + error: null + frequency_penalty: 0.0 + id: resp_0e8ee067a46e72d3006adb0413a50487d1ab0d47db75b969bd + incomplete_details: null + instructions: null + max_output_tokens: null + max_tool_calls: null + metadata: {} + model: gpt-4.1-2025-04-14 + moderation: null + object: response + output: + - content: + - annotations: [] + logprobs: [] + text: SAPPHIRE + type: output_text + id: msg_0e8ee067a46e72d3006adb0413f50c87d194f7ff9dc9d709e7 + role: assistant + status: completed + type: message + parallel_tool_calls: true + presence_penalty: 0.0 + previous_response_id: null + prompt_cache_key: null + prompt_cache_retention: in_memory + reasoning: + context: null + effort: null + summary: null + safety_identifier: null + service_tier: default + status: completed + store: true + temperature: 1.0 + text: + format: + type: text + verbosity: medium + tool_choice: auto + tool_usage: + image_gen: + input_tokens: 0 + input_tokens_details: + image_tokens: 0 + text_tokens: 0 + output_tokens: 0 + output_tokens_details: + image_tokens: 0 + text_tokens: 0 + total_tokens: 0 + web_search: + num_requests: 0 + tools: [] + top_logprobs: 0 + top_p: 1.0 + truncation: disabled + usage: + input_tokens: 32 + input_tokens_details: + cache_write_tokens: 0 + cached_tokens: 0 + output_tokens: 5 + output_tokens_details: + reasoning_tokens: 0 + total_tokens: 37 + user: null + headers: + content-type: application/json + status_code: 200 +- filename: t13 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_0e8ee067a46e72d3006adb0413a50487d1ab0d47db75b969bd/input_items + query_params: + order: asc + response: + body: + data: + - arguments: '{}' + call_id: call_history_probe + id: fc_0e8ee067a46e72d3006adb0413ab7487d185e4c6e198cb70a2 + name: lookup + status: in_progress + type: function_call + - call_id: call_history_probe + id: fc_0e8ee067a46e72d3006adb0413ab8c87d1a6c69ccff84848f3 + output: SAPPHIRE + status: completed + type: function_call_output + - content: + - text: Reply with only the lookup result. + type: input_text + id: msg_0e8ee067a46e72d3006adb0413aba087d19b2ecef0c4a8f7d8 + role: user + status: completed + type: message + first_id: fc_0e8ee067a46e72d3006adb0413ab7487d185e4c6e198cb70a2 + has_more: false + last_id: msg_0e8ee067a46e72d3006adb0413aba087d19b2ecef0c4a8f7d8 + object: list + headers: + content-type: application/json + status_code: 200 +- filename: t14 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_0e216db7dd114c74006adb040d012887d191fcf7e9076c5065/input_items + query_params: + order: asc + response: + body: + data: + - content: + - text: Reply with only SAPPHIRE. + type: input_text + id: msg_0e216db7dd114c74006adb040d115087d1a56c09556fcd9c28 + role: user + status: completed + type: message + first_id: msg_0e216db7dd114c74006adb040d115087d1a56c09556fcd9c28 + has_more: false + last_id: msg_0e216db7dd114c74006adb040d115087d1a56c09556fcd9c28 + object: list + headers: + content-type: application/json + status_code: 200 diff --git a/crates/agentic-server-core/tests/cassettes/responses/response-tool-items-gateway.yaml b/crates/agentic-server-core/tests/cassettes/responses/response-tool-items-gateway.yaml new file mode 100644 index 000000000..a57227f72 --- /dev/null +++ b/crates/agentic-server-core/tests/cassettes/responses/response-tool-items-gateway.yaml @@ -0,0 +1,9311 @@ +turns: +- filename: t1 + request: + body: + input: 'Do two separate web_search calls in parallel, in this single turn -- + do not wait for one to finish before starting the other. The first web_search + call must batch two exact queries together: "potato nutrition facts" and "tomato + nutrition facts". The second web_search call must batch two different exact + queries together: "cucumber nutrition facts" and "carrot nutrition facts". + Issue both calls now, then summarize each of the four results in one sentence.' + max_output_tokens: 2048 + model: Qwen/Qwen3.8-27B-FP8 + parallel_tool_calls: true + store: true + stream: false + tool_choice: auto + tools: + - type: web_search_preview + - allowed_tools: + - search_tiktoken_documentation + require_approval: never + server_label: gitmcp_tiktoken + server_url: https://gitmcp.io/openai/tiktoken + type: mcp + headers: + accept: '*/*' + authorization: Bearer *** + content-type: application/json + user-agent: python-httpx/0.28.1 + method: POST + path: /v1/responses + query_params: {} + response: + body: + background: false + completed_at: 1792753055 + created_at: 1792753055 + error: null + frequency_penalty: 0.0 + id: resp_01a16868-644c-78d3-8018-5ba2236e2c29 + incomplete_details: null + instructions: null + max_output_tokens: 2048 + max_tool_calls: null + metadata: {} + model: Qwen/Qwen3.8-27B-FP8 + object: response + output: + - id: mcpl_01a16868-68c8-7483-a47b-626ba509ed37 + server_label: gitmcp_tiktoken + tools: + - annotations: + read_only: false + description: 'Semantically search within the fetched documentation from + GitHub repository: openai/tiktoken. Useful for specific queries.' + input_schema: + $schema: http://json-schema.org/draft-07/schema# + additionalProperties: false + properties: + query: + description: The search query to find relevant documentation + type: string + required: + - query + type: object + name: search_tiktoken_documentation + type: mcp_list_tools + - content: + - text: 'The user wants me to make two web_search calls in parallel in this + single turn. The first call should batch "potato nutrition facts" and + "tomato nutrition facts" together using the `queries` parameter. The second + call should batch "cucumber nutrition facts" and "carrot nutrition facts" + together using the `queries` parameter. Both calls should be made in the + same function_calls block to execute in parallel. + + ' + type: reasoning_text + id: rs_8694582545bb175b + summary: [] + type: reasoning + - action: + queries: + - potato nutrition facts + - tomato nutrition facts + query: potato nutrition facts + sources: + - title: Potato Nutrition Facts | Nutrients, Calories, Benefits of a Potato + url: https://potatogoodness.com/nutrition/ + - title: Potato + url: https://www.fda.gov/media/76882/download + - title: FACTS | Modern Solutions for K-12 Schools and More + url: https://factsmgt.com/ + - title: 'Potatoes 101: Nutrition Facts, Health Benefits, and Types' + url: https://www.healthline.com/nutrition/foods/potatoes + - title: 'FACTS SIS: Accounts' + url: https://accounts.renweb.com/Account/Login + - title: Nutrition - Potatoes International + url: https://usapotatoes.com/potato-nutrition/ + - title: Food Search | USDA FoodData Central + url: https://fdc.nal.usda.gov/food-search?query=potato + - title: Potato Nutrition - Cooking with Potatoes - Alsum + url: https://alsum.com/products/potato-nutrition-facts/ + - title: Idaho® Potato Nutrition Facts | Idaho Potato Commission + url: https://idahopotato.com/nutrition + - title: The EDFacts Initiative | U.S. Department of Education + url: https://www.ed.gov/data/edfacts-initiative + - title: 'Tomatoes: Nutrition Facts and Health Benefits' + url: https://www.healthline.com/nutrition/tomatoes + - title: Tomato Nutrition Facts and Health Benefits + url: https://www.verywellhealth.com/tomato-nutrition-12012681 + - title: Nutrition Facts for Tomatoes + url: https://tools.myfooddata.com/nutrition-facts/170457/wt6 + - title: Tomato Nutrition Facts and Health Benefits + url: https://www.verywellfit.com/tomatoes-nutrition-facts-calories-and-health-benefits-4119981 + - title: Tomatoes - SNAP-Ed - USDA + url: https://snaped.fna.usda.gov/resources/nutrition-education-materials/seasonal-produce-guide/tomatoes + - title: Tomatoes Nutrition Facts - Eat This Much + url: https://www.eatthismuch.com/calories/tomatoes-2226 + - title: 'Tomatoes 101: Nutrition Facts and Health Benefits' + url: https://www.healthline.com/nutrition/foods/tomatoes + - title: 'Tomatoes, raw: calories and nutrition facts' + url: https://www.nutritionvalue.org/Tomatoes%2C_raw_74101000_nutritional_value.html + - title: Top 10 Tomato Nutrition facts and Health benefits + url: https://www.nutrition-and-you.com/tomato.html + - title: 'Tomatoes: A Nutritional Powerhouse and Culinary Favorite - UF/IFAS + ...' + url: https://blogs.ifas.ufl.edu/brevardco/2025/04/07/tomatoes-a-nutritional-powerhouse-and-culinary-favorite/ + type: search + id: ws_90d3592d82410588 + status: completed + type: web_search_call + - action: + queries: + - cucumber nutrition facts + - carrot nutrition facts + query: cucumber nutrition facts + sources: + - title: Cucumber Nutrition Facts and Benefits - Franklin County Center + ... + url: https://franklin.ces.ncsu.edu/news/cucumber-nutrition-facts-and-benefits/ + - title: Health Benefits of Cucumber + url: https://www.webmd.com/food-recipes/cucumber-health-benefits + - title: Cucumbers | SNAP-Ed + url: https://snaped.fna.usda.gov/resources/nutrition-education-materials/seasonal-produce-guide/cucumbers + - title: Nutrition Facts - URMC.Rochester.edu + url: https://www.urmc.rochester.edu/encyclopedia/content?contenttypeid=76&contentid=11206-3 + - title: Nutrition Facts for Cucumber + url: https://tools.myfooddata.com/nutrition-facts/168409/wt9 + - title: 'Cucumber: Calories, Nutrition and Health Benefits | NutriScan + App' + url: https://nutriscan.app/calories-nutrition/sliced-cucumber + - title: ¼ Cucumber Of Cucumber Nutrition Facts - Eat This Much + url: https://www.eatthismuch.com/calories/cucumber-1971?a=0.25%3A2 + - title: Cucumber, peeled, raw, 1 medium | University Hospitals + url: https://www.uhhospitals.org/health-information/health-and-wellness-library/article/nutritionfacts-v1/cucumber-peeled-raw-1-medium + - title: Are Cucumbers Good for You? + url: https://health.clevelandclinic.org/benefits-of-cucumbers + - title: 'Cucumber: nutritional values, nutrients and calories | FreshMAG + ...' + url: https://www.liebherr.com/en-gb/fridges-freezers/freshmag/food-a-z/cucumber-8279000 + - title: 'Carrots 101: Nutrition Facts and Health Benefits' + url: https://www.healthline.com/nutrition/foods/carrots + - title: Nutrition Facts - URMC.Rochester.edu + url: https://www.urmc.rochester.edu/encyclopedia/content?contenttypeid=76&contentid=11124-3 + - title: Carrots | SNAP-Ed + url: https://snaped.fna.usda.gov/resources/nutrition-education-materials/seasonal-produce-guide/carrots + - title: Nutrition Facts for Raw Carrots + url: https://tools.myfooddata.com/nutrition-facts/170393/wt4 + - title: 'Carrots: Health Benefits, Nutrition Facts, and Risks' + url: https://www.webmd.com/food-recipes/benefits-carrots + - title: Carrot Nutrition Facts 0g Fat 25 calories 0.5g Protein 1.5g Fiber + ... + url: https://cdn.agclassroom.org/media/uploads/LP875/Carrot_nutrition_facts.pdf + - title: Carrots - Nutritional information | Wilcox + url: https://www.wilcoxgoodness.co.nz/helpful-info/nutritional-information/carrots + - title: Carrots, raw, 1 large (7-1/4" to 8-1/2" long) | University Hospitals + url: https://www.uhhospitals.org/health-information/health-and-wellness-library/article/nutritionfacts-v1/carrots-raw-1-large-7-14-to-8-12-long + - title: Baby Carrots Nutrition Facts - Eat This Much + url: https://www.eatthismuch.com/calories/baby-carrots-2569 + - title: Baby Carrots Nutrition Facts and Health Benefits + url: https://www.verywellfit.com/baby-carrot-nutrition-facts-and-health-benefits-5071650 + type: search + id: ws_8ee6b8b91369059f + status: completed + type: web_search_call + - content: + - text: 'Both searches returned results. Let me summarize each of the four + queries in one sentence: + + + 1. **Potato nutrition facts**: A medium potato (148g) has 110 calories, + 0g fat, 26g carbs, 2g fiber, and is a good source of vitamin C (30% DV), + potassium (15% DV), and vitamin B6 (10% DV). + + + 2. **Tomato nutrition facts**: A small tomato (91g) provides about 16-22 + calories and is an excellent source of vitamin C, fiber, and vitamin K, + plus the cancer-fighting antioxidant lycopene. + + + 3. **Cucumber nutrition facts**: Cucumbers are about 95-96% water with + only 15-16 calories per 100g, and provide vitamin K (20% DV), potassium, + and antioxidants like beta-carotene. + + + 4. **Carrot nutrition facts**: One medium carrot (61g) contains 25 calories, + 6g carbs, 1.5g fiber, 0g fat, and is especially rich in vitamin A (beta-carotene), + vitamin K, and potassium. + + ' + type: reasoning_text + id: rs_bb8c0e8e4b68beed + summary: [] + type: reasoning + - content: + - annotations: [] + text: ' + + + Here are one-sentence summaries for each of the four searches: + + + 1. **Potato:** A medium potato (148g) provides 110 calories, 26g of carbohydrates, + 2g of fiber, and is a good source of vitamin C (30% DV), potassium (15% + DV), and vitamin B6 (10% DV), while being naturally fat- and cholesterol-free. + + + 2. **Tomato:** A small raw tomato (91g) delivers about 16–22 calories + and is an excellent source of vitamin C, dietary fiber, and vitamin K, + and is the primary dietary source of the antioxidant lycopene, which is + linked to reduced risks of heart disease and certain cancers. + + + 3. **Cucumber:** With only about 15–16 calories per 100g and roughly 95–96% + water, cucumbers provide vitamin K (~20% DV), potassium, and antioxidants + like beta-carotene, making them a hydrating, low-calorie addition to a + healthy diet. + + + 4. **Carrot:** One medium raw carrot (61g) contains 25 calories, 6g of + carbohydrates, 1.5g of fiber, and 0g of fat, and is especially rich in + beta-carotene (vitamin A), vitamin K, and potassium, with diets high in + carotenoids potentially protective against several types of cancer.' + type: output_text + id: msg_862b73745b32c760 + role: assistant + status: completed + type: message + parallel_tool_calls: true + presence_penalty: 0.0 + previous_response_id: null + prompt_cache_key: null + prompt_cache_options: null + reasoning: null + safety_identifier: null + service_tier: auto + status: completed + store: true + temperature: 1.0 + text: + format: + type: text + tool_choice: auto + tools: + - filters: null + search_context_size: null + type: web_search_preview + user_location: null + - allowed_tools: + - search_tiktoken_documentation + require_approval: never + server_label: gitmcp_tiktoken + server_url: https://gitmcp.io/openai/tiktoken + type: mcp + top_logprobs: 0 + top_p: 1.0 + truncation: disabled + usage: + input_tokens: 11196 + input_tokens_details: + cache_write_tokens: 9408 + cached_tokens: 784 + output_tokens: 730 + output_tokens_details: + reasoning_tokens: 344 + total_tokens: 11926 + headers: + content-type: application/json + status_code: 200 +- filename: t2 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_01a16868-644c-78d3-8018-5ba2236e2c29/input_items + query_params: + limit: '100' + order: asc + response: + body: + data: + - content: + - text: 'Do two separate web_search calls in parallel, in this single turn + -- do not wait for one to finish before starting the other. The first + web_search call must batch two exact queries together: "potato nutrition + facts" and "tomato nutrition facts". The second web_search call must batch + two different exact queries together: "cucumber nutrition facts" and "carrot + nutrition facts". Issue both calls now, then summarize each of the four + results in one sentence.' + type: input_text + id: msg_01a16868-b5eb-7231-8c69-837e933982da + role: user + status: completed + type: message + first_id: msg_01a16868-b5eb-7231-8c69-837e933982da + has_more: false + last_id: msg_01a16868-b5eb-7231-8c69-837e933982da + object: list + headers: + content-type: application/json + status_code: 200 +- filename: t3 + request: + body: + input: + - content: 'Call gitmcp_tiktoken__search_tiktoken_documentation in parallel + for two separate exact queries -- do not wait for one to finish before starting + the other: (1) {"query":"encoding"} and (2) {"query":"tokenizer"}. Issue + both calls now in this single turn, then summarize each result in one sentence.' + role: user + type: message + max_output_tokens: 2048 + model: Qwen/Qwen3.8-27B-FP8 + parallel_tool_calls: true + previous_response_id: resp_01a16868-644c-78d3-8018-5ba2236e2c29 + store: true + stream: false + tool_choice: auto + tools: + - type: web_search_preview + - allowed_tools: + - search_tiktoken_documentation + require_approval: never + server_label: gitmcp_tiktoken + server_url: https://gitmcp.io/openai/tiktoken + type: mcp + headers: + accept: '*/*' + authorization: Bearer *** + content-type: application/json + user-agent: python-httpx/0.28.1 + method: POST + path: /v1/responses + query_params: {} + response: + body: + background: false + completed_at: 1792753072 + created_at: 1792753072 + error: null + frequency_penalty: 0.0 + id: resp_01a16868-b8bf-73b2-a734-2c38a1d79be7 + incomplete_details: null + instructions: null + max_output_tokens: 2048 + max_tool_calls: null + metadata: {} + model: Qwen/Qwen3.8-27B-FP8 + object: response + output: + - content: + - text: 'The user wants me to call `mcp__gitmcp_tiktoken__search_tiktoken_documentation` + twice in parallel - once with query "encoding" and once with query "tokenizer". + I''ll issue both calls in the same function_calls block. + + ' + type: reasoning_text + id: rs_8a8a17763b04a832 + summary: [] + type: reasoning + - approval_request_id: null + arguments: '{"query": "encoding"}' + error: null + id: mcp_a4bef669c02bfcf5 + name: search_tiktoken_documentation + output: "### Search Results for: \"encoding\"\n\nNo relevant documentation\ + \ found for your query. It's either being indexed or the search query did\ + \ not match any documentation.\n\nAs a fallback, this is the documentation\ + \ for openai/tiktoken:\n\n# ⏳ tiktoken\n\ntiktoken is a fast [BPE](https://en.wikipedia.org/wiki/Byte_pair_encoding)\ + \ tokeniser for use with\nOpenAI's models.\n\n```python\nimport tiktoken\n\ + enc = tiktoken.get_encoding(\"o200k_base\")\nassert enc.decode(enc.encode(\"\ + hello world\")) == \"hello world\"\n\n# To get the tokeniser corresponding\ + \ to a specific model in the OpenAI API:\nenc = tiktoken.encoding_for_model(\"\ + gpt-4o\")\n```\n\nThe open source version of `tiktoken` can be installed\ + \ from [PyPI](https://pypi.org/project/tiktoken):\n```\npip install tiktoken\n\ + ```\n\nThe tokeniser API is documented in `tiktoken/core.py`.\n\nExample\ + \ code using `tiktoken` can be found in the\n[OpenAI Cookbook](https://github.com/openai/openai-cookbook/blob/main/examples/How_to_count_tokens_with_tiktoken.ipynb).\n\ + \n\n## Performance\n\n`tiktoken` is between 3-6x faster than a comparable\ + \ open source tokeniser:\n\n![image](https://raw.githubusercontent.com/openai/tiktoken/main/perf.svg)\n\ + \nPerformance measured on 1GB of text using the GPT-2 tokeniser, using `GPT2TokenizerFast`\ + \ from\n`tokenizers==0.13.2`, `transformers==4.24.0` and `tiktoken==0.2.0`.\n\ + \n\n## Getting help\n\nPlease post questions in the [issue tracker](https://github.com/openai/tiktoken/issues).\n\ + \nIf you work at OpenAI, make sure to check the internal documentation or\ + \ feel free to contact\n@shantanu.\n\n## What is BPE anyway?\n\nLanguage\ + \ models don't see text like you and I, instead they see a sequence of numbers\ + \ (known as tokens).\nByte pair encoding (BPE) is a way of converting text\ + \ into tokens. It has a couple desirable\nproperties:\n1) It's reversible\ + \ and lossless, so you can convert tokens back into the original text\n\ + 2) It works on arbitrary text, even text that is not in the tokeniser's\ + \ training data\n3) It compresses the text: the token sequence is shorter\ + \ than the bytes corresponding to the\n original text. On average, in\ + \ practice, each token corresponds to about 4 bytes.\n4) It attempts to\ + \ let the model see common subwords. For instance, \"ing\" is a common subword\ + \ in\n English, so BPE encodings will often split \"encoding\" into tokens\ + \ like \"encod\" and \"ing\"\n (instead of e.g. \"enc\" and \"oding\"\ + ). Because the model will then see the \"ing\" token again and\n again\ + \ in different contexts, it helps models generalise and better understand\ + \ grammar.\n\n`tiktoken` contains an educational submodule that is friendlier\ + \ if you want to learn more about\nthe details of BPE, including code that\ + \ helps visualise the BPE procedure:\n```python\nfrom tiktoken._educational\ + \ import *\n\n# Train a BPE tokeniser on a small amount of text\nenc = train_simple_encoding()\n\ + \n# Visualise how the GPT-4 encoder encodes text\nenc = SimpleBytePairEncoding.from_tiktoken(\"\ + cl100k_base\")\nenc.encode(\"hello world aaaaaaaaaaaa\")\n```\n\n\n## Extending\ + \ tiktoken\n\nYou may wish to extend `tiktoken` to support new encodings.\ + \ There are two ways to do this.\n\n\n**Create your `Encoding` object exactly\ + \ the way you want and simply pass it around.**\n\n```python\ncl100k_base\ + \ = tiktoken.get_encoding(\"cl100k_base\")\n\n# In production, load the\ + \ arguments directly instead of accessing private attributes\n# See openai_public.py\ + \ for examples of arguments for specific encodings\nenc = tiktoken.Encoding(\n\ + \ # If you're changing the set of special tokens, make sure to use a\ + \ different name\n # It should be clear from the name what behaviour\ + \ to expect.\n name=\"cl100k_im\",\n pat_str=cl100k_base._pat_str,\n\ + \ mergeable_ranks=cl100k_base._mergeable_ranks,\n special_tokens={\n\ + \ **cl100k_base._special_tokens,\n \"<|im_start|>\": 100264,\n\ + \ \"<|im_end|>\": 100265,\n }\n)\n```\n\n**Use the `tiktoken_ext`\ + \ plugin mechanism to register your `Encoding` objects with `tiktoken`.**\n\ + \nThis is only useful if you need `tiktoken.get_encoding` to find your encoding,\ + \ otherwise prefer\noption 1.\n\nTo do this, you'll need to create a namespace\ + \ package under `tiktoken_ext`.\n\nLayout your project like this, making\ + \ sure to omit the `tiktoken_ext/__init__.py` file:\n```\nmy_tiktoken_extension\n\ + ├── tiktoken_ext\n│   └── my_encodings.py\n└── setup.py\n```\n\n`my_encodings.py`\ + \ should be a module that contains a variable named `ENCODING_CONSTRUCTORS`.\n\ + This is a dictionary from an encoding name to a function that takes no arguments\ + \ and returns\narguments that can be passed to `tiktoken.Encoding` to construct\ + \ that encoding. For an example, see\n`tiktoken_ext/openai_public.py`. For\ + \ precise details, see `tiktoken/registry.py`.\n\nYour `setup.py` should\ + \ look something like this:\n```python\nfrom setuptools import setup, find_namespace_packages\n\ + \nsetup(\n name=\"my_tiktoken_extension\",\n packages=find_namespace_packages(include=['tiktoken_ext*']),\n\ + \ install_requires=[\"tiktoken\"],\n ...\n)\n```\n\nThen simply `pip\ + \ install ./my_tiktoken_extension` and you should be able to use your\n\ + custom encodings! Make sure **not** to use an editable install.\n\n\n\n\ + If you'd like to retry the search, try changing the query to increase the\ + \ likelihood of a match." + server_label: gitmcp_tiktoken + status: completed + type: mcp_call + - approval_request_id: null + arguments: '{"query": "tokenizer"}' + error: null + id: mcp_8db02699fcd1210b + name: search_tiktoken_documentation + output: "### Search Results for: \"tokenizer\"\n\nNo relevant documentation\ + \ found for your query. It's either being indexed or the search query did\ + \ not match any documentation.\n\nAs a fallback, this is the documentation\ + \ for openai/tiktoken:\n\n# ⏳ tiktoken\n\ntiktoken is a fast [BPE](https://en.wikipedia.org/wiki/Byte_pair_encoding)\ + \ tokeniser for use with\nOpenAI's models.\n\n```python\nimport tiktoken\n\ + enc = tiktoken.get_encoding(\"o200k_base\")\nassert enc.decode(enc.encode(\"\ + hello world\")) == \"hello world\"\n\n# To get the tokeniser corresponding\ + \ to a specific model in the OpenAI API:\nenc = tiktoken.encoding_for_model(\"\ + gpt-4o\")\n```\n\nThe open source version of `tiktoken` can be installed\ + \ from [PyPI](https://pypi.org/project/tiktoken):\n```\npip install tiktoken\n\ + ```\n\nThe tokeniser API is documented in `tiktoken/core.py`.\n\nExample\ + \ code using `tiktoken` can be found in the\n[OpenAI Cookbook](https://github.com/openai/openai-cookbook/blob/main/examples/How_to_count_tokens_with_tiktoken.ipynb).\n\ + \n\n## Performance\n\n`tiktoken` is between 3-6x faster than a comparable\ + \ open source tokeniser:\n\n![image](https://raw.githubusercontent.com/openai/tiktoken/main/perf.svg)\n\ + \nPerformance measured on 1GB of text using the GPT-2 tokeniser, using `GPT2TokenizerFast`\ + \ from\n`tokenizers==0.13.2`, `transformers==4.24.0` and `tiktoken==0.2.0`.\n\ + \n\n## Getting help\n\nPlease post questions in the [issue tracker](https://github.com/openai/tiktoken/issues).\n\ + \nIf you work at OpenAI, make sure to check the internal documentation or\ + \ feel free to contact\n@shantanu.\n\n## What is BPE anyway?\n\nLanguage\ + \ models don't see text like you and I, instead they see a sequence of numbers\ + \ (known as tokens).\nByte pair encoding (BPE) is a way of converting text\ + \ into tokens. It has a couple desirable\nproperties:\n1) It's reversible\ + \ and lossless, so you can convert tokens back into the original text\n\ + 2) It works on arbitrary text, even text that is not in the tokeniser's\ + \ training data\n3) It compresses the text: the token sequence is shorter\ + \ than the bytes corresponding to the\n original text. On average, in\ + \ practice, each token corresponds to about 4 bytes.\n4) It attempts to\ + \ let the model see common subwords. For instance, \"ing\" is a common subword\ + \ in\n English, so BPE encodings will often split \"encoding\" into tokens\ + \ like \"encod\" and \"ing\"\n (instead of e.g. \"enc\" and \"oding\"\ + ). Because the model will then see the \"ing\" token again and\n again\ + \ in different contexts, it helps models generalise and better understand\ + \ grammar.\n\n`tiktoken` contains an educational submodule that is friendlier\ + \ if you want to learn more about\nthe details of BPE, including code that\ + \ helps visualise the BPE procedure:\n```python\nfrom tiktoken._educational\ + \ import *\n\n# Train a BPE tokeniser on a small amount of text\nenc = train_simple_encoding()\n\ + \n# Visualise how the GPT-4 encoder encodes text\nenc = SimpleBytePairEncoding.from_tiktoken(\"\ + cl100k_base\")\nenc.encode(\"hello world aaaaaaaaaaaa\")\n```\n\n\n## Extending\ + \ tiktoken\n\nYou may wish to extend `tiktoken` to support new encodings.\ + \ There are two ways to do this.\n\n\n**Create your `Encoding` object exactly\ + \ the way you want and simply pass it around.**\n\n```python\ncl100k_base\ + \ = tiktoken.get_encoding(\"cl100k_base\")\n\n# In production, load the\ + \ arguments directly instead of accessing private attributes\n# See openai_public.py\ + \ for examples of arguments for specific encodings\nenc = tiktoken.Encoding(\n\ + \ # If you're changing the set of special tokens, make sure to use a\ + \ different name\n # It should be clear from the name what behaviour\ + \ to expect.\n name=\"cl100k_im\",\n pat_str=cl100k_base._pat_str,\n\ + \ mergeable_ranks=cl100k_base._mergeable_ranks,\n special_tokens={\n\ + \ **cl100k_base._special_tokens,\n \"<|im_start|>\": 100264,\n\ + \ \"<|im_end|>\": 100265,\n }\n)\n```\n\n**Use the `tiktoken_ext`\ + \ plugin mechanism to register your `Encoding` objects with `tiktoken`.**\n\ + \nThis is only useful if you need `tiktoken.get_encoding` to find your encoding,\ + \ otherwise prefer\noption 1.\n\nTo do this, you'll need to create a namespace\ + \ package under `tiktoken_ext`.\n\nLayout your project like this, making\ + \ sure to omit the `tiktoken_ext/__init__.py` file:\n```\nmy_tiktoken_extension\n\ + ├── tiktoken_ext\n│   └── my_encodings.py\n└── setup.py\n```\n\n`my_encodings.py`\ + \ should be a module that contains a variable named `ENCODING_CONSTRUCTORS`.\n\ + This is a dictionary from an encoding name to a function that takes no arguments\ + \ and returns\narguments that can be passed to `tiktoken.Encoding` to construct\ + \ that encoding. For an example, see\n`tiktoken_ext/openai_public.py`. For\ + \ precise details, see `tiktoken/registry.py`.\n\nYour `setup.py` should\ + \ look something like this:\n```python\nfrom setuptools import setup, find_namespace_packages\n\ + \nsetup(\n name=\"my_tiktoken_extension\",\n packages=find_namespace_packages(include=['tiktoken_ext*']),\n\ + \ install_requires=[\"tiktoken\"],\n ...\n)\n```\n\nThen simply `pip\ + \ install ./my_tiktoken_extension` and you should be able to use your\n\ + custom encodings! Make sure **not** to use an editable install.\n\n\n\n\ + If you'd like to retry the search, try changing the query to increase the\ + \ likelihood of a match." + server_label: gitmcp_tiktoken + status: completed + type: mcp_call + - content: + - text: 'Both searches returned the same fallback README content since no + specific documentation was indexed for either query. Let me summarize + each in one sentence. + + ' + type: reasoning_text + id: rs_9dca2a42406fd775 + summary: [] + type: reasoning + - content: + - annotations: [] + text: ' + + + Here are one-sentence summaries for each query: + + + 1. **"encoding" search:** No specific documentation was indexed for "encoding," + so the tool returned a fallback of tiktoken''s README, which explains + that tiktoken is a fast BPE tokeniser for OpenAI''s models, that encodings + can be retrieved via `tiktoken.get_encoding("o200k_base")` or `tiktoken.encoding_for_model("gpt-4o")`, + and that custom encodings can be extended by either directly constructing + `tiktoken.Encoding` objects or registering them through the `tiktoken_ext` + plugin mechanism. + + + 2. **"tokenizer" search:** Similarly, no specific documentation was indexed + for "tokenizer," and the same fallback README was returned, noting that + tiktoken is 3–6× faster than comparable open-source tokenisers (benchmarked + against `GPT2TokenizerFast` from HuggingFace `tokenizers`), that the core + tokenizer API is documented in `tiktoken/core.py`, and that BPE works + by converting text into reversible, lossless token sequences where each + token corresponds to roughly 4 bytes on average.' + type: output_text + id: msg_9625fc5a78cfcb95 + role: assistant + status: completed + type: message + parallel_tool_calls: true + presence_penalty: 0.0 + previous_response_id: resp_01a16868-644c-78d3-8018-5ba2236e2c29 + prompt_cache_key: null + prompt_cache_options: null + reasoning: null + safety_identifier: null + service_tier: auto + status: completed + store: true + temperature: 1.0 + text: + format: + type: text + tool_choice: auto + tools: + - filters: null + search_context_size: null + type: web_search_preview + user_location: null + - allowed_tools: + - search_tiktoken_documentation + require_approval: never + server_label: gitmcp_tiktoken + server_url: https://gitmcp.io/openai/tiktoken + type: mcp + top_logprobs: 0 + top_p: 1.0 + truncation: disabled + usage: + input_tokens: 24974 + input_tokens_details: + cache_write_tokens: 13328 + cached_tokens: 10976 + output_tokens: 393 + output_tokens_details: + reasoning_tokens: 81 + total_tokens: 25367 + headers: + content-type: application/json + status_code: 200 +- filename: t4 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_01a16868-b8bf-73b2-a734-2c38a1d79be7/input_items + query_params: + limit: '100' + order: asc + response: + body: + data: + - content: + - text: 'Do two separate web_search calls in parallel, in this single turn + -- do not wait for one to finish before starting the other. The first + web_search call must batch two exact queries together: "potato nutrition + facts" and "tomato nutrition facts". The second web_search call must batch + two different exact queries together: "cucumber nutrition facts" and "carrot + nutrition facts". Issue both calls now, then summarize each of the four + results in one sentence.' + type: input_text + id: msg_01a16868-b5eb-7231-8c69-837e933982da + role: user + status: completed + type: message + - id: mcpl_01a16868-68c8-7483-a47b-626ba509ed37 + server_label: gitmcp_tiktoken + tools: + - annotations: + read_only: false + description: 'Semantically search within the fetched documentation from + GitHub repository: openai/tiktoken. Useful for specific queries.' + input_schema: + $schema: http://json-schema.org/draft-07/schema# + additionalProperties: false + properties: + query: + description: The search query to find relevant documentation + type: string + required: + - query + type: object + name: search_tiktoken_documentation + type: mcp_list_tools + - content: + - text: 'The user wants me to make two web_search calls in parallel in this + single turn. The first call should batch "potato nutrition facts" and + "tomato nutrition facts" together using the `queries` parameter. The second + call should batch "cucumber nutrition facts" and "carrot nutrition facts" + together using the `queries` parameter. Both calls should be made in the + same function_calls block to execute in parallel. + + ' + type: reasoning_text + id: rs_8694582545bb175b + summary: [] + type: reasoning + - action: + queries: + - potato nutrition facts + - tomato nutrition facts + query: potato nutrition facts + sources: + - title: Potato Nutrition Facts | Nutrients, Calories, Benefits of a Potato + url: https://potatogoodness.com/nutrition/ + - title: Potato + url: https://www.fda.gov/media/76882/download + - title: FACTS | Modern Solutions for K-12 Schools and More + url: https://factsmgt.com/ + - title: 'Potatoes 101: Nutrition Facts, Health Benefits, and Types' + url: https://www.healthline.com/nutrition/foods/potatoes + - title: 'FACTS SIS: Accounts' + url: https://accounts.renweb.com/Account/Login + - title: Nutrition - Potatoes International + url: https://usapotatoes.com/potato-nutrition/ + - title: Food Search | USDA FoodData Central + url: https://fdc.nal.usda.gov/food-search?query=potato + - title: Potato Nutrition - Cooking with Potatoes - Alsum + url: https://alsum.com/products/potato-nutrition-facts/ + - title: Idaho® Potato Nutrition Facts | Idaho Potato Commission + url: https://idahopotato.com/nutrition + - title: The EDFacts Initiative | U.S. Department of Education + url: https://www.ed.gov/data/edfacts-initiative + - title: 'Tomatoes: Nutrition Facts and Health Benefits' + url: https://www.healthline.com/nutrition/tomatoes + - title: Tomato Nutrition Facts and Health Benefits + url: https://www.verywellhealth.com/tomato-nutrition-12012681 + - title: Nutrition Facts for Tomatoes + url: https://tools.myfooddata.com/nutrition-facts/170457/wt6 + - title: Tomato Nutrition Facts and Health Benefits + url: https://www.verywellfit.com/tomatoes-nutrition-facts-calories-and-health-benefits-4119981 + - title: Tomatoes - SNAP-Ed - USDA + url: https://snaped.fna.usda.gov/resources/nutrition-education-materials/seasonal-produce-guide/tomatoes + - title: Tomatoes Nutrition Facts - Eat This Much + url: https://www.eatthismuch.com/calories/tomatoes-2226 + - title: 'Tomatoes 101: Nutrition Facts and Health Benefits' + url: https://www.healthline.com/nutrition/foods/tomatoes + - title: 'Tomatoes, raw: calories and nutrition facts' + url: https://www.nutritionvalue.org/Tomatoes%2C_raw_74101000_nutritional_value.html + - title: Top 10 Tomato Nutrition facts and Health benefits + url: https://www.nutrition-and-you.com/tomato.html + - title: 'Tomatoes: A Nutritional Powerhouse and Culinary Favorite - UF/IFAS + ...' + url: https://blogs.ifas.ufl.edu/brevardco/2025/04/07/tomatoes-a-nutritional-powerhouse-and-culinary-favorite/ + type: search + id: ws_90d3592d82410588 + status: completed + type: web_search_call + - action: + queries: + - cucumber nutrition facts + - carrot nutrition facts + query: cucumber nutrition facts + sources: + - title: Cucumber Nutrition Facts and Benefits - Franklin County Center + ... + url: https://franklin.ces.ncsu.edu/news/cucumber-nutrition-facts-and-benefits/ + - title: Health Benefits of Cucumber + url: https://www.webmd.com/food-recipes/cucumber-health-benefits + - title: Cucumbers | SNAP-Ed + url: https://snaped.fna.usda.gov/resources/nutrition-education-materials/seasonal-produce-guide/cucumbers + - title: Nutrition Facts - URMC.Rochester.edu + url: https://www.urmc.rochester.edu/encyclopedia/content?contenttypeid=76&contentid=11206-3 + - title: Nutrition Facts for Cucumber + url: https://tools.myfooddata.com/nutrition-facts/168409/wt9 + - title: 'Cucumber: Calories, Nutrition and Health Benefits | NutriScan + App' + url: https://nutriscan.app/calories-nutrition/sliced-cucumber + - title: ¼ Cucumber Of Cucumber Nutrition Facts - Eat This Much + url: https://www.eatthismuch.com/calories/cucumber-1971?a=0.25%3A2 + - title: Cucumber, peeled, raw, 1 medium | University Hospitals + url: https://www.uhhospitals.org/health-information/health-and-wellness-library/article/nutritionfacts-v1/cucumber-peeled-raw-1-medium + - title: Are Cucumbers Good for You? + url: https://health.clevelandclinic.org/benefits-of-cucumbers + - title: 'Cucumber: nutritional values, nutrients and calories | FreshMAG + ...' + url: https://www.liebherr.com/en-gb/fridges-freezers/freshmag/food-a-z/cucumber-8279000 + - title: 'Carrots 101: Nutrition Facts and Health Benefits' + url: https://www.healthline.com/nutrition/foods/carrots + - title: Nutrition Facts - URMC.Rochester.edu + url: https://www.urmc.rochester.edu/encyclopedia/content?contenttypeid=76&contentid=11124-3 + - title: Carrots | SNAP-Ed + url: https://snaped.fna.usda.gov/resources/nutrition-education-materials/seasonal-produce-guide/carrots + - title: Nutrition Facts for Raw Carrots + url: https://tools.myfooddata.com/nutrition-facts/170393/wt4 + - title: 'Carrots: Health Benefits, Nutrition Facts, and Risks' + url: https://www.webmd.com/food-recipes/benefits-carrots + - title: Carrot Nutrition Facts 0g Fat 25 calories 0.5g Protein 1.5g Fiber + ... + url: https://cdn.agclassroom.org/media/uploads/LP875/Carrot_nutrition_facts.pdf + - title: Carrots - Nutritional information | Wilcox + url: https://www.wilcoxgoodness.co.nz/helpful-info/nutritional-information/carrots + - title: Carrots, raw, 1 large (7-1/4" to 8-1/2" long) | University Hospitals + url: https://www.uhhospitals.org/health-information/health-and-wellness-library/article/nutritionfacts-v1/carrots-raw-1-large-7-14-to-8-12-long + - title: Baby Carrots Nutrition Facts - Eat This Much + url: https://www.eatthismuch.com/calories/baby-carrots-2569 + - title: Baby Carrots Nutrition Facts and Health Benefits + url: https://www.verywellfit.com/baby-carrot-nutrition-facts-and-health-benefits-5071650 + type: search + id: ws_8ee6b8b91369059f + status: completed + type: web_search_call + - content: + - text: 'Both searches returned results. Let me summarize each of the four + queries in one sentence: + + + 1. **Potato nutrition facts**: A medium potato (148g) has 110 calories, + 0g fat, 26g carbs, 2g fiber, and is a good source of vitamin C (30% DV), + potassium (15% DV), and vitamin B6 (10% DV). + + + 2. **Tomato nutrition facts**: A small tomato (91g) provides about 16-22 + calories and is an excellent source of vitamin C, fiber, and vitamin K, + plus the cancer-fighting antioxidant lycopene. + + + 3. **Cucumber nutrition facts**: Cucumbers are about 95-96% water with + only 15-16 calories per 100g, and provide vitamin K (20% DV), potassium, + and antioxidants like beta-carotene. + + + 4. **Carrot nutrition facts**: One medium carrot (61g) contains 25 calories, + 6g carbs, 1.5g fiber, 0g fat, and is especially rich in vitamin A (beta-carotene), + vitamin K, and potassium. + + ' + type: reasoning_text + id: rs_bb8c0e8e4b68beed + summary: [] + type: reasoning + - content: + - annotations: [] + text: ' + + + Here are one-sentence summaries for each of the four searches: + + + 1. **Potato:** A medium potato (148g) provides 110 calories, 26g of carbohydrates, + 2g of fiber, and is a good source of vitamin C (30% DV), potassium (15% + DV), and vitamin B6 (10% DV), while being naturally fat- and cholesterol-free. + + + 2. **Tomato:** A small raw tomato (91g) delivers about 16–22 calories + and is an excellent source of vitamin C, dietary fiber, and vitamin K, + and is the primary dietary source of the antioxidant lycopene, which is + linked to reduced risks of heart disease and certain cancers. + + + 3. **Cucumber:** With only about 15–16 calories per 100g and roughly 95–96% + water, cucumbers provide vitamin K (~20% DV), potassium, and antioxidants + like beta-carotene, making them a hydrating, low-calorie addition to a + healthy diet. + + + 4. **Carrot:** One medium raw carrot (61g) contains 25 calories, 6g of + carbohydrates, 1.5g of fiber, and 0g of fat, and is especially rich in + beta-carotene (vitamin A), vitamin K, and potassium, with diets high in + carotenoids potentially protective against several types of cancer.' + type: output_text + id: msg_862b73745b32c760 + role: assistant + status: completed + type: message + - content: + - text: 'Call gitmcp_tiktoken__search_tiktoken_documentation in parallel for + two separate exact queries -- do not wait for one to finish before starting + the other: (1) {"query":"encoding"} and (2) {"query":"tokenizer"}. Issue + both calls now in this single turn, then summarize each result in one + sentence.' + type: input_text + id: msg_01a16868-f8e7-7121-a3e5-71db08a39cb0 + role: user + status: completed + type: message + first_id: msg_01a16868-b5eb-7231-8c69-837e933982da + has_more: false + last_id: msg_01a16868-f8e7-7121-a3e5-71db08a39cb0 + object: list + headers: + content-type: application/json + status_code: 200 +- filename: t5 + request: + body: + input: + - content: 'Do both of these right now, in parallel, in this single turn -- + do not wait for one to finish before starting the other: (1) search the + web for the exact query "latest vLLM release notes", and (2) call gitmcp_tiktoken__search_tiktoken_documentation + with {"query":"encoding"}. Do not call any other tool.' + role: user + type: message + max_output_tokens: 2048 + model: Qwen/Qwen3.8-27B-FP8 + parallel_tool_calls: true + previous_response_id: resp_01a16868-b8bf-73b2-a734-2c38a1d79be7 + store: true + stream: false + tool_choice: auto + tools: + - type: web_search_preview + - allowed_tools: + - search_tiktoken_documentation + require_approval: never + server_label: gitmcp_tiktoken + server_url: https://gitmcp.io/openai/tiktoken + type: mcp + headers: + accept: '*/*' + authorization: Bearer *** + content-type: application/json + user-agent: python-httpx/0.28.1 + method: POST + path: /v1/responses + query_params: {} + response: + body: + background: false + completed_at: 1792753090 + created_at: 1792753090 + error: null + frequency_penalty: 0.0 + id: resp_01a16868-f9b7-7551-ae08-2017135c85ba + incomplete_details: null + instructions: null + max_output_tokens: 2048 + max_tool_calls: null + metadata: {} + model: Qwen/Qwen3.8-27B-FP8 + object: response + output: + - content: + - text: 'The user wants me to make two tool calls in parallel: + + 1. A web_search call with the query "latest vLLM release notes" + + 2. A gitmcp_tiktoken__search_tiktoken_documentation call with the query + "encoding" + + + These are independent, so I''ll issue both in the same block. + + ' + type: reasoning_text + id: rs_b118aa524415e1c8 + summary: [] + type: reasoning + - action: + queries: + - latest vLLM release notes + query: latest vLLM release notes + sources: + - title: Releases · vllm-project/vllm + url: https://github.com/vllm-project/vllm/releases + - title: vLLM Release Notes - NVIDIA Docs + url: https://docs.nvidia.com/deeplearning/frameworks/vllm-release-notes/index.html + - title: Release Notes - vLLM Ascend + url: https://docs.vllm.ai/projects/ascend/en/latest/user_guide/release_notes.html + - title: Previous vLLM Releases | vLLM + url: https://vllm.ai/releases + - title: Release Notes — vllm-ascend + url: https://docs.vllm.ai/projects/ascend/en/main/user_guide/release_notes.html + - title: Releases · vllm-project/vllm-ascend + url: https://github.com/vllm-project/vllm-ascend/releases + - title: Blog | vLLM + url: https://vllm.ai/blog + - title: vLLM release history | Freedom.Tech + url: https://freedom.tech/project/vllm/ + - title: Release Notes - vLLM Hardware Plugin for Intel® Gaudi® + url: https://docs.vllm.ai/projects/gaudi/en/latest/release_notes.html + - title: Release note — vllm-ascend + url: https://docs.vllm.ai/projects/ascend/en/v0.10.0rc1/user_guide/release_notes.html + type: search + id: ws_b02f4144d93a3ba4 + status: completed + type: web_search_call + - approval_request_id: null + arguments: '{"query": "encoding"}' + error: null + id: mcp_8ccd9b6e8f62355f + name: search_tiktoken_documentation + output: "### Search Results for: \"encoding\"\n\nNo relevant documentation\ + \ found for your query. It's either being indexed or the search query did\ + \ not match any documentation.\n\nAs a fallback, this is the documentation\ + \ for openai/tiktoken:\n\n# ⏳ tiktoken\n\ntiktoken is a fast [BPE](https://en.wikipedia.org/wiki/Byte_pair_encoding)\ + \ tokeniser for use with\nOpenAI's models.\n\n```python\nimport tiktoken\n\ + enc = tiktoken.get_encoding(\"o200k_base\")\nassert enc.decode(enc.encode(\"\ + hello world\")) == \"hello world\"\n\n# To get the tokeniser corresponding\ + \ to a specific model in the OpenAI API:\nenc = tiktoken.encoding_for_model(\"\ + gpt-4o\")\n```\n\nThe open source version of `tiktoken` can be installed\ + \ from [PyPI](https://pypi.org/project/tiktoken):\n```\npip install tiktoken\n\ + ```\n\nThe tokeniser API is documented in `tiktoken/core.py`.\n\nExample\ + \ code using `tiktoken` can be found in the\n[OpenAI Cookbook](https://github.com/openai/openai-cookbook/blob/main/examples/How_to_count_tokens_with_tiktoken.ipynb).\n\ + \n\n## Performance\n\n`tiktoken` is between 3-6x faster than a comparable\ + \ open source tokeniser:\n\n![image](https://raw.githubusercontent.com/openai/tiktoken/main/perf.svg)\n\ + \nPerformance measured on 1GB of text using the GPT-2 tokeniser, using `GPT2TokenizerFast`\ + \ from\n`tokenizers==0.13.2`, `transformers==4.24.0` and `tiktoken==0.2.0`.\n\ + \n\n## Getting help\n\nPlease post questions in the [issue tracker](https://github.com/openai/tiktoken/issues).\n\ + \nIf you work at OpenAI, make sure to check the internal documentation or\ + \ feel free to contact\n@shantanu.\n\n## What is BPE anyway?\n\nLanguage\ + \ models don't see text like you and I, instead they see a sequence of numbers\ + \ (known as tokens).\nByte pair encoding (BPE) is a way of converting text\ + \ into tokens. It has a couple desirable\nproperties:\n1) It's reversible\ + \ and lossless, so you can convert tokens back into the original text\n\ + 2) It works on arbitrary text, even text that is not in the tokeniser's\ + \ training data\n3) It compresses the text: the token sequence is shorter\ + \ than the bytes corresponding to the\n original text. On average, in\ + \ practice, each token corresponds to about 4 bytes.\n4) It attempts to\ + \ let the model see common subwords. For instance, \"ing\" is a common subword\ + \ in\n English, so BPE encodings will often split \"encoding\" into tokens\ + \ like \"encod\" and \"ing\"\n (instead of e.g. \"enc\" and \"oding\"\ + ). Because the model will then see the \"ing\" token again and\n again\ + \ in different contexts, it helps models generalise and better understand\ + \ grammar.\n\n`tiktoken` contains an educational submodule that is friendlier\ + \ if you want to learn more about\nthe details of BPE, including code that\ + \ helps visualise the BPE procedure:\n```python\nfrom tiktoken._educational\ + \ import *\n\n# Train a BPE tokeniser on a small amount of text\nenc = train_simple_encoding()\n\ + \n# Visualise how the GPT-4 encoder encodes text\nenc = SimpleBytePairEncoding.from_tiktoken(\"\ + cl100k_base\")\nenc.encode(\"hello world aaaaaaaaaaaa\")\n```\n\n\n## Extending\ + \ tiktoken\n\nYou may wish to extend `tiktoken` to support new encodings.\ + \ There are two ways to do this.\n\n\n**Create your `Encoding` object exactly\ + \ the way you want and simply pass it around.**\n\n```python\ncl100k_base\ + \ = tiktoken.get_encoding(\"cl100k_base\")\n\n# In production, load the\ + \ arguments directly instead of accessing private attributes\n# See openai_public.py\ + \ for examples of arguments for specific encodings\nenc = tiktoken.Encoding(\n\ + \ # If you're changing the set of special tokens, make sure to use a\ + \ different name\n # It should be clear from the name what behaviour\ + \ to expect.\n name=\"cl100k_im\",\n pat_str=cl100k_base._pat_str,\n\ + \ mergeable_ranks=cl100k_base._mergeable_ranks,\n special_tokens={\n\ + \ **cl100k_base._special_tokens,\n \"<|im_start|>\": 100264,\n\ + \ \"<|im_end|>\": 100265,\n }\n)\n```\n\n**Use the `tiktoken_ext`\ + \ plugin mechanism to register your `Encoding` objects with `tiktoken`.**\n\ + \nThis is only useful if you need `tiktoken.get_encoding` to find your encoding,\ + \ otherwise prefer\noption 1.\n\nTo do this, you'll need to create a namespace\ + \ package under `tiktoken_ext`.\n\nLayout your project like this, making\ + \ sure to omit the `tiktoken_ext/__init__.py` file:\n```\nmy_tiktoken_extension\n\ + ├── tiktoken_ext\n│   └── my_encodings.py\n└── setup.py\n```\n\n`my_encodings.py`\ + \ should be a module that contains a variable named `ENCODING_CONSTRUCTORS`.\n\ + This is a dictionary from an encoding name to a function that takes no arguments\ + \ and returns\narguments that can be passed to `tiktoken.Encoding` to construct\ + \ that encoding. For an example, see\n`tiktoken_ext/openai_public.py`. For\ + \ precise details, see `tiktoken/registry.py`.\n\nYour `setup.py` should\ + \ look something like this:\n```python\nfrom setuptools import setup, find_namespace_packages\n\ + \nsetup(\n name=\"my_tiktoken_extension\",\n packages=find_namespace_packages(include=['tiktoken_ext*']),\n\ + \ install_requires=[\"tiktoken\"],\n ...\n)\n```\n\nThen simply `pip\ + \ install ./my_tiktoken_extension` and you should be able to use your\n\ + custom encodings! Make sure **not** to use an editable install.\n\n\n\n\ + If you'd like to retry the search, try changing the query to increase the\ + \ likelihood of a match." + server_label: gitmcp_tiktoken + status: completed + type: mcp_call + - content: + - text: 'Both calls were made in parallel as requested. Let me summarize the + results. + + + 1. Web search for "latest vLLM release notes" - found the GitHub releases + page, which shows the latest release (v0.26.0) with 411 commits from 212 + contributors, featuring improvements like faster startup, bi-directional + KV transfer, and various performance optimizations. + + + 2. tiktoken documentation search for "encoding" - returned the README/fallback + docs explaining that tiktoken is a fast BPE tokeniser, how to use encodings, + and how to extend with custom encodings. + + + The user just asked me to do both in parallel and didn''t ask for a summary + this time - they said "Do not call any other tool." So I should just confirm + both were done and briefly note the results. + + ' + type: reasoning_text + id: rs_be9503832d80f838 + summary: [] + type: reasoning + - content: + - annotations: [] + text: ' + + + Both calls were issued in parallel in this single turn. Here''s a brief + recap of each: + + + 1. **Web search ("latest vLLM release notes"):** The top result is the + vLLM GitHub releases page, showing the latest release **v0.26.0** (411 + commits from 212 contributors), which adds features like faster startup + via precompiled FlashInfer kernels, bi-directional KV transfer for reduced + TTFT (up to 3.3× on long multi-turn prompts), a shared-memory tensor arena + for multimodal tensors, and least-loaded API worker routing for 43–85% + more req/s on short requests. + + + 2. **tiktoken doc search ("encoding"):** No specific documentation was + indexed, so the tool returned the repo README as a fallback, which explains + that tiktoken is a fast BPE tokeniser for OpenAI models, that you can + retrieve encodings via `tiktoken.get_encoding("o200k_base")` or `tiktoken.encoding_for_model("gpt-4o")`, + and that custom encodings can be created by directly constructing `tiktoken.Encoding` + objects or registering them through the `tiktoken_ext` plugin mechanism.' + type: output_text + id: msg_86c8e81126d72e24 + role: assistant + status: completed + type: message + parallel_tool_calls: true + presence_penalty: 0.0 + previous_response_id: resp_01a16868-b8bf-73b2-a734-2c38a1d79be7 + prompt_cache_key: null + prompt_cache_options: null + reasoning: null + safety_identifier: null + service_tier: auto + status: completed + store: true + temperature: 1.0 + text: + format: + type: text + tool_choice: auto + tools: + - filters: null + search_context_size: null + type: web_search_preview + user_location: null + - allowed_tools: + - search_tiktoken_documentation + require_approval: never + server_label: gitmcp_tiktoken + server_url: https://gitmcp.io/openai/tiktoken + type: mcp + top_logprobs: 0 + top_p: 1.0 + truncation: disabled + usage: + input_tokens: 34388 + input_tokens_details: + cache_write_tokens: 8624 + cached_tokens: 25088 + output_tokens: 567 + output_tokens_details: + reasoning_tokens: 241 + total_tokens: 34955 + headers: + content-type: application/json + status_code: 200 +- filename: t6 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_01a16868-f9b7-7551-ae08-2017135c85ba/input_items + query_params: + limit: '100' + order: asc + response: + body: + data: + - content: + - text: 'Do two separate web_search calls in parallel, in this single turn + -- do not wait for one to finish before starting the other. The first + web_search call must batch two exact queries together: "potato nutrition + facts" and "tomato nutrition facts". The second web_search call must batch + two different exact queries together: "cucumber nutrition facts" and "carrot + nutrition facts". Issue both calls now, then summarize each of the four + results in one sentence.' + type: input_text + id: msg_01a16868-b5eb-7231-8c69-837e933982da + role: user + status: completed + type: message + - id: mcpl_01a16868-68c8-7483-a47b-626ba509ed37 + server_label: gitmcp_tiktoken + tools: + - annotations: + read_only: false + description: 'Semantically search within the fetched documentation from + GitHub repository: openai/tiktoken. Useful for specific queries.' + input_schema: + $schema: http://json-schema.org/draft-07/schema# + additionalProperties: false + properties: + query: + description: The search query to find relevant documentation + type: string + required: + - query + type: object + name: search_tiktoken_documentation + type: mcp_list_tools + - content: + - text: 'The user wants me to make two web_search calls in parallel in this + single turn. The first call should batch "potato nutrition facts" and + "tomato nutrition facts" together using the `queries` parameter. The second + call should batch "cucumber nutrition facts" and "carrot nutrition facts" + together using the `queries` parameter. Both calls should be made in the + same function_calls block to execute in parallel. + + ' + type: reasoning_text + id: rs_8694582545bb175b + summary: [] + type: reasoning + - action: + queries: + - potato nutrition facts + - tomato nutrition facts + query: potato nutrition facts + sources: + - title: Potato Nutrition Facts | Nutrients, Calories, Benefits of a Potato + url: https://potatogoodness.com/nutrition/ + - title: Potato + url: https://www.fda.gov/media/76882/download + - title: FACTS | Modern Solutions for K-12 Schools and More + url: https://factsmgt.com/ + - title: 'Potatoes 101: Nutrition Facts, Health Benefits, and Types' + url: https://www.healthline.com/nutrition/foods/potatoes + - title: 'FACTS SIS: Accounts' + url: https://accounts.renweb.com/Account/Login + - title: Nutrition - Potatoes International + url: https://usapotatoes.com/potato-nutrition/ + - title: Food Search | USDA FoodData Central + url: https://fdc.nal.usda.gov/food-search?query=potato + - title: Potato Nutrition - Cooking with Potatoes - Alsum + url: https://alsum.com/products/potato-nutrition-facts/ + - title: Idaho® Potato Nutrition Facts | Idaho Potato Commission + url: https://idahopotato.com/nutrition + - title: The EDFacts Initiative | U.S. Department of Education + url: https://www.ed.gov/data/edfacts-initiative + - title: 'Tomatoes: Nutrition Facts and Health Benefits' + url: https://www.healthline.com/nutrition/tomatoes + - title: Tomato Nutrition Facts and Health Benefits + url: https://www.verywellhealth.com/tomato-nutrition-12012681 + - title: Nutrition Facts for Tomatoes + url: https://tools.myfooddata.com/nutrition-facts/170457/wt6 + - title: Tomato Nutrition Facts and Health Benefits + url: https://www.verywellfit.com/tomatoes-nutrition-facts-calories-and-health-benefits-4119981 + - title: Tomatoes - SNAP-Ed - USDA + url: https://snaped.fna.usda.gov/resources/nutrition-education-materials/seasonal-produce-guide/tomatoes + - title: Tomatoes Nutrition Facts - Eat This Much + url: https://www.eatthismuch.com/calories/tomatoes-2226 + - title: 'Tomatoes 101: Nutrition Facts and Health Benefits' + url: https://www.healthline.com/nutrition/foods/tomatoes + - title: 'Tomatoes, raw: calories and nutrition facts' + url: https://www.nutritionvalue.org/Tomatoes%2C_raw_74101000_nutritional_value.html + - title: Top 10 Tomato Nutrition facts and Health benefits + url: https://www.nutrition-and-you.com/tomato.html + - title: 'Tomatoes: A Nutritional Powerhouse and Culinary Favorite - UF/IFAS + ...' + url: https://blogs.ifas.ufl.edu/brevardco/2025/04/07/tomatoes-a-nutritional-powerhouse-and-culinary-favorite/ + type: search + id: ws_90d3592d82410588 + status: completed + type: web_search_call + - action: + queries: + - cucumber nutrition facts + - carrot nutrition facts + query: cucumber nutrition facts + sources: + - title: Cucumber Nutrition Facts and Benefits - Franklin County Center + ... + url: https://franklin.ces.ncsu.edu/news/cucumber-nutrition-facts-and-benefits/ + - title: Health Benefits of Cucumber + url: https://www.webmd.com/food-recipes/cucumber-health-benefits + - title: Cucumbers | SNAP-Ed + url: https://snaped.fna.usda.gov/resources/nutrition-education-materials/seasonal-produce-guide/cucumbers + - title: Nutrition Facts - URMC.Rochester.edu + url: https://www.urmc.rochester.edu/encyclopedia/content?contenttypeid=76&contentid=11206-3 + - title: Nutrition Facts for Cucumber + url: https://tools.myfooddata.com/nutrition-facts/168409/wt9 + - title: 'Cucumber: Calories, Nutrition and Health Benefits | NutriScan + App' + url: https://nutriscan.app/calories-nutrition/sliced-cucumber + - title: ¼ Cucumber Of Cucumber Nutrition Facts - Eat This Much + url: https://www.eatthismuch.com/calories/cucumber-1971?a=0.25%3A2 + - title: Cucumber, peeled, raw, 1 medium | University Hospitals + url: https://www.uhhospitals.org/health-information/health-and-wellness-library/article/nutritionfacts-v1/cucumber-peeled-raw-1-medium + - title: Are Cucumbers Good for You? + url: https://health.clevelandclinic.org/benefits-of-cucumbers + - title: 'Cucumber: nutritional values, nutrients and calories | FreshMAG + ...' + url: https://www.liebherr.com/en-gb/fridges-freezers/freshmag/food-a-z/cucumber-8279000 + - title: 'Carrots 101: Nutrition Facts and Health Benefits' + url: https://www.healthline.com/nutrition/foods/carrots + - title: Nutrition Facts - URMC.Rochester.edu + url: https://www.urmc.rochester.edu/encyclopedia/content?contenttypeid=76&contentid=11124-3 + - title: Carrots | SNAP-Ed + url: https://snaped.fna.usda.gov/resources/nutrition-education-materials/seasonal-produce-guide/carrots + - title: Nutrition Facts for Raw Carrots + url: https://tools.myfooddata.com/nutrition-facts/170393/wt4 + - title: 'Carrots: Health Benefits, Nutrition Facts, and Risks' + url: https://www.webmd.com/food-recipes/benefits-carrots + - title: Carrot Nutrition Facts 0g Fat 25 calories 0.5g Protein 1.5g Fiber + ... + url: https://cdn.agclassroom.org/media/uploads/LP875/Carrot_nutrition_facts.pdf + - title: Carrots - Nutritional information | Wilcox + url: https://www.wilcoxgoodness.co.nz/helpful-info/nutritional-information/carrots + - title: Carrots, raw, 1 large (7-1/4" to 8-1/2" long) | University Hospitals + url: https://www.uhhospitals.org/health-information/health-and-wellness-library/article/nutritionfacts-v1/carrots-raw-1-large-7-14-to-8-12-long + - title: Baby Carrots Nutrition Facts - Eat This Much + url: https://www.eatthismuch.com/calories/baby-carrots-2569 + - title: Baby Carrots Nutrition Facts and Health Benefits + url: https://www.verywellfit.com/baby-carrot-nutrition-facts-and-health-benefits-5071650 + type: search + id: ws_8ee6b8b91369059f + status: completed + type: web_search_call + - content: + - text: 'Both searches returned results. Let me summarize each of the four + queries in one sentence: + + + 1. **Potato nutrition facts**: A medium potato (148g) has 110 calories, + 0g fat, 26g carbs, 2g fiber, and is a good source of vitamin C (30% DV), + potassium (15% DV), and vitamin B6 (10% DV). + + + 2. **Tomato nutrition facts**: A small tomato (91g) provides about 16-22 + calories and is an excellent source of vitamin C, fiber, and vitamin K, + plus the cancer-fighting antioxidant lycopene. + + + 3. **Cucumber nutrition facts**: Cucumbers are about 95-96% water with + only 15-16 calories per 100g, and provide vitamin K (20% DV), potassium, + and antioxidants like beta-carotene. + + + 4. **Carrot nutrition facts**: One medium carrot (61g) contains 25 calories, + 6g carbs, 1.5g fiber, 0g fat, and is especially rich in vitamin A (beta-carotene), + vitamin K, and potassium. + + ' + type: reasoning_text + id: rs_bb8c0e8e4b68beed + summary: [] + type: reasoning + - content: + - annotations: [] + text: ' + + + Here are one-sentence summaries for each of the four searches: + + + 1. **Potato:** A medium potato (148g) provides 110 calories, 26g of carbohydrates, + 2g of fiber, and is a good source of vitamin C (30% DV), potassium (15% + DV), and vitamin B6 (10% DV), while being naturally fat- and cholesterol-free. + + + 2. **Tomato:** A small raw tomato (91g) delivers about 16–22 calories + and is an excellent source of vitamin C, dietary fiber, and vitamin K, + and is the primary dietary source of the antioxidant lycopene, which is + linked to reduced risks of heart disease and certain cancers. + + + 3. **Cucumber:** With only about 15–16 calories per 100g and roughly 95–96% + water, cucumbers provide vitamin K (~20% DV), potassium, and antioxidants + like beta-carotene, making them a hydrating, low-calorie addition to a + healthy diet. + + + 4. **Carrot:** One medium raw carrot (61g) contains 25 calories, 6g of + carbohydrates, 1.5g of fiber, and 0g of fat, and is especially rich in + beta-carotene (vitamin A), vitamin K, and potassium, with diets high in + carotenoids potentially protective against several types of cancer.' + type: output_text + id: msg_862b73745b32c760 + role: assistant + status: completed + type: message + - content: + - text: 'Call gitmcp_tiktoken__search_tiktoken_documentation in parallel for + two separate exact queries -- do not wait for one to finish before starting + the other: (1) {"query":"encoding"} and (2) {"query":"tokenizer"}. Issue + both calls now in this single turn, then summarize each result in one + sentence.' + type: input_text + id: msg_01a16868-f8e7-7121-a3e5-71db08a39cb0 + role: user + status: completed + type: message + - content: + - text: 'The user wants me to call `mcp__gitmcp_tiktoken__search_tiktoken_documentation` + twice in parallel - once with query "encoding" and once with query "tokenizer". + I''ll issue both calls in the same function_calls block. + + ' + type: reasoning_text + id: rs_8a8a17763b04a832 + summary: [] + type: reasoning + - approval_request_id: null + arguments: '{"query": "encoding"}' + error: null + id: mcp_a4bef669c02bfcf5 + name: search_tiktoken_documentation + output: "### Search Results for: \"encoding\"\n\nNo relevant documentation\ + \ found for your query. It's either being indexed or the search query did\ + \ not match any documentation.\n\nAs a fallback, this is the documentation\ + \ for openai/tiktoken:\n\n# ⏳ tiktoken\n\ntiktoken is a fast [BPE](https://en.wikipedia.org/wiki/Byte_pair_encoding)\ + \ tokeniser for use with\nOpenAI's models.\n\n```python\nimport tiktoken\n\ + enc = tiktoken.get_encoding(\"o200k_base\")\nassert enc.decode(enc.encode(\"\ + hello world\")) == \"hello world\"\n\n# To get the tokeniser corresponding\ + \ to a specific model in the OpenAI API:\nenc = tiktoken.encoding_for_model(\"\ + gpt-4o\")\n```\n\nThe open source version of `tiktoken` can be installed\ + \ from [PyPI](https://pypi.org/project/tiktoken):\n```\npip install tiktoken\n\ + ```\n\nThe tokeniser API is documented in `tiktoken/core.py`.\n\nExample\ + \ code using `tiktoken` can be found in the\n[OpenAI Cookbook](https://github.com/openai/openai-cookbook/blob/main/examples/How_to_count_tokens_with_tiktoken.ipynb).\n\ + \n\n## Performance\n\n`tiktoken` is between 3-6x faster than a comparable\ + \ open source tokeniser:\n\n![image](https://raw.githubusercontent.com/openai/tiktoken/main/perf.svg)\n\ + \nPerformance measured on 1GB of text using the GPT-2 tokeniser, using `GPT2TokenizerFast`\ + \ from\n`tokenizers==0.13.2`, `transformers==4.24.0` and `tiktoken==0.2.0`.\n\ + \n\n## Getting help\n\nPlease post questions in the [issue tracker](https://github.com/openai/tiktoken/issues).\n\ + \nIf you work at OpenAI, make sure to check the internal documentation or\ + \ feel free to contact\n@shantanu.\n\n## What is BPE anyway?\n\nLanguage\ + \ models don't see text like you and I, instead they see a sequence of numbers\ + \ (known as tokens).\nByte pair encoding (BPE) is a way of converting text\ + \ into tokens. It has a couple desirable\nproperties:\n1) It's reversible\ + \ and lossless, so you can convert tokens back into the original text\n\ + 2) It works on arbitrary text, even text that is not in the tokeniser's\ + \ training data\n3) It compresses the text: the token sequence is shorter\ + \ than the bytes corresponding to the\n original text. On average, in\ + \ practice, each token corresponds to about 4 bytes.\n4) It attempts to\ + \ let the model see common subwords. For instance, \"ing\" is a common subword\ + \ in\n English, so BPE encodings will often split \"encoding\" into tokens\ + \ like \"encod\" and \"ing\"\n (instead of e.g. \"enc\" and \"oding\"\ + ). Because the model will then see the \"ing\" token again and\n again\ + \ in different contexts, it helps models generalise and better understand\ + \ grammar.\n\n`tiktoken` contains an educational submodule that is friendlier\ + \ if you want to learn more about\nthe details of BPE, including code that\ + \ helps visualise the BPE procedure:\n```python\nfrom tiktoken._educational\ + \ import *\n\n# Train a BPE tokeniser on a small amount of text\nenc = train_simple_encoding()\n\ + \n# Visualise how the GPT-4 encoder encodes text\nenc = SimpleBytePairEncoding.from_tiktoken(\"\ + cl100k_base\")\nenc.encode(\"hello world aaaaaaaaaaaa\")\n```\n\n\n## Extending\ + \ tiktoken\n\nYou may wish to extend `tiktoken` to support new encodings.\ + \ There are two ways to do this.\n\n\n**Create your `Encoding` object exactly\ + \ the way you want and simply pass it around.**\n\n```python\ncl100k_base\ + \ = tiktoken.get_encoding(\"cl100k_base\")\n\n# In production, load the\ + \ arguments directly instead of accessing private attributes\n# See openai_public.py\ + \ for examples of arguments for specific encodings\nenc = tiktoken.Encoding(\n\ + \ # If you're changing the set of special tokens, make sure to use a\ + \ different name\n # It should be clear from the name what behaviour\ + \ to expect.\n name=\"cl100k_im\",\n pat_str=cl100k_base._pat_str,\n\ + \ mergeable_ranks=cl100k_base._mergeable_ranks,\n special_tokens={\n\ + \ **cl100k_base._special_tokens,\n \"<|im_start|>\": 100264,\n\ + \ \"<|im_end|>\": 100265,\n }\n)\n```\n\n**Use the `tiktoken_ext`\ + \ plugin mechanism to register your `Encoding` objects with `tiktoken`.**\n\ + \nThis is only useful if you need `tiktoken.get_encoding` to find your encoding,\ + \ otherwise prefer\noption 1.\n\nTo do this, you'll need to create a namespace\ + \ package under `tiktoken_ext`.\n\nLayout your project like this, making\ + \ sure to omit the `tiktoken_ext/__init__.py` file:\n```\nmy_tiktoken_extension\n\ + ├── tiktoken_ext\n│   └── my_encodings.py\n└── setup.py\n```\n\n`my_encodings.py`\ + \ should be a module that contains a variable named `ENCODING_CONSTRUCTORS`.\n\ + This is a dictionary from an encoding name to a function that takes no arguments\ + \ and returns\narguments that can be passed to `tiktoken.Encoding` to construct\ + \ that encoding. For an example, see\n`tiktoken_ext/openai_public.py`. For\ + \ precise details, see `tiktoken/registry.py`.\n\nYour `setup.py` should\ + \ look something like this:\n```python\nfrom setuptools import setup, find_namespace_packages\n\ + \nsetup(\n name=\"my_tiktoken_extension\",\n packages=find_namespace_packages(include=['tiktoken_ext*']),\n\ + \ install_requires=[\"tiktoken\"],\n ...\n)\n```\n\nThen simply `pip\ + \ install ./my_tiktoken_extension` and you should be able to use your\n\ + custom encodings! Make sure **not** to use an editable install.\n\n\n\n\ + If you'd like to retry the search, try changing the query to increase the\ + \ likelihood of a match." + server_label: gitmcp_tiktoken + status: completed + type: mcp_call + - approval_request_id: null + arguments: '{"query": "tokenizer"}' + error: null + id: mcp_8db02699fcd1210b + name: search_tiktoken_documentation + output: "### Search Results for: \"tokenizer\"\n\nNo relevant documentation\ + \ found for your query. It's either being indexed or the search query did\ + \ not match any documentation.\n\nAs a fallback, this is the documentation\ + \ for openai/tiktoken:\n\n# ⏳ tiktoken\n\ntiktoken is a fast [BPE](https://en.wikipedia.org/wiki/Byte_pair_encoding)\ + \ tokeniser for use with\nOpenAI's models.\n\n```python\nimport tiktoken\n\ + enc = tiktoken.get_encoding(\"o200k_base\")\nassert enc.decode(enc.encode(\"\ + hello world\")) == \"hello world\"\n\n# To get the tokeniser corresponding\ + \ to a specific model in the OpenAI API:\nenc = tiktoken.encoding_for_model(\"\ + gpt-4o\")\n```\n\nThe open source version of `tiktoken` can be installed\ + \ from [PyPI](https://pypi.org/project/tiktoken):\n```\npip install tiktoken\n\ + ```\n\nThe tokeniser API is documented in `tiktoken/core.py`.\n\nExample\ + \ code using `tiktoken` can be found in the\n[OpenAI Cookbook](https://github.com/openai/openai-cookbook/blob/main/examples/How_to_count_tokens_with_tiktoken.ipynb).\n\ + \n\n## Performance\n\n`tiktoken` is between 3-6x faster than a comparable\ + \ open source tokeniser:\n\n![image](https://raw.githubusercontent.com/openai/tiktoken/main/perf.svg)\n\ + \nPerformance measured on 1GB of text using the GPT-2 tokeniser, using `GPT2TokenizerFast`\ + \ from\n`tokenizers==0.13.2`, `transformers==4.24.0` and `tiktoken==0.2.0`.\n\ + \n\n## Getting help\n\nPlease post questions in the [issue tracker](https://github.com/openai/tiktoken/issues).\n\ + \nIf you work at OpenAI, make sure to check the internal documentation or\ + \ feel free to contact\n@shantanu.\n\n## What is BPE anyway?\n\nLanguage\ + \ models don't see text like you and I, instead they see a sequence of numbers\ + \ (known as tokens).\nByte pair encoding (BPE) is a way of converting text\ + \ into tokens. It has a couple desirable\nproperties:\n1) It's reversible\ + \ and lossless, so you can convert tokens back into the original text\n\ + 2) It works on arbitrary text, even text that is not in the tokeniser's\ + \ training data\n3) It compresses the text: the token sequence is shorter\ + \ than the bytes corresponding to the\n original text. On average, in\ + \ practice, each token corresponds to about 4 bytes.\n4) It attempts to\ + \ let the model see common subwords. For instance, \"ing\" is a common subword\ + \ in\n English, so BPE encodings will often split \"encoding\" into tokens\ + \ like \"encod\" and \"ing\"\n (instead of e.g. \"enc\" and \"oding\"\ + ). Because the model will then see the \"ing\" token again and\n again\ + \ in different contexts, it helps models generalise and better understand\ + \ grammar.\n\n`tiktoken` contains an educational submodule that is friendlier\ + \ if you want to learn more about\nthe details of BPE, including code that\ + \ helps visualise the BPE procedure:\n```python\nfrom tiktoken._educational\ + \ import *\n\n# Train a BPE tokeniser on a small amount of text\nenc = train_simple_encoding()\n\ + \n# Visualise how the GPT-4 encoder encodes text\nenc = SimpleBytePairEncoding.from_tiktoken(\"\ + cl100k_base\")\nenc.encode(\"hello world aaaaaaaaaaaa\")\n```\n\n\n## Extending\ + \ tiktoken\n\nYou may wish to extend `tiktoken` to support new encodings.\ + \ There are two ways to do this.\n\n\n**Create your `Encoding` object exactly\ + \ the way you want and simply pass it around.**\n\n```python\ncl100k_base\ + \ = tiktoken.get_encoding(\"cl100k_base\")\n\n# In production, load the\ + \ arguments directly instead of accessing private attributes\n# See openai_public.py\ + \ for examples of arguments for specific encodings\nenc = tiktoken.Encoding(\n\ + \ # If you're changing the set of special tokens, make sure to use a\ + \ different name\n # It should be clear from the name what behaviour\ + \ to expect.\n name=\"cl100k_im\",\n pat_str=cl100k_base._pat_str,\n\ + \ mergeable_ranks=cl100k_base._mergeable_ranks,\n special_tokens={\n\ + \ **cl100k_base._special_tokens,\n \"<|im_start|>\": 100264,\n\ + \ \"<|im_end|>\": 100265,\n }\n)\n```\n\n**Use the `tiktoken_ext`\ + \ plugin mechanism to register your `Encoding` objects with `tiktoken`.**\n\ + \nThis is only useful if you need `tiktoken.get_encoding` to find your encoding,\ + \ otherwise prefer\noption 1.\n\nTo do this, you'll need to create a namespace\ + \ package under `tiktoken_ext`.\n\nLayout your project like this, making\ + \ sure to omit the `tiktoken_ext/__init__.py` file:\n```\nmy_tiktoken_extension\n\ + ├── tiktoken_ext\n│   └── my_encodings.py\n└── setup.py\n```\n\n`my_encodings.py`\ + \ should be a module that contains a variable named `ENCODING_CONSTRUCTORS`.\n\ + This is a dictionary from an encoding name to a function that takes no arguments\ + \ and returns\narguments that can be passed to `tiktoken.Encoding` to construct\ + \ that encoding. For an example, see\n`tiktoken_ext/openai_public.py`. For\ + \ precise details, see `tiktoken/registry.py`.\n\nYour `setup.py` should\ + \ look something like this:\n```python\nfrom setuptools import setup, find_namespace_packages\n\ + \nsetup(\n name=\"my_tiktoken_extension\",\n packages=find_namespace_packages(include=['tiktoken_ext*']),\n\ + \ install_requires=[\"tiktoken\"],\n ...\n)\n```\n\nThen simply `pip\ + \ install ./my_tiktoken_extension` and you should be able to use your\n\ + custom encodings! Make sure **not** to use an editable install.\n\n\n\n\ + If you'd like to retry the search, try changing the query to increase the\ + \ likelihood of a match." + server_label: gitmcp_tiktoken + status: completed + type: mcp_call + - content: + - text: 'Both searches returned the same fallback README content since no + specific documentation was indexed for either query. Let me summarize + each in one sentence. + + ' + type: reasoning_text + id: rs_9dca2a42406fd775 + summary: [] + type: reasoning + - content: + - annotations: [] + text: ' + + + Here are one-sentence summaries for each query: + + + 1. **"encoding" search:** No specific documentation was indexed for "encoding," + so the tool returned a fallback of tiktoken''s README, which explains + that tiktoken is a fast BPE tokeniser for OpenAI''s models, that encodings + can be retrieved via `tiktoken.get_encoding("o200k_base")` or `tiktoken.encoding_for_model("gpt-4o")`, + and that custom encodings can be extended by either directly constructing + `tiktoken.Encoding` objects or registering them through the `tiktoken_ext` + plugin mechanism. + + + 2. **"tokenizer" search:** Similarly, no specific documentation was indexed + for "tokenizer," and the same fallback README was returned, noting that + tiktoken is 3–6× faster than comparable open-source tokenisers (benchmarked + against `GPT2TokenizerFast` from HuggingFace `tokenizers`), that the core + tokenizer API is documented in `tiktoken/core.py`, and that BPE works + by converting text into reversible, lossless token sequences where each + token corresponds to roughly 4 bytes on average.' + type: output_text + id: msg_9625fc5a78cfcb95 + role: assistant + status: completed + type: message + - content: + - text: 'Do both of these right now, in parallel, in this single turn -- do + not wait for one to finish before starting the other: (1) search the web + for the exact query "latest vLLM release notes", and (2) call gitmcp_tiktoken__search_tiktoken_documentation + with {"query":"encoding"}. Do not call any other tool.' + type: input_text + id: msg_01a16869-4085-7ea3-b457-aaed0b24407a + role: user + status: completed + type: message + first_id: msg_01a16868-b5eb-7231-8c69-837e933982da + has_more: false + last_id: msg_01a16869-4085-7ea3-b457-aaed0b24407a + object: list + headers: + content-type: application/json + status_code: 200 +- filename: t7 + request: + body: + input: + - content: Do not call tools again. Reply only OK. + role: user + type: message + max_output_tokens: 2048 + model: Qwen/Qwen3.8-27B-FP8 + parallel_tool_calls: true + previous_response_id: resp_01a16868-f9b7-7551-ae08-2017135c85ba + store: true + stream: false + tool_choice: none + tools: + - type: web_search_preview + - allowed_tools: + - search_tiktoken_documentation + require_approval: never + server_label: gitmcp_tiktoken + server_url: https://gitmcp.io/openai/tiktoken + type: mcp + headers: + accept: '*/*' + authorization: Bearer *** + content-type: application/json + user-agent: python-httpx/0.28.1 + method: POST + path: /v1/responses + query_params: {} + response: + body: + background: false + completed_at: 1792753096 + created_at: 1792753096 + error: null + frequency_penalty: 0.0 + id: resp_01a16869-41f8-7d30-8f49-92e87599a7e3 + incomplete_details: null + instructions: null + max_output_tokens: 2048 + max_tool_calls: null + metadata: {} + model: Qwen/Qwen3.8-27B-FP8 + object: response + output: + - content: + - text: 'The user wants me to reply only "OK" and not call any tools. + + ' + type: reasoning_text + id: rs_b7341380f1ecc47f + summary: [] + type: reasoning + - content: + - annotations: [] + text: ' + + + OK' + type: output_text + id: msg_a4185254fd908c9e + role: assistant + status: completed + type: message + parallel_tool_calls: true + presence_penalty: 0.0 + previous_response_id: resp_01a16868-f9b7-7551-ae08-2017135c85ba + prompt_cache_key: null + prompt_cache_options: null + reasoning: null + safety_identifier: null + service_tier: auto + status: completed + store: true + temperature: 1.0 + text: + format: + type: text + tool_choice: none + tools: + - filters: null + search_context_size: null + type: web_search_preview + user_location: null + - allowed_tools: + - search_tiktoken_documentation + require_approval: never + server_label: gitmcp_tiktoken + server_url: https://gitmcp.io/openai/tiktoken + type: mcp + top_logprobs: 0 + top_p: 1.0 + truncation: disabled + usage: + input_tokens: 20587 + input_tokens_details: + cache_write_tokens: 6272 + cached_tokens: 14112 + output_tokens: 21 + output_tokens_details: + reasoning_tokens: 17 + total_tokens: 20608 + headers: + content-type: application/json + status_code: 200 +- filename: t8 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_01a16869-41f8-7d30-8f49-92e87599a7e3/input_items + query_params: + limit: '100' + order: asc + response: + body: + data: + - content: + - text: 'Do two separate web_search calls in parallel, in this single turn + -- do not wait for one to finish before starting the other. The first + web_search call must batch two exact queries together: "potato nutrition + facts" and "tomato nutrition facts". The second web_search call must batch + two different exact queries together: "cucumber nutrition facts" and "carrot + nutrition facts". Issue both calls now, then summarize each of the four + results in one sentence.' + type: input_text + id: msg_01a16868-b5eb-7231-8c69-837e933982da + role: user + status: completed + type: message + - id: mcpl_01a16868-68c8-7483-a47b-626ba509ed37 + server_label: gitmcp_tiktoken + tools: + - annotations: + read_only: false + description: 'Semantically search within the fetched documentation from + GitHub repository: openai/tiktoken. Useful for specific queries.' + input_schema: + $schema: http://json-schema.org/draft-07/schema# + additionalProperties: false + properties: + query: + description: The search query to find relevant documentation + type: string + required: + - query + type: object + name: search_tiktoken_documentation + type: mcp_list_tools + - content: + - text: 'The user wants me to make two web_search calls in parallel in this + single turn. The first call should batch "potato nutrition facts" and + "tomato nutrition facts" together using the `queries` parameter. The second + call should batch "cucumber nutrition facts" and "carrot nutrition facts" + together using the `queries` parameter. Both calls should be made in the + same function_calls block to execute in parallel. + + ' + type: reasoning_text + id: rs_8694582545bb175b + summary: [] + type: reasoning + - action: + queries: + - potato nutrition facts + - tomato nutrition facts + query: potato nutrition facts + sources: + - title: Potato Nutrition Facts | Nutrients, Calories, Benefits of a Potato + url: https://potatogoodness.com/nutrition/ + - title: Potato + url: https://www.fda.gov/media/76882/download + - title: FACTS | Modern Solutions for K-12 Schools and More + url: https://factsmgt.com/ + - title: 'Potatoes 101: Nutrition Facts, Health Benefits, and Types' + url: https://www.healthline.com/nutrition/foods/potatoes + - title: 'FACTS SIS: Accounts' + url: https://accounts.renweb.com/Account/Login + - title: Nutrition - Potatoes International + url: https://usapotatoes.com/potato-nutrition/ + - title: Food Search | USDA FoodData Central + url: https://fdc.nal.usda.gov/food-search?query=potato + - title: Potato Nutrition - Cooking with Potatoes - Alsum + url: https://alsum.com/products/potato-nutrition-facts/ + - title: Idaho® Potato Nutrition Facts | Idaho Potato Commission + url: https://idahopotato.com/nutrition + - title: The EDFacts Initiative | U.S. Department of Education + url: https://www.ed.gov/data/edfacts-initiative + - title: 'Tomatoes: Nutrition Facts and Health Benefits' + url: https://www.healthline.com/nutrition/tomatoes + - title: Tomato Nutrition Facts and Health Benefits + url: https://www.verywellhealth.com/tomato-nutrition-12012681 + - title: Nutrition Facts for Tomatoes + url: https://tools.myfooddata.com/nutrition-facts/170457/wt6 + - title: Tomato Nutrition Facts and Health Benefits + url: https://www.verywellfit.com/tomatoes-nutrition-facts-calories-and-health-benefits-4119981 + - title: Tomatoes - SNAP-Ed - USDA + url: https://snaped.fna.usda.gov/resources/nutrition-education-materials/seasonal-produce-guide/tomatoes + - title: Tomatoes Nutrition Facts - Eat This Much + url: https://www.eatthismuch.com/calories/tomatoes-2226 + - title: 'Tomatoes 101: Nutrition Facts and Health Benefits' + url: https://www.healthline.com/nutrition/foods/tomatoes + - title: 'Tomatoes, raw: calories and nutrition facts' + url: https://www.nutritionvalue.org/Tomatoes%2C_raw_74101000_nutritional_value.html + - title: Top 10 Tomato Nutrition facts and Health benefits + url: https://www.nutrition-and-you.com/tomato.html + - title: 'Tomatoes: A Nutritional Powerhouse and Culinary Favorite - UF/IFAS + ...' + url: https://blogs.ifas.ufl.edu/brevardco/2025/04/07/tomatoes-a-nutritional-powerhouse-and-culinary-favorite/ + type: search + id: ws_90d3592d82410588 + status: completed + type: web_search_call + - action: + queries: + - cucumber nutrition facts + - carrot nutrition facts + query: cucumber nutrition facts + sources: + - title: Cucumber Nutrition Facts and Benefits - Franklin County Center + ... + url: https://franklin.ces.ncsu.edu/news/cucumber-nutrition-facts-and-benefits/ + - title: Health Benefits of Cucumber + url: https://www.webmd.com/food-recipes/cucumber-health-benefits + - title: Cucumbers | SNAP-Ed + url: https://snaped.fna.usda.gov/resources/nutrition-education-materials/seasonal-produce-guide/cucumbers + - title: Nutrition Facts - URMC.Rochester.edu + url: https://www.urmc.rochester.edu/encyclopedia/content?contenttypeid=76&contentid=11206-3 + - title: Nutrition Facts for Cucumber + url: https://tools.myfooddata.com/nutrition-facts/168409/wt9 + - title: 'Cucumber: Calories, Nutrition and Health Benefits | NutriScan + App' + url: https://nutriscan.app/calories-nutrition/sliced-cucumber + - title: ¼ Cucumber Of Cucumber Nutrition Facts - Eat This Much + url: https://www.eatthismuch.com/calories/cucumber-1971?a=0.25%3A2 + - title: Cucumber, peeled, raw, 1 medium | University Hospitals + url: https://www.uhhospitals.org/health-information/health-and-wellness-library/article/nutritionfacts-v1/cucumber-peeled-raw-1-medium + - title: Are Cucumbers Good for You? + url: https://health.clevelandclinic.org/benefits-of-cucumbers + - title: 'Cucumber: nutritional values, nutrients and calories | FreshMAG + ...' + url: https://www.liebherr.com/en-gb/fridges-freezers/freshmag/food-a-z/cucumber-8279000 + - title: 'Carrots 101: Nutrition Facts and Health Benefits' + url: https://www.healthline.com/nutrition/foods/carrots + - title: Nutrition Facts - URMC.Rochester.edu + url: https://www.urmc.rochester.edu/encyclopedia/content?contenttypeid=76&contentid=11124-3 + - title: Carrots | SNAP-Ed + url: https://snaped.fna.usda.gov/resources/nutrition-education-materials/seasonal-produce-guide/carrots + - title: Nutrition Facts for Raw Carrots + url: https://tools.myfooddata.com/nutrition-facts/170393/wt4 + - title: 'Carrots: Health Benefits, Nutrition Facts, and Risks' + url: https://www.webmd.com/food-recipes/benefits-carrots + - title: Carrot Nutrition Facts 0g Fat 25 calories 0.5g Protein 1.5g Fiber + ... + url: https://cdn.agclassroom.org/media/uploads/LP875/Carrot_nutrition_facts.pdf + - title: Carrots - Nutritional information | Wilcox + url: https://www.wilcoxgoodness.co.nz/helpful-info/nutritional-information/carrots + - title: Carrots, raw, 1 large (7-1/4" to 8-1/2" long) | University Hospitals + url: https://www.uhhospitals.org/health-information/health-and-wellness-library/article/nutritionfacts-v1/carrots-raw-1-large-7-14-to-8-12-long + - title: Baby Carrots Nutrition Facts - Eat This Much + url: https://www.eatthismuch.com/calories/baby-carrots-2569 + - title: Baby Carrots Nutrition Facts and Health Benefits + url: https://www.verywellfit.com/baby-carrot-nutrition-facts-and-health-benefits-5071650 + type: search + id: ws_8ee6b8b91369059f + status: completed + type: web_search_call + - content: + - text: 'Both searches returned results. Let me summarize each of the four + queries in one sentence: + + + 1. **Potato nutrition facts**: A medium potato (148g) has 110 calories, + 0g fat, 26g carbs, 2g fiber, and is a good source of vitamin C (30% DV), + potassium (15% DV), and vitamin B6 (10% DV). + + + 2. **Tomato nutrition facts**: A small tomato (91g) provides about 16-22 + calories and is an excellent source of vitamin C, fiber, and vitamin K, + plus the cancer-fighting antioxidant lycopene. + + + 3. **Cucumber nutrition facts**: Cucumbers are about 95-96% water with + only 15-16 calories per 100g, and provide vitamin K (20% DV), potassium, + and antioxidants like beta-carotene. + + + 4. **Carrot nutrition facts**: One medium carrot (61g) contains 25 calories, + 6g carbs, 1.5g fiber, 0g fat, and is especially rich in vitamin A (beta-carotene), + vitamin K, and potassium. + + ' + type: reasoning_text + id: rs_bb8c0e8e4b68beed + summary: [] + type: reasoning + - content: + - annotations: [] + text: ' + + + Here are one-sentence summaries for each of the four searches: + + + 1. **Potato:** A medium potato (148g) provides 110 calories, 26g of carbohydrates, + 2g of fiber, and is a good source of vitamin C (30% DV), potassium (15% + DV), and vitamin B6 (10% DV), while being naturally fat- and cholesterol-free. + + + 2. **Tomato:** A small raw tomato (91g) delivers about 16–22 calories + and is an excellent source of vitamin C, dietary fiber, and vitamin K, + and is the primary dietary source of the antioxidant lycopene, which is + linked to reduced risks of heart disease and certain cancers. + + + 3. **Cucumber:** With only about 15–16 calories per 100g and roughly 95–96% + water, cucumbers provide vitamin K (~20% DV), potassium, and antioxidants + like beta-carotene, making them a hydrating, low-calorie addition to a + healthy diet. + + + 4. **Carrot:** One medium raw carrot (61g) contains 25 calories, 6g of + carbohydrates, 1.5g of fiber, and 0g of fat, and is especially rich in + beta-carotene (vitamin A), vitamin K, and potassium, with diets high in + carotenoids potentially protective against several types of cancer.' + type: output_text + id: msg_862b73745b32c760 + role: assistant + status: completed + type: message + - content: + - text: 'Call gitmcp_tiktoken__search_tiktoken_documentation in parallel for + two separate exact queries -- do not wait for one to finish before starting + the other: (1) {"query":"encoding"} and (2) {"query":"tokenizer"}. Issue + both calls now in this single turn, then summarize each result in one + sentence.' + type: input_text + id: msg_01a16868-f8e7-7121-a3e5-71db08a39cb0 + role: user + status: completed + type: message + - content: + - text: 'The user wants me to call `mcp__gitmcp_tiktoken__search_tiktoken_documentation` + twice in parallel - once with query "encoding" and once with query "tokenizer". + I''ll issue both calls in the same function_calls block. + + ' + type: reasoning_text + id: rs_8a8a17763b04a832 + summary: [] + type: reasoning + - approval_request_id: null + arguments: '{"query": "encoding"}' + error: null + id: mcp_a4bef669c02bfcf5 + name: search_tiktoken_documentation + output: "### Search Results for: \"encoding\"\n\nNo relevant documentation\ + \ found for your query. It's either being indexed or the search query did\ + \ not match any documentation.\n\nAs a fallback, this is the documentation\ + \ for openai/tiktoken:\n\n# ⏳ tiktoken\n\ntiktoken is a fast [BPE](https://en.wikipedia.org/wiki/Byte_pair_encoding)\ + \ tokeniser for use with\nOpenAI's models.\n\n```python\nimport tiktoken\n\ + enc = tiktoken.get_encoding(\"o200k_base\")\nassert enc.decode(enc.encode(\"\ + hello world\")) == \"hello world\"\n\n# To get the tokeniser corresponding\ + \ to a specific model in the OpenAI API:\nenc = tiktoken.encoding_for_model(\"\ + gpt-4o\")\n```\n\nThe open source version of `tiktoken` can be installed\ + \ from [PyPI](https://pypi.org/project/tiktoken):\n```\npip install tiktoken\n\ + ```\n\nThe tokeniser API is documented in `tiktoken/core.py`.\n\nExample\ + \ code using `tiktoken` can be found in the\n[OpenAI Cookbook](https://github.com/openai/openai-cookbook/blob/main/examples/How_to_count_tokens_with_tiktoken.ipynb).\n\ + \n\n## Performance\n\n`tiktoken` is between 3-6x faster than a comparable\ + \ open source tokeniser:\n\n![image](https://raw.githubusercontent.com/openai/tiktoken/main/perf.svg)\n\ + \nPerformance measured on 1GB of text using the GPT-2 tokeniser, using `GPT2TokenizerFast`\ + \ from\n`tokenizers==0.13.2`, `transformers==4.24.0` and `tiktoken==0.2.0`.\n\ + \n\n## Getting help\n\nPlease post questions in the [issue tracker](https://github.com/openai/tiktoken/issues).\n\ + \nIf you work at OpenAI, make sure to check the internal documentation or\ + \ feel free to contact\n@shantanu.\n\n## What is BPE anyway?\n\nLanguage\ + \ models don't see text like you and I, instead they see a sequence of numbers\ + \ (known as tokens).\nByte pair encoding (BPE) is a way of converting text\ + \ into tokens. It has a couple desirable\nproperties:\n1) It's reversible\ + \ and lossless, so you can convert tokens back into the original text\n\ + 2) It works on arbitrary text, even text that is not in the tokeniser's\ + \ training data\n3) It compresses the text: the token sequence is shorter\ + \ than the bytes corresponding to the\n original text. On average, in\ + \ practice, each token corresponds to about 4 bytes.\n4) It attempts to\ + \ let the model see common subwords. For instance, \"ing\" is a common subword\ + \ in\n English, so BPE encodings will often split \"encoding\" into tokens\ + \ like \"encod\" and \"ing\"\n (instead of e.g. \"enc\" and \"oding\"\ + ). Because the model will then see the \"ing\" token again and\n again\ + \ in different contexts, it helps models generalise and better understand\ + \ grammar.\n\n`tiktoken` contains an educational submodule that is friendlier\ + \ if you want to learn more about\nthe details of BPE, including code that\ + \ helps visualise the BPE procedure:\n```python\nfrom tiktoken._educational\ + \ import *\n\n# Train a BPE tokeniser on a small amount of text\nenc = train_simple_encoding()\n\ + \n# Visualise how the GPT-4 encoder encodes text\nenc = SimpleBytePairEncoding.from_tiktoken(\"\ + cl100k_base\")\nenc.encode(\"hello world aaaaaaaaaaaa\")\n```\n\n\n## Extending\ + \ tiktoken\n\nYou may wish to extend `tiktoken` to support new encodings.\ + \ There are two ways to do this.\n\n\n**Create your `Encoding` object exactly\ + \ the way you want and simply pass it around.**\n\n```python\ncl100k_base\ + \ = tiktoken.get_encoding(\"cl100k_base\")\n\n# In production, load the\ + \ arguments directly instead of accessing private attributes\n# See openai_public.py\ + \ for examples of arguments for specific encodings\nenc = tiktoken.Encoding(\n\ + \ # If you're changing the set of special tokens, make sure to use a\ + \ different name\n # It should be clear from the name what behaviour\ + \ to expect.\n name=\"cl100k_im\",\n pat_str=cl100k_base._pat_str,\n\ + \ mergeable_ranks=cl100k_base._mergeable_ranks,\n special_tokens={\n\ + \ **cl100k_base._special_tokens,\n \"<|im_start|>\": 100264,\n\ + \ \"<|im_end|>\": 100265,\n }\n)\n```\n\n**Use the `tiktoken_ext`\ + \ plugin mechanism to register your `Encoding` objects with `tiktoken`.**\n\ + \nThis is only useful if you need `tiktoken.get_encoding` to find your encoding,\ + \ otherwise prefer\noption 1.\n\nTo do this, you'll need to create a namespace\ + \ package under `tiktoken_ext`.\n\nLayout your project like this, making\ + \ sure to omit the `tiktoken_ext/__init__.py` file:\n```\nmy_tiktoken_extension\n\ + ├── tiktoken_ext\n│   └── my_encodings.py\n└── setup.py\n```\n\n`my_encodings.py`\ + \ should be a module that contains a variable named `ENCODING_CONSTRUCTORS`.\n\ + This is a dictionary from an encoding name to a function that takes no arguments\ + \ and returns\narguments that can be passed to `tiktoken.Encoding` to construct\ + \ that encoding. For an example, see\n`tiktoken_ext/openai_public.py`. For\ + \ precise details, see `tiktoken/registry.py`.\n\nYour `setup.py` should\ + \ look something like this:\n```python\nfrom setuptools import setup, find_namespace_packages\n\ + \nsetup(\n name=\"my_tiktoken_extension\",\n packages=find_namespace_packages(include=['tiktoken_ext*']),\n\ + \ install_requires=[\"tiktoken\"],\n ...\n)\n```\n\nThen simply `pip\ + \ install ./my_tiktoken_extension` and you should be able to use your\n\ + custom encodings! Make sure **not** to use an editable install.\n\n\n\n\ + If you'd like to retry the search, try changing the query to increase the\ + \ likelihood of a match." + server_label: gitmcp_tiktoken + status: completed + type: mcp_call + - approval_request_id: null + arguments: '{"query": "tokenizer"}' + error: null + id: mcp_8db02699fcd1210b + name: search_tiktoken_documentation + output: "### Search Results for: \"tokenizer\"\n\nNo relevant documentation\ + \ found for your query. It's either being indexed or the search query did\ + \ not match any documentation.\n\nAs a fallback, this is the documentation\ + \ for openai/tiktoken:\n\n# ⏳ tiktoken\n\ntiktoken is a fast [BPE](https://en.wikipedia.org/wiki/Byte_pair_encoding)\ + \ tokeniser for use with\nOpenAI's models.\n\n```python\nimport tiktoken\n\ + enc = tiktoken.get_encoding(\"o200k_base\")\nassert enc.decode(enc.encode(\"\ + hello world\")) == \"hello world\"\n\n# To get the tokeniser corresponding\ + \ to a specific model in the OpenAI API:\nenc = tiktoken.encoding_for_model(\"\ + gpt-4o\")\n```\n\nThe open source version of `tiktoken` can be installed\ + \ from [PyPI](https://pypi.org/project/tiktoken):\n```\npip install tiktoken\n\ + ```\n\nThe tokeniser API is documented in `tiktoken/core.py`.\n\nExample\ + \ code using `tiktoken` can be found in the\n[OpenAI Cookbook](https://github.com/openai/openai-cookbook/blob/main/examples/How_to_count_tokens_with_tiktoken.ipynb).\n\ + \n\n## Performance\n\n`tiktoken` is between 3-6x faster than a comparable\ + \ open source tokeniser:\n\n![image](https://raw.githubusercontent.com/openai/tiktoken/main/perf.svg)\n\ + \nPerformance measured on 1GB of text using the GPT-2 tokeniser, using `GPT2TokenizerFast`\ + \ from\n`tokenizers==0.13.2`, `transformers==4.24.0` and `tiktoken==0.2.0`.\n\ + \n\n## Getting help\n\nPlease post questions in the [issue tracker](https://github.com/openai/tiktoken/issues).\n\ + \nIf you work at OpenAI, make sure to check the internal documentation or\ + \ feel free to contact\n@shantanu.\n\n## What is BPE anyway?\n\nLanguage\ + \ models don't see text like you and I, instead they see a sequence of numbers\ + \ (known as tokens).\nByte pair encoding (BPE) is a way of converting text\ + \ into tokens. It has a couple desirable\nproperties:\n1) It's reversible\ + \ and lossless, so you can convert tokens back into the original text\n\ + 2) It works on arbitrary text, even text that is not in the tokeniser's\ + \ training data\n3) It compresses the text: the token sequence is shorter\ + \ than the bytes corresponding to the\n original text. On average, in\ + \ practice, each token corresponds to about 4 bytes.\n4) It attempts to\ + \ let the model see common subwords. For instance, \"ing\" is a common subword\ + \ in\n English, so BPE encodings will often split \"encoding\" into tokens\ + \ like \"encod\" and \"ing\"\n (instead of e.g. \"enc\" and \"oding\"\ + ). Because the model will then see the \"ing\" token again and\n again\ + \ in different contexts, it helps models generalise and better understand\ + \ grammar.\n\n`tiktoken` contains an educational submodule that is friendlier\ + \ if you want to learn more about\nthe details of BPE, including code that\ + \ helps visualise the BPE procedure:\n```python\nfrom tiktoken._educational\ + \ import *\n\n# Train a BPE tokeniser on a small amount of text\nenc = train_simple_encoding()\n\ + \n# Visualise how the GPT-4 encoder encodes text\nenc = SimpleBytePairEncoding.from_tiktoken(\"\ + cl100k_base\")\nenc.encode(\"hello world aaaaaaaaaaaa\")\n```\n\n\n## Extending\ + \ tiktoken\n\nYou may wish to extend `tiktoken` to support new encodings.\ + \ There are two ways to do this.\n\n\n**Create your `Encoding` object exactly\ + \ the way you want and simply pass it around.**\n\n```python\ncl100k_base\ + \ = tiktoken.get_encoding(\"cl100k_base\")\n\n# In production, load the\ + \ arguments directly instead of accessing private attributes\n# See openai_public.py\ + \ for examples of arguments for specific encodings\nenc = tiktoken.Encoding(\n\ + \ # If you're changing the set of special tokens, make sure to use a\ + \ different name\n # It should be clear from the name what behaviour\ + \ to expect.\n name=\"cl100k_im\",\n pat_str=cl100k_base._pat_str,\n\ + \ mergeable_ranks=cl100k_base._mergeable_ranks,\n special_tokens={\n\ + \ **cl100k_base._special_tokens,\n \"<|im_start|>\": 100264,\n\ + \ \"<|im_end|>\": 100265,\n }\n)\n```\n\n**Use the `tiktoken_ext`\ + \ plugin mechanism to register your `Encoding` objects with `tiktoken`.**\n\ + \nThis is only useful if you need `tiktoken.get_encoding` to find your encoding,\ + \ otherwise prefer\noption 1.\n\nTo do this, you'll need to create a namespace\ + \ package under `tiktoken_ext`.\n\nLayout your project like this, making\ + \ sure to omit the `tiktoken_ext/__init__.py` file:\n```\nmy_tiktoken_extension\n\ + ├── tiktoken_ext\n│   └── my_encodings.py\n└── setup.py\n```\n\n`my_encodings.py`\ + \ should be a module that contains a variable named `ENCODING_CONSTRUCTORS`.\n\ + This is a dictionary from an encoding name to a function that takes no arguments\ + \ and returns\narguments that can be passed to `tiktoken.Encoding` to construct\ + \ that encoding. For an example, see\n`tiktoken_ext/openai_public.py`. For\ + \ precise details, see `tiktoken/registry.py`.\n\nYour `setup.py` should\ + \ look something like this:\n```python\nfrom setuptools import setup, find_namespace_packages\n\ + \nsetup(\n name=\"my_tiktoken_extension\",\n packages=find_namespace_packages(include=['tiktoken_ext*']),\n\ + \ install_requires=[\"tiktoken\"],\n ...\n)\n```\n\nThen simply `pip\ + \ install ./my_tiktoken_extension` and you should be able to use your\n\ + custom encodings! Make sure **not** to use an editable install.\n\n\n\n\ + If you'd like to retry the search, try changing the query to increase the\ + \ likelihood of a match." + server_label: gitmcp_tiktoken + status: completed + type: mcp_call + - content: + - text: 'Both searches returned the same fallback README content since no + specific documentation was indexed for either query. Let me summarize + each in one sentence. + + ' + type: reasoning_text + id: rs_9dca2a42406fd775 + summary: [] + type: reasoning + - content: + - annotations: [] + text: ' + + + Here are one-sentence summaries for each query: + + + 1. **"encoding" search:** No specific documentation was indexed for "encoding," + so the tool returned a fallback of tiktoken''s README, which explains + that tiktoken is a fast BPE tokeniser for OpenAI''s models, that encodings + can be retrieved via `tiktoken.get_encoding("o200k_base")` or `tiktoken.encoding_for_model("gpt-4o")`, + and that custom encodings can be extended by either directly constructing + `tiktoken.Encoding` objects or registering them through the `tiktoken_ext` + plugin mechanism. + + + 2. **"tokenizer" search:** Similarly, no specific documentation was indexed + for "tokenizer," and the same fallback README was returned, noting that + tiktoken is 3–6× faster than comparable open-source tokenisers (benchmarked + against `GPT2TokenizerFast` from HuggingFace `tokenizers`), that the core + tokenizer API is documented in `tiktoken/core.py`, and that BPE works + by converting text into reversible, lossless token sequences where each + token corresponds to roughly 4 bytes on average.' + type: output_text + id: msg_9625fc5a78cfcb95 + role: assistant + status: completed + type: message + - content: + - text: 'Do both of these right now, in parallel, in this single turn -- do + not wait for one to finish before starting the other: (1) search the web + for the exact query "latest vLLM release notes", and (2) call gitmcp_tiktoken__search_tiktoken_documentation + with {"query":"encoding"}. Do not call any other tool.' + type: input_text + id: msg_01a16869-4085-7ea3-b457-aaed0b24407a + role: user + status: completed + type: message + - content: + - text: 'The user wants me to make two tool calls in parallel: + + 1. A web_search call with the query "latest vLLM release notes" + + 2. A gitmcp_tiktoken__search_tiktoken_documentation call with the query + "encoding" + + + These are independent, so I''ll issue both in the same block. + + ' + type: reasoning_text + id: rs_b118aa524415e1c8 + summary: [] + type: reasoning + - action: + queries: + - latest vLLM release notes + query: latest vLLM release notes + sources: + - title: Releases · vllm-project/vllm + url: https://github.com/vllm-project/vllm/releases + - title: vLLM Release Notes - NVIDIA Docs + url: https://docs.nvidia.com/deeplearning/frameworks/vllm-release-notes/index.html + - title: Release Notes - vLLM Ascend + url: https://docs.vllm.ai/projects/ascend/en/latest/user_guide/release_notes.html + - title: Previous vLLM Releases | vLLM + url: https://vllm.ai/releases + - title: Release Notes — vllm-ascend + url: https://docs.vllm.ai/projects/ascend/en/main/user_guide/release_notes.html + - title: Releases · vllm-project/vllm-ascend + url: https://github.com/vllm-project/vllm-ascend/releases + - title: Blog | vLLM + url: https://vllm.ai/blog + - title: vLLM release history | Freedom.Tech + url: https://freedom.tech/project/vllm/ + - title: Release Notes - vLLM Hardware Plugin for Intel® Gaudi® + url: https://docs.vllm.ai/projects/gaudi/en/latest/release_notes.html + - title: Release note — vllm-ascend + url: https://docs.vllm.ai/projects/ascend/en/v0.10.0rc1/user_guide/release_notes.html + type: search + id: ws_b02f4144d93a3ba4 + status: completed + type: web_search_call + - approval_request_id: null + arguments: '{"query": "encoding"}' + error: null + id: mcp_8ccd9b6e8f62355f + name: search_tiktoken_documentation + output: "### Search Results for: \"encoding\"\n\nNo relevant documentation\ + \ found for your query. It's either being indexed or the search query did\ + \ not match any documentation.\n\nAs a fallback, this is the documentation\ + \ for openai/tiktoken:\n\n# ⏳ tiktoken\n\ntiktoken is a fast [BPE](https://en.wikipedia.org/wiki/Byte_pair_encoding)\ + \ tokeniser for use with\nOpenAI's models.\n\n```python\nimport tiktoken\n\ + enc = tiktoken.get_encoding(\"o200k_base\")\nassert enc.decode(enc.encode(\"\ + hello world\")) == \"hello world\"\n\n# To get the tokeniser corresponding\ + \ to a specific model in the OpenAI API:\nenc = tiktoken.encoding_for_model(\"\ + gpt-4o\")\n```\n\nThe open source version of `tiktoken` can be installed\ + \ from [PyPI](https://pypi.org/project/tiktoken):\n```\npip install tiktoken\n\ + ```\n\nThe tokeniser API is documented in `tiktoken/core.py`.\n\nExample\ + \ code using `tiktoken` can be found in the\n[OpenAI Cookbook](https://github.com/openai/openai-cookbook/blob/main/examples/How_to_count_tokens_with_tiktoken.ipynb).\n\ + \n\n## Performance\n\n`tiktoken` is between 3-6x faster than a comparable\ + \ open source tokeniser:\n\n![image](https://raw.githubusercontent.com/openai/tiktoken/main/perf.svg)\n\ + \nPerformance measured on 1GB of text using the GPT-2 tokeniser, using `GPT2TokenizerFast`\ + \ from\n`tokenizers==0.13.2`, `transformers==4.24.0` and `tiktoken==0.2.0`.\n\ + \n\n## Getting help\n\nPlease post questions in the [issue tracker](https://github.com/openai/tiktoken/issues).\n\ + \nIf you work at OpenAI, make sure to check the internal documentation or\ + \ feel free to contact\n@shantanu.\n\n## What is BPE anyway?\n\nLanguage\ + \ models don't see text like you and I, instead they see a sequence of numbers\ + \ (known as tokens).\nByte pair encoding (BPE) is a way of converting text\ + \ into tokens. It has a couple desirable\nproperties:\n1) It's reversible\ + \ and lossless, so you can convert tokens back into the original text\n\ + 2) It works on arbitrary text, even text that is not in the tokeniser's\ + \ training data\n3) It compresses the text: the token sequence is shorter\ + \ than the bytes corresponding to the\n original text. On average, in\ + \ practice, each token corresponds to about 4 bytes.\n4) It attempts to\ + \ let the model see common subwords. For instance, \"ing\" is a common subword\ + \ in\n English, so BPE encodings will often split \"encoding\" into tokens\ + \ like \"encod\" and \"ing\"\n (instead of e.g. \"enc\" and \"oding\"\ + ). Because the model will then see the \"ing\" token again and\n again\ + \ in different contexts, it helps models generalise and better understand\ + \ grammar.\n\n`tiktoken` contains an educational submodule that is friendlier\ + \ if you want to learn more about\nthe details of BPE, including code that\ + \ helps visualise the BPE procedure:\n```python\nfrom tiktoken._educational\ + \ import *\n\n# Train a BPE tokeniser on a small amount of text\nenc = train_simple_encoding()\n\ + \n# Visualise how the GPT-4 encoder encodes text\nenc = SimpleBytePairEncoding.from_tiktoken(\"\ + cl100k_base\")\nenc.encode(\"hello world aaaaaaaaaaaa\")\n```\n\n\n## Extending\ + \ tiktoken\n\nYou may wish to extend `tiktoken` to support new encodings.\ + \ There are two ways to do this.\n\n\n**Create your `Encoding` object exactly\ + \ the way you want and simply pass it around.**\n\n```python\ncl100k_base\ + \ = tiktoken.get_encoding(\"cl100k_base\")\n\n# In production, load the\ + \ arguments directly instead of accessing private attributes\n# See openai_public.py\ + \ for examples of arguments for specific encodings\nenc = tiktoken.Encoding(\n\ + \ # If you're changing the set of special tokens, make sure to use a\ + \ different name\n # It should be clear from the name what behaviour\ + \ to expect.\n name=\"cl100k_im\",\n pat_str=cl100k_base._pat_str,\n\ + \ mergeable_ranks=cl100k_base._mergeable_ranks,\n special_tokens={\n\ + \ **cl100k_base._special_tokens,\n \"<|im_start|>\": 100264,\n\ + \ \"<|im_end|>\": 100265,\n }\n)\n```\n\n**Use the `tiktoken_ext`\ + \ plugin mechanism to register your `Encoding` objects with `tiktoken`.**\n\ + \nThis is only useful if you need `tiktoken.get_encoding` to find your encoding,\ + \ otherwise prefer\noption 1.\n\nTo do this, you'll need to create a namespace\ + \ package under `tiktoken_ext`.\n\nLayout your project like this, making\ + \ sure to omit the `tiktoken_ext/__init__.py` file:\n```\nmy_tiktoken_extension\n\ + ├── tiktoken_ext\n│   └── my_encodings.py\n└── setup.py\n```\n\n`my_encodings.py`\ + \ should be a module that contains a variable named `ENCODING_CONSTRUCTORS`.\n\ + This is a dictionary from an encoding name to a function that takes no arguments\ + \ and returns\narguments that can be passed to `tiktoken.Encoding` to construct\ + \ that encoding. For an example, see\n`tiktoken_ext/openai_public.py`. For\ + \ precise details, see `tiktoken/registry.py`.\n\nYour `setup.py` should\ + \ look something like this:\n```python\nfrom setuptools import setup, find_namespace_packages\n\ + \nsetup(\n name=\"my_tiktoken_extension\",\n packages=find_namespace_packages(include=['tiktoken_ext*']),\n\ + \ install_requires=[\"tiktoken\"],\n ...\n)\n```\n\nThen simply `pip\ + \ install ./my_tiktoken_extension` and you should be able to use your\n\ + custom encodings! Make sure **not** to use an editable install.\n\n\n\n\ + If you'd like to retry the search, try changing the query to increase the\ + \ likelihood of a match." + server_label: gitmcp_tiktoken + status: completed + type: mcp_call + - content: + - text: 'Both calls were made in parallel as requested. Let me summarize the + results. + + + 1. Web search for "latest vLLM release notes" - found the GitHub releases + page, which shows the latest release (v0.26.0) with 411 commits from 212 + contributors, featuring improvements like faster startup, bi-directional + KV transfer, and various performance optimizations. + + + 2. tiktoken documentation search for "encoding" - returned the README/fallback + docs explaining that tiktoken is a fast BPE tokeniser, how to use encodings, + and how to extend with custom encodings. + + + The user just asked me to do both in parallel and didn''t ask for a summary + this time - they said "Do not call any other tool." So I should just confirm + both were done and briefly note the results. + + ' + type: reasoning_text + id: rs_be9503832d80f838 + summary: [] + type: reasoning + - content: + - annotations: [] + text: ' + + + Both calls were issued in parallel in this single turn. Here''s a brief + recap of each: + + + 1. **Web search ("latest vLLM release notes"):** The top result is the + vLLM GitHub releases page, showing the latest release **v0.26.0** (411 + commits from 212 contributors), which adds features like faster startup + via precompiled FlashInfer kernels, bi-directional KV transfer for reduced + TTFT (up to 3.3× on long multi-turn prompts), a shared-memory tensor arena + for multimodal tensors, and least-loaded API worker routing for 43–85% + more req/s on short requests. + + + 2. **tiktoken doc search ("encoding"):** No specific documentation was + indexed, so the tool returned the repo README as a fallback, which explains + that tiktoken is a fast BPE tokeniser for OpenAI models, that you can + retrieve encodings via `tiktoken.get_encoding("o200k_base")` or `tiktoken.encoding_for_model("gpt-4o")`, + and that custom encodings can be created by directly constructing `tiktoken.Encoding` + objects or registering them through the `tiktoken_ext` plugin mechanism.' + type: output_text + id: msg_86c8e81126d72e24 + role: assistant + status: completed + type: message + - content: + - text: Do not call tools again. Reply only OK. + type: input_text + id: msg_01a16869-5631-74d0-9543-76b9c7d2b740 + role: user + status: completed + type: message + first_id: msg_01a16868-b5eb-7231-8c69-837e933982da + has_more: false + last_id: msg_01a16869-5631-74d0-9543-76b9c7d2b740 + object: list + headers: + content-type: application/json + status_code: 200 +- filename: t9 + request: + body: + input: 'Do all three of these right now, in parallel, in this single turn -- + do not wait for one before starting another: (1) call get_weather for "Tokyo", + (2) call get_stock_price for "AAPL", and (3) call set_temperature_unit to + set my preferred unit to "fahrenheit" for the rest of this conversation.' + max_output_tokens: 2048 + model: Qwen/Qwen3.8-27B-FP8 + parallel_tool_calls: true + store: true + stream: false + tool_choice: auto + tools: + - description: Get the current weather for a given city. + name: get_weather + parameters: + additionalProperties: false + properties: + city: + description: City name, e.g. Paris + type: string + required: + - city + type: object + strict: true + type: function + - description: Get the current stock price for a given ticker symbol. + name: get_stock_price + parameters: + additionalProperties: false + properties: + ticker: + description: Stock ticker symbol, e.g. AAPL + type: string + required: + - ticker + type: object + strict: true + type: function + - description: Set the user's preferred temperature unit. This changes how temperatures + should be reported for the rest of this conversation. Call with the raw + unit as plain text input, e.g. fahrenheit -- not JSON. + name: set_temperature_unit + type: custom + headers: + accept: '*/*' + authorization: Bearer *** + content-type: application/json + user-agent: python-httpx/0.28.1 + method: POST + path: /v1/responses + query_params: {} + response: + body: + background: false + completed_at: 1792753101 + created_at: 1792753101 + error: null + frequency_penalty: 0.0 + id: resp_01a16869-5882-76a1-a153-61199d2d278c + incomplete_details: null + instructions: null + max_output_tokens: 2048 + max_tool_calls: null + metadata: {} + model: Qwen/Qwen3.8-27B-FP8 + object: response + output: + - content: + - text: 'The user wants me to make three independent function calls in parallel: + + 1. get_weather for "Tokyo" + + 2. get_stock_price for "AAPL" + + 3. set_temperature_unit to "fahrenheit" + + + These are all independent of each other, so I can call them all in the + same block. + + + For set_temperature_unit, the description says "Call with the raw unit + as plain text input, e.g. fahrenheit -- not JSON." So the `input` field + should be just the string "fahrenheit". + + ' + type: reasoning_text + id: rs_921e660698a6a519 + summary: [] + type: reasoning + - arguments: '{"city": "Tokyo"}' + call_id: chatcmpl-tool-a0fbc5371a13c949 + id: fc_8d0577669244161c + name: get_weather + status: completed + type: function_call + - arguments: '{"ticker": "AAPL"}' + call_id: chatcmpl-tool-b6d0f4de6bac48e1 + id: fc_a30f8440cf89804e + name: get_stock_price + status: completed + type: function_call + - call_id: chatcmpl-tool-9a7bee702487b0bd + id: ctc_ad92e0c07fb5a297 + input: fahrenheit + name: set_temperature_unit + status: completed + type: custom_tool_call + parallel_tool_calls: true + presence_penalty: 0.0 + previous_response_id: null + prompt_cache_key: null + prompt_cache_options: null + reasoning: null + safety_identifier: null + service_tier: auto + status: completed + store: true + temperature: 1.0 + text: + format: + type: text + tool_choice: auto + tools: + - description: Get the current weather for a given city. + name: get_weather + parameters: + additionalProperties: false + properties: + city: + description: City name, e.g. Paris + type: string + required: + - city + type: object + strict: true + type: function + - description: Get the current stock price for a given ticker symbol. + name: get_stock_price + parameters: + additionalProperties: false + properties: + ticker: + description: Stock ticker symbol, e.g. AAPL + type: string + required: + - ticker + type: object + strict: true + type: function + - description: Set the user's preferred temperature unit. This changes how temperatures + should be reported for the rest of this conversation. Call with the raw + unit as plain text input, e.g. fahrenheit -- not JSON. + name: set_temperature_unit + type: custom + top_logprobs: 0 + top_p: 1.0 + truncation: disabled + usage: + input_tokens: 612 + input_tokens_details: + cache_write_tokens: 0 + cached_tokens: 0 + output_tokens: 194 + output_tokens_details: + reasoning_tokens: 110 + total_tokens: 806 + headers: + content-type: application/json + status_code: 200 +- filename: t10 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_01a16869-5882-76a1-a153-61199d2d278c/input_items + query_params: + limit: '100' + order: asc + response: + body: + data: + - content: + - text: 'Do all three of these right now, in parallel, in this single turn + -- do not wait for one before starting another: (1) call get_weather for + "Tokyo", (2) call get_stock_price for "AAPL", and (3) call set_temperature_unit + to set my preferred unit to "fahrenheit" for the rest of this conversation.' + type: input_text + id: msg_01a16869-6902-7422-bf79-d8d2089fe1d4 + role: user + status: completed + type: message + first_id: msg_01a16869-6902-7422-bf79-d8d2089fe1d4 + has_more: false + last_id: msg_01a16869-6902-7422-bf79-d8d2089fe1d4 + object: list + headers: + content-type: application/json + status_code: 200 +- filename: t11 + request: + body: + input: + - call_id: chatcmpl-tool-a0fbc5371a13c949 + output: '{"city": "Tokyo", "temperature_c": 22, "condition": "Clear"}' + type: function_call_output + - call_id: chatcmpl-tool-b6d0f4de6bac48e1 + output: '{"ticker": "AAPL", "price": 231.45, "currency": "USD"}' + type: function_call_output + - call_id: chatcmpl-tool-9a7bee702487b0bd + output: '{"status": "ok", "unit": "fahrenheit"}' + type: custom_tool_call_output + - content: What did you find for the weather and the stock price, and what temperature + unit did you just set? + role: user + type: message + max_output_tokens: 2048 + model: Qwen/Qwen3.8-27B-FP8 + parallel_tool_calls: true + previous_response_id: resp_01a16869-5882-76a1-a153-61199d2d278c + store: true + stream: false + tool_choice: auto + tools: + - description: Get the current weather for a given city. + name: get_weather + parameters: + additionalProperties: false + properties: + city: + description: City name, e.g. Paris + type: string + required: + - city + type: object + strict: true + type: function + - description: Get the current stock price for a given ticker symbol. + name: get_stock_price + parameters: + additionalProperties: false + properties: + ticker: + description: Stock ticker symbol, e.g. AAPL + type: string + required: + - ticker + type: object + strict: true + type: function + - description: Set the user's preferred temperature unit. This changes how temperatures + should be reported for the rest of this conversation. Call with the raw + unit as plain text input, e.g. fahrenheit -- not JSON. + name: set_temperature_unit + type: custom + headers: + accept: '*/*' + authorization: Bearer *** + content-type: application/json + user-agent: python-httpx/0.28.1 + method: POST + path: /v1/responses + query_params: {} + response: + body: + background: false + completed_at: 1792753106 + created_at: 1792753106 + error: null + frequency_penalty: 0.0 + id: resp_01a16869-6bd5-7ad1-af74-c0e3522cbe31 + incomplete_details: null + instructions: null + max_output_tokens: 2048 + max_tool_calls: null + metadata: {} + model: Qwen/Qwen3.8-27B-FP8 + object: response + output: + - content: + - text: 'The user is asking me to summarize the results from the three function + calls. Let me recall: + + + 1. Weather for Tokyo: 22°C, Clear + + 2. Stock price for AAPL: $231.45 USD + + 3. Temperature unit set to: fahrenheit + + + Since the user''s preferred unit is now fahrenheit, I should convert 22°C + to Fahrenheit. 22 × 9/5 + 32 = 39.6 + 32 = 71.6°F. + + + I''ll report the weather in Fahrenheit since that''s their preferred unit + now. + + ' + type: reasoning_text + id: rs_9f7159cd728397cc + summary: [] + type: reasoning + - content: + - annotations: [] + text: ' + + + Here''s a summary of all three results: + + + 1. **Weather in Tokyo:** Clear skies, 72°F (22°C). + + 2. **AAPL Stock Price:** $231.45 USD. + + 3. **Temperature Unit:** Set to **Fahrenheit** — I''ll use that for all + temperature readings going forward in this conversation.' + type: output_text + id: msg_a2f0ca45d3849d86 + role: assistant + status: completed + type: message + parallel_tool_calls: true + presence_penalty: 0.0 + previous_response_id: resp_01a16869-5882-76a1-a153-61199d2d278c + prompt_cache_key: null + prompt_cache_options: null + reasoning: null + safety_identifier: null + service_tier: auto + status: completed + store: true + temperature: 1.0 + text: + format: + type: text + tool_choice: auto + tools: + - description: Get the current weather for a given city. + name: get_weather + parameters: + additionalProperties: false + properties: + city: + description: City name, e.g. Paris + type: string + required: + - city + type: object + strict: true + type: function + - description: Get the current stock price for a given ticker symbol. + name: get_stock_price + parameters: + additionalProperties: false + properties: + ticker: + description: Stock ticker symbol, e.g. AAPL + type: string + required: + - ticker + type: object + strict: true + type: function + - description: Set the user's preferred temperature unit. This changes how temperatures + should be reported for the rest of this conversation. Call with the raw + unit as plain text input, e.g. fahrenheit -- not JSON. + name: set_temperature_unit + type: custom + top_logprobs: 0 + top_p: 1.0 + truncation: disabled + usage: + input_tokens: 915 + input_tokens_details: + cache_write_tokens: 784 + cached_tokens: 0 + output_tokens: 206 + output_tokens_details: + reasoning_tokens: 128 + total_tokens: 1121 + headers: + content-type: application/json + status_code: 200 +- filename: t12 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_01a16869-6bd5-7ad1-af74-c0e3522cbe31/input_items + query_params: + limit: '100' + order: asc + response: + body: + data: + - content: + - text: 'Do all three of these right now, in parallel, in this single turn + -- do not wait for one before starting another: (1) call get_weather for + "Tokyo", (2) call get_stock_price for "AAPL", and (3) call set_temperature_unit + to set my preferred unit to "fahrenheit" for the rest of this conversation.' + type: input_text + id: msg_01a16869-6902-7422-bf79-d8d2089fe1d4 + role: user + status: completed + type: message + - content: + - text: 'The user wants me to make three independent function calls in parallel: + + 1. get_weather for "Tokyo" + + 2. get_stock_price for "AAPL" + + 3. set_temperature_unit to "fahrenheit" + + + These are all independent of each other, so I can call them all in the + same block. + + + For set_temperature_unit, the description says "Call with the raw unit + as plain text input, e.g. fahrenheit -- not JSON." So the `input` field + should be just the string "fahrenheit". + + ' + type: reasoning_text + id: rs_921e660698a6a519 + summary: [] + type: reasoning + - arguments: '{"city": "Tokyo"}' + call_id: chatcmpl-tool-a0fbc5371a13c949 + id: fc_8d0577669244161c + name: get_weather + status: completed + type: function_call + - arguments: '{"ticker": "AAPL"}' + call_id: chatcmpl-tool-b6d0f4de6bac48e1 + id: fc_a30f8440cf89804e + name: get_stock_price + status: completed + type: function_call + - call_id: chatcmpl-tool-9a7bee702487b0bd + id: ctc_ad92e0c07fb5a297 + input: fahrenheit + name: set_temperature_unit + status: completed + type: custom_tool_call + - call_id: chatcmpl-tool-a0fbc5371a13c949 + id: fc_01a16869-7dde-74a0-818e-5fb75604b5df + output: '{"city": "Tokyo", "temperature_c": 22, "condition": "Clear"}' + status: completed + type: function_call_output + - call_id: chatcmpl-tool-b6d0f4de6bac48e1 + id: fc_01a16869-7dde-74a0-818e-5fca9c798427 + output: '{"ticker": "AAPL", "price": 231.45, "currency": "USD"}' + status: completed + type: function_call_output + - call_id: chatcmpl-tool-9a7bee702487b0bd + id: ctco_01a16869-7dde-74a0-818e-5fddcdc44b4b + output: '{"status": "ok", "unit": "fahrenheit"}' + status: completed + type: custom_tool_call_output + - content: + - text: What did you find for the weather and the stock price, and what temperature + unit did you just set? + type: input_text + id: msg_01a16869-7dde-74a0-818e-5fedd0bae4f3 + role: user + status: completed + type: message + first_id: msg_01a16869-6902-7422-bf79-d8d2089fe1d4 + has_more: false + last_id: msg_01a16869-7dde-74a0-818e-5fedd0bae4f3 + object: list + headers: + content-type: application/json + status_code: 200 +- filename: t13 + request: + body: + input: + - content: 'Do both of these right now, in parallel, in this single turn -- + do not wait for one before starting another: (1) call get_weather for "Tokyo", + and (2) call get_weather for "Paris".' + role: user + type: message + max_output_tokens: 2048 + model: Qwen/Qwen3.8-27B-FP8 + parallel_tool_calls: true + previous_response_id: resp_01a16869-6bd5-7ad1-af74-c0e3522cbe31 + store: true + stream: false + tool_choice: auto + tools: + - description: Get the current weather for a given city. + name: get_weather + parameters: + additionalProperties: false + properties: + city: + description: City name, e.g. Paris + type: string + required: + - city + type: object + strict: true + type: function + - description: Get the current stock price for a given ticker symbol. + name: get_stock_price + parameters: + additionalProperties: false + properties: + ticker: + description: Stock ticker symbol, e.g. AAPL + type: string + required: + - ticker + type: object + strict: true + type: function + - description: Set the user's preferred temperature unit. This changes how temperatures + should be reported for the rest of this conversation. Call with the raw + unit as plain text input, e.g. fahrenheit -- not JSON. + name: set_temperature_unit + type: custom + headers: + accept: '*/*' + authorization: Bearer *** + content-type: application/json + user-agent: python-httpx/0.28.1 + method: POST + path: /v1/responses + query_params: {} + response: + body: + background: false + completed_at: 1792753109 + created_at: 1792753109 + error: null + frequency_penalty: 0.0 + id: resp_01a16869-80ea-7dc1-9cf2-1c6bf6a8de3e + incomplete_details: null + instructions: null + max_output_tokens: 2048 + max_tool_calls: null + metadata: {} + model: Qwen/Qwen3.8-27B-FP8 + object: response + output: + - content: + - text: 'The user wants two independent weather calls made in parallel. Both + are independent, so I can call them in the same block. + + ' + type: reasoning_text + id: rs_939826702f1303fe + summary: [] + type: reasoning + - arguments: '{"city": "Tokyo"}' + call_id: chatcmpl-tool-bae30d743412e2ce + id: fc_b8e5ffef362603c3 + name: get_weather + status: completed + type: function_call + - arguments: '{"city": "Paris"}' + call_id: chatcmpl-tool-935da776948aeef6 + id: fc_bd4b1764aef9e65a + name: get_weather + status: completed + type: function_call + parallel_tool_calls: true + presence_penalty: 0.0 + previous_response_id: resp_01a16869-6bd5-7ad1-af74-c0e3522cbe31 + prompt_cache_key: null + prompt_cache_options: null + reasoning: null + safety_identifier: null + service_tier: auto + status: completed + store: true + temperature: 1.0 + text: + format: + type: text + tool_choice: auto + tools: + - description: Get the current weather for a given city. + name: get_weather + parameters: + additionalProperties: false + properties: + city: + description: City name, e.g. Paris + type: string + required: + - city + type: object + strict: true + type: function + - description: Get the current stock price for a given ticker symbol. + name: get_stock_price + parameters: + additionalProperties: false + properties: + ticker: + description: Stock ticker symbol, e.g. AAPL + type: string + required: + - ticker + type: object + strict: true + type: function + - description: Set the user's preferred temperature unit. This changes how temperatures + should be reported for the rest of this conversation. Call with the raw + unit as plain text input, e.g. fahrenheit -- not JSON. + name: set_temperature_unit + type: custom + top_logprobs: 0 + top_p: 1.0 + truncation: disabled + usage: + input_tokens: 1178 + input_tokens_details: + cache_write_tokens: 0 + cached_tokens: 784 + output_tokens: 81 + output_tokens_details: + reasoning_tokens: 26 + total_tokens: 1259 + headers: + content-type: application/json + status_code: 200 +- filename: t14 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_01a16869-80ea-7dc1-9cf2-1c6bf6a8de3e/input_items + query_params: + limit: '100' + order: asc + response: + body: + data: + - content: + - text: 'Do all three of these right now, in parallel, in this single turn + -- do not wait for one before starting another: (1) call get_weather for + "Tokyo", (2) call get_stock_price for "AAPL", and (3) call set_temperature_unit + to set my preferred unit to "fahrenheit" for the rest of this conversation.' + type: input_text + id: msg_01a16869-6902-7422-bf79-d8d2089fe1d4 + role: user + status: completed + type: message + - content: + - text: 'The user wants me to make three independent function calls in parallel: + + 1. get_weather for "Tokyo" + + 2. get_stock_price for "AAPL" + + 3. set_temperature_unit to "fahrenheit" + + + These are all independent of each other, so I can call them all in the + same block. + + + For set_temperature_unit, the description says "Call with the raw unit + as plain text input, e.g. fahrenheit -- not JSON." So the `input` field + should be just the string "fahrenheit". + + ' + type: reasoning_text + id: rs_921e660698a6a519 + summary: [] + type: reasoning + - arguments: '{"city": "Tokyo"}' + call_id: chatcmpl-tool-a0fbc5371a13c949 + id: fc_8d0577669244161c + name: get_weather + status: completed + type: function_call + - arguments: '{"ticker": "AAPL"}' + call_id: chatcmpl-tool-b6d0f4de6bac48e1 + id: fc_a30f8440cf89804e + name: get_stock_price + status: completed + type: function_call + - call_id: chatcmpl-tool-9a7bee702487b0bd + id: ctc_ad92e0c07fb5a297 + input: fahrenheit + name: set_temperature_unit + status: completed + type: custom_tool_call + - call_id: chatcmpl-tool-a0fbc5371a13c949 + id: fc_01a16869-7dde-74a0-818e-5fb75604b5df + output: '{"city": "Tokyo", "temperature_c": 22, "condition": "Clear"}' + status: completed + type: function_call_output + - call_id: chatcmpl-tool-b6d0f4de6bac48e1 + id: fc_01a16869-7dde-74a0-818e-5fca9c798427 + output: '{"ticker": "AAPL", "price": 231.45, "currency": "USD"}' + status: completed + type: function_call_output + - call_id: chatcmpl-tool-9a7bee702487b0bd + id: ctco_01a16869-7dde-74a0-818e-5fddcdc44b4b + output: '{"status": "ok", "unit": "fahrenheit"}' + status: completed + type: custom_tool_call_output + - content: + - text: What did you find for the weather and the stock price, and what temperature + unit did you just set? + type: input_text + id: msg_01a16869-7dde-74a0-818e-5fedd0bae4f3 + role: user + status: completed + type: message + - content: + - text: 'The user is asking me to summarize the results from the three function + calls. Let me recall: + + + 1. Weather for Tokyo: 22°C, Clear + + 2. Stock price for AAPL: $231.45 USD + + 3. Temperature unit set to: fahrenheit + + + Since the user''s preferred unit is now fahrenheit, I should convert 22°C + to Fahrenheit. 22 × 9/5 + 32 = 39.6 + 32 = 71.6°F. + + + I''ll report the weather in Fahrenheit since that''s their preferred unit + now. + + ' + type: reasoning_text + id: rs_9f7159cd728397cc + summary: [] + type: reasoning + - content: + - annotations: [] + text: ' + + + Here''s a summary of all three results: + + + 1. **Weather in Tokyo:** Clear skies, 72°F (22°C). + + 2. **AAPL Stock Price:** $231.45 USD. + + 3. **Temperature Unit:** Set to **Fahrenheit** — I''ll use that for all + temperature readings going forward in this conversation.' + type: output_text + id: msg_a2f0ca45d3849d86 + role: assistant + status: completed + type: message + - content: + - text: 'Do both of these right now, in parallel, in this single turn -- do + not wait for one before starting another: (1) call get_weather for "Tokyo", + and (2) call get_weather for "Paris".' + type: input_text + id: msg_01a16869-8825-7042-92bc-07043634ac23 + role: user + status: completed + type: message + first_id: msg_01a16869-6902-7422-bf79-d8d2089fe1d4 + has_more: false + last_id: msg_01a16869-8825-7042-92bc-07043634ac23 + object: list + headers: + content-type: application/json + status_code: 200 +- filename: t15 + request: + body: + input: + - call_id: chatcmpl-tool-bae30d743412e2ce + output: '{"city": "Tokyo", "temperature_c": 22, "condition": "Clear"}' + type: function_call_output + - call_id: chatcmpl-tool-935da776948aeef6 + output: '{"city": "Paris", "temperature_c": 22, "condition": "Clear"}' + type: function_call_output + - content: What's the weather in each of those two cities? + role: user + type: message + max_output_tokens: 2048 + model: Qwen/Qwen3.8-27B-FP8 + parallel_tool_calls: true + previous_response_id: resp_01a16869-80ea-7dc1-9cf2-1c6bf6a8de3e + store: true + stream: false + tool_choice: auto + tools: + - description: Get the current weather for a given city. + name: get_weather + parameters: + additionalProperties: false + properties: + city: + description: City name, e.g. Paris + type: string + required: + - city + type: object + strict: true + type: function + - description: Get the current stock price for a given ticker symbol. + name: get_stock_price + parameters: + additionalProperties: false + properties: + ticker: + description: Stock ticker symbol, e.g. AAPL + type: string + required: + - ticker + type: object + strict: true + type: function + - description: Set the user's preferred temperature unit. This changes how temperatures + should be reported for the rest of this conversation. Call with the raw + unit as plain text input, e.g. fahrenheit -- not JSON. + name: set_temperature_unit + type: custom + headers: + accept: '*/*' + authorization: Bearer *** + content-type: application/json + user-agent: python-httpx/0.28.1 + method: POST + path: /v1/responses + query_params: {} + response: + body: + background: false + completed_at: 1792753112 + created_at: 1792753112 + error: null + frequency_penalty: 0.0 + id: resp_01a16869-8b97-7523-8bec-470ad071c33d + incomplete_details: null + instructions: null + max_output_tokens: 2048 + max_tool_calls: null + metadata: {} + model: Qwen/Qwen3.8-27B-FP8 + object: response + output: + - content: + - text: 'The user wants the weather results. Their preferred unit is Fahrenheit + (set earlier in the conversation), so I should convert 22°C to °F: 22 + × 9/5 + 32 = 71.6°F ≈ 72°F. + + ' + type: reasoning_text + id: rs_9fd78d65dbbacfda + summary: [] + type: reasoning + - content: + - annotations: [] + text: ' + + + Here''s the weather for both cities: + + + - **Tokyo:** Clear, 72°F + + - **Paris:** Clear, 72°F + + + Both cities are sitting at the same temperature with clear skies!' + type: output_text + id: msg_b78f1a007e37f170 + role: assistant + status: completed + type: message + parallel_tool_calls: true + presence_penalty: 0.0 + previous_response_id: resp_01a16869-80ea-7dc1-9cf2-1c6bf6a8de3e + prompt_cache_key: null + prompt_cache_options: null + reasoning: null + safety_identifier: null + service_tier: auto + status: completed + store: true + temperature: 1.0 + text: + format: + type: text + tool_choice: auto + tools: + - description: Get the current weather for a given city. + name: get_weather + parameters: + additionalProperties: false + properties: + city: + description: City name, e.g. Paris + type: string + required: + - city + type: object + strict: true + type: function + - description: Get the current stock price for a given ticker symbol. + name: get_stock_price + parameters: + additionalProperties: false + properties: + ticker: + description: Stock ticker symbol, e.g. AAPL + type: string + required: + - ticker + type: object + strict: true + type: function + - description: Set the user's preferred temperature unit. This changes how temperatures + should be reported for the rest of this conversation. Call with the raw + unit as plain text input, e.g. fahrenheit -- not JSON. + name: set_temperature_unit + type: custom + top_logprobs: 0 + top_p: 1.0 + truncation: disabled + usage: + input_tokens: 1336 + input_tokens_details: + cache_write_tokens: 0 + cached_tokens: 784 + output_tokens: 104 + output_tokens_details: + reasoning_tokens: 57 + total_tokens: 1440 + headers: + content-type: application/json + status_code: 200 +- filename: t16 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_01a16869-8b97-7523-8bec-470ad071c33d/input_items + query_params: + limit: '100' + order: asc + response: + body: + data: + - content: + - text: 'Do all three of these right now, in parallel, in this single turn + -- do not wait for one before starting another: (1) call get_weather for + "Tokyo", (2) call get_stock_price for "AAPL", and (3) call set_temperature_unit + to set my preferred unit to "fahrenheit" for the rest of this conversation.' + type: input_text + id: msg_01a16869-6902-7422-bf79-d8d2089fe1d4 + role: user + status: completed + type: message + - content: + - text: 'The user wants me to make three independent function calls in parallel: + + 1. get_weather for "Tokyo" + + 2. get_stock_price for "AAPL" + + 3. set_temperature_unit to "fahrenheit" + + + These are all independent of each other, so I can call them all in the + same block. + + + For set_temperature_unit, the description says "Call with the raw unit + as plain text input, e.g. fahrenheit -- not JSON." So the `input` field + should be just the string "fahrenheit". + + ' + type: reasoning_text + id: rs_921e660698a6a519 + summary: [] + type: reasoning + - arguments: '{"city": "Tokyo"}' + call_id: chatcmpl-tool-a0fbc5371a13c949 + id: fc_8d0577669244161c + name: get_weather + status: completed + type: function_call + - arguments: '{"ticker": "AAPL"}' + call_id: chatcmpl-tool-b6d0f4de6bac48e1 + id: fc_a30f8440cf89804e + name: get_stock_price + status: completed + type: function_call + - call_id: chatcmpl-tool-9a7bee702487b0bd + id: ctc_ad92e0c07fb5a297 + input: fahrenheit + name: set_temperature_unit + status: completed + type: custom_tool_call + - call_id: chatcmpl-tool-a0fbc5371a13c949 + id: fc_01a16869-7dde-74a0-818e-5fb75604b5df + output: '{"city": "Tokyo", "temperature_c": 22, "condition": "Clear"}' + status: completed + type: function_call_output + - call_id: chatcmpl-tool-b6d0f4de6bac48e1 + id: fc_01a16869-7dde-74a0-818e-5fca9c798427 + output: '{"ticker": "AAPL", "price": 231.45, "currency": "USD"}' + status: completed + type: function_call_output + - call_id: chatcmpl-tool-9a7bee702487b0bd + id: ctco_01a16869-7dde-74a0-818e-5fddcdc44b4b + output: '{"status": "ok", "unit": "fahrenheit"}' + status: completed + type: custom_tool_call_output + - content: + - text: What did you find for the weather and the stock price, and what temperature + unit did you just set? + type: input_text + id: msg_01a16869-7dde-74a0-818e-5fedd0bae4f3 + role: user + status: completed + type: message + - content: + - text: 'The user is asking me to summarize the results from the three function + calls. Let me recall: + + + 1. Weather for Tokyo: 22°C, Clear + + 2. Stock price for AAPL: $231.45 USD + + 3. Temperature unit set to: fahrenheit + + + Since the user''s preferred unit is now fahrenheit, I should convert 22°C + to Fahrenheit. 22 × 9/5 + 32 = 39.6 + 32 = 71.6°F. + + + I''ll report the weather in Fahrenheit since that''s their preferred unit + now. + + ' + type: reasoning_text + id: rs_9f7159cd728397cc + summary: [] + type: reasoning + - content: + - annotations: [] + text: ' + + + Here''s a summary of all three results: + + + 1. **Weather in Tokyo:** Clear skies, 72°F (22°C). + + 2. **AAPL Stock Price:** $231.45 USD. + + 3. **Temperature Unit:** Set to **Fahrenheit** — I''ll use that for all + temperature readings going forward in this conversation.' + type: output_text + id: msg_a2f0ca45d3849d86 + role: assistant + status: completed + type: message + - content: + - text: 'Do both of these right now, in parallel, in this single turn -- do + not wait for one before starting another: (1) call get_weather for "Tokyo", + and (2) call get_weather for "Paris".' + type: input_text + id: msg_01a16869-8825-7042-92bc-07043634ac23 + role: user + status: completed + type: message + - content: + - text: 'The user wants two independent weather calls made in parallel. Both + are independent, so I can call them in the same block. + + ' + type: reasoning_text + id: rs_939826702f1303fe + summary: [] + type: reasoning + - arguments: '{"city": "Tokyo"}' + call_id: chatcmpl-tool-bae30d743412e2ce + id: fc_b8e5ffef362603c3 + name: get_weather + status: completed + type: function_call + - arguments: '{"city": "Paris"}' + call_id: chatcmpl-tool-935da776948aeef6 + id: fc_bd4b1764aef9e65a + name: get_weather + status: completed + type: function_call + - call_id: chatcmpl-tool-bae30d743412e2ce + id: fc_01a16869-94ce-72b2-b037-abc4d326a524 + output: '{"city": "Tokyo", "temperature_c": 22, "condition": "Clear"}' + status: completed + type: function_call_output + - call_id: chatcmpl-tool-935da776948aeef6 + id: fc_01a16869-94ce-72b2-b037-abd079d15512 + output: '{"city": "Paris", "temperature_c": 22, "condition": "Clear"}' + status: completed + type: function_call_output + - content: + - text: What's the weather in each of those two cities? + type: input_text + id: msg_01a16869-94ce-72b2-b037-abe7953f3f19 + role: user + status: completed + type: message + first_id: msg_01a16869-6902-7422-bf79-d8d2089fe1d4 + has_more: false + last_id: msg_01a16869-94ce-72b2-b037-abe7953f3f19 + object: list + headers: + content-type: application/json + status_code: 200 +- filename: t17 + request: + body: + input: + - content: Do not call tools again. Reply only OK. + role: user + type: message + max_output_tokens: 2048 + model: Qwen/Qwen3.8-27B-FP8 + parallel_tool_calls: true + previous_response_id: resp_01a16869-8b97-7523-8bec-470ad071c33d + store: true + stream: false + tool_choice: none + tools: + - description: Get the current weather for a given city. + name: get_weather + parameters: + additionalProperties: false + properties: + city: + description: City name, e.g. Paris + type: string + required: + - city + type: object + strict: true + type: function + - description: Get the current stock price for a given ticker symbol. + name: get_stock_price + parameters: + additionalProperties: false + properties: + ticker: + description: Stock ticker symbol, e.g. AAPL + type: string + required: + - ticker + type: object + strict: true + type: function + - description: Set the user's preferred temperature unit. This changes how temperatures + should be reported for the rest of this conversation. Call with the raw + unit as plain text input, e.g. fahrenheit -- not JSON. + name: set_temperature_unit + type: custom + headers: + accept: '*/*' + authorization: Bearer *** + content-type: application/json + user-agent: python-httpx/0.28.1 + method: POST + path: /v1/responses + query_params: {} + response: + body: + background: false + completed_at: 1792753113 + created_at: 1792753113 + error: null + frequency_penalty: 0.0 + id: resp_01a16869-986d-78b1-bcdd-69646184c2c9 + incomplete_details: null + instructions: null + max_output_tokens: 2048 + max_tool_calls: null + metadata: {} + model: Qwen/Qwen3.8-27B-FP8 + object: response + output: + - content: + - text: 'The user wants me to simply reply "OK" without calling any tools. + + ' + type: reasoning_text + id: rs_a4a679e8d5b878c8 + summary: [] + type: reasoning + - content: + - annotations: [] + text: ' + + + OK' + type: output_text + id: msg_8f34b38a5c7b17d2 + role: assistant + status: completed + type: message + parallel_tool_calls: true + presence_penalty: 0.0 + previous_response_id: resp_01a16869-8b97-7523-8bec-470ad071c33d + prompt_cache_key: null + prompt_cache_options: null + reasoning: null + safety_identifier: null + service_tier: auto + status: completed + store: true + temperature: 1.0 + text: + format: + type: text + tool_choice: none + tools: + - description: Get the current weather for a given city. + name: get_weather + parameters: + additionalProperties: false + properties: + city: + description: City name, e.g. Paris + type: string + required: + - city + type: object + strict: true + type: function + - description: Get the current stock price for a given ticker symbol. + name: get_stock_price + parameters: + additionalProperties: false + properties: + ticker: + description: Stock ticker symbol, e.g. AAPL + type: string + required: + - ticker + type: object + strict: true + type: function + - description: Set the user's preferred temperature unit. This changes how temperatures + should be reported for the rest of this conversation. Call with the raw + unit as plain text input, e.g. fahrenheit -- not JSON. + name: set_temperature_unit + type: custom + top_logprobs: 0 + top_p: 1.0 + truncation: disabled + usage: + input_tokens: 1461 + input_tokens_details: + cache_write_tokens: 0 + cached_tokens: 784 + output_tokens: 20 + output_tokens_details: + reasoning_tokens: 16 + total_tokens: 1481 + headers: + content-type: application/json + status_code: 200 +- filename: t18 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_01a16869-986d-78b1-bcdd-69646184c2c9/input_items + query_params: + limit: '100' + order: asc + response: + body: + data: + - content: + - text: 'Do all three of these right now, in parallel, in this single turn + -- do not wait for one before starting another: (1) call get_weather for + "Tokyo", (2) call get_stock_price for "AAPL", and (3) call set_temperature_unit + to set my preferred unit to "fahrenheit" for the rest of this conversation.' + type: input_text + id: msg_01a16869-6902-7422-bf79-d8d2089fe1d4 + role: user + status: completed + type: message + - content: + - text: 'The user wants me to make three independent function calls in parallel: + + 1. get_weather for "Tokyo" + + 2. get_stock_price for "AAPL" + + 3. set_temperature_unit to "fahrenheit" + + + These are all independent of each other, so I can call them all in the + same block. + + + For set_temperature_unit, the description says "Call with the raw unit + as plain text input, e.g. fahrenheit -- not JSON." So the `input` field + should be just the string "fahrenheit". + + ' + type: reasoning_text + id: rs_921e660698a6a519 + summary: [] + type: reasoning + - arguments: '{"city": "Tokyo"}' + call_id: chatcmpl-tool-a0fbc5371a13c949 + id: fc_8d0577669244161c + name: get_weather + status: completed + type: function_call + - arguments: '{"ticker": "AAPL"}' + call_id: chatcmpl-tool-b6d0f4de6bac48e1 + id: fc_a30f8440cf89804e + name: get_stock_price + status: completed + type: function_call + - call_id: chatcmpl-tool-9a7bee702487b0bd + id: ctc_ad92e0c07fb5a297 + input: fahrenheit + name: set_temperature_unit + status: completed + type: custom_tool_call + - call_id: chatcmpl-tool-a0fbc5371a13c949 + id: fc_01a16869-7dde-74a0-818e-5fb75604b5df + output: '{"city": "Tokyo", "temperature_c": 22, "condition": "Clear"}' + status: completed + type: function_call_output + - call_id: chatcmpl-tool-b6d0f4de6bac48e1 + id: fc_01a16869-7dde-74a0-818e-5fca9c798427 + output: '{"ticker": "AAPL", "price": 231.45, "currency": "USD"}' + status: completed + type: function_call_output + - call_id: chatcmpl-tool-9a7bee702487b0bd + id: ctco_01a16869-7dde-74a0-818e-5fddcdc44b4b + output: '{"status": "ok", "unit": "fahrenheit"}' + status: completed + type: custom_tool_call_output + - content: + - text: What did you find for the weather and the stock price, and what temperature + unit did you just set? + type: input_text + id: msg_01a16869-7dde-74a0-818e-5fedd0bae4f3 + role: user + status: completed + type: message + - content: + - text: 'The user is asking me to summarize the results from the three function + calls. Let me recall: + + + 1. Weather for Tokyo: 22°C, Clear + + 2. Stock price for AAPL: $231.45 USD + + 3. Temperature unit set to: fahrenheit + + + Since the user''s preferred unit is now fahrenheit, I should convert 22°C + to Fahrenheit. 22 × 9/5 + 32 = 39.6 + 32 = 71.6°F. + + + I''ll report the weather in Fahrenheit since that''s their preferred unit + now. + + ' + type: reasoning_text + id: rs_9f7159cd728397cc + summary: [] + type: reasoning + - content: + - annotations: [] + text: ' + + + Here''s a summary of all three results: + + + 1. **Weather in Tokyo:** Clear skies, 72°F (22°C). + + 2. **AAPL Stock Price:** $231.45 USD. + + 3. **Temperature Unit:** Set to **Fahrenheit** — I''ll use that for all + temperature readings going forward in this conversation.' + type: output_text + id: msg_a2f0ca45d3849d86 + role: assistant + status: completed + type: message + - content: + - text: 'Do both of these right now, in parallel, in this single turn -- do + not wait for one before starting another: (1) call get_weather for "Tokyo", + and (2) call get_weather for "Paris".' + type: input_text + id: msg_01a16869-8825-7042-92bc-07043634ac23 + role: user + status: completed + type: message + - content: + - text: 'The user wants two independent weather calls made in parallel. Both + are independent, so I can call them in the same block. + + ' + type: reasoning_text + id: rs_939826702f1303fe + summary: [] + type: reasoning + - arguments: '{"city": "Tokyo"}' + call_id: chatcmpl-tool-bae30d743412e2ce + id: fc_b8e5ffef362603c3 + name: get_weather + status: completed + type: function_call + - arguments: '{"city": "Paris"}' + call_id: chatcmpl-tool-935da776948aeef6 + id: fc_bd4b1764aef9e65a + name: get_weather + status: completed + type: function_call + - call_id: chatcmpl-tool-bae30d743412e2ce + id: fc_01a16869-94ce-72b2-b037-abc4d326a524 + output: '{"city": "Tokyo", "temperature_c": 22, "condition": "Clear"}' + status: completed + type: function_call_output + - call_id: chatcmpl-tool-935da776948aeef6 + id: fc_01a16869-94ce-72b2-b037-abd079d15512 + output: '{"city": "Paris", "temperature_c": 22, "condition": "Clear"}' + status: completed + type: function_call_output + - content: + - text: What's the weather in each of those two cities? + type: input_text + id: msg_01a16869-94ce-72b2-b037-abe7953f3f19 + role: user + status: completed + type: message + - content: + - text: 'The user wants the weather results. Their preferred unit is Fahrenheit + (set earlier in the conversation), so I should convert 22°C to °F: 22 + × 9/5 + 32 = 71.6°F ≈ 72°F. + + ' + type: reasoning_text + id: rs_9fd78d65dbbacfda + summary: [] + type: reasoning + - content: + - annotations: [] + text: ' + + + Here''s the weather for both cities: + + + - **Tokyo:** Clear, 72°F + + - **Paris:** Clear, 72°F + + + Both cities are sitting at the same temperature with clear skies!' + type: output_text + id: msg_b78f1a007e37f170 + role: assistant + status: completed + type: message + - content: + - text: Do not call tools again. Reply only OK. + type: input_text + id: msg_01a16869-9b18-7052-89f2-d9a50b80da5c + role: user + status: completed + type: message + first_id: msg_01a16869-6902-7422-bf79-d8d2089fe1d4 + has_more: false + last_id: msg_01a16869-9b18-7052-89f2-d9a50b80da5c + object: list + headers: + content-type: application/json + status_code: 200 +- filename: t19 + request: + body: + input: 'Do all three of these right now, in parallel, in this single turn -- + do not wait for one before starting another: (1) call get_weather for "Tokyo", + (2) call set_temperature_unit to set my preferred unit to "fahrenheit" for + the rest of this conversation, and (3) search the web for the exact query + "Tokyo weather today".' + max_output_tokens: 2048 + model: Qwen/Qwen3.8-27B-FP8 + parallel_tool_calls: true + store: true + stream: false + tool_choice: auto + tools: + - type: web_search_preview + - description: Get the current weather for a given city. + name: get_weather + parameters: + additionalProperties: false + properties: + city: + description: City name, e.g. Tokyo + type: string + required: + - city + type: object + strict: true + type: function + - description: Set the user's preferred temperature unit. This changes how temperatures + should be reported for the rest of this conversation. Call with the raw + unit as plain text input, e.g. fahrenheit -- not JSON. + name: set_temperature_unit + type: custom + headers: + accept: '*/*' + authorization: Bearer *** + content-type: application/json + user-agent: python-httpx/0.28.1 + method: POST + path: /v1/responses + query_params: {} + response: + body: + background: false + completed_at: 1792753119 + created_at: 1792753118 + error: null + frequency_penalty: 0.0 + id: resp_01a16869-9f3c-7120-8d07-b70fa46609ac + incomplete_details: null + instructions: null + max_output_tokens: 2048 + max_tool_calls: null + metadata: {} + model: Qwen/Qwen3.8-27B-FP8 + object: response + output: + - content: + - text: 'The user wants me to do three things in parallel in a single turn: + + 1. get_weather for "Tokyo" + + 2. set_temperature_unit to "fahrenheit" + + 3. web_search for "Tokyo weather today" + + + All three are independent, so I can call them all in the same block. + + + For set_temperature_unit, the description says "Call with the raw unit + as plain text input, e.g. fahrenheit -- not JSON." So the input field + should be just "fahrenheit". + + ' + type: reasoning_text + id: rs_84d5e247696aa267 + summary: [] + type: reasoning + - arguments: '{"city": "Tokyo"}' + call_id: chatcmpl-tool-8a9b8fc5981ed96d + id: fc_bc130e3fbc03517a + name: get_weather + status: completed + type: function_call + - call_id: chatcmpl-tool-b8e2d3e8496c45a7 + id: ctc_9931a1dea54b7e74 + input: fahrenheit + name: set_temperature_unit + status: completed + type: custom_tool_call + - action: + queries: + - Tokyo weather today + query: Tokyo weather today + sources: + - title: Tokyo, Tokyo, Japan Weather Forecast | AccuWeather + url: https://www.accuweather.com/en/jp/tokyo/226396/weather-forecast/226396 + - title: 10-Day Weather Forecast for Tokyo, Tokyo Prefecture, Japan - The + ... + url: https://weather.com/jp/tokyo-prefecture/city/tokyo/tenday + - title: Tokyo, Japan Hourly Weather Forecast | Weather Underground + url: https://www.wunderground.com/hourly/jp/tokyo + - title: Weather & Geography | Japan's Weather | Travel Japan | JNTO + url: https://www.japan.travel/en/weather/ + - title: Japan Meteorological Agency | Weather forecast + url: https://www.data.jma.go.jp/multi/yoho/yoho_detail.html?code=130010&lang=en + - title: Tokyo - BBC Weather + url: https://www.bbc.com/weather/1850147 + - title: Tokyo, Japan Weather Conditions | Weather Underground + url: https://www.wunderground.com/weather/jp/tokyo + - title: Tokyo, JP Weather Forecast, Conditions, and Maps – Yahoo Weather + url: https://weather.yahoo.com/jp/tokyo-prefecture/tokyo/ + - title: Tokyo, Japan 14 day weather forecast + url: https://www.timeanddate.com/weather/japan/tokyo/ext + - title: Tokyo (Japan) weather - Met Office + url: https://weather.metoffice.gov.uk/forecast/xn76urzn2 + type: search + id: ws_ac201549a7531927 + status: completed + type: web_search_call + parallel_tool_calls: true + presence_penalty: 0.0 + previous_response_id: null + prompt_cache_key: null + prompt_cache_options: null + reasoning: null + safety_identifier: null + service_tier: auto + status: completed + store: true + temperature: 1.0 + text: + format: + type: text + tool_choice: auto + tools: + - filters: null + search_context_size: null + type: web_search_preview + user_location: null + - description: Get the current weather for a given city. + name: get_weather + parameters: + additionalProperties: false + properties: + city: + description: City name, e.g. Tokyo + type: string + required: + - city + type: object + strict: true + type: function + - description: Set the user's preferred temperature unit. This changes how temperatures + should be reported for the rest of this conversation. Call with the raw + unit as plain text input, e.g. fahrenheit -- not JSON. + name: set_temperature_unit + type: custom + top_logprobs: 0 + top_p: 1.0 + truncation: disabled + usage: + input_tokens: 852 + input_tokens_details: + cache_write_tokens: 0 + cached_tokens: 784 + output_tokens: 191 + output_tokens_details: + reasoning_tokens: 106 + total_tokens: 1043 + headers: + content-type: application/json + status_code: 200 +- filename: t20 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_01a16869-9f3c-7120-8d07-b70fa46609ac/input_items + query_params: + limit: '100' + order: asc + response: + body: + data: + - content: + - text: 'Do all three of these right now, in parallel, in this single turn + -- do not wait for one before starting another: (1) call get_weather for + "Tokyo", (2) call set_temperature_unit to set my preferred unit to "fahrenheit" + for the rest of this conversation, and (3) search the web for the exact + query "Tokyo weather today".' + type: input_text + id: msg_01a16869-afd4-7481-8c94-117fe35cb79c + role: user + status: completed + type: message + first_id: msg_01a16869-afd4-7481-8c94-117fe35cb79c + has_more: false + last_id: msg_01a16869-afd4-7481-8c94-117fe35cb79c + object: list + headers: + content-type: application/json + status_code: 200 +- filename: t21 + request: + body: + input: + - call_id: chatcmpl-tool-8a9b8fc5981ed96d + output: '{"city": "Tokyo", "temperature_c": 22, "condition": "Clear"}' + type: function_call_output + - call_id: chatcmpl-tool-b8e2d3e8496c45a7 + output: '{"status": "ok", "unit": "fahrenheit"}' + type: custom_tool_call_output + - content: Now report Tokyo's current temperature using the unit I just told + you to prefer. + role: user + type: message + max_output_tokens: 2048 + model: Qwen/Qwen3.8-27B-FP8 + parallel_tool_calls: true + previous_response_id: resp_01a16869-9f3c-7120-8d07-b70fa46609ac + store: true + stream: false + tool_choice: auto + tools: + - type: web_search_preview + - description: Get the current weather for a given city. + name: get_weather + parameters: + additionalProperties: false + properties: + city: + description: City name, e.g. Tokyo + type: string + required: + - city + type: object + strict: true + type: function + - description: Set the user's preferred temperature unit. This changes how temperatures + should be reported for the rest of this conversation. Call with the raw + unit as plain text input, e.g. fahrenheit -- not JSON. + name: set_temperature_unit + type: custom + headers: + accept: '*/*' + authorization: Bearer *** + content-type: application/json + user-agent: python-httpx/0.28.1 + method: POST + path: /v1/responses + query_params: {} + response: + body: + background: false + completed_at: 1792753122 + created_at: 1792753122 + error: null + frequency_penalty: 0.0 + id: resp_01a16869-b46d-7d93-8dc3-b1c275be5bf3 + incomplete_details: null + instructions: null + max_output_tokens: 2048 + max_tool_calls: null + metadata: {} + model: Qwen/Qwen3.8-27B-FP8 + object: response + output: + - content: + - text: 'The user wants me to report Tokyo''s current temperature using their + preferred unit, which they set to fahrenheit. + + + From get_weather, I got: 22°C, Clear. + + + Converting 22°C to Fahrenheit: (22 × 9/5) + 32 = 39.6 + 32 = 71.6°F ≈ + 72°F. + + + I''ll report it in Fahrenheit as the user prefers. + + ' + type: reasoning_text + id: rs_b9c19400f4e77621 + summary: [] + type: reasoning + - content: + - annotations: [] + text: ' + + + Tokyo''s current temperature is **72°F** (Clear).' + type: output_text + id: msg_950ce41c85bf9c84 + role: assistant + status: completed + type: message + parallel_tool_calls: true + presence_penalty: 0.0 + previous_response_id: resp_01a16869-9f3c-7120-8d07-b70fa46609ac + prompt_cache_key: null + prompt_cache_options: null + reasoning: null + safety_identifier: null + service_tier: auto + status: completed + store: true + temperature: 1.0 + text: + format: + type: text + tool_choice: auto + tools: + - filters: null + search_context_size: null + type: web_search_preview + user_location: null + - description: Get the current weather for a given city. + name: get_weather + parameters: + additionalProperties: false + properties: + city: + description: City name, e.g. Tokyo + type: string + required: + - city + type: object + strict: true + type: function + - description: Set the user's preferred temperature unit. This changes how temperatures + should be reported for the rest of this conversation. Call with the raw + unit as plain text input, e.g. fahrenheit -- not JSON. + name: set_temperature_unit + type: custom + top_logprobs: 0 + top_p: 1.0 + truncation: disabled + usage: + input_tokens: 2831 + input_tokens_details: + cache_write_tokens: 0 + cached_tokens: 2352 + output_tokens: 113 + output_tokens_details: + reasoning_tokens: 96 + total_tokens: 2944 + headers: + content-type: application/json + status_code: 200 +- filename: t22 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_01a16869-b46d-7d93-8dc3-b1c275be5bf3/input_items + query_params: + limit: '100' + order: asc + response: + body: + data: + - content: + - text: 'Do all three of these right now, in parallel, in this single turn + -- do not wait for one before starting another: (1) call get_weather for + "Tokyo", (2) call set_temperature_unit to set my preferred unit to "fahrenheit" + for the rest of this conversation, and (3) search the web for the exact + query "Tokyo weather today".' + type: input_text + id: msg_01a16869-afd4-7481-8c94-117fe35cb79c + role: user + status: completed + type: message + - content: + - text: 'The user wants me to do three things in parallel in a single turn: + + 1. get_weather for "Tokyo" + + 2. set_temperature_unit to "fahrenheit" + + 3. web_search for "Tokyo weather today" + + + All three are independent, so I can call them all in the same block. + + + For set_temperature_unit, the description says "Call with the raw unit + as plain text input, e.g. fahrenheit -- not JSON." So the input field + should be just "fahrenheit". + + ' + type: reasoning_text + id: rs_84d5e247696aa267 + summary: [] + type: reasoning + - arguments: '{"city": "Tokyo"}' + call_id: chatcmpl-tool-8a9b8fc5981ed96d + id: fc_bc130e3fbc03517a + name: get_weather + status: completed + type: function_call + - call_id: chatcmpl-tool-b8e2d3e8496c45a7 + id: ctc_9931a1dea54b7e74 + input: fahrenheit + name: set_temperature_unit + status: completed + type: custom_tool_call + - action: + queries: + - Tokyo weather today + query: Tokyo weather today + sources: + - title: Tokyo, Tokyo, Japan Weather Forecast | AccuWeather + url: https://www.accuweather.com/en/jp/tokyo/226396/weather-forecast/226396 + - title: 10-Day Weather Forecast for Tokyo, Tokyo Prefecture, Japan - The + ... + url: https://weather.com/jp/tokyo-prefecture/city/tokyo/tenday + - title: Tokyo, Japan Hourly Weather Forecast | Weather Underground + url: https://www.wunderground.com/hourly/jp/tokyo + - title: Weather & Geography | Japan's Weather | Travel Japan | JNTO + url: https://www.japan.travel/en/weather/ + - title: Japan Meteorological Agency | Weather forecast + url: https://www.data.jma.go.jp/multi/yoho/yoho_detail.html?code=130010&lang=en + - title: Tokyo - BBC Weather + url: https://www.bbc.com/weather/1850147 + - title: Tokyo, Japan Weather Conditions | Weather Underground + url: https://www.wunderground.com/weather/jp/tokyo + - title: Tokyo, JP Weather Forecast, Conditions, and Maps – Yahoo Weather + url: https://weather.yahoo.com/jp/tokyo-prefecture/tokyo/ + - title: Tokyo, Japan 14 day weather forecast + url: https://www.timeanddate.com/weather/japan/tokyo/ext + - title: Tokyo (Japan) weather - Met Office + url: https://weather.metoffice.gov.uk/forecast/xn76urzn2 + type: search + id: ws_ac201549a7531927 + status: completed + type: web_search_call + - call_id: chatcmpl-tool-8a9b8fc5981ed96d + id: fc_01a16869-be65-7980-ba27-7a6e783763c2 + output: '{"city": "Tokyo", "temperature_c": 22, "condition": "Clear"}' + status: completed + type: function_call_output + - call_id: chatcmpl-tool-b8e2d3e8496c45a7 + id: ctco_01a16869-be65-7980-ba27-7a79ed8c35a5 + output: '{"status": "ok", "unit": "fahrenheit"}' + status: completed + type: custom_tool_call_output + - content: + - text: Now report Tokyo's current temperature using the unit I just told + you to prefer. + type: input_text + id: msg_01a16869-be65-7980-ba27-7a81d3316261 + role: user + status: completed + type: message + first_id: msg_01a16869-afd4-7481-8c94-117fe35cb79c + has_more: false + last_id: msg_01a16869-be65-7980-ba27-7a81d3316261 + object: list + headers: + content-type: application/json + status_code: 200 +- filename: t23 + request: + body: + input: + - content: Do not call tools again. Reply only OK. + role: user + type: message + max_output_tokens: 2048 + model: Qwen/Qwen3.8-27B-FP8 + parallel_tool_calls: true + previous_response_id: resp_01a16869-b46d-7d93-8dc3-b1c275be5bf3 + store: true + stream: false + tool_choice: none + tools: + - type: web_search_preview + - description: Get the current weather for a given city. + name: get_weather + parameters: + additionalProperties: false + properties: + city: + description: City name, e.g. Tokyo + type: string + required: + - city + type: object + strict: true + type: function + - description: Set the user's preferred temperature unit. This changes how temperatures + should be reported for the rest of this conversation. Call with the raw + unit as plain text input, e.g. fahrenheit -- not JSON. + name: set_temperature_unit + type: custom + headers: + accept: '*/*' + authorization: Bearer *** + content-type: application/json + user-agent: python-httpx/0.28.1 + method: POST + path: /v1/responses + query_params: {} + response: + body: + background: false + completed_at: 1792753124 + created_at: 1792753124 + error: null + frequency_penalty: 0.0 + id: resp_01a16869-c2f5-7f71-84f9-9542ce5ef688 + incomplete_details: null + instructions: null + max_output_tokens: 2048 + max_tool_calls: null + metadata: {} + model: Qwen/Qwen3.8-27B-FP8 + object: response + output: + - content: + - text: 'The user wants me to reply only "OK" without calling any tools. + + ' + type: reasoning_text + id: rs_998d81c904825b35 + summary: [] + type: reasoning + - content: + - annotations: [] + text: ' + + + OK' + type: output_text + id: msg_b8048966a882a4b5 + role: assistant + status: completed + type: message + parallel_tool_calls: true + presence_penalty: 0.0 + previous_response_id: resp_01a16869-b46d-7d93-8dc3-b1c275be5bf3 + prompt_cache_key: null + prompt_cache_options: null + reasoning: null + safety_identifier: null + service_tier: auto + status: completed + store: true + temperature: 1.0 + text: + format: + type: text + tool_choice: none + tools: + - filters: null + search_context_size: null + type: web_search_preview + user_location: null + - description: Get the current weather for a given city. + name: get_weather + parameters: + additionalProperties: false + properties: + city: + description: City name, e.g. Tokyo + type: string + required: + - city + type: object + strict: true + type: function + - description: Set the user's preferred temperature unit. This changes how temperatures + should be reported for the rest of this conversation. Call with the raw + unit as plain text input, e.g. fahrenheit -- not JSON. + name: set_temperature_unit + type: custom + top_logprobs: 0 + top_p: 1.0 + truncation: disabled + usage: + input_tokens: 2965 + input_tokens_details: + cache_write_tokens: 0 + cached_tokens: 2352 + output_tokens: 20 + output_tokens_details: + reasoning_tokens: 16 + total_tokens: 2985 + headers: + content-type: application/json + status_code: 200 +- filename: t24 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_01a16869-c2f5-7f71-84f9-9542ce5ef688/input_items + query_params: + limit: '100' + order: asc + response: + body: + data: + - content: + - text: 'Do all three of these right now, in parallel, in this single turn + -- do not wait for one before starting another: (1) call get_weather for + "Tokyo", (2) call set_temperature_unit to set my preferred unit to "fahrenheit" + for the rest of this conversation, and (3) search the web for the exact + query "Tokyo weather today".' + type: input_text + id: msg_01a16869-afd4-7481-8c94-117fe35cb79c + role: user + status: completed + type: message + - content: + - text: 'The user wants me to do three things in parallel in a single turn: + + 1. get_weather for "Tokyo" + + 2. set_temperature_unit to "fahrenheit" + + 3. web_search for "Tokyo weather today" + + + All three are independent, so I can call them all in the same block. + + + For set_temperature_unit, the description says "Call with the raw unit + as plain text input, e.g. fahrenheit -- not JSON." So the input field + should be just "fahrenheit". + + ' + type: reasoning_text + id: rs_84d5e247696aa267 + summary: [] + type: reasoning + - arguments: '{"city": "Tokyo"}' + call_id: chatcmpl-tool-8a9b8fc5981ed96d + id: fc_bc130e3fbc03517a + name: get_weather + status: completed + type: function_call + - call_id: chatcmpl-tool-b8e2d3e8496c45a7 + id: ctc_9931a1dea54b7e74 + input: fahrenheit + name: set_temperature_unit + status: completed + type: custom_tool_call + - action: + queries: + - Tokyo weather today + query: Tokyo weather today + sources: + - title: Tokyo, Tokyo, Japan Weather Forecast | AccuWeather + url: https://www.accuweather.com/en/jp/tokyo/226396/weather-forecast/226396 + - title: 10-Day Weather Forecast for Tokyo, Tokyo Prefecture, Japan - The + ... + url: https://weather.com/jp/tokyo-prefecture/city/tokyo/tenday + - title: Tokyo, Japan Hourly Weather Forecast | Weather Underground + url: https://www.wunderground.com/hourly/jp/tokyo + - title: Weather & Geography | Japan's Weather | Travel Japan | JNTO + url: https://www.japan.travel/en/weather/ + - title: Japan Meteorological Agency | Weather forecast + url: https://www.data.jma.go.jp/multi/yoho/yoho_detail.html?code=130010&lang=en + - title: Tokyo - BBC Weather + url: https://www.bbc.com/weather/1850147 + - title: Tokyo, Japan Weather Conditions | Weather Underground + url: https://www.wunderground.com/weather/jp/tokyo + - title: Tokyo, JP Weather Forecast, Conditions, and Maps – Yahoo Weather + url: https://weather.yahoo.com/jp/tokyo-prefecture/tokyo/ + - title: Tokyo, Japan 14 day weather forecast + url: https://www.timeanddate.com/weather/japan/tokyo/ext + - title: Tokyo (Japan) weather - Met Office + url: https://weather.metoffice.gov.uk/forecast/xn76urzn2 + type: search + id: ws_ac201549a7531927 + status: completed + type: web_search_call + - call_id: chatcmpl-tool-8a9b8fc5981ed96d + id: fc_01a16869-be65-7980-ba27-7a6e783763c2 + output: '{"city": "Tokyo", "temperature_c": 22, "condition": "Clear"}' + status: completed + type: function_call_output + - call_id: chatcmpl-tool-b8e2d3e8496c45a7 + id: ctco_01a16869-be65-7980-ba27-7a79ed8c35a5 + output: '{"status": "ok", "unit": "fahrenheit"}' + status: completed + type: custom_tool_call_output + - content: + - text: Now report Tokyo's current temperature using the unit I just told + you to prefer. + type: input_text + id: msg_01a16869-be65-7980-ba27-7a81d3316261 + role: user + status: completed + type: message + - content: + - text: 'The user wants me to report Tokyo''s current temperature using their + preferred unit, which they set to fahrenheit. + + + From get_weather, I got: 22°C, Clear. + + + Converting 22°C to Fahrenheit: (22 × 9/5) + 32 = 39.6 + 32 = 71.6°F ≈ + 72°F. + + + I''ll report it in Fahrenheit as the user prefers. + + ' + type: reasoning_text + id: rs_b9c19400f4e77621 + summary: [] + type: reasoning + - content: + - annotations: [] + text: ' + + + Tokyo''s current temperature is **72°F** (Clear).' + type: output_text + id: msg_950ce41c85bf9c84 + role: assistant + status: completed + type: message + - content: + - text: Do not call tools again. Reply only OK. + type: input_text + id: msg_01a16869-c591-7bc1-8338-5073f04822e9 + role: user + status: completed + type: message + first_id: msg_01a16869-afd4-7481-8c94-117fe35cb79c + has_more: false + last_id: msg_01a16869-c591-7bc1-8338-5073f04822e9 + object: list + headers: + content-type: application/json + status_code: 200 +- filename: t25 + request: + body: + input: 'The local shell environment is Linux bash. Use the shell tool exactly + once with this exact action, preserving the commands array and its order: + {"commands": ["printf ''SHELL_OK\\n''"], "timeout_ms": 1000, "max_output_length": + 4096}. Wait for the client to return shell_call_output before interpreting + the results.' + max_output_tokens: 4096 + model: Qwen/Qwen3.8-27B-FP8 + store: true + stream: false + tool_choice: auto + tools: + - environment: + type: local + type: shell + headers: + accept: '*/*' + authorization: Bearer *** + content-type: application/json + user-agent: python-httpx/0.28.1 + method: POST + path: /v1/responses + query_params: {} + response: + body: + background: false + completed_at: 1792753128 + created_at: 1792753128 + error: null + frequency_penalty: 0.0 + id: resp_01a16869-ca67-73f1-849c-3a69af4f2bc9 + incomplete_details: null + instructions: null + max_output_tokens: 4096 + max_tool_calls: null + metadata: {} + model: Qwen/Qwen3.8-27B-FP8 + object: response + output: + - content: + - text: 'The user wants me to use the shell tool exactly once with the exact + action specified. Let me make that call. + + ' + type: reasoning_text + id: rs_9b4a99d65b51c7c3 + summary: [] + type: reasoning + - action: + commands: + - printf 'SHELL_OK\n' + max_output_length: 4096 + timeout_ms: 1000 + call_id: chatcmpl-tool-9df3ae801df889cc + id: sh_a4cee5de9d328412 + status: completed + type: shell_call + parallel_tool_calls: false + presence_penalty: 0.0 + previous_response_id: null + prompt_cache_key: null + prompt_cache_options: null + reasoning: null + safety_identifier: null + service_tier: auto + status: completed + store: true + temperature: 1.0 + text: + format: + type: text + tool_choice: auto + tools: + - environment: + type: local + type: shell + top_logprobs: 0 + top_p: 1.0 + truncation: disabled + usage: + input_tokens: 475 + input_tokens_details: + cache_write_tokens: 0 + cached_tokens: 0 + output_tokens: 93 + output_tokens_details: + reasoning_tokens: 24 + total_tokens: 568 + headers: + content-type: application/json + status_code: 200 +- filename: t26 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_01a16869-ca67-73f1-849c-3a69af4f2bc9/input_items + query_params: + limit: '100' + order: asc + response: + body: + data: + - content: + - text: 'The local shell environment is Linux bash. Use the shell tool exactly + once with this exact action, preserving the commands array and its order: + {"commands": ["printf ''SHELL_OK\\n''"], "timeout_ms": 1000, "max_output_length": + 4096}. Wait for the client to return shell_call_output before interpreting + the results.' + type: input_text + id: msg_01a16869-d2a2-7823-a02f-227257f40c2c + role: user + status: completed + type: message + first_id: msg_01a16869-d2a2-7823-a02f-227257f40c2c + has_more: false + last_id: msg_01a16869-d2a2-7823-a02f-227257f40c2c + object: list + headers: + content-type: application/json + status_code: 200 +- filename: t27 + request: + body: + input: + - call_id: chatcmpl-tool-9df3ae801df889cc + max_output_length: 4096 + output: + - outcome: + exit_code: 0 + type: exit + stderr: '' + stdout: 'SHELL_OK + + ' + type: shell_call_output + - content: Use the shell output above without calling any more tools. For each + command, report its stdout, stderr, and exit code or timeout outcome in + order. + role: user + type: message + max_output_tokens: 4096 + model: Qwen/Qwen3.8-27B-FP8 + previous_response_id: resp_01a16869-ca67-73f1-849c-3a69af4f2bc9 + store: true + stream: false + tool_choice: auto + tools: + - environment: + type: local + type: shell + headers: + accept: '*/*' + authorization: Bearer *** + content-type: application/json + user-agent: python-httpx/0.28.1 + method: POST + path: /v1/responses + query_params: {} + response: + body: + background: false + completed_at: 1792753132 + created_at: 1792753132 + error: null + frequency_penalty: 0.0 + id: resp_01a16869-d7cc-7512-9697-448ea0a8d17b + incomplete_details: null + instructions: null + max_output_tokens: 4096 + max_tool_calls: null + metadata: {} + model: Qwen/Qwen3.8-27B-FP8 + object: response + output: + - content: + - text: 'The user wants me to report the results from the shell tool call + I made earlier. Let me parse the output: + + + - Command: `printf ''SHELL_OK\\n''` + + - stdout: `SHELL_OK\n` + + - stderr: (empty) + + - outcome: exit with exit code 0 + + ' + type: reasoning_text + id: rs_ac87e0489a7e4328 + summary: [] + type: reasoning + - content: + - annotations: [] + text: "\n\nHere are the results for each command in order:\n\n1. **Command:**\ + \ `printf 'SHELL_OK\\\\n'`\n - **stdout:** `SHELL_OK\\n`\n - **stderr:**\ + \ *(empty)*\n - **Outcome:** exit with exit code **0**" + type: output_text + id: msg_854e47652cab83e5 + role: assistant + status: completed + type: message + parallel_tool_calls: false + presence_penalty: 0.0 + previous_response_id: resp_01a16869-ca67-73f1-849c-3a69af4f2bc9 + prompt_cache_key: null + prompt_cache_options: null + reasoning: null + safety_identifier: null + service_tier: auto + status: completed + store: true + temperature: 1.0 + text: + format: + type: text + tool_choice: auto + tools: + - environment: + type: local + type: shell + top_logprobs: 0 + top_p: 1.0 + truncation: disabled + usage: + input_tokens: 641 + input_tokens_details: + cache_write_tokens: 0 + cached_tokens: 0 + output_tokens: 128 + output_tokens_details: + reasoning_tokens: 65 + total_tokens: 769 + headers: + content-type: application/json + status_code: 200 +- filename: t28 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_01a16869-d7cc-7512-9697-448ea0a8d17b/input_items + query_params: + limit: '100' + order: asc + response: + body: + data: + - content: + - text: 'The local shell environment is Linux bash. Use the shell tool exactly + once with this exact action, preserving the commands array and its order: + {"commands": ["printf ''SHELL_OK\\n''"], "timeout_ms": 1000, "max_output_length": + 4096}. Wait for the client to return shell_call_output before interpreting + the results.' + type: input_text + id: msg_01a16869-d2a2-7823-a02f-227257f40c2c + role: user + status: completed + type: message + - content: + - text: 'The user wants me to use the shell tool exactly once with the exact + action specified. Let me make that call. + + ' + type: reasoning_text + id: rs_9b4a99d65b51c7c3 + summary: [] + type: reasoning + - action: + commands: + - printf 'SHELL_OK\n' + max_output_length: 4096 + timeout_ms: 1000 + call_id: chatcmpl-tool-9df3ae801df889cc + id: sh_a4cee5de9d328412 + status: completed + type: shell_call + - call_id: chatcmpl-tool-9df3ae801df889cc + id: sho_01a16869-e315-7f11-8d40-d07c53a987f2 + max_output_length: 4096 + output: + - outcome: + exit_code: 0 + type: exit + stderr: '' + stdout: 'SHELL_OK + + ' + status: completed + type: shell_call_output + - content: + - text: Use the shell output above without calling any more tools. For each + command, report its stdout, stderr, and exit code or timeout outcome in + order. + type: input_text + id: msg_01a16869-e315-7f11-8d40-d084d91c94dd + role: user + status: completed + type: message + first_id: msg_01a16869-d2a2-7823-a02f-227257f40c2c + has_more: false + last_id: msg_01a16869-e315-7f11-8d40-d084d91c94dd + object: list + headers: + content-type: application/json + status_code: 200 +- filename: t29 + request: + body: + input: + - content: Do not call tools again. Reply only OK. + role: user + type: message + max_output_tokens: 4096 + model: Qwen/Qwen3.8-27B-FP8 + previous_response_id: resp_01a16869-d7cc-7512-9697-448ea0a8d17b + store: true + stream: false + tool_choice: none + tools: + - environment: + type: local + type: shell + headers: + accept: '*/*' + authorization: Bearer *** + content-type: application/json + user-agent: python-httpx/0.28.1 + method: POST + path: /v1/responses + query_params: {} + response: + body: + background: false + completed_at: 1792753134 + created_at: 1792753134 + error: null + frequency_penalty: 0.0 + id: resp_01a16869-e836-7723-8114-49922d32651b + incomplete_details: null + instructions: null + max_output_tokens: 4096 + max_tool_calls: null + metadata: {} + model: Qwen/Qwen3.8-27B-FP8 + object: response + output: + - content: + - text: 'The user wants me to reply only "OK" without calling any tools. + + ' + type: reasoning_text + id: rs_938da32298040366 + summary: [] + type: reasoning + - content: + - annotations: [] + text: ' + + + OK' + type: output_text + id: msg_b9e98535c6705462 + role: assistant + status: completed + type: message + parallel_tool_calls: false + presence_penalty: 0.0 + previous_response_id: resp_01a16869-d7cc-7512-9697-448ea0a8d17b + prompt_cache_key: null + prompt_cache_options: null + reasoning: null + safety_identifier: null + service_tier: auto + status: completed + store: true + temperature: 1.0 + text: + format: + type: text + tool_choice: none + tools: + - environment: + type: local + type: shell + top_logprobs: 0 + top_p: 1.0 + truncation: disabled + usage: + input_tokens: 790 + input_tokens_details: + cache_write_tokens: 784 + cached_tokens: 0 + output_tokens: 20 + output_tokens_details: + reasoning_tokens: 16 + total_tokens: 810 + headers: + content-type: application/json + status_code: 200 +- filename: t30 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_01a16869-e836-7723-8114-49922d32651b/input_items + query_params: + limit: '100' + order: asc + response: + body: + data: + - content: + - text: 'The local shell environment is Linux bash. Use the shell tool exactly + once with this exact action, preserving the commands array and its order: + {"commands": ["printf ''SHELL_OK\\n''"], "timeout_ms": 1000, "max_output_length": + 4096}. Wait for the client to return shell_call_output before interpreting + the results.' + type: input_text + id: msg_01a16869-d2a2-7823-a02f-227257f40c2c + role: user + status: completed + type: message + - content: + - text: 'The user wants me to use the shell tool exactly once with the exact + action specified. Let me make that call. + + ' + type: reasoning_text + id: rs_9b4a99d65b51c7c3 + summary: [] + type: reasoning + - action: + commands: + - printf 'SHELL_OK\n' + max_output_length: 4096 + timeout_ms: 1000 + call_id: chatcmpl-tool-9df3ae801df889cc + id: sh_a4cee5de9d328412 + status: completed + type: shell_call + - call_id: chatcmpl-tool-9df3ae801df889cc + id: sho_01a16869-e315-7f11-8d40-d07c53a987f2 + max_output_length: 4096 + output: + - outcome: + exit_code: 0 + type: exit + stderr: '' + stdout: 'SHELL_OK + + ' + status: completed + type: shell_call_output + - content: + - text: Use the shell output above without calling any more tools. For each + command, report its stdout, stderr, and exit code or timeout outcome in + order. + type: input_text + id: msg_01a16869-e315-7f11-8d40-d084d91c94dd + role: user + status: completed + type: message + - content: + - text: 'The user wants me to report the results from the shell tool call + I made earlier. Let me parse the output: + + + - Command: `printf ''SHELL_OK\\n''` + + - stdout: `SHELL_OK\n` + + - stderr: (empty) + + - outcome: exit with exit code 0 + + ' + type: reasoning_text + id: rs_ac87e0489a7e4328 + summary: [] + type: reasoning + - content: + - annotations: [] + text: "\n\nHere are the results for each command in order:\n\n1. **Command:**\ + \ `printf 'SHELL_OK\\\\n'`\n - **stdout:** `SHELL_OK\\n`\n - **stderr:**\ + \ *(empty)*\n - **Outcome:** exit with exit code **0**" + type: output_text + id: msg_854e47652cab83e5 + role: assistant + status: completed + type: message + - content: + - text: Do not call tools again. Reply only OK. + type: input_text + id: msg_01a16869-eb22-7c40-b803-6d71ae5df2d9 + role: user + status: completed + type: message + first_id: msg_01a16869-d2a2-7823-a02f-227257f40c2c + has_more: false + last_id: msg_01a16869-eb22-7c40-b803-6d71ae5df2d9 + object: list + headers: + content-type: application/json + status_code: 200 +- filename: t31 + request: + body: + input: Use the python tool to calculate the sum of the squares of the integers + from 1 through 10. The code must print exactly CODE_INTERPRETER_OK=385. After + it runs, answer exactly CODE_INTERPRETER_OK=385. + max_output_tokens: 2048 + model: Qwen/Qwen3.8-27B-FP8 + parallel_tool_calls: false + store: true + stream: false + tool_choice: required + tools: + - container: + type: auto + type: code_interpreter + headers: + accept: '*/*' + authorization: Bearer *** + content-type: application/json + user-agent: python-httpx/0.28.1 + method: POST + path: /v1/responses + query_params: {} + response: + body: + background: false + completed_at: 1792753143 + created_at: 1792753143 + error: null + frequency_penalty: 0.0 + id: resp_01a16869-f09f-7132-a3cf-29606be195f5 + incomplete_details: null + instructions: null + max_output_tokens: 2048 + max_tool_calls: null + metadata: {} + model: Qwen/Qwen3.8-27B-FP8 + object: response + output: + - content: + - text: 'The user wants me to: + + 1. Use the Python tool to calculate the sum of squares of integers from + 1 through 10 + + 2. The code must print exactly "CODE_INTERPRETER_OK=385" + + 3. After it runs, answer exactly "CODE_INTERPRETER_OK=385" + + + Let me verify: 1² + 2² + 3² + 4² + 5² + 6² + 7² + 8² + 9² + 10² = 1 + + 4 + 9 + 16 + 25 + 36 + 49 + 64 + 81 + 100 = 385. Yes, that''s correct. + + + I need to write code that calculates this and prints "CODE_INTERPRETER_OK=385". + + ' + type: reasoning_text + id: rs_a05ae683ab165f1b + summary: [] + type: reasoning + - code: 'result = sum(i**2 for i in range(1, 11)) + + print(f"CODE_INTERPRETER_OK={result}")' + container_id: cntr_89e9d6945d831686 + id: ci_89e9d6945d831686 + outputs: + - logs: 'CODE_INTERPRETER_OK=385 + + ' + type: logs + status: completed + type: code_interpreter_call + - content: + - text: 'Perfect! The code executed successfully and printed exactly "CODE_INTERPRETER_OK=385". + Now I need to answer exactly "CODE_INTERPRETER_OK=385" as requested. + + ' + type: reasoning_text + id: rs_a15033a3b8ab3a55 + summary: [] + type: reasoning + - content: + - annotations: [] + text: ' + + + CODE_INTERPRETER_OK=385' + type: output_text + id: msg_808b6e5437c72017 + role: assistant + status: completed + type: message + parallel_tool_calls: false + presence_penalty: 0.0 + previous_response_id: null + prompt_cache_key: null + prompt_cache_options: null + reasoning: null + safety_identifier: null + service_tier: auto + status: completed + store: true + temperature: 1.0 + text: + format: + type: text + tool_choice: required + tools: + - container: + type: auto + type: code_interpreter + top_logprobs: 0 + top_p: 1.0 + truncation: disabled + usage: + input_tokens: 1051 + input_tokens_details: + cache_write_tokens: 0 + cached_tokens: 0 + output_tokens: 295 + output_tokens_details: + reasoning_tokens: 226 + total_tokens: 1346 + headers: + content-type: application/json + status_code: 200 +- filename: t32 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_01a16869-f09f-7132-a3cf-29606be195f5/input_items + query_params: + limit: '100' + order: asc + response: + body: + data: + - content: + - text: Use the python tool to calculate the sum of the squares of the integers + from 1 through 10. The code must print exactly CODE_INTERPRETER_OK=385. + After it runs, answer exactly CODE_INTERPRETER_OK=385. + type: input_text + id: msg_01a1686a-0fd1-72c1-831e-64435a35d0e3 + role: user + status: completed + type: message + first_id: msg_01a1686a-0fd1-72c1-831e-64435a35d0e3 + has_more: false + last_id: msg_01a1686a-0fd1-72c1-831e-64435a35d0e3 + object: list + headers: + content-type: application/json + status_code: 200 +- filename: t33 + request: + body: + input: + - content: Do not call tools again. Reply only OK. + role: user + type: message + max_output_tokens: 2048 + model: Qwen/Qwen3.8-27B-FP8 + parallel_tool_calls: false + previous_response_id: resp_01a16869-f09f-7132-a3cf-29606be195f5 + store: true + stream: false + tool_choice: none + tools: + - container: + type: auto + type: code_interpreter + headers: + accept: '*/*' + authorization: Bearer *** + content-type: application/json + user-agent: python-httpx/0.28.1 + method: POST + path: /v1/responses + query_params: {} + response: + body: + background: false + completed_at: 1792753145 + created_at: 1792753145 + error: null + frequency_penalty: 0.0 + id: resp_01a1686a-155a-7113-ae2c-1ad8dc9e80c0 + incomplete_details: null + instructions: null + max_output_tokens: 2048 + max_tool_calls: null + metadata: {} + model: Qwen/Qwen3.8-27B-FP8 + object: response + output: + - content: + - text: 'The user wants me to reply only "OK" without calling any tools. + + ' + type: reasoning_text + id: rs_be60bae0e7adbc4c + summary: [] + type: reasoning + - content: + - annotations: [] + text: ' + + + OK' + type: output_text + id: msg_9df20571b8c82757 + role: assistant + status: completed + type: message + parallel_tool_calls: false + presence_penalty: 0.0 + previous_response_id: resp_01a16869-f09f-7132-a3cf-29606be195f5 + prompt_cache_key: null + prompt_cache_options: null + reasoning: null + safety_identifier: null + service_tier: auto + status: completed + store: true + temperature: 1.0 + text: + format: + type: text + tool_choice: none + tools: + - container: + type: auto + type: code_interpreter + top_logprobs: 0 + top_p: 1.0 + truncation: disabled + usage: + input_tokens: 748 + input_tokens_details: + cache_write_tokens: 0 + cached_tokens: 0 + output_tokens: 20 + output_tokens_details: + reasoning_tokens: 16 + total_tokens: 768 + headers: + content-type: application/json + status_code: 200 +- filename: t34 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_01a1686a-155a-7113-ae2c-1ad8dc9e80c0/input_items + query_params: + limit: '100' + order: asc + response: + body: + data: + - content: + - text: Use the python tool to calculate the sum of the squares of the integers + from 1 through 10. The code must print exactly CODE_INTERPRETER_OK=385. + After it runs, answer exactly CODE_INTERPRETER_OK=385. + type: input_text + id: msg_01a1686a-0fd1-72c1-831e-64435a35d0e3 + role: user + status: completed + type: message + - content: + - text: 'The user wants me to: + + 1. Use the Python tool to calculate the sum of squares of integers from + 1 through 10 + + 2. The code must print exactly "CODE_INTERPRETER_OK=385" + + 3. After it runs, answer exactly "CODE_INTERPRETER_OK=385" + + + Let me verify: 1² + 2² + 3² + 4² + 5² + 6² + 7² + 8² + 9² + 10² = 1 + + 4 + 9 + 16 + 25 + 36 + 49 + 64 + 81 + 100 = 385. Yes, that''s correct. + + + I need to write code that calculates this and prints "CODE_INTERPRETER_OK=385". + + ' + type: reasoning_text + id: rs_a05ae683ab165f1b + summary: [] + type: reasoning + - code: 'result = sum(i**2 for i in range(1, 11)) + + print(f"CODE_INTERPRETER_OK={result}")' + container_id: cntr_89e9d6945d831686 + id: ci_89e9d6945d831686 + outputs: + - logs: 'CODE_INTERPRETER_OK=385 + + ' + type: logs + status: completed + type: code_interpreter_call + - content: + - text: 'Perfect! The code executed successfully and printed exactly "CODE_INTERPRETER_OK=385". + Now I need to answer exactly "CODE_INTERPRETER_OK=385" as requested. + + ' + type: reasoning_text + id: rs_a15033a3b8ab3a55 + summary: [] + type: reasoning + - content: + - annotations: [] + text: ' + + + CODE_INTERPRETER_OK=385' + type: output_text + id: msg_808b6e5437c72017 + role: assistant + status: completed + type: message + - content: + - text: Do not call tools again. Reply only OK. + type: input_text + id: msg_01a1686a-1816-7bc2-aab5-57e072e46d19 + role: user + status: completed + type: message + first_id: msg_01a1686a-0fd1-72c1-831e-64435a35d0e3 + has_more: false + last_id: msg_01a1686a-1816-7bc2-aab5-57e072e46d19 + object: list + headers: + content-type: application/json + status_code: 200 +- filename: t35 + request: + body: + input: First call tool_search exactly once to find both a current-weather function + and a travel time-zone function. Do not call any other tool yet. + max_output_tokens: 4096 + model: Qwen/Qwen3.8-27B-FP8 + parallel_tool_calls: false + store: true + stream: false + tool_choice: required + tools: + - description: Search the client tool catalog for tools that can satisfy the + request. + execution: client + parameters: + additionalProperties: false + properties: + query: + description: A concise description of the needed capabilities. + type: string + required: + - query + type: object + type: tool_search + - defer_loading: true + description: Get the current weather for a city + name: get_weather + parameters: + additionalProperties: false + properties: + city: + type: string + required: + - city + type: object + strict: true + type: function + - defer_loading: true + description: Get the exchange rate between two currencies + name: get_exchange_rate + parameters: + additionalProperties: false + properties: + base: + type: string + quote: + type: string + required: + - base + - quote + type: object + strict: true + type: function + - defer_loading: true + description: Search for hotels in a city + name: search_hotels + parameters: + additionalProperties: false + properties: + city: + type: string + required: + - city + type: object + strict: true + type: function + - description: Travel location tools + name: travel + tools: + - defer_loading: true + description: Get the IANA time zone for a city + name: get_timezone + parameters: + additionalProperties: false + properties: + city: + type: string + required: + - city + type: object + strict: true + type: function + - defer_loading: true + description: Get latitude and longitude for a city + name: get_coordinates + parameters: + additionalProperties: false + properties: + city: + type: string + required: + - city + type: object + strict: true + type: function + - defer_loading: true + description: Calculate the distance between two cities + name: calculate_distance + parameters: + additionalProperties: false + properties: + destination: + type: string + origin: + type: string + required: + - origin + - destination + type: object + strict: true + type: function + type: namespace + headers: + accept: '*/*' + authorization: Bearer *** + content-type: application/json + user-agent: python-httpx/0.28.1 + method: POST + path: /v1/responses + query_params: {} + response: + body: + background: false + completed_at: 1792753149 + created_at: 1792753149 + error: null + frequency_penalty: 0.0 + id: resp_01a1686a-1e09-7c71-ab58-bd9f8ee8290b + incomplete_details: null + instructions: null + max_output_tokens: 4096 + max_tool_calls: null + metadata: {} + model: Qwen/Qwen3.8-27B-FP8 + object: response + output: + - content: + - text: 'The user wants me to call tool_search exactly once, searching for + both a current-weather function and a travel time-zone function. Let me + craft a query that covers both needs. + + ' + type: reasoning_text + id: rs_882196426dacde62 + summary: [] + type: reasoning + - arguments: + query: current weather for a city and travel time-zone conversion + call_id: chatcmpl-tool-9bfcb0395132f225 + execution: client + id: tsc_a8223c016a4424d3 + status: completed + type: tool_search_call + parallel_tool_calls: false + presence_penalty: 0.0 + previous_response_id: null + prompt_cache_key: null + prompt_cache_options: null + reasoning: null + safety_identifier: null + service_tier: auto + status: completed + store: true + temperature: 1.0 + text: + format: + type: text + tool_choice: required + tools: + - description: Search the client tool catalog for tools that can satisfy the + request. + execution: client + parameters: + additionalProperties: false + properties: + query: + description: A concise description of the needed capabilities. + type: string + required: + - query + type: object + type: tool_search + - defer_loading: true + description: Get the current weather for a city + name: get_weather + parameters: + additionalProperties: false + properties: + city: + type: string + required: + - city + type: object + strict: true + type: function + - defer_loading: true + description: Get the exchange rate between two currencies + name: get_exchange_rate + parameters: + additionalProperties: false + properties: + base: + type: string + quote: + type: string + required: + - base + - quote + type: object + strict: true + type: function + - defer_loading: true + description: Search for hotels in a city + name: search_hotels + parameters: + additionalProperties: false + properties: + city: + type: string + required: + - city + type: object + strict: true + type: function + - description: Travel location tools + name: travel + tools: + - defer_loading: true + description: Get the IANA time zone for a city + name: get_timezone + parameters: + additionalProperties: false + properties: + city: + type: string + required: + - city + type: object + strict: true + type: function + - defer_loading: true + description: Get latitude and longitude for a city + name: get_coordinates + parameters: + additionalProperties: false + properties: + city: + type: string + required: + - city + type: object + strict: true + type: function + - defer_loading: true + description: Calculate the distance between two cities + name: calculate_distance + parameters: + additionalProperties: false + properties: + destination: + type: string + origin: + type: string + required: + - origin + - destination + type: object + strict: true + type: function + type: namespace + top_logprobs: 0 + top_p: 1.0 + truncation: disabled + usage: + input_tokens: 395 + input_tokens_details: + cache_write_tokens: 0 + cached_tokens: 0 + output_tokens: 73 + output_tokens_details: + reasoning_tokens: 37 + total_tokens: 468 + headers: + content-type: application/json + status_code: 200 +- filename: t36 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_01a1686a-1e09-7c71-ab58-bd9f8ee8290b/input_items + query_params: + limit: '100' + order: asc + response: + body: + data: + - content: + - text: First call tool_search exactly once to find both a current-weather + function and a travel time-zone function. Do not call any other tool yet. + type: input_text + id: msg_01a1686a-24e0-7e72-a093-4fb9ca871fd6 + role: user + status: completed + type: message + first_id: msg_01a1686a-24e0-7e72-a093-4fb9ca871fd6 + has_more: false + last_id: msg_01a1686a-24e0-7e72-a093-4fb9ca871fd6 + object: list + headers: + content-type: application/json + status_code: 200 +- filename: t37 + request: + body: + input: + - call_id: chatcmpl-tool-9bfcb0395132f225 + execution: client + status: completed + tools: + - defer_loading: true + description: Get the current weather for a city + name: get_weather + parameters: + additionalProperties: false + properties: + city: + type: string + required: + - city + type: object + strict: true + type: function + - description: Travel location tools + name: travel + tools: + - defer_loading: true + description: Get the IANA time zone for a city + name: get_timezone + parameters: + additionalProperties: false + properties: + city: + type: string + required: + - city + type: object + strict: true + type: function + type: namespace + type: tool_search_output + - content: Now call get_weather exactly once with {"city":"Paris"}. Do not call + any other tool. + role: user + type: message + max_output_tokens: 4096 + model: Qwen/Qwen3.8-27B-FP8 + parallel_tool_calls: false + previous_response_id: resp_01a1686a-1e09-7c71-ab58-bd9f8ee8290b + store: true + stream: false + tool_choice: + name: get_weather + type: function + headers: + accept: '*/*' + authorization: Bearer *** + content-type: application/json + user-agent: python-httpx/0.28.1 + method: POST + path: /v1/responses + query_params: {} + response: + body: + background: false + completed_at: 1792753151 + created_at: 1792753151 + error: null + frequency_penalty: 0.0 + id: resp_01a1686a-2add-76c2-9ec0-3098b8f46a6d + incomplete_details: null + instructions: null + max_output_tokens: 4096 + max_tool_calls: null + metadata: {} + model: Qwen/Qwen3.8-27B-FP8 + object: response + output: + - content: + - text: 'The user wants me to call get_weather exactly once with the city + "Paris" and nothing else. + + ' + type: reasoning_text + id: rs_8e2d51599a92e78e + summary: [] + type: reasoning + - arguments: '{"city": "Paris"}' + call_id: chatcmpl-tool-9e4783529d80aacb + id: fc_b5a2ae9c32e51507 + name: get_weather + status: completed + type: function_call + parallel_tool_calls: false + presence_penalty: 0.0 + previous_response_id: resp_01a1686a-1e09-7c71-ab58-bd9f8ee8290b + prompt_cache_key: null + prompt_cache_options: null + reasoning: null + safety_identifier: null + service_tier: auto + status: completed + store: true + temperature: 1.0 + text: + format: + type: text + tool_choice: + name: get_weather + type: function + tools: + - description: Get the current weather for a city + name: get_weather + parameters: + additionalProperties: false + properties: + city: + type: string + required: + - city + type: object + strict: true + type: function + - description: Travel location tools + name: travel + tools: + - description: Get the IANA time zone for a city + name: get_timezone + parameters: + additionalProperties: false + properties: + city: + type: string + required: + - city + type: object + strict: true + type: function + type: namespace + top_logprobs: 0 + top_p: 1.0 + truncation: disabled + usage: + input_tokens: 712 + input_tokens_details: + cache_write_tokens: 0 + cached_tokens: 0 + output_tokens: 48 + output_tokens_details: + reasoning_tokens: 21 + total_tokens: 760 + headers: + content-type: application/json + status_code: 200 +- filename: t38 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_01a1686a-2add-76c2-9ec0-3098b8f46a6d/input_items + query_params: + limit: '100' + order: asc + response: + body: + data: + - content: + - text: First call tool_search exactly once to find both a current-weather + function and a travel time-zone function. Do not call any other tool yet. + type: input_text + id: msg_01a1686a-24e0-7e72-a093-4fb9ca871fd6 + role: user + status: completed + type: message + - content: + - text: 'The user wants me to call tool_search exactly once, searching for + both a current-weather function and a travel time-zone function. Let me + craft a query that covers both needs. + + ' + type: reasoning_text + id: rs_882196426dacde62 + summary: [] + type: reasoning + - arguments: + query: current weather for a city and travel time-zone conversion + call_id: chatcmpl-tool-9bfcb0395132f225 + execution: client + id: tsc_a8223c016a4424d3 + status: completed + type: tool_search_call + - call_id: chatcmpl-tool-9bfcb0395132f225 + execution: client + id: tso_01a1686a-2fdf-72a1-8bde-381cc55a4ed8 + status: completed + tools: + - defer_loading: true + description: Get the current weather for a city + name: get_weather + parameters: + additionalProperties: false + properties: + city: + type: string + required: + - city + type: object + strict: true + type: function + - description: Travel location tools + name: travel + tools: + - defer_loading: true + description: Get the IANA time zone for a city + name: get_timezone + parameters: + additionalProperties: false + properties: + city: + type: string + required: + - city + type: object + strict: true + type: function + type: namespace + type: tool_search_output + - content: + - text: Now call get_weather exactly once with {"city":"Paris"}. Do not call + any other tool. + type: input_text + id: msg_01a1686a-2fdf-72a1-8bde-3820d2049b99 + role: user + status: completed + type: message + first_id: msg_01a1686a-24e0-7e72-a093-4fb9ca871fd6 + has_more: false + last_id: msg_01a1686a-2fdf-72a1-8bde-3820d2049b99 + object: list + headers: + content-type: application/json + status_code: 200 +- filename: t39 + request: + body: + input: + - call_id: chatcmpl-tool-9e4783529d80aacb + output: '{"city":"Paris","condition":"clear","temperature_c":21}' + type: function_call_output + - content: Now call the loaded travel namespace member get_timezone exactly + once with {"city":"Paris"}. Do not call any other tool. + role: user + type: message + max_output_tokens: 4096 + model: Qwen/Qwen3.8-27B-FP8 + parallel_tool_calls: false + previous_response_id: resp_01a1686a-2add-76c2-9ec0-3098b8f46a6d + store: true + stream: false + tool_choice: auto + headers: + accept: '*/*' + authorization: Bearer *** + content-type: application/json + user-agent: python-httpx/0.28.1 + method: POST + path: /v1/responses + query_params: {} + response: + body: + background: false + completed_at: 1792753155 + created_at: 1792753155 + error: null + frequency_penalty: 0.0 + id: resp_01a1686a-3637-7d51-8cde-b035bd3a4b15 + incomplete_details: null + instructions: null + max_output_tokens: 4096 + max_tool_calls: null + metadata: {} + model: Qwen/Qwen3.8-27B-FP8 + object: response + output: + - content: + - text: 'The user wants me to call the travel namespace member `get_timezone` + with `{"city":"Paris"}`. + + ' + type: reasoning_text + id: rs_845c8e9c9b4e459f + summary: [] + type: reasoning + - arguments: '{"city": "Paris"}' + call_id: chatcmpl-tool-b64d6e7c111b8a9a + id: fc_8064e5123e854c49 + name: get_timezone + namespace: travel + status: completed + type: function_call + parallel_tool_calls: false + presence_penalty: 0.0 + previous_response_id: resp_01a1686a-2add-76c2-9ec0-3098b8f46a6d + prompt_cache_key: null + prompt_cache_options: null + reasoning: null + safety_identifier: null + service_tier: auto + status: completed + store: true + temperature: 1.0 + text: + format: + type: text + tool_choice: auto + tools: + - description: Get the current weather for a city + name: get_weather + parameters: + additionalProperties: false + properties: + city: + type: string + required: + - city + type: object + strict: true + type: function + - description: Travel location tools + name: travel + tools: + - description: Get the IANA time zone for a city + name: get_timezone + parameters: + additionalProperties: false + properties: + city: + type: string + required: + - city + type: object + strict: true + type: function + type: namespace + top_logprobs: 0 + top_p: 1.0 + truncation: disabled + usage: + input_tokens: 821 + input_tokens_details: + cache_write_tokens: 784 + cached_tokens: 0 + output_tokens: 59 + output_tokens_details: + reasoning_tokens: 24 + total_tokens: 880 + headers: + content-type: application/json + status_code: 200 +- filename: t40 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_01a1686a-3637-7d51-8cde-b035bd3a4b15/input_items + query_params: + limit: '100' + order: asc + response: + body: + data: + - content: + - text: First call tool_search exactly once to find both a current-weather + function and a travel time-zone function. Do not call any other tool yet. + type: input_text + id: msg_01a1686a-24e0-7e72-a093-4fb9ca871fd6 + role: user + status: completed + type: message + - content: + - text: 'The user wants me to call tool_search exactly once, searching for + both a current-weather function and a travel time-zone function. Let me + craft a query that covers both needs. + + ' + type: reasoning_text + id: rs_882196426dacde62 + summary: [] + type: reasoning + - arguments: + query: current weather for a city and travel time-zone conversion + call_id: chatcmpl-tool-9bfcb0395132f225 + execution: client + id: tsc_a8223c016a4424d3 + status: completed + type: tool_search_call + - call_id: chatcmpl-tool-9bfcb0395132f225 + execution: client + id: tso_01a1686a-2fdf-72a1-8bde-381cc55a4ed8 + status: completed + tools: + - defer_loading: true + description: Get the current weather for a city + name: get_weather + parameters: + additionalProperties: false + properties: + city: + type: string + required: + - city + type: object + strict: true + type: function + - description: Travel location tools + name: travel + tools: + - defer_loading: true + description: Get the IANA time zone for a city + name: get_timezone + parameters: + additionalProperties: false + properties: + city: + type: string + required: + - city + type: object + strict: true + type: function + type: namespace + type: tool_search_output + - content: + - text: Now call get_weather exactly once with {"city":"Paris"}. Do not call + any other tool. + type: input_text + id: msg_01a1686a-2fdf-72a1-8bde-3820d2049b99 + role: user + status: completed + type: message + - content: + - text: 'The user wants me to call get_weather exactly once with the city + "Paris" and nothing else. + + ' + type: reasoning_text + id: rs_8e2d51599a92e78e + summary: [] + type: reasoning + - arguments: '{"city": "Paris"}' + call_id: chatcmpl-tool-9e4783529d80aacb + id: fc_b5a2ae9c32e51507 + name: get_weather + status: completed + type: function_call + - call_id: chatcmpl-tool-9e4783529d80aacb + id: fc_01a1686a-3ca5-74d2-942c-ac60295f134c + output: '{"city":"Paris","condition":"clear","temperature_c":21}' + status: completed + type: function_call_output + - content: + - text: Now call the loaded travel namespace member get_timezone exactly once + with {"city":"Paris"}. Do not call any other tool. + type: input_text + id: msg_01a1686a-3ca5-74d2-942c-ac713b58a696 + role: user + status: completed + type: message + first_id: msg_01a1686a-24e0-7e72-a093-4fb9ca871fd6 + has_more: false + last_id: msg_01a1686a-3ca5-74d2-942c-ac713b58a696 + object: list + headers: + content-type: application/json + status_code: 200 +- filename: t41 + request: + body: + input: + - call_id: chatcmpl-tool-b64d6e7c111b8a9a + output: '{"city":"Paris","iana_timezone":"Europe/Paris"}' + type: function_call_output + - content: Use both function outputs and call no more tools. Reply with exactly + PARIS_MIXED_TOOLS_OK. + role: user + type: message + max_output_tokens: 4096 + model: Qwen/Qwen3.8-27B-FP8 + parallel_tool_calls: false + previous_response_id: resp_01a1686a-3637-7d51-8cde-b035bd3a4b15 + store: true + stream: false + tool_choice: none + headers: + accept: '*/*' + authorization: Bearer *** + content-type: application/json + user-agent: python-httpx/0.28.1 + method: POST + path: /v1/responses + query_params: {} + response: + body: + background: false + completed_at: 1792753157 + created_at: 1792753157 + error: null + frequency_penalty: 0.0 + id: resp_01a1686a-4318-7f53-a2ec-ebf64c22d901 + incomplete_details: null + instructions: null + max_output_tokens: 4096 + max_tool_calls: null + metadata: {} + model: Qwen/Qwen3.8-27B-FP8 + object: response + output: + - content: + - text: 'The user wants me to reply with exactly "PARIS_MIXED_TOOLS_OK" and + call no more tools. + + ' + type: reasoning_text + id: rs_803b14c3efacf014 + summary: [] + type: reasoning + - content: + - annotations: [] + text: ' + + + PARIS_MIXED_TOOLS_OK' + type: output_text + id: msg_b85656b29fd28fe6 + role: assistant + status: completed + type: message + parallel_tool_calls: false + presence_penalty: 0.0 + previous_response_id: resp_01a1686a-3637-7d51-8cde-b035bd3a4b15 + prompt_cache_key: null + prompt_cache_options: null + reasoning: null + safety_identifier: null + service_tier: auto + status: completed + store: true + temperature: 1.0 + text: + format: + type: text + tool_choice: none + tools: + - description: Get the current weather for a city + name: get_weather + parameters: + additionalProperties: false + properties: + city: + type: string + required: + - city + type: object + strict: true + type: function + - description: Travel location tools + name: travel + tools: + - description: Get the IANA time zone for a city + name: get_timezone + parameters: + additionalProperties: false + properties: + city: + type: string + required: + - city + type: object + strict: true + type: function + type: namespace + top_logprobs: 0 + top_p: 1.0 + truncation: disabled + usage: + input_tokens: 932 + input_tokens_details: + cache_write_tokens: 0 + cached_tokens: 784 + output_tokens: 34 + output_tokens_details: + reasoning_tokens: 24 + total_tokens: 966 + headers: + content-type: application/json + status_code: 200 +- filename: t42 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_01a1686a-4318-7f53-a2ec-ebf64c22d901/input_items + query_params: + limit: '100' + order: asc + response: + body: + data: + - content: + - text: First call tool_search exactly once to find both a current-weather + function and a travel time-zone function. Do not call any other tool yet. + type: input_text + id: msg_01a1686a-24e0-7e72-a093-4fb9ca871fd6 + role: user + status: completed + type: message + - content: + - text: 'The user wants me to call tool_search exactly once, searching for + both a current-weather function and a travel time-zone function. Let me + craft a query that covers both needs. + + ' + type: reasoning_text + id: rs_882196426dacde62 + summary: [] + type: reasoning + - arguments: + query: current weather for a city and travel time-zone conversion + call_id: chatcmpl-tool-9bfcb0395132f225 + execution: client + id: tsc_a8223c016a4424d3 + status: completed + type: tool_search_call + - call_id: chatcmpl-tool-9bfcb0395132f225 + execution: client + id: tso_01a1686a-2fdf-72a1-8bde-381cc55a4ed8 + status: completed + tools: + - defer_loading: true + description: Get the current weather for a city + name: get_weather + parameters: + additionalProperties: false + properties: + city: + type: string + required: + - city + type: object + strict: true + type: function + - description: Travel location tools + name: travel + tools: + - defer_loading: true + description: Get the IANA time zone for a city + name: get_timezone + parameters: + additionalProperties: false + properties: + city: + type: string + required: + - city + type: object + strict: true + type: function + type: namespace + type: tool_search_output + - content: + - text: Now call get_weather exactly once with {"city":"Paris"}. Do not call + any other tool. + type: input_text + id: msg_01a1686a-2fdf-72a1-8bde-3820d2049b99 + role: user + status: completed + type: message + - content: + - text: 'The user wants me to call get_weather exactly once with the city + "Paris" and nothing else. + + ' + type: reasoning_text + id: rs_8e2d51599a92e78e + summary: [] + type: reasoning + - arguments: '{"city": "Paris"}' + call_id: chatcmpl-tool-9e4783529d80aacb + id: fc_b5a2ae9c32e51507 + name: get_weather + status: completed + type: function_call + - call_id: chatcmpl-tool-9e4783529d80aacb + id: fc_01a1686a-3ca5-74d2-942c-ac60295f134c + output: '{"city":"Paris","condition":"clear","temperature_c":21}' + status: completed + type: function_call_output + - content: + - text: Now call the loaded travel namespace member get_timezone exactly once + with {"city":"Paris"}. Do not call any other tool. + type: input_text + id: msg_01a1686a-3ca5-74d2-942c-ac713b58a696 + role: user + status: completed + type: message + - content: + - text: 'The user wants me to call the travel namespace member `get_timezone` + with `{"city":"Paris"}`. + + ' + type: reasoning_text + id: rs_845c8e9c9b4e459f + summary: [] + type: reasoning + - arguments: '{"city": "Paris"}' + call_id: chatcmpl-tool-b64d6e7c111b8a9a + id: fc_8064e5123e854c49 + name: get_timezone + namespace: travel + status: completed + type: function_call + - call_id: chatcmpl-tool-b64d6e7c111b8a9a + id: fc_01a1686a-4638-7dc0-a7c4-731a6e236565 + output: '{"city":"Paris","iana_timezone":"Europe/Paris"}' + status: completed + type: function_call_output + - content: + - text: Use both function outputs and call no more tools. Reply with exactly + PARIS_MIXED_TOOLS_OK. + type: input_text + id: msg_01a1686a-4638-7dc0-a7c4-732af44c3f56 + role: user + status: completed + type: message + first_id: msg_01a1686a-24e0-7e72-a093-4fb9ca871fd6 + has_more: false + last_id: msg_01a1686a-4638-7dc0-a7c4-732af44c3f56 + object: list + headers: + content-type: application/json + status_code: 200 +- filename: t43 + request: + body: + input: + - content: Do not call tools again. Reply only OK. + role: user + type: message + max_output_tokens: 4096 + model: Qwen/Qwen3.8-27B-FP8 + parallel_tool_calls: false + previous_response_id: resp_01a1686a-4318-7f53-a2ec-ebf64c22d901 + store: true + stream: false + tool_choice: none + headers: + accept: '*/*' + authorization: Bearer *** + content-type: application/json + user-agent: python-httpx/0.28.1 + method: POST + path: /v1/responses + query_params: {} + response: + body: + background: false + completed_at: 1792753159 + created_at: 1792753159 + error: null + frequency_penalty: 0.0 + id: resp_01a1686a-4cf5-7223-917f-cdf38247e6bb + incomplete_details: null + instructions: null + max_output_tokens: 4096 + max_tool_calls: null + metadata: {} + model: Qwen/Qwen3.8-27B-FP8 + object: response + output: + - content: + - text: 'The user wants me to reply only "OK" without calling any tools. + + ' + type: reasoning_text + id: rs_a98ef4703170f351 + summary: [] + type: reasoning + - content: + - annotations: [] + text: ' + + + OK' + type: output_text + id: msg_ab9477b32b79e026 + role: assistant + status: completed + type: message + parallel_tool_calls: false + presence_penalty: 0.0 + previous_response_id: resp_01a1686a-4318-7f53-a2ec-ebf64c22d901 + prompt_cache_key: null + prompt_cache_options: null + reasoning: null + safety_identifier: null + service_tier: auto + status: completed + store: true + temperature: 1.0 + text: + format: + type: text + tool_choice: none + tools: + - description: Get the current weather for a city + name: get_weather + parameters: + additionalProperties: false + properties: + city: + type: string + required: + - city + type: object + strict: true + type: function + - description: Travel location tools + name: travel + tools: + - description: Get the IANA time zone for a city + name: get_timezone + parameters: + additionalProperties: false + properties: + city: + type: string + required: + - city + type: object + strict: true + type: function + type: namespace + top_logprobs: 0 + top_p: 1.0 + truncation: disabled + usage: + input_tokens: 987 + input_tokens_details: + cache_write_tokens: 0 + cached_tokens: 784 + output_tokens: 20 + output_tokens_details: + reasoning_tokens: 16 + total_tokens: 1007 + headers: + content-type: application/json + status_code: 200 +- filename: t44 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_01a1686a-4cf5-7223-917f-cdf38247e6bb/input_items + query_params: + limit: '100' + order: asc + response: + body: + data: + - content: + - text: First call tool_search exactly once to find both a current-weather + function and a travel time-zone function. Do not call any other tool yet. + type: input_text + id: msg_01a1686a-24e0-7e72-a093-4fb9ca871fd6 + role: user + status: completed + type: message + - content: + - text: 'The user wants me to call tool_search exactly once, searching for + both a current-weather function and a travel time-zone function. Let me + craft a query that covers both needs. + + ' + type: reasoning_text + id: rs_882196426dacde62 + summary: [] + type: reasoning + - arguments: + query: current weather for a city and travel time-zone conversion + call_id: chatcmpl-tool-9bfcb0395132f225 + execution: client + id: tsc_a8223c016a4424d3 + status: completed + type: tool_search_call + - call_id: chatcmpl-tool-9bfcb0395132f225 + execution: client + id: tso_01a1686a-2fdf-72a1-8bde-381cc55a4ed8 + status: completed + tools: + - defer_loading: true + description: Get the current weather for a city + name: get_weather + parameters: + additionalProperties: false + properties: + city: + type: string + required: + - city + type: object + strict: true + type: function + - description: Travel location tools + name: travel + tools: + - defer_loading: true + description: Get the IANA time zone for a city + name: get_timezone + parameters: + additionalProperties: false + properties: + city: + type: string + required: + - city + type: object + strict: true + type: function + type: namespace + type: tool_search_output + - content: + - text: Now call get_weather exactly once with {"city":"Paris"}. Do not call + any other tool. + type: input_text + id: msg_01a1686a-2fdf-72a1-8bde-3820d2049b99 + role: user + status: completed + type: message + - content: + - text: 'The user wants me to call get_weather exactly once with the city + "Paris" and nothing else. + + ' + type: reasoning_text + id: rs_8e2d51599a92e78e + summary: [] + type: reasoning + - arguments: '{"city": "Paris"}' + call_id: chatcmpl-tool-9e4783529d80aacb + id: fc_b5a2ae9c32e51507 + name: get_weather + status: completed + type: function_call + - call_id: chatcmpl-tool-9e4783529d80aacb + id: fc_01a1686a-3ca5-74d2-942c-ac60295f134c + output: '{"city":"Paris","condition":"clear","temperature_c":21}' + status: completed + type: function_call_output + - content: + - text: Now call the loaded travel namespace member get_timezone exactly once + with {"city":"Paris"}. Do not call any other tool. + type: input_text + id: msg_01a1686a-3ca5-74d2-942c-ac713b58a696 + role: user + status: completed + type: message + - content: + - text: 'The user wants me to call the travel namespace member `get_timezone` + with `{"city":"Paris"}`. + + ' + type: reasoning_text + id: rs_845c8e9c9b4e459f + summary: [] + type: reasoning + - arguments: '{"city": "Paris"}' + call_id: chatcmpl-tool-b64d6e7c111b8a9a + id: fc_8064e5123e854c49 + name: get_timezone + namespace: travel + status: completed + type: function_call + - call_id: chatcmpl-tool-b64d6e7c111b8a9a + id: fc_01a1686a-4638-7dc0-a7c4-731a6e236565 + output: '{"city":"Paris","iana_timezone":"Europe/Paris"}' + status: completed + type: function_call_output + - content: + - text: Use both function outputs and call no more tools. Reply with exactly + PARIS_MIXED_TOOLS_OK. + type: input_text + id: msg_01a1686a-4638-7dc0-a7c4-732af44c3f56 + role: user + status: completed + type: message + - content: + - text: 'The user wants me to reply with exactly "PARIS_MIXED_TOOLS_OK" and + call no more tools. + + ' + type: reasoning_text + id: rs_803b14c3efacf014 + summary: [] + type: reasoning + - content: + - annotations: [] + text: ' + + + PARIS_MIXED_TOOLS_OK' + type: output_text + id: msg_b85656b29fd28fe6 + role: assistant + status: completed + type: message + - content: + - text: Do not call tools again. Reply only OK. + type: input_text + id: msg_01a1686a-4efc-7960-8cbe-f2aa5f05f279 + role: user + status: completed + type: message + first_id: msg_01a1686a-24e0-7e72-a093-4fb9ca871fd6 + has_more: false + last_id: msg_01a1686a-4efc-7960-8cbe-f2aa5f05f279 + object: list + headers: + content-type: application/json + status_code: 200 +- filename: t45 + request: + body: + input: 'Use three subagents to review this Python change: one for correctness, + one for security, and one for missing tests. File cache.py now contains these + lines: 1: import pickle; 2: CACHE = {}; 3: def load_profile(user_id, payload):; + 4: if user_id not in CACHE:; 5: CACHE[user_id] = pickle.loads(payload); + 6: return CACHE[user_id]. The function accepts payload bytes from an unauthenticated + HTTP request, caches profiles without expiration, and returns the cached mutable + dictionary directly. The only existing test loads one valid payload for one + user.' + max_output_tokens: 16384 + model: Qwen/Qwen3.8-27B-FP8 + multi_agent: + enabled: true + max_concurrent_subagents: 3 + store: true + stream: false + headers: + accept: '*/*' + authorization: Bearer *** + content-type: application/json + openai-beta: responses_multi_agent=v1 + user-agent: python-httpx/0.28.1 + method: POST + path: /v1/responses + query_params: {} + response: + body: + background: false + completed_at: 1792753299 + created_at: 1792753161 + error: null + frequency_penalty: 0.0 + id: resp_01a1686a-5682-7bd1-8c95-f08ef8429203 + incomplete_details: null + instructions: null + max_output_tokens: 16384 + max_tool_calls: null + metadata: {} + model: Qwen/Qwen3.8-27B-FP8 + object: response + output: + - agent: + agent_name: /root + content: + - text: "The user wants me to use three subagents to review a Python change\ + \ in cache.py:\n1. One for correctness\n2. One for security\n3. One for\ + \ missing tests\n\nThe file cache.py contains:\n```python\nimport pickle\n\ + CACHE = {}\ndef load_profile(user_id, payload):\n if user_id not in\ + \ CACHE:\n CACHE[user_id] = pickle.loads(payload)\n return CACHE[user_id]\n\ + ```\n\nContext: The function accepts payload bytes from an unauthenticated\ + \ HTTP request, caches profiles without expiration, and returns the cached\ + \ mutable dictionary directly. The only existing test loads one valid\ + \ payload for one user.\n\nLet me spawn three agents with distinct, bounded\ + \ assignments.\n" + type: reasoning_text + id: rs_b2d84a4596d72ce3 + summary: [] + type: reasoning + - action: spawn_agent + agent: + agent_name: /root + arguments: '{"task_name":"correctness_review","message":"enc_arPr9zESu3iaF8wAhYeCmHJN2kC0HtkHASNRkc8p6iCBGYi-st0JNxGxBD_QJSQpNtlXdZIxOUX3l22u2iSIYc_FB4LrwTFlSyBsj18IX3xWmaAmypL9hpESdbqe-YqACaEBmASqeLqASkckhiarCxJd2b33BpP0zZEHlm8EDm-Xsr0h1fF2nR0-MhUkQ23RA0W82hnOpE-uOd0zjeEMkt1H1JosYwwJC7j5k0Wk-7hSSiPeRR26Kjbzqp2udbD2f7UdyxaYJfDgFrxiBV9oBQ35jJScVVZvIJhPuv6Ya4poW88Rr0C8KLk6wpE4ZFHk9e2Z_YbWVnr64nvc_ye1cCw_rGE7XHImQyVZATfkRmx0qO0DOhSmRlTk0oGO3hCUK9SdzPf6sm3CsLCXrejUHhr0QKsdqssQGsarHeOxmdgBQXUhfG_-ouNuSGlIMxZnwTFbCWmN-5ApShjDNA7PlYdQ0djLkdDhODSDc4Twm-2vWT4BqZkpPfqivlO0qQrgG1Fwbyllk8ZSCMEaBrMJDhhdcBIHbbvlSjIGBNnspu6t774dRszmHG045eSerE4aT5zcgyjVw_HRxoh07g1s5PFlLBNthqikj__Cfjcz8xoUSnZy15Sbom7TbSibmpDLoKhnoJXJXPnBubwgK-M85pqjLRm6aD6RH-zSQ8NIi87k8qkdcCKEMoOLtXn9wUHJ7S9JrCKh0QBobPdvLat8YlY6Z16yYl-SSkeX_4TPqpJbbOLHtq-zJEtHgB5WEqzFD_2phnOzoVBpp-QQHTxNui2UbDnonK2gpRjXbcmishOUZkK217pGsiqNpwRiIToMMuSKyvUoP5cy0Ysq_PDaCW0IJ6D6SQPEn4hFk_M0ascguBWtZ3jKC7kfiwGkH21wgWobPT6jLmVzqGHhuXCBzGPkioL8ns6mktgvL8sGOp7ZddjiNSBm5rhzdtba4bl8V6EiUUtj9TQ99vFOMK3aNTOTbW1lVutsdAH3OyecxpYfvazdU0OQw7sYyq5XUBKX2wmykEVxmSIoEaz0e1EM_1gvVwPVzlJCQsdrKiAn8eLMdzTryOR1jxI7bcMhZaBDyIkR7ulhnup-kPmnY9KqRQP4_EC8fCjEj_zSxLntgXSEGgVAabq7akLHoDNFG5qgTbrM3KT-9y-6_8T3gV4_R_Y1ori5730ADUxdqz0tP7SMfJvJTjDGzYX-xwAqGh38mIYZneHBPBAahFGuSudUaeTdUQQcYZMQpkQX56IBtwSZZxcq8iBjKCKzhuyHJXb9Frn_ZC8xXD6VAWrVdJTn2nxy65oT5yaJtcbuujiwcOWVNvunwKNSISTYMhcgqwNi1rFQwjDvfdlM4mhtYNU","fork_turns":"all"}' + call_id: chatcmpl-tool-ba1410025d43a186 + id: mac_01a1686a-7bbc-7a60-8630-532a18705f97 + type: multi_agent_call + - agent: + agent_name: /root/correctness_review + author: /root + content: + - encrypted_content: enc_hP4HMi3DIigVa2OOrMwxJ3Ka4-R_oXXm85lNFcfqHExygU1CjKZKf8oZpZmY1oOkFtD88IW7ah9jeI8j9CipyQMKH-XgqbLgJb1dnJYqEQOYKfoPWnwwvpfKGCK18VR5P_3KGepcnhneAaJubgSqmN0cIJ89GOK2L3iPWlLDTHINXLZxodqRDWIXLUWmercr5j7u78qmFH1xd_yCsyiPnqP2CmWNiCxJF8vwGrcc3A5uzIvIZ21INiBMYQKRPLEaRBohV1Gn-oWpIgBkskatVqI2iLcArEdfPTOQcbdTQ1J6IzDdT2wMp4Yooo9CGZ_H59rE5_H4l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2ce6d + recipient: /root/correctness_review + type: agent_message + - action: spawn_agent + agent: + agent_name: /root + call_id: chatcmpl-tool-ba1410025d43a186 + id: maco_01a1686a-7bbd-7d32-9a0c-3fe134e05c9c + output: + - annotations: [] + text: '{"task_name":"/root/correctness_review"}' + type: output_text + type: multi_agent_call_output + - agent: + agent_name: /root + content: + - text: 'The first agent is spawned. Let me spawn the other two now. + + ' + type: reasoning_text + id: rs_9402c5bbd1e8db9f + summary: [] + type: reasoning + - action: spawn_agent + agent: + agent_name: /root + arguments: '{"task_name":"security_review","message":"enc_EA87eB2Aidg3zZR2xPlAgyV600V5x5usELCIcCCV0nMdjtKldD0Q7TWHVjnUtESGXC40hpTpG2yWMiC6zSbPX1twhG524szMHDkHSCy3a-06IYxlDnte2kGa0IlZS2sJxV1iPfn08rBWTWzY_EjxQga7P0lVgtMv6YJaNGK9VGzjvc0cQXAdFyZbYRTQUiMWEno6e0VXbjua1FhfN02C4-2yHBu0qo95yXiPIAfyyEzsQHl-qVj4HpMmpkVuhhNoEfwgmZfEMnAywT1m3TtGcwq9lJqzfiNacpTSdzZclsNQnD6GkPy13mB5WpQiranCM36ZaW7BoeejUQ1G_D3RpQVSlcakb7VzPmae2_nAxctKkBm3Tskjo7aWRQTKkb40Xpir5RWR4rsAJEhc2U7UEgVxxD9RaQV--g8Xw5ZEr3f58RAzpPQBLG3V-Eo-Wv1TF19G2ESV98_kCf0cTUIpZbXr7GT_opbpo6ln6gKLn7JxphTaGPandYi4dOrVA-H69jKYaKW7i4qnM-tiOUKI7XM96V0hwb1XxxWe6lK95oq9MUrfrVZ5p4GbP9nytezqjBOuDR3Kq3iycOCVD6cOZOCSupfvxHbSBe8wn5LzULhRyoQ0VHFAd6FI9-AZ7_1_JRXef42VLuLKt26k82RnDx2wFiTn9mSTPu6NKjhzvZed7-uDrIjcVc-kTnGqI0hEcJDiRBL_DOV82mHiDvcENnG4j0WHtgxDUlrE_4Ogn0wK_hMg_bYC030a-AlROfIIAl4p5suP_SzBA4vYIWiXciniOYCejdO-gVnnX9_oeu7ExA_bQ8PTacb3KuSpKS9RK0j-sc25ow40Q7-VBONwvML-DHooMZXNZLfmHtvroEoAepOKkOOUnbKS_hALtnoxxzb7FjQGZppRPFsmiuehzJwUJlJQhSDMU0QFldxT1sBczHyO7KZsjkxAKC5MEJFI6Lf-BCMmi8EIVLikVcfjkk6Hjc5ZpoqJ4USqR8coMruyp2K19FXoeXHhV-XhGTMFSckvxm0RTSKDSV7q4rWcC7EzENLbKqH4eZY9aY_0NT1v-G3CSuP0WL6vvZyFlnHEY_IMXOteaE6eczs68qN-N8RDcuY2RTSVMx44FaW9Rl5uKIYaAMYZxnk7IETz2cy7b4vOOwnLFCKVSnMlGKhjofteE3cjWmEtTbQI3Ic5VRu_elv5On3ABXjNBdK_qgUpqdAPd013RQkzlNlKXScxOZeY6T3JYLW2pMr2o4CmB785K45ySMhB_3DV1ByJvHVfCLCckgiDvyosIwjRmCEvQJ-nIBQnuQiS5cb4pf57Yd3BTbDnqhpq-ptPh2PPmI49JWeXmqeDWeNjNhE67mFseqm_cZdh1GhHwcicbKhYypS_B5PR4Jht7wDYJz5SJUBVpNvV7FqRLs6jiL0W6MolBbMKDvAjeaXelhufJrDj_-bpDOYUrlg8XemoLtT5XvGe","fork_turns":"all"}' + call_id: chatcmpl-tool-b4e4d375f9b6642d + id: mac_01a1686a-9943-7720-a427-c50a9b89944a + type: multi_agent_call + - agent: + agent_name: /root/security_review + author: /root + content: + - encrypted_content: enc_pJF4Hzl4gf97q5vMVkTm_M-X3QGox8QJWyRGrxurEhMaG1EP4_CkrbDZGDNpOdYquKiIvckkUcFnlsWYkO05kBGcPwOXIE8ZSISziJzsMOUxeMnc_v33Wy72aixQuQddEwsMO24ECE9m4aYMwV7Z7VqMycXcNeOjywzvFDoeF8I7vkxBrWa7kyEptVl3frDhHnHX9eRPPnuGh4QozErxK3nFLv4qjzrr1d0GXT-m3yqXQckkZB_UUTmJeeWB3uFIWdnw_cwYsgomEemynnQP7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JbNyvPzw54XqGueeD5KQOC7zHH7gJJ46waA7crLwrtpM7AaxZ3wfUFONDQAdnHcVFnLMqNOZdqm-U0z_wCTboek81cwg3oCzix9Ib9WaLSrsPe37VJKo2T6 + type: encrypted_content + id: amsg_01a1686a-9943-7720-a427-c52e5ad9a500 + recipient: /root/security_review + type: agent_message + - action: spawn_agent + agent: + agent_name: /root + call_id: chatcmpl-tool-b4e4d375f9b6642d + id: maco_01a1686a-9943-7720-a427-c546658a5646 + output: + - annotations: [] + text: '{"task_name":"/root/security_review"}' + type: output_text + type: multi_agent_call_output + - agent: + agent_name: /root + content: + - text: 'Now I need to spawn the third agent for missing tests. + + ' + type: reasoning_text + id: rs_a4f8b08deb9728ad + summary: [] + type: reasoning + - action: spawn_agent + agent: + agent_name: /root + arguments: '{"task_name":"missing_tests","message":"enc_o_seguRKsKQ1RCWPj1Sk26Y6IfY_KAddIexL-gSIIA_FY8XV-5_VEsjrL_Byy4P9cpbjcgCip9Mgh9BMTQ0Fxa-9x5hReTadtHK9yoqXTLVdCixQU1XSZcvMF0GLqlYvMizKZ9QCdXhYEQmcHQjYjySKp-zoRYwmvn9_IOGOmNwTMu5cgE-O5dcLVIDsaadq2CdivY7qCv7pF5RpMHl4YoFdP_88RXFQv8aTCyMGOOAkYfTYVOD_wzo7at1t043IzzYV-XSXbeMn0TzHucEvves6D7HDGZy39Nt9lugBsnxgopEZlE6-1OhiYO7kZZozIWyZlgw5wxkZNJ668d1wr8zxLkWeTf14VcnV353f5nCj3nT93ZvSbMo0fAaVIKOgN7Qg0NA5BnH-2sUrn2fhXedPuG3j2dt3c6Yo5sFKvgJouMfqi-U_4xpY9XJhuzgsLi17lSdjbvgBD1NjAFelyTVC9aM1p0UN-X-O0Z9mgv7i6kEDqbcWyNFKNNU6Az1fgCJLDoyOvg0JBKkbKhri4AU32FUCsTcCBzLG1SbgHW0Kq3s7bvzRLhx3PGKKsPX2Pfcc7NfZ-i_U49CXq2hJaaOkWuxbizdKJrydJRVNJCxcqzOqJdls4gsnIz2JA1u9AH-e0ZObbHoY-iYkfgQKRhJgCiZG4dbFrj5s4glbmBkopPNt8k5RsUPHTf7f0NlgE0YfjrA6tXUbdhoWV2_7GP61TaSGECYCZxKtwiUO6MYd4G_x9LccJCQ09cbpF6XHKBKEg9WXImigKc34-Xje1gjMsdzIv3BzRo3wv5JLo8bOcZAplppaH8nbmWeFCNlJlqeaHpxFxYHW4dQqZfRBO4gzLhdY9tfn90AI87ziot2tBsHwYf3z1Fr584BD-cxGb7nM6FRS16lwekXHs4MRhZFp6kJ0lDxk5yv9iW1v21ugk8JkeUq7mUTjvbSq-99dw03h_a7QNLGfdwEiH6ERguwWG12azXL8hBypGo4cmRYx8L4db6cSUnFNdYSb6Dc--au1W0-66cw1rr5lFNwDlH5cChWYdyeahRsj-Or3epQIBy-8a625843_wiK9GIwcVUaX6o3Yo1PuWRaTWOFainEIi8sKotV-65gAo8dTzZzxEggEbzLzUj8uV2upW6Ze5UT0kpkcvp19HA9mOuGl8aJIpbiOA4EGis4O3MJnuod4vmH8Zxs2-d_yz0HSVwEvo5f3IIHyzE12gHo6629PgAd4NniJsSsFRsSrzu7UmNpKHDlU24bDriyQbIvxF75Ya5t0uTX0QoYaAMVs0g2oy62vt3waoJYH2k07C-v-21iYW0yE_7ES9t5EUc8-M67jdqoj2xHbdpNzm5ArcMn6_sHS6g2FSP3b18gmHuDwKbmn8DpoCd_M2f08Z4RgH-cOV45qI_0TxmJbDO-EkYctXZXauPUJEVYDz8mEfJJgWAquPPo1a7fll5hf1rxfqyE78ZY3-rckjYejcoX7T6eUZdszKYk63rJHtk2Pj0oYnDHa_KXZ2VP5Cw","fork_turns":"all"}' + call_id: chatcmpl-tool-82d8e28a739efcd7 + id: mac_01a1686a-b7fe-73b0-a4a0-c57f7b509b26 + type: multi_agent_call + - agent: + agent_name: /root/missing_tests + author: /root + content: + - encrypted_content: enc_L4HqwAlVvY2TgvtD7HRK1NbwNShm7a5xYcZaBpJYZqxXop-C8VGhZ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NQXPzgSL8u-QyogmO4DcHrKHQJBV1l1KlSIF2qPqugQjDxTXuNAfX1tkVSE-Xw8NoQ5npYsRGAtmVAVfoHAQ_9xYOrSiYnxVinW2qDxkaG5bvIUd2j756lfcufqqAOn6UyyPI_mSeFzr_kfXdD2ZiM5OSUOFLGYijLivmjPUAvcvFe8fXWcFKdrVv3R4rXEDyakdvN8p8yz3O-Dmw8PBbMYdpZiuwZlbPqFRw6AAFdxIQlVQgNZjK9VPjO7MREcG5XzsFeGT4ONHfThWF0qJdXSCW0tvtt8Gf8MicEAfBXSn1E8oee__8i_zk_IA-0c8qqbLItZC_hVvaUDK58u1ecNkESHIsmondY8QkAakE3WXdPcpplZbe58qrC6VMDlA + type: encrypted_content + id: amsg_01a1686a-b7fe-73b0-a4a0-c59f62294d20 + recipient: /root/missing_tests + type: agent_message + - action: spawn_agent + agent: + agent_name: /root + call_id: chatcmpl-tool-82d8e28a739efcd7 + id: maco_01a1686a-b7fe-73b0-a4a0-c5b1e5241864 + output: + - annotations: [] + text: '{"task_name":"/root/missing_tests"}' + type: output_text + type: multi_agent_call_output + - agent: + agent_name: /root + content: + - text: 'All three agents are now spawned. I need to wait for their results. + Let me wait for the first one to complete. + + ' + type: reasoning_text + id: rs_890c73a079af7523 + summary: [] + type: reasoning + - agent: + agent_name: /root + content: + - annotations: [] + text: All three review agents are running. Let me collect their results. + type: output_text + id: msg_a8000a4038f8c579 + role: assistant + status: completed + type: message + - action: wait_agent + agent: + agent_name: /root + arguments: '{"timeout_ms":120000}' + call_id: chatcmpl-tool-a9a3f9406d5895cb + id: mac_01a1686a-c466-7ec3-9817-b33adeb90186 + type: multi_agent_call + - agent: + agent_name: /root/missing_tests + content: + - text: "My assignment is to review the Python code for MISSING TESTS. Let\ + \ me analyze the code carefully and identify all the test scenarios that\ + \ are missing.\n\nThe code:\n```python\nimport pickle\nCACHE = {}\ndef\ + \ load_profile(user_id, payload):\n if user_id not in CACHE:\n \ + \ CACHE[user_id] = pickle.loads(payload)\n return CACHE[user_id]\n\ + ```\n\nContext:\n- `payload` is bytes from an unauthenticated HTTP request\n\ + - `user_id` identifies the profile\n- The result is a mutable dict returned\ + \ directly\n- The cache is a module-level global with no expiration or\ + \ eviction\n\nExisting test: One test that loads a single valid payload\ + \ for a single user and asserts the returned dict is correct.\n\nLet me\ + \ think through all the missing test scenarios systematically:\n\n**Caching\ + \ Semantics:**\n1. Second call with same user_id should return cached\ + \ data (not re-deserialize)\n2. Second call with same user_id but DIFFERENT\ + \ payload should still return the original cached data (first-write-wins)\n\ + 3. Different user_ids should get independent cache entries\n4. The cache\ + \ should return the same object (identity) for the same user_id across\ + \ calls\n\n**Edge Cases:**\n5. Empty user_id string\n6. Very long user_id\n\ + 7. Non-string user_id (e.g., integer, bytes)\n8. Empty payload bytes (b\"\ + \")\n9. Payload that deserializes to None\n10. Payload that deserializes\ + \ to a non-dict (e.g., a string, a list, an integer)\n11. Payload that\ + \ deserializes to an empty dict\n\n**Error Handling:**\n12. Malformed/invalid\ + \ pickle data (raises pickle.UnpicklingError or similar)\n13. Payload\ + \ that raises an exception during unpickling\n14. What happens if pickle.loads\ + \ returns something that has no dict-like behavior\n\n**Concurrency:**\n\ + 15. Two threads calling load_profile with the same user_id simultaneously\ + \ — should only deserialize once, both get same object\n16. Two threads\ + \ calling with different user_ids — both should succeed independently\n\ + 17. Thread-safety of the CACHE dict itself (check-then-act race)\n\n**Cache\ + \ Mutation / Shared State:**\n18. Mutating the returned dict should affect\ + \ subsequent calls (since it's the same object) — this documents the current\ + \ behavior (or the bug)\n19. Mutating the returned dict should NOT affect\ + \ other users' cached data\n\n**Unbounded Growth:**\n20. Many unique user_ids\ + \ cause CACHE to grow without bound (documents the leak)\n\n**Type/Contract\ + \ Issues:**\n21. payload is None instead of bytes\n22. payload is a string\ + \ instead of bytes\n23. user_id is None\n\nLet me organize these into\ + \ a clear, structured report. I should be specific about inputs and expected\ + \ outputs.\n\nLet me also think about what \"first-write-wins\" means\ + \ — if user \"alice\" first sends payload A, then later sends payload\ + \ B, the function should still return the deserialized A. This is a critical\ + \ caching semantic that's untested.\n\nAlso, the check-then-act pattern\ + \ (if user_id not in CACHE: CACHE[user_id] = ...) is not atomic. Under\ + \ concurrency, two threads could both see user_id not in CACHE, both call\ + \ pickle.loads, and one overwrites the other. The final value depends\ + \ on which thread's assignment executes last. This is a real race condition.\n\ + \nLet me write up the full report now.\n" + type: reasoning_text + id: rs_ac7b4b15cd0776ac + summary: [] + type: reasoning + - action: list_agents + agent: + agent_name: /root/missing_tests + arguments: '{}' + call_id: chatcmpl-tool-80af08d7ee382b50 + id: mac_01a1686b-0032-7e60-85df-241ed3ee0676 + type: multi_agent_call + - action: list_agents + agent: + agent_name: /root/missing_tests + call_id: chatcmpl-tool-80af08d7ee382b50 + id: maco_01a1686b-0032-7e60-85df-24334e05366f + output: + - annotations: [] + text: '{"agents":[{"agent_name":"/root","agent_status":"running"},{"agent_name":"/root/correctness_review","agent_status":"running"},{"agent_name":"/root/security_review","agent_status":"running"},{"agent_name":"/root/missing_tests","agent_status":"running"}]}' + type: output_text + type: multi_agent_call_output + - agent: + agent_name: /root/missing_tests + content: + - text: 'Good, I can see my siblings are running. My assignment is clear — + I need to produce my own findings on missing tests. Let me write a comprehensive + report now. I don''t need to wait for the other agents since my task is + independent. + + + Let me structure my findings carefully. + + ' + type: reasoning_text + id: rs_abd432a548919a85 + summary: [] + type: reasoning + - agent: + agent_name: /root/missing_tests + content: + - annotations: [] + text: I have a clear, independent assignment. Let me produce my findings + directly. + type: output_text + id: msg_b5a39e4b8a98e219 + role: assistant + status: completed + type: message + - action: spawn_agent + agent: + agent_name: /root/missing_tests + arguments: '{"task_name":"missing_tests","message":"enc_crV_LNJ2itOXlJp5Jm5jsDg9LPvKi2I-jJE_94dGv3Dl3xr4mIAGBW2gpFMPYEXUpiYwJtX9R5fT9rek4KQD8ok7PrLOiXRKpT7RTztHUfX8ZXCKhrWYFSvw5EuFaH-jqPJX9ilyOE44RcKmGnczCsbxMopO5h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yhythhyXnwC5fTGfcJi3ukuXnN8OfKJpblWAbVMSf5vPyl0oXJbVWDaAHkFbsWfCknpstel94q61AP_gn3PKF-gJtvftTR3CvoqYkI-TzSgVbGBfjLlC14cErU7ZS_NESKhbVbGExdxIAHruSESyM0oasGMFswUIqUv1DRsi8V3NS3kZTgti0TtF3Z8sNzBQhLuHruPafCpP4wRHk0E6C75qBGQOWqKafVZUkMpEyLP1aXbMd06Gn3czT8NV8ICZamJbopScVb3ZB744btNeznfjF6dtfOaww2ySbsbPMA7EVXPLfEB4UMqg9nc15qgt_fHw","fork_turns":"all"}' + call_id: chatcmpl-tool-8dc9ece48552be04 + id: mac_01a1686b-222d-71c3-9209-f5773e2997ef + type: multi_agent_call + - action: spawn_agent + agent: + agent_name: /root/missing_tests + call_id: chatcmpl-tool-8dc9ece48552be04 + id: maco_01a1686b-222d-71c3-9209-f5901356dd29 + output: + - annotations: [] + text: '{"error":"maximum concurrent subagent turns reached"}' + type: output_text + type: multi_agent_call_output + - agent: + agent_name: /root/security_review + content: + - text: 'I''m the security_review agent. I have a clear, bounded assignment: + review the cache.py code for security vulnerabilities only. Let me analyze + the code directly and return my findings. I don''t need to spawn any subagents + for this — it''s a small code snippet and I can complete it myself. + + + Let me analyze the security issues: + + + 1. **Pickle deserialization of untrusted input (Critical)** - `pickle.loads(payload)` + on line 5 where payload comes from an unauthenticated HTTP request. This + is a classic RCE vector. An attacker can craft a malicious pickle payload + that executes arbitrary code when deserialized. + + + 2. **No authentication/authorization (Critical)** - The function is called + with data from an unauthenticated HTTP request. There''s no verification + that the caller is who they claim to be. Any unauthenticated user can + load any profile. + + + 3. **Cache poisoning (High)** - Line 4-5: The first request for a given + `user_id` wins. Since there''s no authentication, an attacker can poison + the cache for any user_id by being the first to call with that user_id. + Subsequent legitimate requests for that user_id will get the attacker''s + poisoned data. + + + 4. **Information disclosure via shared mutable state (High)** - Line 6: + The function returns the cached mutable dict directly. If the caller (or + downstream code) modifies this dict, it modifies the shared CACHE entry, + affecting all future callers for that user_id. Combined with the lack + of authentication, this means any attacker who calls first can modify + the data that all subsequent callers see. + + + 5. **Unbounded memory growth / DoS (Medium)** - Lines 2, 4-5: CACHE is + a global dict with no eviction policy, no size limit, and no expiration. + An attacker can send requests with many unique user_ids to exhaust server + memory (DoS). + + + 6. **User enumeration (Low/Medium)** - If the application returns different + responses for cached vs uncached user_ids (e.g., timing differences or + different error messages), an attacker could enumerate valid user_ids. + + + Let me structure these findings clearly. + + ' + type: reasoning_text + id: rs_9818f9bb42a2249c + summary: [] + type: reasoning + - agent: + agent_name: /root/security_review + content: + - annotations: [] + text: ' + + + ## Security Review: `cache.py` + + + ### 1. Remote Code Execution via Unsafe Deserialization + + - **Severity:** Critical + + - **Lines:** 5 + + - **Problem:** `pickle.loads(payload)` deserializes attacker-controlled + bytes from an unauthenticated HTTP request. Pickle is not a safe serialization + format — a crafted payload can instantiate arbitrary objects and execute + arbitrary code during `__reduce__` / `__setstate__`. This is a well-known + RCE vector (OWASP A03:2021 – Injection). + + - **Mitigation:** Never use `pickle.loads` on untrusted input. Replace + with a safe format such as JSON (`json.loads`), MessagePack, or Protocol + Buffers. If pickle must be retained internally, restrict it to server-to-server + channels with mutual TLS and integrity verification. + + + --- + + + ### 2. Missing Authentication / Authorization + + - **Severity:** Critical + + - **Lines:** 3 (function signature), entire file + + - **Problem:** The function is invoked with `payload` and `user_id` from + an **unauthenticated** HTTP request. No identity verification or access-control + check exists. Any anonymous caller can (a) trigger deserialization of + arbitrary bytes, (b) read any user''s profile, and (c) write arbitrary + data into the cache under any `user_id`. This violates OWASP A01:2021 + – Broken Access Control. + + - **Mitigation:** Authenticate the caller (session token, OAuth, API key) + and enforce an authorization check that the authenticated principal is + allowed to load the profile for the requested `user_id` (typically `caller + == user_id` or an explicit ACL). + + + --- + + + ### 3. Cache Poisoning (Cross-User) + + - **Severity:** High + + - **Lines:** 4–5 + + - **Problem:** The first request that supplies a given `user_id` populates + the cache, and subsequent requests for the same `user_id` return the cached + value without re-validation. Because the input is unauthenticated, an + attacker can send the first request for a victim''s `user_id` with attacker-chosen + `payload` bytes. All later legitimate requests for that victim then receive + the attacker''s poisoned data. This is a classic cache-poisoning / confusion + attack. + + - **Mitigation:** Derive the cache key from a **trusted** identity (e.g., + a signed session token) rather than a client-supplied `user_id`. Alternatively, + tag each cache entry with the authenticated principal who created it and + validate ownership on read. Invalidate or re-fetch if the authenticated + principal does not match. + + + --- + + + ### 4. Information Disclosure & Tampering via Shared Mutable State + + - **Severity:** High + + - **Lines:** 2, 6 + + - **Problem:** `CACHE` is a process-global mutable dict. Line 6 returns + the **same dict object** to the caller. Any downstream mutation of the + returned dict (e.g., `profile["role"] = "admin"`) silently rewrites the + cached entry for all future callers. Combined with the lack of authentication, + an attacker who calls `load_profile` first can mutate the shared dict + and thereby alter data seen by other users'' requests. + + - **Mitigation:** Return a **deep copy** (`copy.deepcopy(CACHE[user_id])`) + or a frozen/immutable structure. Alternatively, serialize to a read-only + view before returning. Ensure the cache stores canonical, server-validated + data only. + + + --- + + + ### 5. Unbounded Memory Growth (Denial of Service) + + - **Severity:** Medium + + - **Lines:** 2, 4–5 + + - **Problem:** `CACHE` has no size limit, no TTL, and no eviction policy. + An unauthenticated attacker can issue requests with millions of distinct + `user_id` values, each storing an arbitrarily large deserialized object, + exhausting process memory and crashing the server (OWASP A05:2021 – Security + Misconfiguration / A04:2021 – Insecure Design). + + - **Mitigation:** Use a bounded cache (e.g., `functools.lru_cache` with + `maxsize`, `cachetools.TTLCache`, or a Redis/Memcached backend with `MAXMEMORY` + and an eviction policy). Enforce a maximum payload size at the HTTP layer + before deserialization. + + + --- + + + ### 6. User Enumeration + + - **Severity:** Low + + - **Lines:** 4, 6 + + - **Problem:** If the application surface exposes observable differences + between a cache hit and a cache miss (timing, error messages, response + size), an unauthenticated attacker can probe `user_id` values to enumerate + which identifiers are valid. + + - **Mitigation:** Normalize response timing and error messages regardless + of cache state. Ideally, the access-control fix in Finding 2 eliminates + this entirely. + + + --- + + + ### Summary Table + + + | # | Finding | Severity | Primary Line(s) | + + |---|---------|----------|-----------------| + + | 1 | RCE via `pickle.loads` on untrusted input | Critical | 5 | + + | 2 | No authentication / authorization | Critical | 3 (whole file) | + + | 3 | Cross-user cache poisoning | High | 4–5 | + + | 4 | Shared mutable state → tampering & info leak | High | 2, 6 | + + | 5 | Unbounded cache → memory DoS | Medium | 2, 4–5 | + + | 6 | User enumeration via cache state | Low | 4, 6 |' + type: output_text + id: msg_b068d7e90b024f84 + phase: final_answer + role: assistant + status: completed + type: message + - agent: + agent_name: /root + author: /root/security_review + content: + - encrypted_content: enc_xdqHKtKU03YmCjc7bQxN1aKKKOlI91CLE4TLr8NvJDYryiz4GH2QfUmRLovHAKy6djCIbl3SRtuR-6wpp99EPSY8_cBmgY-7OVqLRGFkjpSeiY5pmHScsIYTTt4hvY-aTdzbGMRQf2tXfnE3jce3r0To4HtcSSGwSjmvzfn_PpjpgAn-i1q6tVK2haHsX8OaV82cOc9ZQ4_qZVl39HnvRoqgWlN3PPmyL50VZGsTnEsra3xRpwsdtu8FGc_UJpPlQOiGJvd_-4cQX8Ov6Zd2AFoMhz7UXkvxsE2Vm3R8g6ulz0iufAh4ceJOl-r8uUGV5BqA_PdAQABl74Om68ulhPE_HVQsmtRlY27GwAxDVSREZd173ozun81Xi0qkeMNljFy0FzquRBMgUpMQQKLtWJA9qI9MW6iXDFbShC9twKvDMjp6oAcDAjCkjc8YN9kekz2kpNri9w6DBsjcsFtgGD5V6FWvLEJr1XDYoLrgu3OahRnecyolcxCGkFASSPDPHHFqgujVvAWwMMdYCHBE2QdtUBA6rbEk9kiTspjTQqrn8v1TCZ6veT3TUg2t0sgX-4hR0RceMNcipYATQspcXFGJg45lqlsAbeb-J9indPtNpSxV2JVjNS7Yz7ArsulMbqlvudogD1cPg469upGhr3gPO_I5DEDHoANBDC_VnROQR2xp2EidueGLwA-Lp9n4rVVe79fX5IZ80xmBepYVj35tlwXXGjSsV62XeGuE51b8Cuz7e1XP1SdFoRV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SDZd2zwZ7-q8lrvEtlsglc6hPAjvpH1FvVfdCzAKXL6DKAYksKwR5-xRYtOOEjQwjwgVZTsVDC3mn0lSlCeMaj4Rg_dB1MkLXmoZGnkpX51z4YlWPcrvGRachBa3HIMMcspXP8urhwCvXbmqf5IT2o8hwlgUpPsVxDsY8Awb7odqVAs9svAil_l-dzgQU8vKMQbr93BlvSVAplgD_ovFL6GW8vQdJ704W7deqVKlmWJVpQO1GpcQw1BtXmZuVl5emODZVA7rei7Ccg + type: encrypted_content + id: amsg_01a1686b-2e93-7943-8ad3-9794a6eaedc2 + recipient: /root + type: agent_message + - action: wait_agent + agent: + agent_name: /root + call_id: chatcmpl-tool-a9a3f9406d5895cb + id: maco_01a1686b-2e93-7943-8ad3-97b16d5b741f + output: + - annotations: [] + text: '{"message":"Agent mailbox updated.","timed_out":false}' + type: output_text + type: multi_agent_call_output + - agent: + agent_name: /root + content: + - text: 'The security review is complete. Now I need to wait for the other + two agents (correctness_review and missing_tests) to finish. + + ' + type: reasoning_text + id: rs_beb22deb778120fb + summary: [] + type: reasoning + - agent: + agent_name: /root + content: + - annotations: [] + text: Security review is in. Waiting for the other two agents to complete. + type: output_text + id: msg_a619e1b0bc4a3674 + role: assistant + status: completed + type: message + - action: wait_agent + agent: + agent_name: /root + arguments: '{"timeout_ms":120000}' + call_id: chatcmpl-tool-ab98420abeedd69c + id: mac_01a1686b-3990-7ca1-bba3-1303431948c2 + type: multi_agent_call + - agent: + agent_name: /root/correctness_review + content: + - text: "The user wants me to review the Python code for correctness issues\ + \ only. Let me analyze the code carefully:\n\n```python\n1: import pickle\n\ + 2: CACHE = {}\n3: def load_profile(user_id, payload):\n4: if user_id\ + \ not in CACHE:\n5: CACHE[user_id] = pickle.loads(payload)\n6:\ + \ return CACHE[user_id]\n```\n\nContext: Called with `payload` bytes\ + \ from an HTTP request. `user_id` identifies which profile to cache.\n\ + \nLet me think through each focus area:\n\n1. **Logic bugs (race conditions,\ + \ TOCTOU, incorrect caching semantics)**\n\n - **TOCTOU / Race condition\ + \ on lines 4-5**: The check `if user_id not in CACHE` and the assignment\ + \ `CACHE[user_id] = pickle.loads(payload)` are not atomic. In a multithreaded\ + \ environment, two threads could both see `user_id not in CACHE` as True,\ + \ both call `pickle.loads(payload)`, and both assign to `CACHE[user_id]`.\ + \ This is a classic check-then-act race. While the final value might be\ + \ consistent (both write the same or different values), it means `pickle.loads`\ + \ could be called redundantly, and if the payloads differ (which they\ + \ can since they come from different HTTP requests), the result is non-deterministic.\n\ + \ \n - **Stale cache / incorrect caching semantics (lines 4-5)**:\ + \ The cache is \"set-and-never-update.\" Once a `user_id` is in `CACHE`,\ + \ subsequent calls with a different (updated) `payload` for the same `user_id`\ + \ will silently ignore the new payload and return the stale cached value.\ + \ This means if a user's profile is updated, the cache will serve the\ + \ old profile forever (until process restart). This is a behavioral correctness\ + \ issue — the function's contract is ambiguous but the behavior is clearly\ + \ \"first write wins, forever.\"\n\n2. **Thread-safety issues with the\ + \ global CACHE dict**\n\n - **Unprotected read-modify-write on the global\ + \ dict**: Python's GIL makes individual dict operations (like `__setitem__`\ + \ or `__contains__`) atomic at the bytecode level, but the compound operation\ + \ on lines 4-5 (check + set) is not atomic. In CPython, `if user_id not\ + \ in CACHE` compiles to a `CONTAINS_OP` followed by a conditional jump,\ + \ and `CACHE[user_id] = ...` is a separate `STORE_SUBSCR`. Between these,\ + \ another thread can interleave.\n \n - Also, `return CACHE[user_id]`\ + \ on line 6 — if another thread deletes the key between the check on line\ + \ 4 and the return on line 6, you'd get a `KeyError`. Though in this code\ + \ there's no deletion, it's worth noting the pattern is fragile.\n\n \ + \ - Actually, since there's no deletion in this code, the `KeyError`\ + \ on line 6 is not an immediate issue. But the race on lines 4-5 is real.\n\ + \n3. **Behavioral correctness (stale data)**\n\n - As noted above, once\ + \ cached, the value is never invalidated or updated. If an HTTP client\ + \ sends an updated profile for the same `user_id`, the new payload is\ + \ silently discarded. This is a correctness issue if the intent is to\ + \ reflect the latest profile.\n\n4. **Error handling gaps**\n\n - **Malformed\ + \ pickle data (line 5)**: `pickle.loads(payload)` can raise `pickle.UnpicklingError`,\ + \ `EOFError`, `ValueError`, or other exceptions if `payload` is malformed.\ + \ There's no try/except, so the function will propagate the exception\ + \ to the caller. Depending on the HTTP framework, this could result in\ + \ a 500 error. More subtly, if the unpickling partially succeeds before\ + \ failing, no state is corrupted (the CACHE assignment hasn't happened\ + \ yet), but the lack of handling means the caller must be prepared for\ + \ arbitrary exceptions.\n \n - **Unexpected types (line 5)**: `pickle.loads`\ + \ can return any Python object, not just a dict. If a malicious or buggy\ + \ client sends a payload that unpickles to a string, integer, or `None`,\ + \ then `CACHE[user_id]` will hold that type. Subsequent code that expects\ + \ a dict (e.g., `profile['name']`) will fail with a `TypeError`. There's\ + \ no type validation.\n \n - **`payload` could be `None` or non-bytes**:\ + \ If `payload` is `None` (e.g., an empty request body not properly handled\ + \ upstream), `pickle.loads(None)` raises `TypeError`. No validation of\ + \ input type.\n\n5. **Resource/leak issues that affect correctness**\n\ + \n - **Unbounded growth of CACHE (line 2)**: The global `CACHE` dict\ + \ grows without bound. Every unique `user_id` seen adds an entry that\ + \ is never evicted. In a long-running server, this is a memory leak. More\ + \ than a resource issue, this can affect correctness indirectly: if the\ + \ system is serving profiles for many users, memory pressure could cause\ + \ OOM kills, which is a liveness issue. But strictly as a correctness\ + \ issue in the caching semantics: the cache never expires, so it's both\ + \ a leak and a staleness problem.\n\nLet me structure these findings clearly.\n" + type: reasoning_text + id: rs_a510afee9ec596ea + summary: [] + type: reasoning + - agent: + agent_name: /root/correctness_review + content: + - annotations: [] + text: "\n\n## Correctness Review: `cache.py`\n\n### 1. TOCTOU / Check-Then-Act\ + \ Race (Lines 4–5)\n\n**Problem:** The membership test on line 4 and the\ + \ assignment on line 5 are not atomic. Under concurrent requests for the\ + \ same `user_id`, two threads can both observe `user_id not in CACHE`\ + \ as `True`, both deserialize, and both write. The final cached value\ + \ is non-deterministic if the two payloads differ.\n\n**Fix:** Use a lock,\ + \ or a thread-safe cache primitive (e.g., `threading.Lock` around the\ + \ check-and-set, or a `collections.defaultdict` + `Lock`). At minimum:\n\ + \n```python\nimport threading\n_CACHE_LOCK = threading.Lock()\n\ndef load_profile(user_id,\ + \ payload):\n with _CACHE_LOCK:\n if user_id not in CACHE:\n\ + \ CACHE[user_id] = pickle.loads(payload)\n return CACHE[user_id]\n\ + ```\n\n---\n\n### 2. Stale / Never-Invalidated Cache (Lines 4–5)\n\n**Problem:**\ + \ The cache is \"first write wins, forever.\" Once a `user_id` is present,\ + \ any subsequent call with an updated `payload` is silently ignored and\ + \ the original (stale) value is returned. There is no TTL, no version\ + \ check, and no invalidation path. If the intent is to reflect the user's\ + \ current profile, this is incorrect.\n\n**Fix:** Either (a) add a TTL\ + \ / max-age and evict expired entries before the lookup, or (b) accept\ + \ an explicit `version` or `updated_at` field and re-cache when it changes,\ + \ or (c) rename the function and document that it intentionally returns\ + \ the *first* payload seen per key.\n\n---\n\n### 3. No Validation of\ + \ Deserialized Type (Line 5)\n\n**Problem:** `pickle.loads(payload)` can\ + \ return *any* Python object (int, str, list, `None`, …). The cache will\ + \ store whatever type is produced. Downstream code that assumes a dict\ + \ (e.g., `profile[\"name\"]`) will raise `TypeError`. The function gives\ + \ no signal that the cached value is not the expected shape.\n\n**Fix:**\ + \ Validate after deserialization:\n\n```python\nobj = pickle.loads(payload)\n\ + if not isinstance(obj, dict):\n raise ValueError(f\"Expected dict payload,\ + \ got {type(obj).__name__}\")\nCACHE[user_id] = obj\n```\n\n---\n\n###\ + \ 4. Unhandled Exceptions on Malformed / Wrong-Type Input (Line 5)\n\n\ + **Problem:** If `payload` is not valid pickle bytes, `pickle.loads` raises\ + \ `pickle.UnpicklingError`, `EOFError`, or `ValueError`. If `payload`\ + \ is `None` or a `str`, it raises `TypeError`. None of these are caught,\ + \ so a single bad request can produce an unhandled 500 (or worse, depending\ + \ on the framework). There is also no guard that `payload` is actually\ + \ `bytes`.\n\n**Fix:** Add input-type validation and a narrow `try/except`\ + \ around the deserialization:\n\n```python\nif not isinstance(payload,\ + \ (bytes, bytearray, memoryview)):\n raise TypeError(\"payload must\ + \ be bytes\")\ntry:\n obj = pickle.loads(payload)\nexcept (pickle.UnpicklingError,\ + \ EOFError, ValueError) as e:\n raise ValueError(f\"Malformed payload:\ + \ {e}\")\n```\n\n---\n\n### 5. Unbounded Cache Growth (Line 2)\n\n**Problem:**\ + \ `CACHE` is a plain dict with no eviction policy. Every distinct `user_id`\ + \ observed in any request adds an entry that persists for the lifetime\ + \ of the process. In a long-running server handling many users, this is\ + \ an unbounded memory leak that will eventually cause OOM, killing the\ + \ process and losing all in-flight state.\n\n**Fix:** Use a bounded cache\ + \ such as `functools.lru_cache` (if the function can be made cacheable)\ + \ or a third-party `LRUCache` / `cachetools.TTLCache` with a max size.\ + \ Alternatively, add a background task that evicts entries older than\ + \ a threshold.\n\n---\n\n### 6. Mutable Cache Value Returned by Reference\ + \ (Line 6)\n\n**Problem:** The function returns the actual dict object\ + \ stored in `CACHE`. Any caller that mutates the returned object (e.g.,\ + \ `profile[\"bio\"] = \"...\"`) silently corrupts the cached state for\ + \ all subsequent callers. This is a data-integrity / correctness bug in\ + \ any multi-caller context.\n\n**Fix:** Return a copy:\n\n```python\n\ + import copy\nreturn copy.deepcopy(CACHE[user_id])\n```\n\nor document\ + \ that the returned object is read-only and enforce that at the API boundary.\n\ + \n---\n\n**Summary table**\n\n| # | Title | Lines | Severity |\n|---|-------|-------|----------|\n\ + | 1 | TOCTOU race on check-then-set | 4–5 | High (concurrency) |\n| 2\ + \ | Stale / never-invalidated cache | 4–5 | High (correctness) |\n| 3\ + \ | No type validation on deserialized object | 5 | Medium |\n| 4 | Unhandled\ + \ exceptions on bad input | 5 | Medium |\n| 5 | Unbounded cache growth\ + \ | 2 | Medium (liveness) |\n| 6 | Mutable value returned by reference\ + \ | 6 | Medium (data integrity) |" + type: output_text + id: msg_a5eeb577ad29b303 + phase: final_answer + role: assistant + status: completed + type: message + - agent: + agent_name: /root +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rqwRtQESXbjJ1NOnuCt7cxvSICyvy-xDLAS89CE8lVkqqEfvKb0VAsZUiRH_PpJSaRQJbAye4JrVo5OzOWaoTnVBOntR3NndoupF8IZGUZt6h44ibNtl7fQ3yz0o7a_qf6hGepSvN98ehmBCZPU8y6N0Xmu7AygkEUsD_MpyaxVyRgqcryDRsiRStPnDZ4_fVTUPZIk7YU3fzocr6B51DSuotWORYc9hsdzg4vN-XKgxqCO9IjlBxQw58rLYlRqr4X0i2u2Z0LU_hyQRUl27S7ieU_ca5Xr53odTqSf1-mVDPojATfmuUG2PJIwim4JrDaNopTWGt_zVjd2NCnJfXVZUXErl_DSVGYXtunCRTbioJKycFhKjelKcUrc7WG_W2_8KblMKVOqsdgtGMFd89hdYV9uD1q7aPMDTKLWghYgBLm83zDH3k1242mhqTDZLXrFZps-HWSgphVxeMdDcGqtMZGgCa7A4_o9_OZ235Z6BmjR1yTqKVpHzxpQ950epPTfLhnjeMj2bvh7PQ7-wWN7fFJ3TilB9jeG4Tx7gtONz0yEob2Okq4HMr6DeIOrFtX0WFEWVl12ly_em74c5xoOIB2Zgo2_CxYaSdYBkwahgLEmd-edTsO-PF_ukPMOqUMYWASfdg + type: encrypted_content + id: amsg_01a1686b-5282-7a32-9b23-c75d789a643a + recipient: /root + type: agent_message + - action: wait_agent + agent: + agent_name: /root + call_id: chatcmpl-tool-ab98420abeedd69c + id: maco_01a1686b-5282-7a32-9b23-c7760c17d458 + output: + - annotations: [] + text: '{"message":"Agent mailbox updated.","timed_out":false}' + type: output_text + type: multi_agent_call_output + - agent: + agent_name: /root + content: + - text: 'Two of the three reviews are in. I''m still waiting for the missing_tests + agent to complete. Let me wait for it. + + ' + type: reasoning_text + id: rs_aad46c74173698ab + summary: [] + type: reasoning + - agent: + agent_name: /root + content: + - annotations: [] + text: Two reviews complete. Waiting for the missing tests review. + type: output_text + id: msg_969d0d12e7a47035 + role: assistant + status: completed + type: message + - action: wait_agent + agent: + agent_name: /root + arguments: '{"timeout_ms":120000}' + call_id: chatcmpl-tool-afc49a7b2cfc2b4c + id: mac_01a1686b-5ef2-7421-9cb8-d9284a360863 + type: multi_agent_call + - agent: + agent_name: /root/missing_tests + content: + - text: 'I can''t spawn another agent because the slot is full. But my assignment + IS to do the missing tests review myself — I''m `/root/missing_tests`. + Let me just complete the work directly and return my findings. + + ' + type: reasoning_text + id: rs_abe99740748e3d46 + summary: [] + type: reasoning + - agent: + agent_name: /root/missing_tests + content: + - annotations: [] + text: ' + + + I''m `/root/missing_tests` myself — I don''t need to spawn another agent. + Let me complete this assignment directly and return my findings. + + + Here is my full review of missing tests for `cache.py`: + + + --- + + + ## Missing Test Report — `cache.py` + + + ### 1. Caching Semantics + + + **1a. `test_second_call_returns_cached_value_not_reloaded`** + + - **Input:** Call `load_profile("alice", pickle.dumps({"name": "Alice", + "age": 30}))` twice. + + - **Verify:** The second call returns the same object (identity check: + `assert result1 is result2`). Also verify that if `pickle.loads` were + instrumented (e.g., via a spy or by passing a payload that would raise + on a second decode), it is not re-invoked. + + - **Why it matters:** Confirms the cache actually caches. A regression + that accidentally re-deserializes on every call (e.g., a logic inversion) + would be caught. + + + **1b. `test_first_write_wins_subsequent_payload_ignored`** + + - **Input:** Call `load_profile("bob", pickle.dumps({"role": "admin"}))`, + then call `load_profile("bob", pickle.dumps({"role": "viewer"}))`. + + - **Verify:** The second call returns `{"role": "admin"}`, not `{"role": + "viewer"}`. + + - **Why it matters:** Documents and locks in the "first writer wins" caching + contract. A regression that overwrites existing cache entries (e.g., switching + to an unconditional assignment) would silently allow one request to overwrite + another user''s cached profile. + + + **1c. `test_different_users_get_independent_entries`** + + - **Input:** `load_profile("alice", pickle.dumps({"a": 1}))` and `load_profile("bob", + pickle.dumps({"b": 2}))`. + + - **Verify:** `CACHE["alice"] == {"a": 1}` and `CACHE["bob"] == {"b": + 2}`; mutating one does not affect the other. + + - **Why it matters:** Catches a regression where the cache key is accidentally + ignored (e.g., a single global slot) or where entries are aliased. + + + **1d. `test_cache_grows_without_bound`** + + - **Input:** Call `load_profile` with N unique user_ids (e.g., 10,000). + + - **Verify:** `len(CACHE) == N` after all calls. (This is a "documents + current behavior" test — it would fail if a TTL or eviction mechanism + were added.) + + - **Why it matters:** Pins the memory-leak behavior so that a future regression + or intentional fix to add eviction is a conscious, visible change rather + than an accidental side-effect of a refactor. + + + --- + + + ### 2. Edge Cases / Input Validation + + + **2a. `test_empty_user_id`** + + - **Input:** `load_profile("", pickle.dumps({"x": 1}))`. + + - **Verify:** Returns `{"x": 1}` and `CACHE[""]` exists. + + - **Why it matters:** An empty string is a valid dict key in Python but + may indicate a missing or malformed user identifier upstream. Catches + an accidental `if not user_id` guard that would break valid-but-empty + keys, or conversely documents that no such guard exists. + + + **2b. `test_non_string_user_id`** + + - **Input:** `load_profile(12345, pickle.dumps({"x": 1}))` (integer key). + + - **Verify:** Returns `{"x": 1}` and `CACHE[12345]` exists. A subsequent + call with `load_profile("12345", ...)` should create a *separate* entry. + + - **Why it matters:** If the upstream layer ever coerces user IDs to strings, + an int-vs-str mismatch would silently create duplicate cache entries and + break the "one profile per user" invariant. + + + **2c. `test_empty_payload`** + + - **Input:** `load_profile("carol", b"")`. + + - **Verify:** Raises `pickle.UnpicklingError` (or `EOFError`). The cache + entry for "carol" should NOT be created (i.e., `"carol" not in CACHE` + after the exception). + + - **Why it matters:** Confirms that a failed deserialization does not + pollute the cache. A regression that assigns `CACHE[user_id]` before the + `pickle.loads` call succeeds (e.g., refactoring to pre-allocate) would + leave a `None` or partial entry that poisons all future requests for that + user. + + + **2d. `test_payload_deserializes_to_none`** + + - **Input:** `load_profile("dave", pickle.dumps(None))`. + + - **Verify:** Returns `None`. `CACHE["dave"] is None`. + + - **Why it matters:** If downstream code assumes the result is always + a dict (e.g., calls `result["key"]`), a `None` entry causes an `AttributeError`. + This test documents that the function does not validate the deserialized + type. + + + **2e. `test_payload_deserializes_to_non_dict`** + + - **Input:** `load_profile("eve", pickle.dumps([1, 2, 3]))` (a list, not + a dict). + + - **Verify:** Returns `[1, 2, 3]`. + + - **Why it matters:** The docstring/context says the result is a "mutable + dict," but the function enforces no type. This test documents the absence + of a type contract and would catch a regression that adds one (or the + lack thereof, if downstream code relies on dict behavior). + + + **2f. `test_payload_deserializes_to_empty_dict`** + + - **Input:** `load_profile("frank", pickle.dumps({}))`. + + - **Verify:** Returns `{}`. Subsequent call with same user_id returns + the same empty dict object (identity). + + - **Why it matters:** An empty dict is falsy in Python. A regression that + uses `if not CACHE.get(user_id)` instead of `if user_id not in CACHE` + would re-deserialize on every call for empty profiles, breaking the cache + contract. + + + **2g. `test_none_payload`** + + - **Input:** `load_profile("grace", None)`. + + - **Verify:** Raises `TypeError` (or similar). No cache entry created. + + - **Why it matters:** Documents that the function does not guard against + `None` input. A regression that adds a truthiness check (`if payload:`) + would silently skip caching for `None` without raising — a different (and + possibly worse) failure mode. + + + **2h. `test_string_payload_instead_of_bytes`** + + - **Input:** `load_profile("heidi", "some_string")`. + + - **Verify:** Raises `TypeError` (pickle expects bytes). No cache entry + created. + + - **Why it matters:** In Python 3, passing a `str` to `pickle.loads` is + a type error. This test pins the expected exception type so a regression + that silently encodes the string would be caught. + + + --- + + + ### 3. Error Handling + + + **3a. `test_malformed_pickle_raises`** + + - **Input:** `load_profile("ivan", b"\xff\xff\xff not real pickle")`. + + - **Verify:** Raises `pickle.UnpicklingError` (or a subclass). `"ivan" + not in CACHE` after the exception. + + - **Why it matters:** The most critical error-path test. Confirms that + a failed deserialization does NOT leave a partial or poison entry in the + cache. A TOCTOU-style refactor (e.g., setting `CACHE[user_id] = None` + before calling `pickle.loads`) would pass the happy path but fail this + test. + + + **3b. `test_pickle_raises_during_unpickling_of_nested_object`** + + - **Input:** A payload that is structurally valid pickle but whose `__reduce__` + or `__setstate__` raises during reconstruction. + + - **Verify:** The exception propagates. No cache entry is created. + + - **Why it matters:** Distinguishes "malformed bytes" from "valid pickle, + failing object." Both must leave the cache clean. + + + **3c. `test_exception_does_not_create_cache_entry`** + + - **Input:** Any payload that causes `pickle.loads` to raise (use a `mock.patch` + on `pickle.loads` to raise a custom exception). + + - **Verify:** After the exception, `user_id not in CACHE`. + + - **Why it matters:** This is the key invariant: the cache must be all-or-nothing + per entry. A refactor that wraps the assignment in a try/except and still + assigns would violate this. + + + --- + + + ### 4. Concurrency / Thread Safety + + + **4a. `test_concurrent_same_user_id_single_deserialization`** + + - **Input:** Launch N threads (e.g., 50) that all call `load_profile("shared", + payload)` simultaneously (use a barrier to synchronize the start). + + - **Verify:** All threads receive the same object (`all(r is results[0] + for r in results)`). `pickle.loads` is called exactly once (instrument + with a counter or spy). + + - **Why it matters:** The check-then-act pattern (`if user_id not in CACHE: + CACHE[user_id] = ...`) is a classic race. Without a lock, multiple threads + can pass the `not in` check, each call `pickle.loads`, and the last writer + wins. While the final value may be correct (same payload), the test catches + unintended redundant deserialization and, more importantly, would fail + if different payloads were in play (see 4b). + + + **4b. `test_con' + type: output_text + id: msg_a78a40af81c14eca + phase: final_answer + role: assistant + status: completed + type: message + - agent: + agent_name: /root + author: /root/missing_tests + content: + - encrypted_content: enc_nxrnjVqdicjf0g9oDCODZMR1IPQ1vZcAu4veAL9hcZTaVmzkiB61dHneGx6WjHHpFwKGs1X7uw7w-w3Y-Tbe-PRyYZXsqNfojlr78vcpx76l7OzOvkBqnZzNmy7OfmNk_5pB6oUQsQRocZzMzjN4wGuASj_qIM3FU7rGWaI-gvmE6fJ166hXTP2WqJeaDMyZRu0SWA5Snj5Jg_2nmOGGKAl-iT1RfFUBN_NUuZmslamLpt8ElFDxRbyF0v7zTFQOIY1M2OGq7zRGu4B_7DblQYzfzLwTKMIuLQBOKH5Jjrb7iQcet-SwchgZqTtq9CoyG1SZqYOy_F1zHghK8I8Dy3-4qcXYSUCFwsEIAeTYX1YBbK5Zwsv19zD4ZZl38ELdy4PDvMxUtl-IjbRhv_eaEdKH8SryLABZVevr9jl4dHVi24mmEOqtONuwp9e8tpNbtZSWxa99IA-HhrdreDdHONjomKvrKAzHCvWaoDBLhVwVoV2N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L-qwqk9JCa2Xf6qx51OFnYJiO8l9shPER3JpMD3eSFeVQeLM29FfBrHesPvPWdcFuEMXEwfBKseagt3EvdrlgQrl7PNDkon3Og45y9ehVsCKpR10OIMGyZA61OTm4LC2sW6Lqhp-0g39HHuyofoF18mrWf5zpAxxf3pYWyhqXGbI-uEkeREr1ygZLxmsMUxNdjzjpkix0QNO8i_cjgo_Z8tk1hBf4P3UsW2IXceSn909EDBmdGc9fvUjJcD6qe7V3q3ehRN9ICmCa17C3ZoanAX7b110XUgx5dEpm5aXv94NKKkRSNSyNe51MVHchcS9b1pW_NnQT7aqAHkIeY7arSA4yuo4DxsCY4Y5AwN0uguQmo2i4UBOsSJ-R7t4YDdVuSpdjd0653SkCKbIH3fFOp1rUPT0EWm52cz-lfJcUIxzUHx6EsO08mC6NDNklKea0wjgOid6fSSUkQEXf6dNX_TW4L8 + type: encrypted_content + id: amsg_01a1686b-dc2a-78b2-8e60-9ce94668c444 + recipient: /root + type: agent_message + - action: wait_agent + agent: + agent_name: /root + call_id: chatcmpl-tool-afc49a7b2cfc2b4c + id: maco_01a1686b-dc2a-78b2-8e60-9d0340d8f459 + output: + - annotations: [] + text: '{"message":"Agent mailbox updated.","timed_out":false}' + type: output_text + type: multi_agent_call_output + - agent: + agent_name: /root + content: + - text: 'The missing tests review appears to have been cut off at the end. + Let me check what I have and whether I need to follow up with that agent. + The response was cut off at "4b. `test_con" — it seems like the agent''s + response was truncated. Let me check if the agent is still running or + if this is the final answer that was just truncated in display. + + + Looking at the message, it says "Message Type: FINAL_ANSWER" so this is + the agent''s final answer, but it appears to have been cut off in the + display. I have enough content to synthesize a comprehensive review. Let + me compile the results from all three agents and present them to the user. + + + Actually, let me check - the response seems to be cut off mid-sentence + at "4b. `test_con". This might just be a display truncation. I have substantial + content from all three agents. Let me compile the final review. + + + Let me synthesize all three reviews into a coherent final answer. + + ' + type: reasoning_text + id: rs_a89b80782feb1644 + summary: [] + type: reasoning + - agent: + agent_name: /root + content: + - annotations: [] + text: "\n\nAll three reviews are complete. Here's the consolidated report:\n\ + \n---\n\n# Code Review: `cache.py`\n\n```python\nimport pickle\nCACHE\ + \ = {}\ndef load_profile(user_id, payload):\n if user_id not in CACHE:\n\ + \ CACHE[user_id] = pickle.loads(payload)\n return CACHE[user_id]\n\ + ```\n\n---\n\n## \U0001F534 Security Findings\n\n| # | Finding | Severity\ + \ | Lines |\n|---|---------|----------|-------|\n| S1 | **RCE via `pickle.loads`\ + \ on untrusted input** — Attacker-controlled bytes from an unauthenticated\ + \ request are deserialized by pickle, which can execute arbitrary code\ + \ during `__reduce__`/`__setstate__`. | **Critical** | 5 |\n| S2 | **No\ + \ authentication/authorization** — No identity check; any anonymous caller\ + \ can trigger deserialization, read any profile, or write arbitrary cache\ + \ entries. | **Critical** | 3 (whole file) |\n| S3 | **Cross-user cache\ + \ poisoning** — First request for a `user_id` populates the cache permanently;\ + \ an attacker can pre-seed a victim's `user_id` with malicious data. |\ + \ **High** | 4–5 |\n| S4 | **Shared mutable state → tampering & info leak**\ + \ — Returns the cached dict object by reference; downstream mutation silently\ + \ rewrites state for all callers. | **High** | 2, 6 |\n| S5 | **Unbounded\ + \ cache → memory DoS** — No size limit, TTL, or eviction; attacker can\ + \ exhaust process memory with millions of unique keys. | **Medium** |\ + \ 2, 4–5 |\n| S6 | **User enumeration** — Observable differences between\ + \ cache hit/miss (timing, errors) allow probing valid `user_id`s. | **Low**\ + \ | 4, 6 |\n\n**Top mitigations:**\n- Replace `pickle` with a safe format\ + \ (JSON, Protocol Buffers) or restrict to authenticated/mutual-TLS channels.\n\ + - Authenticate callers and enforce `caller == user_id` or explicit ACL.\n\ + - Return `copy.deepcopy(...)` or an immutable view.\n- Use a bounded,\ + \ TTL-backed cache (`cachetools.TTLCache`, Redis with `maxmemory`).\n\n\ + ---\n\n## \U0001F7E0 Correctness Findings\n\n| # | Finding | Severity\ + \ | Lines |\n|---|---------|----------|-------|\n| C1 | **TOCTOU race\ + \ (check-then-act)** — Two threads can both see `user_id not in CACHE`\ + \ as `True`, both deserialize, and the last writer wins non-deterministically.\ + \ | **High** (concurrency) | 4–5 |\n| C2 | **Stale / never-invalidated\ + \ cache** — First write wins forever; subsequent calls with updated payloads\ + \ are silently ignored. No TTL, version, or invalidation path. | **High**\ + \ (correctness) | 4–5 |\n| C3 | **No type validation on deserialized object**\ + \ — `pickle.loads` can return any Python object; downstream code assuming\ + \ a dict will crash. | **Medium** | 5 |\n| C4 | **Unhandled exceptions\ + \ on bad input** — Malformed bytes, `None`, or `str` payloads raise unhandled\ + \ exceptions (500s); no input-type guard. | **Medium** | 5 |\n| C5 | **Unbounded\ + \ cache growth** — No eviction; long-running process will eventually OOM.\ + \ | **Medium** (liveness) | 2 |\n| C6 | **Mutable value returned by reference**\ + \ — Caller mutation corrupts cached state for all future callers. | **Medium**\ + \ (data integrity) | 6 |\n\n**Top fixes:**\n```python\nimport threading,\ + \ copy\n_CACHE_LOCK = threading.Lock()\n\ndef load_profile(user_id, payload):\n\ + \ if not isinstance(payload, (bytes, bytearray, memoryview)):\n \ + \ raise TypeError(\"payload must be bytes\")\n with _CACHE_LOCK:\n\ + \ if user_id not in CACHE:\n obj = pickle.loads(payload)\ + \ # replace with safe format\n if not isinstance(obj, dict):\n\ + \ raise ValueError(f\"Expected dict, got {type(obj).__name__}\"\ + )\n CACHE[user_id] = obj\n return copy.deepcopy(CACHE[user_id])\n\ + ```\n\n---\n\n## \U0001F7E1 Missing Tests\n\nThe single existing test\ + \ (one valid payload, one user) leaves the following untested:\n\n###\ + \ Caching Semantics\n| Test | What it verifies |\n|------|-----------------|\n\ + | `test_second_call_returns_cached_value_not_reloaded` | Cache actually\ + \ caches (identity check + spy on `pickle.loads`) |\n| `test_first_write_wins_subsequent_payload_ignored`\ + \ | Documents the \"first writer wins\" contract |\n| `test_different_users_get_independent_entries`\ + \ | No cross-contamination between keys |\n| `test_empty_dict_profile_is_cached`\ + \ | Guards against a truthiness-based check (`if not CACHE.get(...)`)\ + \ |\n\n### Input Validation / Edge Cases\n| Test | What it verifies |\n\ + |------|-----------------|\n| `test_empty_user_id` | Behavior with `\"\ + \"` as key |\n| `test_non_string_user_id` | int vs. str key mismatch creates\ + \ separate entries |\n| `test_empty_payload` | `b\"\"` raises; **no cache\ + \ entry created** |\n| `test_payload_deserializes_to_none` | Documents\ + \ lack of type contract |\n| `test_payload_deserializes_to_non_dict` |\ + \ List/int payload stored as-is |\n| `test_none_payload` | `None` input\ + \ raises `TypeError`; no entry created |\n| `test_string_payload_instead_of_bytes`\ + \ | `str` input raises `TypeError` |\n\n### Error Handling\n| Test | What\ + \ it verifies |\n|------|-----------------|\n| `test_malformed_pickle_raises`\ + \ | Garbage bytes raise `UnpicklingError`; cache stays clean |\n| `test_exception_does_not_create_cache_entry`\ + \ | **Key invariant:** failed deserialization never poisons the cache\ + \ |\n| `test_pickle_raises_during_object_reconstruction` | Valid pickle,\ + \ failing `__reduce__` — cache stays clean |\n\n### Concurrency\n| Test\ + \ | What it verifies |\n|------|-----------------|\n| `test_concurrent_same_user_id_single_deserialization`\ + \ | N threads, same key → `pickle.loads` called exactly once |\n| `test_concurrent_different_user_ids_no_interference`\ + \ | Parallel distinct keys don't corrupt each other |\n\n---\n\n## Summary\n\ + \nThe code has **two critical security vulnerabilities** (remote code\ + \ execution and missing authentication), a high-severity cache-poisoning\ + \ vector, and multiple correctness issues around concurrency, staleness,\ + \ and data integrity. The test suite is essentially empty — it covers\ + \ only the happy path for a single user and provides no protection against\ + \ any of the failure modes identified above. The most urgent fixes are:\ + \ (1) replace pickle with a safe deserializer, (2) add authentication,\ + \ and (3) add a lock around the check-and-set." + type: output_text + id: msg_9876395e7e41277c + phase: final_answer + role: assistant + status: completed + type: message + parallel_tool_calls: false + presence_penalty: 0.0 + previous_response_id: null + prompt_cache_key: null + prompt_cache_options: null + reasoning: null + safety_identifier: null + service_tier: auto + status: completed + store: true + temperature: 1.0 + text: + format: + type: text + tool_choice: auto + tools: [] + top_logprobs: 0 + top_p: 1.0 + truncation: disabled + usage: + input_tokens: 44435 + input_tokens_details: + cache_write_tokens: 21952 + cached_tokens: 18032 + output_tokens: 10109 + output_tokens_details: + reasoning_tokens: 2866 + total_tokens: 54544 + headers: + content-type: application/json + status_code: 200 +- filename: t46 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_01a1686a-5682-7bd1-8c95-f08ef8429203/input_items + query_params: + limit: '100' + order: asc + response: + body: + data: + - content: + - text: 'Use three subagents to review this Python change: one for correctness, + one for security, and one for missing tests. File cache.py now contains + these lines: 1: import pickle; 2: CACHE = {}; 3: def load_profile(user_id, + payload):; 4: if user_id not in CACHE:; 5: CACHE[user_id] + = pickle.loads(payload); 6: return CACHE[user_id]. The function accepts + payload bytes from an unauthenticated HTTP request, caches profiles without + expiration, and returns the cached mutable dictionary directly. The only + existing test loads one valid payload for one user.' + type: input_text + id: msg_01a1686c-71e5-7a92-bb27-7ccd32a8b1cb + role: user + status: completed + type: message + first_id: msg_01a1686c-71e5-7a92-bb27-7ccd32a8b1cb + has_more: false + last_id: msg_01a1686c-71e5-7a92-bb27-7ccd32a8b1cb + object: list + headers: + content-type: application/json + status_code: 200 +- filename: t47 + request: + body: + input: + - content: Do not call tools again. Reply only OK. + role: user + type: message + max_output_tokens: 16384 + model: Qwen/Qwen3.8-27B-FP8 + multi_agent: + enabled: true + max_concurrent_subagents: 3 + previous_response_id: resp_01a1686a-5682-7bd1-8c95-f08ef8429203 + store: true + stream: false + tool_choice: none + headers: + accept: '*/*' + authorization: Bearer *** + content-type: application/json + openai-beta: responses_multi_agent=v1 + user-agent: python-httpx/0.28.1 + method: POST + path: /v1/responses + query_params: {} + response: + body: + background: false + completed_at: 1792753303 + created_at: 1792753302 + error: null + frequency_penalty: 0.0 + id: resp_01a1686c-7a7c-7cb1-8d4d-dc60efce66b3 + incomplete_details: null + instructions: null + max_output_tokens: 16384 + max_tool_calls: null + metadata: {} + model: Qwen/Qwen3.8-27B-FP8 + object: response + output: + - agent: + agent_name: /root + content: + - text: 'The user is asking me to reply only "OK" without calling any tools. + This is a simple acknowledgment request. + + ' + type: reasoning_text + id: rs_a0a616f511ff23bf + summary: [] + type: reasoning + - agent: + agent_name: /root + content: + - annotations: [] + text: ' + + + OK' + type: output_text + id: msg_a501402cc01fcbd5 + phase: final_answer + role: assistant + status: completed + type: message + parallel_tool_calls: false + presence_penalty: 0.0 + previous_response_id: resp_01a1686a-5682-7bd1-8c95-f08ef8429203 + prompt_cache_key: null + prompt_cache_options: null + reasoning: null + safety_identifier: null + service_tier: auto + status: completed + store: true + temperature: 1.0 + text: + format: + type: text + tool_choice: none + tools: [] + top_logprobs: 0 + top_p: 1.0 + truncation: disabled + usage: + input_tokens: 9464 + input_tokens_details: + cache_write_tokens: 2352 + cached_tokens: 7056 + output_tokens: 28 + output_tokens_details: + reasoning_tokens: 24 + total_tokens: 9492 + headers: + content-type: application/json + status_code: 200 +- filename: t48 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_01a1686c-7a7c-7cb1-8d4d-dc60efce66b3/input_items + query_params: + limit: '100' + order: asc + response: + body: + data: + - content: + - text: 'Use three subagents to review this Python change: one for correctness, + one for security, and one for missing tests. File cache.py now contains + these lines: 1: import pickle; 2: CACHE = {}; 3: def load_profile(user_id, + payload):; 4: if user_id not in CACHE:; 5: CACHE[user_id] + = pickle.loads(payload); 6: return CACHE[user_id]. The function accepts + payload bytes from an unauthenticated HTTP request, caches profiles without + expiration, and returns the cached mutable dictionary directly. The only + existing test loads one valid payload for one user.' + type: input_text + id: msg_01a1686c-71e5-7a92-bb27-7ccd32a8b1cb + role: user + status: completed + type: message + - agent: + agent_name: /root + content: + - text: "The user wants me to use three subagents to review a Python change\ + \ in cache.py:\n1. One for correctness\n2. One for security\n3. One for\ + \ missing tests\n\nThe file cache.py contains:\n```python\nimport pickle\n\ + CACHE = {}\ndef load_profile(user_id, payload):\n if user_id not in\ + \ CACHE:\n CACHE[user_id] = pickle.loads(payload)\n return CACHE[user_id]\n\ + ```\n\nContext: The function accepts payload bytes from an unauthenticated\ + \ HTTP request, caches profiles without expiration, and returns the cached\ + \ mutable dictionary directly. The only existing test loads one valid\ + \ payload for one user.\n\nLet me spawn three agents with distinct, bounded\ + \ assignments.\n" + type: reasoning_text + id: rs_b2d84a4596d72ce3 + summary: [] + type: reasoning + - action: spawn_agent + agent: + agent_name: /root + arguments: '{"task_name":"correctness_review","message":"enc_arPr9zESu3iaF8wAhYeCmHJN2kC0HtkHASNRkc8p6iCBGYi-st0JNxGxBD_QJSQpNtlXdZIxOUX3l22u2iSIYc_FB4LrwTFlSyBsj18IX3xWmaAmypL9hpESdbqe-YqACaEBmASqeLqASkckhiarCxJd2b33BpP0zZEHlm8EDm-Xsr0h1fF2nR0-MhUkQ23RA0W82hnOpE-uOd0zjeEMkt1H1JosYwwJC7j5k0Wk-7hSSiPeRR26Kjbzqp2udbD2f7UdyxaYJfDgFrxiBV9oBQ35jJScVVZvIJhPuv6Ya4poW88Rr0C8KLk6wpE4ZFHk9e2Z_YbWVnr64nvc_ye1cCw_rGE7XHImQyVZATfkRmx0qO0DOhSmRlTk0oGO3hCUK9SdzPf6sm3CsLCXrejUHhr0QKsdqssQGsarHeOxmdgBQXUhfG_-ouNuSGlIMxZnwTFbCWmN-5ApShjDNA7PlYdQ0djLkdDhODSDc4Twm-2vWT4BqZkpPfqivlO0qQrgG1Fwbyllk8ZSCMEaBrMJDhhdcBIHbbvlSjIGBNnspu6t774dRszmHG045eSerE4aT5zcgyjVw_HRxoh07g1s5PFlLBNthqikj__Cfjcz8xoUSnZy15Sbom7TbSibmpDLoKhnoJXJXPnBubwgK-M85pqjLRm6aD6RH-zSQ8NIi87k8qkdcCKEMoOLtXn9wUHJ7S9JrCKh0QBobPdvLat8YlY6Z16yYl-SSkeX_4TPqpJbbOLHtq-zJEtHgB5WEqzFD_2phnOzoVBpp-QQHTxNui2UbDnonK2gpRjXbcmishOUZkK217pGsiqNpwRiIToMMuSKyvUoP5cy0Ysq_PDaCW0IJ6D6SQPEn4hFk_M0ascguBWtZ3jKC7kfiwGkH21wgWobPT6jLmVzqGHhuXCBzGPkioL8ns6mktgvL8sGOp7ZddjiNSBm5rhzdtba4bl8V6EiUUtj9TQ99vFOMK3aNTOTbW1lVutsdAH3OyecxpYfvazdU0OQw7sYyq5XUBKX2wmykEVxmSIoEaz0e1EM_1gvVwPVzlJCQsdrKiAn8eLMdzTryOR1jxI7bcMhZaBDyIkR7ulhnup-kPmnY9KqRQP4_EC8fCjEj_zSxLntgXSEGgVAabq7akLHoDNFG5qgTbrM3KT-9y-6_8T3gV4_R_Y1ori5730ADUxdqz0tP7SMfJvJTjDGzYX-xwAqGh38mIYZneHBPBAahFGuSudUaeTdUQQcYZMQpkQX56IBtwSZZxcq8iBjKCKzhuyHJXb9Frn_ZC8xXD6VAWrVdJTn2nxy65oT5yaJtcbuujiwcOWVNvunwKNSISTYMhcgqwNi1rFQwjDvfdlM4mhtYNU","fork_turns":"all"}' + call_id: chatcmpl-tool-ba1410025d43a186 + id: mac_01a1686a-7bbc-7a60-8630-532a18705f97 + type: multi_agent_call + - agent: + agent_name: /root/correctness_review + author: /root + content: + - encrypted_content: enc_hP4HMi3DIigVa2OOrMwxJ3Ka4-R_oXXm85lNFcfqHExygU1CjKZKf8oZpZmY1oOkFtD88IW7ah9jeI8j9CipyQMKH-XgqbLgJb1dnJYqEQOYKfoPWnwwvpfKGCK18VR5P_3KGepcnhneAaJubgSqmN0cIJ89GOK2L3iPWlLDTHINXLZxodqRDWIXLUWmercr5j7u78qmFH1xd_yCsyiPnqP2CmWNiCxJF8vwGrcc3A5uzIvIZ21INiBMYQKRPLEaRBohV1Gn-oWpIgBkskatVqI2iLcArEdfPTOQcbdTQ1J6IzDdT2wMp4Yooo9CGZ_H59rE5_H4l_NGbbOjRFrmgRPOlamVLD8vnABHWSWYG6cdfOeUV-6AGiBA3t3rF-sgbJFYkmfCXlpyqE_T304SyRZ5m7OEceslO-5IXuj9_oLAcULapBi-m_CgxiPuAmFP5Fi_Mj5W62ZVoQ6GBqBgP93uPE482fQBU36eJLW9qtzYouiimF8tOdVE0wbZKylXJmXqU-0hiH0AoAjInlbjwK5b56ieoZx3vgCaxpKlmB1fQKSNqa8Z3hVjt2_sM1qe4AkRqbEvbs70j48Y4mrnck0z8n0W9jDKkZGCNOYgXMSMz8cm_wEKbXE9LBEOA-ibAyZjwuPlYLHQeC9mkVvCXTmZP8XhcXuoT9ANysZx4KYRbuYOXoNsiWq_BVSvnqm5556HfJF4Rr8KFEd5bp-0usBdnvPpyiKdl4NiLRt711lnymHb1jfX50Opjq15_11PiBQvsXi6xy13fic_Yr94OKOmcBalyMbivrKlO0J2NjsuIa6M9KInnqCDN-oKy4Un7z7MxE0O_kZZElrgKzloHHR6Gp6WkIksMel4RC-Sviid1b53Fw5sgysmUbSulDwYo9icsWnR6CT-92-mAP25j2ivEjQ-JEqg1-hhPgHJjR7ObW9Gwhe_pA0pHjaMX2dp2S8wvU9WmPo4LtGDaNvHY5gQxFyLmAQbfdWJpV9jeB1aPH5E_gpotgF4rn95K9m1U4lqM1HPGF4SoxiudCNveHy5BZbDFw1LvI4d1-i-Q3UbnTM-yo3CYoSQCTN-1YA7uA3yw0xilC0yuR_wD-Mu7pi972A0P_BYj8Fog7ubZ6TGR5g3ByMmW_tqeiFEI9kSuBfvLH44PK5aPCBCCkg6hCXt-O6C5ooC832oLYvXFRfpRoST0BhXu-rHSlJmGWuvF0JMAvA3TWiwAJGw5JnwLkm7KgaW1D_1Vh107Nwh390PxRo4G92noptbdeYWb2MJp9W46rCllRVNJI36Bbu-tLU6SLTh9vLirGcwif2tEmTG6TAR4sRywD2mo0ox20yUOvP1GR1LVqNYcCTh_Pw + type: encrypted_content + id: amsg_01a1686a-7bbd-7d32-9a0c-3fc4a9c2ce6d + recipient: /root/correctness_review + type: agent_message + - action: spawn_agent + agent: + agent_name: /root + call_id: chatcmpl-tool-ba1410025d43a186 + id: maco_01a1686a-7bbd-7d32-9a0c-3fe134e05c9c + output: + - annotations: [] + text: '{"task_name":"/root/correctness_review"}' + type: output_text + type: multi_agent_call_output + - agent: + agent_name: /root + content: + - text: 'The first agent is spawned. Let me spawn the other two now. + + ' + type: reasoning_text + id: rs_9402c5bbd1e8db9f + summary: [] + type: reasoning + - action: spawn_agent + agent: + agent_name: /root + arguments: '{"task_name":"security_review","message":"enc_EA87eB2Aidg3zZR2xPlAgyV600V5x5usELCIcCCV0nMdjtKldD0Q7TWHVjnUtESGXC40hpTpG2yWMiC6zSbPX1twhG524szMHDkHSCy3a-06IYxlDnte2kGa0IlZS2sJxV1iPfn08rBWTWzY_EjxQga7P0lVgtMv6YJaNGK9VGzjvc0cQXAdFyZbYRTQUiMWEno6e0VXbjua1FhfN02C4-2yHBu0qo95yXiPIAfyyEzsQHl-qVj4HpMmpkVuhhNoEfwgmZfEMnAywT1m3TtGcwq9lJqzfiNacpTSdzZclsNQnD6GkPy13mB5WpQiranCM36ZaW7BoeejUQ1G_D3RpQVSlcakb7VzPmae2_nAxctKkBm3Tskjo7aWRQTKkb40Xpir5RWR4rsAJEhc2U7UEgVxxD9RaQV--g8Xw5ZEr3f58RAzpPQBLG3V-Eo-Wv1TF19G2ESV98_kCf0cTUIpZbXr7GT_opbpo6ln6gKLn7JxphTaGPandYi4dOrVA-H69jKYaKW7i4qnM-tiOUKI7XM96V0hwb1XxxWe6lK95oq9MUrfrVZ5p4GbP9nytezqjBOuDR3Kq3iycOCVD6cOZOCSupfvxHbSBe8wn5LzULhRyoQ0VHFAd6FI9-AZ7_1_JRXef42VLuLKt26k82RnDx2wFiTn9mSTPu6NKjhzvZed7-uDrIjcVc-kTnGqI0hEcJDiRBL_DOV82mHiDvcENnG4j0WHtgxDUlrE_4Ogn0wK_hMg_bYC030a-AlROfIIAl4p5suP_SzBA4vYIWiXciniOYCejdO-gVnnX9_oeu7ExA_bQ8PTacb3KuSpKS9RK0j-sc25ow40Q7-VBONwvML-DHooMZXNZLfmHtvroEoAepOKkOOUnbKS_hALtnoxxzb7FjQGZppRPFsmiuehzJwUJlJQhSDMU0QFldxT1sBczHyO7KZsjkxAKC5MEJFI6Lf-BCMmi8EIVLikVcfjkk6Hjc5ZpoqJ4USqR8coMruyp2K19FXoeXHhV-XhGTMFSckvxm0RTSKDSV7q4rWcC7EzENLbKqH4eZY9aY_0NT1v-G3CSuP0WL6vvZyFlnHEY_IMXOteaE6eczs68qN-N8RDcuY2RTSVMx44FaW9Rl5uKIYaAMYZxnk7IETz2cy7b4vOOwnLFCKVSnMlGKhjofteE3cjWmEtTbQI3Ic5VRu_elv5On3ABXjNBdK_qgUpqdAPd013RQkzlNlKXScxOZeY6T3JYLW2pMr2o4CmB785K45ySMhB_3DV1ByJvHVfCLCckgiDvyosIwjRmCEvQJ-nIBQnuQiS5cb4pf57Yd3BTbDnqhpq-ptPh2PPmI49JWeXmqeDWeNjNhE67mFseqm_cZdh1GhHwcicbKhYypS_B5PR4Jht7wDYJz5SJUBVpNvV7FqRLs6jiL0W6MolBbMKDvAjeaXelhufJrDj_-bpDOYUrlg8XemoLtT5XvGe","fork_turns":"all"}' + call_id: chatcmpl-tool-b4e4d375f9b6642d + id: mac_01a1686a-9943-7720-a427-c50a9b89944a + type: multi_agent_call + - agent: + agent_name: /root/security_review + author: /root + content: + - encrypted_content: enc_pJF4Hzl4gf97q5vMVkTm_M-X3QGox8QJWyRGrxurEhMaG1EP4_CkrbDZGDNpOdYquKiIvckkUcFnlsWYkO05kBGcPwOXIE8ZSISziJzsMOUxeMnc_v33Wy72aixQuQddEwsMO24ECE9m4aYMwV7Z7VqMycXcNeOjywzvFDoeF8I7vkxBrWa7kyEptVl3frDhHnHX9eRPPnuGh4QozErxK3nFLv4qjzrr1d0GXT-m3yqXQckkZB_UUTmJeeWB3uFIWdnw_cwYsgomEemynnQP7af9KahRUo475qB4c74pTYiVDYEiA727Eoe0QLskY-J-dYFEIsJXzVuHWD1QfknDVG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HcVFnLMqNOZdqm-U0z_wCTboek81cwg3oCzix9Ib9WaLSrsPe37VJKo2T6 + type: encrypted_content + id: amsg_01a1686a-9943-7720-a427-c52e5ad9a500 + recipient: /root/security_review + type: agent_message + - action: spawn_agent + agent: + agent_name: /root + call_id: chatcmpl-tool-b4e4d375f9b6642d + id: maco_01a1686a-9943-7720-a427-c546658a5646 + output: + - annotations: [] + text: '{"task_name":"/root/security_review"}' + type: output_text + type: multi_agent_call_output + - agent: + agent_name: /root + content: + - text: 'Now I need to spawn the third agent for missing tests. + + ' + type: reasoning_text + id: rs_a4f8b08deb9728ad + summary: [] + type: reasoning + - action: spawn_agent + agent: + agent_name: /root + arguments: '{"task_name":"missing_tests","message":"enc_o_seguRKsKQ1RCWPj1Sk26Y6IfY_KAddIexL-gSIIA_FY8XV-5_VEsjrL_Byy4P9cpbjcgCip9Mgh9BMTQ0Fxa-9x5hReTadtHK9yoqXTLVdCixQU1XSZcvMF0GLqlYvMizKZ9QCdXhYEQmcHQjYjySKp-zoRYwmvn9_IOGOmNwTMu5cgE-O5dcLVIDsaadq2CdivY7qCv7pF5RpMHl4YoFdP_88RXFQv8aTCyMGOOAkYfTYVOD_wzo7at1t043IzzYV-XSXbeMn0TzHucEvves6D7HDGZy39Nt9lugBsnxgopEZlE6-1OhiYO7kZZozIWyZlgw5wxkZNJ668d1wr8zxLkWeTf14VcnV353f5nCj3nT93ZvSbMo0fAaVIKOgN7Qg0NA5BnH-2sUrn2fhXedPuG3j2dt3c6Yo5sFKvgJouMfqi-U_4xpY9XJhuzgsLi17lSdjbvgBD1NjAFelyTVC9aM1p0UN-X-O0Z9mgv7i6kEDqbcWyNFKNNU6Az1fgCJLDoyOvg0JBKkbKhri4AU32FUCsTcCBzLG1SbgHW0Kq3s7bvzRLhx3PGKKsPX2Pfcc7NfZ-i_U49CXq2hJaaOkWuxbizdKJrydJRVNJCxcqzOqJdls4gsnIz2JA1u9AH-e0ZObbHoY-iYkfgQKRhJgCiZG4dbFrj5s4glbmBkopPNt8k5RsUPHTf7f0NlgE0YfjrA6tXUbdhoWV2_7GP61TaSGECYCZxKtwiUO6MYd4G_x9LccJCQ09cbpF6XHKBKEg9WXImigKc34-Xje1gjMsdzIv3BzRo3wv5JLo8bOcZAplppaH8nbmWeFCNlJlqeaHpxFxYHW4dQqZfRBO4gzLhdY9tfn90AI87ziot2tBsHwYf3z1Fr584BD-cxGb7nM6FRS16lwekXHs4MRhZFp6kJ0lDxk5yv9iW1v21ugk8JkeUq7mUTjvbSq-99dw03h_a7QNLGfdwEiH6ERguwWG12azXL8hBypGo4cmRYx8L4db6cSUnFNdYSb6Dc--au1W0-66cw1rr5lFNwDlH5cChWYdyeahRsj-Or3epQIBy-8a625843_wiK9GIwcVUaX6o3Yo1PuWRaTWOFainEIi8sKotV-65gAo8dTzZzxEggEbzLzUj8uV2upW6Ze5UT0kpkcvp19HA9mOuGl8aJIpbiOA4EGis4O3MJnuod4vmH8Zxs2-d_yz0HSVwEvo5f3IIHyzE12gHo6629PgAd4NniJsSsFRsSrzu7UmNpKHDlU24bDriyQbIvxF75Ya5t0uTX0QoYaAMVs0g2oy62vt3waoJYH2k07C-v-21iYW0yE_7ES9t5EUc8-M67jdqoj2xHbdpNzm5ArcMn6_sHS6g2FSP3b18gmHuDwKbmn8DpoCd_M2f08Z4RgH-cOV45qI_0TxmJbDO-EkYctXZXauPUJEVYDz8mEfJJgWAquPPo1a7fll5hf1rxfqyE78ZY3-rckjYejcoX7T6eUZdszKYk63rJHtk2Pj0oYnDHa_KXZ2VP5Cw","fork_turns":"all"}' + call_id: chatcmpl-tool-82d8e28a739efcd7 + id: mac_01a1686a-b7fe-73b0-a4a0-c57f7b509b26 + type: multi_agent_call + - agent: + agent_name: /root/missing_tests + author: /root + content: + - encrypted_content: enc_L4HqwAlVvY2TgvtD7HRK1NbwNShm7a5xYcZaBpJYZqxXop-C8VGhZTvbP6kJkdd4B6ynnB83DX97YrpMeLXw1DBQZvnIbwqNPAGnl8UD_XIpirWgJ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-Xw8NoQ5npYsRGAtmVAVfoHAQ_9xYOrSiYnxVinW2qDxkaG5bvIUd2j756lfcufqqAOn6UyyPI_mSeFzr_kfXdD2ZiM5OSUOFLGYijLivmjPUAvcvFe8fXWcFKdrVv3R4rXEDyakdvN8p8yz3O-Dmw8PBbMYdpZiuwZlbPqFRw6AAFdxIQlVQgNZjK9VPjO7MREcG5XzsFeGT4ONHfThWF0qJdXSCW0tvtt8Gf8MicEAfBXSn1E8oee__8i_zk_IA-0c8qqbLItZC_hVvaUDK58u1ecNkESHIsmondY8QkAakE3WXdPcpplZbe58qrC6VMDlA + type: encrypted_content + id: amsg_01a1686a-b7fe-73b0-a4a0-c59f62294d20 + recipient: /root/missing_tests + type: agent_message + - action: spawn_agent + agent: + agent_name: /root + call_id: chatcmpl-tool-82d8e28a739efcd7 + id: maco_01a1686a-b7fe-73b0-a4a0-c5b1e5241864 + output: + - annotations: [] + text: '{"task_name":"/root/missing_tests"}' + type: output_text + type: multi_agent_call_output + - agent: + agent_name: /root + content: + - text: 'All three agents are now spawned. I need to wait for their results. + Let me wait for the first one to complete. + + ' + type: reasoning_text + id: rs_890c73a079af7523 + summary: [] + type: reasoning + - agent: + agent_name: /root + content: + - annotations: [] + text: All three review agents are running. Let me collect their results. + type: output_text + id: msg_a8000a4038f8c579 + role: assistant + status: completed + type: message + - action: wait_agent + agent: + agent_name: /root + arguments: '{"timeout_ms":120000}' + call_id: chatcmpl-tool-a9a3f9406d5895cb + id: mac_01a1686a-c466-7ec3-9817-b33adeb90186 + type: multi_agent_call + - agent: + agent_name: /root/missing_tests + content: + - text: "My assignment is to review the Python code for MISSING TESTS. Let\ + \ me analyze the code carefully and identify all the test scenarios that\ + \ are missing.\n\nThe code:\n```python\nimport pickle\nCACHE = {}\ndef\ + \ load_profile(user_id, payload):\n if user_id not in CACHE:\n \ + \ CACHE[user_id] = pickle.loads(payload)\n return CACHE[user_id]\n\ + ```\n\nContext:\n- `payload` is bytes from an unauthenticated HTTP request\n\ + - `user_id` identifies the profile\n- The result is a mutable dict returned\ + \ directly\n- The cache is a module-level global with no expiration or\ + \ eviction\n\nExisting test: One test that loads a single valid payload\ + \ for a single user and asserts the returned dict is correct.\n\nLet me\ + \ think through all the missing test scenarios systematically:\n\n**Caching\ + \ Semantics:**\n1. Second call with same user_id should return cached\ + \ data (not re-deserialize)\n2. Second call with same user_id but DIFFERENT\ + \ payload should still return the original cached data (first-write-wins)\n\ + 3. Different user_ids should get independent cache entries\n4. The cache\ + \ should return the same object (identity) for the same user_id across\ + \ calls\n\n**Edge Cases:**\n5. Empty user_id string\n6. Very long user_id\n\ + 7. Non-string user_id (e.g., integer, bytes)\n8. Empty payload bytes (b\"\ + \")\n9. Payload that deserializes to None\n10. Payload that deserializes\ + \ to a non-dict (e.g., a string, a list, an integer)\n11. Payload that\ + \ deserializes to an empty dict\n\n**Error Handling:**\n12. Malformed/invalid\ + \ pickle data (raises pickle.UnpicklingError or similar)\n13. Payload\ + \ that raises an exception during unpickling\n14. What happens if pickle.loads\ + \ returns something that has no dict-like behavior\n\n**Concurrency:**\n\ + 15. Two threads calling load_profile with the same user_id simultaneously\ + \ — should only deserialize once, both get same object\n16. Two threads\ + \ calling with different user_ids — both should succeed independently\n\ + 17. Thread-safety of the CACHE dict itself (check-then-act race)\n\n**Cache\ + \ Mutation / Shared State:**\n18. Mutating the returned dict should affect\ + \ subsequent calls (since it's the same object) — this documents the current\ + \ behavior (or the bug)\n19. Mutating the returned dict should NOT affect\ + \ other users' cached data\n\n**Unbounded Growth:**\n20. Many unique user_ids\ + \ cause CACHE to grow without bound (documents the leak)\n\n**Type/Contract\ + \ Issues:**\n21. payload is None instead of bytes\n22. payload is a string\ + \ instead of bytes\n23. user_id is None\n\nLet me organize these into\ + \ a clear, structured report. I should be specific about inputs and expected\ + \ outputs.\n\nLet me also think about what \"first-write-wins\" means\ + \ — if user \"alice\" first sends payload A, then later sends payload\ + \ B, the function should still return the deserialized A. This is a critical\ + \ caching semantic that's untested.\n\nAlso, the check-then-act pattern\ + \ (if user_id not in CACHE: CACHE[user_id] = ...) is not atomic. Under\ + \ concurrency, two threads could both see user_id not in CACHE, both call\ + \ pickle.loads, and one overwrites the other. The final value depends\ + \ on which thread's assignment executes last. This is a real race condition.\n\ + \nLet me write up the full report now.\n" + type: reasoning_text + id: rs_ac7b4b15cd0776ac + summary: [] + type: reasoning + - action: list_agents + agent: + agent_name: /root/missing_tests + arguments: '{}' + call_id: chatcmpl-tool-80af08d7ee382b50 + id: mac_01a1686b-0032-7e60-85df-241ed3ee0676 + type: multi_agent_call + - action: list_agents + agent: + agent_name: /root/missing_tests + call_id: chatcmpl-tool-80af08d7ee382b50 + id: maco_01a1686b-0032-7e60-85df-24334e05366f + output: + - annotations: [] + text: '{"agents":[{"agent_name":"/root","agent_status":"running"},{"agent_name":"/root/correctness_review","agent_status":"running"},{"agent_name":"/root/security_review","agent_status":"running"},{"agent_name":"/root/missing_tests","agent_status":"running"}]}' + type: output_text + type: multi_agent_call_output + - agent: + agent_name: /root/missing_tests + content: + - text: 'Good, I can see my siblings are running. My assignment is clear — + I need to produce my own findings on missing tests. Let me write a comprehensive + report now. I don''t need to wait for the other agents since my task is + independent. + + + Let me structure my findings carefully. + + ' + type: reasoning_text + id: rs_abd432a548919a85 + summary: [] + type: reasoning + - agent: + agent_name: /root/missing_tests + content: + - annotations: [] + text: I have a clear, independent assignment. Let me produce my findings + directly. + type: output_text + id: msg_b5a39e4b8a98e219 + role: assistant + status: completed + type: message + - action: spawn_agent + agent: + agent_name: /root/missing_tests + arguments: '{"task_name":"missing_tests","message":"enc_crV_LNJ2itOXlJp5Jm5jsDg9LPvKi2I-jJE_94dGv3Dl3xr4mIAGBW2gpFMPYEXUpiYwJtX9R5fT9rek4KQD8ok7PrLOiXRKpT7RTztHUfX8ZXCKhrWYFSvw5EuFaH-jqPJX9ilyOE44RcKmGnczCsbxMopO5hFv6I4L1FbEl872OYiWSBTxroOXqJ3VMBqppVamPDh9MPTACIFIZMQNsrJXTYaI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sWfCknpstel94q61AP_gn3PKF-gJtvftTR3CvoqYkI-TzSgVbGBfjLlC14cErU7ZS_NESKhbVbGExdxIAHruSESyM0oasGMFswUIqUv1DRsi8V3NS3kZTgti0TtF3Z8sNzBQhLuHruPafCpP4wRHk0E6C75qBGQOWqKafVZUkMpEyLP1aXbMd06Gn3czT8NV8ICZamJbopScVb3ZB744btNeznfjF6dtfOaww2ySbsbPMA7EVXPLfEB4UMqg9nc15qgt_fHw","fork_turns":"all"}' + call_id: chatcmpl-tool-8dc9ece48552be04 + id: mac_01a1686b-222d-71c3-9209-f5773e2997ef + type: multi_agent_call + - action: spawn_agent + agent: + agent_name: /root/missing_tests + call_id: chatcmpl-tool-8dc9ece48552be04 + id: maco_01a1686b-222d-71c3-9209-f5901356dd29 + output: + - annotations: [] + text: '{"error":"maximum concurrent subagent turns reached"}' + type: output_text + type: multi_agent_call_output + - agent: + agent_name: /root/security_review + content: + - text: 'I''m the security_review agent. I have a clear, bounded assignment: + review the cache.py code for security vulnerabilities only. Let me analyze + the code directly and return my findings. I don''t need to spawn any subagents + for this — it''s a small code snippet and I can complete it myself. + + + Let me analyze the security issues: + + + 1. **Pickle deserialization of untrusted input (Critical)** - `pickle.loads(payload)` + on line 5 where payload comes from an unauthenticated HTTP request. This + is a classic RCE vector. An attacker can craft a malicious pickle payload + that executes arbitrary code when deserialized. + + + 2. **No authentication/authorization (Critical)** - The function is called + with data from an unauthenticated HTTP request. There''s no verification + that the caller is who they claim to be. Any unauthenticated user can + load any profile. + + + 3. **Cache poisoning (High)** - Line 4-5: The first request for a given + `user_id` wins. Since there''s no authentication, an attacker can poison + the cache for any user_id by being the first to call with that user_id. + Subsequent legitimate requests for that user_id will get the attacker''s + poisoned data. + + + 4. **Information disclosure via shared mutable state (High)** - Line 6: + The function returns the cached mutable dict directly. If the caller (or + downstream code) modifies this dict, it modifies the shared CACHE entry, + affecting all future callers for that user_id. Combined with the lack + of authentication, this means any attacker who calls first can modify + the data that all subsequent callers see. + + + 5. **Unbounded memory growth / DoS (Medium)** - Lines 2, 4-5: CACHE is + a global dict with no eviction policy, no size limit, and no expiration. + An attacker can send requests with many unique user_ids to exhaust server + memory (DoS). + + + 6. **User enumeration (Low/Medium)** - If the application returns different + responses for cached vs uncached user_ids (e.g., timing differences or + different error messages), an attacker could enumerate valid user_ids. + + + Let me structure these findings clearly. + + ' + type: reasoning_text + id: rs_9818f9bb42a2249c + summary: [] + type: reasoning + - agent: + agent_name: /root/security_review + content: + - annotations: [] + text: ' + + + ## Security Review: `cache.py` + + + ### 1. Remote Code Execution via Unsafe Deserialization + + - **Severity:** Critical + + - **Lines:** 5 + + - **Problem:** `pickle.loads(payload)` deserializes attacker-controlled + bytes from an unauthenticated HTTP request. Pickle is not a safe serialization + format — a crafted payload can instantiate arbitrary objects and execute + arbitrary code during `__reduce__` / `__setstate__`. This is a well-known + RCE vector (OWASP A03:2021 – Injection). + + - **Mitigation:** Never use `pickle.loads` on untrusted input. Replace + with a safe format such as JSON (`json.loads`), MessagePack, or Protocol + Buffers. If pickle must be retained internally, restrict it to server-to-server + channels with mutual TLS and integrity verification. + + + --- + + + ### 2. Missing Authentication / Authorization + + - **Severity:** Critical + + - **Lines:** 3 (function signature), entire file + + - **Problem:** The function is invoked with `payload` and `user_id` from + an **unauthenticated** HTTP request. No identity verification or access-control + check exists. Any anonymous caller can (a) trigger deserialization of + arbitrary bytes, (b) read any user''s profile, and (c) write arbitrary + data into the cache under any `user_id`. This violates OWASP A01:2021 + – Broken Access Control. + + - **Mitigation:** Authenticate the caller (session token, OAuth, API key) + and enforce an authorization check that the authenticated principal is + allowed to load the profile for the requested `user_id` (typically `caller + == user_id` or an explicit ACL). + + + --- + + + ### 3. Cache Poisoning (Cross-User) + + - **Severity:** High + + - **Lines:** 4–5 + + - **Problem:** The first request that supplies a given `user_id` populates + the cache, and subsequent requests for the same `user_id` return the cached + value without re-validation. Because the input is unauthenticated, an + attacker can send the first request for a victim''s `user_id` with attacker-chosen + `payload` bytes. All later legitimate requests for that victim then receive + the attacker''s poisoned data. This is a classic cache-poisoning / confusion + attack. + + - **Mitigation:** Derive the cache key from a **trusted** identity (e.g., + a signed session token) rather than a client-supplied `user_id`. Alternatively, + tag each cache entry with the authenticated principal who created it and + validate ownership on read. Invalidate or re-fetch if the authenticated + principal does not match. + + + --- + + + ### 4. Information Disclosure & Tampering via Shared Mutable State + + - **Severity:** High + + - **Lines:** 2, 6 + + - **Problem:** `CACHE` is a process-global mutable dict. Line 6 returns + the **same dict object** to the caller. Any downstream mutation of the + returned dict (e.g., `profile["role"] = "admin"`) silently rewrites the + cached entry for all future callers. Combined with the lack of authentication, + an attacker who calls `load_profile` first can mutate the shared dict + and thereby alter data seen by other users'' requests. + + - **Mitigation:** Return a **deep copy** (`copy.deepcopy(CACHE[user_id])`) + or a frozen/immutable structure. Alternatively, serialize to a read-only + view before returning. Ensure the cache stores canonical, server-validated + data only. + + + --- + + + ### 5. Unbounded Memory Growth (Denial of Service) + + - **Severity:** Medium + + - **Lines:** 2, 4–5 + + - **Problem:** `CACHE` has no size limit, no TTL, and no eviction policy. + An unauthenticated attacker can issue requests with millions of distinct + `user_id` values, each storing an arbitrarily large deserialized object, + exhausting process memory and crashing the server (OWASP A05:2021 – Security + Misconfiguration / A04:2021 – Insecure Design). + + - **Mitigation:** Use a bounded cache (e.g., `functools.lru_cache` with + `maxsize`, `cachetools.TTLCache`, or a Redis/Memcached backend with `MAXMEMORY` + and an eviction policy). Enforce a maximum payload size at the HTTP layer + before deserialization. + + + --- + + + ### 6. User Enumeration + + - **Severity:** Low + + - **Lines:** 4, 6 + + - **Problem:** If the application surface exposes observable differences + between a cache hit and a cache miss (timing, error messages, response + size), an unauthenticated attacker can probe `user_id` values to enumerate + which identifiers are valid. + + - **Mitigation:** Normalize response timing and error messages regardless + of cache state. Ideally, the access-control fix in Finding 2 eliminates + this entirely. + + + --- + + + ### Summary Table + + + | # | Finding | Severity | Primary Line(s) | + + |---|---------|----------|-----------------| + + | 1 | RCE via `pickle.loads` on untrusted input | Critical | 5 | + + | 2 | No authentication / authorization | Critical | 3 (whole file) | + + | 3 | Cross-user cache poisoning | High | 4–5 | + + | 4 | Shared mutable state → tampering & info leak | High | 2, 6 | + + | 5 | Unbounded cache → memory DoS | Medium | 2, 4–5 | + + | 6 | User enumeration via cache state | Low | 4, 6 |' + type: output_text + id: msg_b068d7e90b024f84 + phase: final_answer + role: assistant + status: completed + type: message + - agent: + agent_name: /root + author: /root/security_review + content: + - encrypted_content: enc_xdqHKtKU03YmCjc7bQxN1aKKKOlI91CLE4TLr8NvJDYryiz4GH2QfUmRLovHAKy6djCIbl3SRtuR-6wpp99EPSY8_cBmgY-7OVqLRGFkjpSeiY5pmHScsIYTTt4hvY-aTdzbGMRQf2tXfnE3jce3r0To4HtcSSGwSjmvzfn_PpjpgAn-i1q6tVK2haHsX8OaV82cOc9ZQ4_qZVl39HnvRoqgWlN3PPmyL50VZGsTnEsra3xRpwsdtu8FGc_UJpPlQOiGJvd_-4cQX8Ov6Zd2AFoMhz7UXkvxsE2Vm3R8g6ulz0iufAh4ceJOl-r8uUGV5BqA_PdAQABl74Om68ulhPE_HVQsmtRlY27GwAxDVSREZd173ozun81Xi0qkeMNljFy0FzquRBMgUpMQQKLtWJA9qI9MW6iXDFbShC9twKvDMjp6oAcDAjCkjc8YN9kekz2kpNri9w6DBsjcsFtgGD5V6FWvLEJr1XDYoLrgu3OahRnecyolcxCGkFASSPDPHHFqgujVvAWwMMdYCHBE2QdtUBA6rbEk9kiTspjTQqrn8v1TCZ6veT3TUg2t0sgX-4hR0RceMNcipYATQspcXFGJg45lqlsAbeb-J9indPtNpSxV2JVjNS7Yz7ArsulMbqlvudogD1cPg469upGhr3gPO_I5DEDHoANBDC_VnROQR2xp2EidueGLwA-Lp9n4rVVe79fX5IZ80xmBepYVj35tlwXXGjSsV62XeGuE51b8Cuz7e1XP1SdFoRVPSwtb3mBoSz6VejPZgsheNFeiF29N3vklJm-TYdTHCxJIzAs257gEbThW_GJH1c14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OOEjQwjwgVZTsVDC3mn0lSlCeMaj4Rg_dB1MkLXmoZGnkpX51z4YlWPcrvGRachBa3HIMMcspXP8urhwCvXbmqf5IT2o8hwlgUpPsVxDsY8Awb7odqVAs9svAil_l-dzgQU8vKMQbr93BlvSVAplgD_ovFL6GW8vQdJ704W7deqVKlmWJVpQO1GpcQw1BtXmZuVl5emODZVA7rei7Ccg + type: encrypted_content + id: amsg_01a1686b-2e93-7943-8ad3-9794a6eaedc2 + recipient: /root + type: agent_message + - action: wait_agent + agent: + agent_name: /root + call_id: chatcmpl-tool-a9a3f9406d5895cb + id: maco_01a1686b-2e93-7943-8ad3-97b16d5b741f + output: + - annotations: [] + text: '{"message":"Agent mailbox updated.","timed_out":false}' + type: output_text + type: multi_agent_call_output + - agent: + agent_name: /root + content: + - text: 'The security review is complete. Now I need to wait for the other + two agents (correctness_review and missing_tests) to finish. + + ' + type: reasoning_text + id: rs_beb22deb778120fb + summary: [] + type: reasoning + - agent: + agent_name: /root + content: + - annotations: [] + text: Security review is in. Waiting for the other two agents to complete. + type: output_text + id: msg_a619e1b0bc4a3674 + role: assistant + status: completed + type: message + - action: wait_agent + agent: + agent_name: /root + arguments: '{"timeout_ms":120000}' + call_id: chatcmpl-tool-ab98420abeedd69c + id: mac_01a1686b-3990-7ca1-bba3-1303431948c2 + type: multi_agent_call + - agent: + agent_name: /root/correctness_review + content: + - text: "The user wants me to review the Python code for correctness issues\ + \ only. Let me analyze the code carefully:\n\n```python\n1: import pickle\n\ + 2: CACHE = {}\n3: def load_profile(user_id, payload):\n4: if user_id\ + \ not in CACHE:\n5: CACHE[user_id] = pickle.loads(payload)\n6:\ + \ return CACHE[user_id]\n```\n\nContext: Called with `payload` bytes\ + \ from an HTTP request. `user_id` identifies which profile to cache.\n\ + \nLet me think through each focus area:\n\n1. **Logic bugs (race conditions,\ + \ TOCTOU, incorrect caching semantics)**\n\n - **TOCTOU / Race condition\ + \ on lines 4-5**: The check `if user_id not in CACHE` and the assignment\ + \ `CACHE[user_id] = pickle.loads(payload)` are not atomic. In a multithreaded\ + \ environment, two threads could both see `user_id not in CACHE` as True,\ + \ both call `pickle.loads(payload)`, and both assign to `CACHE[user_id]`.\ + \ This is a classic check-then-act race. While the final value might be\ + \ consistent (both write the same or different values), it means `pickle.loads`\ + \ could be called redundantly, and if the payloads differ (which they\ + \ can since they come from different HTTP requests), the result is non-deterministic.\n\ + \ \n - **Stale cache / incorrect caching semantics (lines 4-5)**:\ + \ The cache is \"set-and-never-update.\" Once a `user_id` is in `CACHE`,\ + \ subsequent calls with a different (updated) `payload` for the same `user_id`\ + \ will silently ignore the new payload and return the stale cached value.\ + \ This means if a user's profile is updated, the cache will serve the\ + \ old profile forever (until process restart). This is a behavioral correctness\ + \ issue — the function's contract is ambiguous but the behavior is clearly\ + \ \"first write wins, forever.\"\n\n2. **Thread-safety issues with the\ + \ global CACHE dict**\n\n - **Unprotected read-modify-write on the global\ + \ dict**: Python's GIL makes individual dict operations (like `__setitem__`\ + \ or `__contains__`) atomic at the bytecode level, but the compound operation\ + \ on lines 4-5 (check + set) is not atomic. In CPython, `if user_id not\ + \ in CACHE` compiles to a `CONTAINS_OP` followed by a conditional jump,\ + \ and `CACHE[user_id] = ...` is a separate `STORE_SUBSCR`. Between these,\ + \ another thread can interleave.\n \n - Also, `return CACHE[user_id]`\ + \ on line 6 — if another thread deletes the key between the check on line\ + \ 4 and the return on line 6, you'd get a `KeyError`. Though in this code\ + \ there's no deletion, it's worth noting the pattern is fragile.\n\n \ + \ - Actually, since there's no deletion in this code, the `KeyError`\ + \ on line 6 is not an immediate issue. But the race on lines 4-5 is real.\n\ + \n3. **Behavioral correctness (stale data)**\n\n - As noted above, once\ + \ cached, the value is never invalidated or updated. If an HTTP client\ + \ sends an updated profile for the same `user_id`, the new payload is\ + \ silently discarded. This is a correctness issue if the intent is to\ + \ reflect the latest profile.\n\n4. **Error handling gaps**\n\n - **Malformed\ + \ pickle data (line 5)**: `pickle.loads(payload)` can raise `pickle.UnpicklingError`,\ + \ `EOFError`, `ValueError`, or other exceptions if `payload` is malformed.\ + \ There's no try/except, so the function will propagate the exception\ + \ to the caller. Depending on the HTTP framework, this could result in\ + \ a 500 error. More subtly, if the unpickling partially succeeds before\ + \ failing, no state is corrupted (the CACHE assignment hasn't happened\ + \ yet), but the lack of handling means the caller must be prepared for\ + \ arbitrary exceptions.\n \n - **Unexpected types (line 5)**: `pickle.loads`\ + \ can return any Python object, not just a dict. If a malicious or buggy\ + \ client sends a payload that unpickles to a string, integer, or `None`,\ + \ then `CACHE[user_id]` will hold that type. Subsequent code that expects\ + \ a dict (e.g., `profile['name']`) will fail with a `TypeError`. There's\ + \ no type validation.\n \n - **`payload` could be `None` or non-bytes**:\ + \ If `payload` is `None` (e.g., an empty request body not properly handled\ + \ upstream), `pickle.loads(None)` raises `TypeError`. No validation of\ + \ input type.\n\n5. **Resource/leak issues that affect correctness**\n\ + \n - **Unbounded growth of CACHE (line 2)**: The global `CACHE` dict\ + \ grows without bound. Every unique `user_id` seen adds an entry that\ + \ is never evicted. In a long-running server, this is a memory leak. More\ + \ than a resource issue, this can affect correctness indirectly: if the\ + \ system is serving profiles for many users, memory pressure could cause\ + \ OOM kills, which is a liveness issue. But strictly as a correctness\ + \ issue in the caching semantics: the cache never expires, so it's both\ + \ a leak and a staleness problem.\n\nLet me structure these findings clearly.\n" + type: reasoning_text + id: rs_a510afee9ec596ea + summary: [] + type: reasoning + - agent: + agent_name: /root/correctness_review + content: + - annotations: [] + text: "\n\n## Correctness Review: `cache.py`\n\n### 1. TOCTOU / Check-Then-Act\ + \ Race (Lines 4–5)\n\n**Problem:** The membership test on line 4 and the\ + \ assignment on line 5 are not atomic. Under concurrent requests for the\ + \ same `user_id`, two threads can both observe `user_id not in CACHE`\ + \ as `True`, both deserialize, and both write. The final cached value\ + \ is non-deterministic if the two payloads differ.\n\n**Fix:** Use a lock,\ + \ or a thread-safe cache primitive (e.g., `threading.Lock` around the\ + \ check-and-set, or a `collections.defaultdict` + `Lock`). At minimum:\n\ + \n```python\nimport threading\n_CACHE_LOCK = threading.Lock()\n\ndef load_profile(user_id,\ + \ payload):\n with _CACHE_LOCK:\n if user_id not in CACHE:\n\ + \ CACHE[user_id] = pickle.loads(payload)\n return CACHE[user_id]\n\ + ```\n\n---\n\n### 2. Stale / Never-Invalidated Cache (Lines 4–5)\n\n**Problem:**\ + \ The cache is \"first write wins, forever.\" Once a `user_id` is present,\ + \ any subsequent call with an updated `payload` is silently ignored and\ + \ the original (stale) value is returned. There is no TTL, no version\ + \ check, and no invalidation path. If the intent is to reflect the user's\ + \ current profile, this is incorrect.\n\n**Fix:** Either (a) add a TTL\ + \ / max-age and evict expired entries before the lookup, or (b) accept\ + \ an explicit `version` or `updated_at` field and re-cache when it changes,\ + \ or (c) rename the function and document that it intentionally returns\ + \ the *first* payload seen per key.\n\n---\n\n### 3. No Validation of\ + \ Deserialized Type (Line 5)\n\n**Problem:** `pickle.loads(payload)` can\ + \ return *any* Python object (int, str, list, `None`, …). The cache will\ + \ store whatever type is produced. Downstream code that assumes a dict\ + \ (e.g., `profile[\"name\"]`) will raise `TypeError`. The function gives\ + \ no signal that the cached value is not the expected shape.\n\n**Fix:**\ + \ Validate after deserialization:\n\n```python\nobj = pickle.loads(payload)\n\ + if not isinstance(obj, dict):\n raise ValueError(f\"Expected dict payload,\ + \ got {type(obj).__name__}\")\nCACHE[user_id] = obj\n```\n\n---\n\n###\ + \ 4. Unhandled Exceptions on Malformed / Wrong-Type Input (Line 5)\n\n\ + **Problem:** If `payload` is not valid pickle bytes, `pickle.loads` raises\ + \ `pickle.UnpicklingError`, `EOFError`, or `ValueError`. If `payload`\ + \ is `None` or a `str`, it raises `TypeError`. None of these are caught,\ + \ so a single bad request can produce an unhandled 500 (or worse, depending\ + \ on the framework). There is also no guard that `payload` is actually\ + \ `bytes`.\n\n**Fix:** Add input-type validation and a narrow `try/except`\ + \ around the deserialization:\n\n```python\nif not isinstance(payload,\ + \ (bytes, bytearray, memoryview)):\n raise TypeError(\"payload must\ + \ be bytes\")\ntry:\n obj = pickle.loads(payload)\nexcept (pickle.UnpicklingError,\ + \ EOFError, ValueError) as e:\n raise ValueError(f\"Malformed payload:\ + \ {e}\")\n```\n\n---\n\n### 5. Unbounded Cache Growth (Line 2)\n\n**Problem:**\ + \ `CACHE` is a plain dict with no eviction policy. Every distinct `user_id`\ + \ observed in any request adds an entry that persists for the lifetime\ + \ of the process. In a long-running server handling many users, this is\ + \ an unbounded memory leak that will eventually cause OOM, killing the\ + \ process and losing all in-flight state.\n\n**Fix:** Use a bounded cache\ + \ such as `functools.lru_cache` (if the function can be made cacheable)\ + \ or a third-party `LRUCache` / `cachetools.TTLCache` with a max size.\ + \ Alternatively, add a background task that evicts entries older than\ + \ a threshold.\n\n---\n\n### 6. Mutable Cache Value Returned by Reference\ + \ (Line 6)\n\n**Problem:** The function returns the actual dict object\ + \ stored in `CACHE`. Any caller that mutates the returned object (e.g.,\ + \ `profile[\"bio\"] = \"...\"`) silently corrupts the cached state for\ + \ all subsequent callers. This is a data-integrity / correctness bug in\ + \ any multi-caller context.\n\n**Fix:** Return a copy:\n\n```python\n\ + import copy\nreturn copy.deepcopy(CACHE[user_id])\n```\n\nor document\ + \ that the returned object is read-only and enforce that at the API boundary.\n\ + \n---\n\n**Summary table**\n\n| # | Title | Lines | Severity |\n|---|-------|-------|----------|\n\ + | 1 | TOCTOU race on check-then-set | 4–5 | High (concurrency) |\n| 2\ + \ | Stale / never-invalidated cache | 4–5 | High (correctness) |\n| 3\ + \ | No type validation on deserialized object | 5 | Medium |\n| 4 | Unhandled\ + \ exceptions on bad input | 5 | Medium |\n| 5 | Unbounded cache growth\ + \ | 2 | Medium (liveness) |\n| 6 | Mutable value returned by reference\ + \ | 6 | Medium (data integrity) |" + type: output_text + id: msg_a5eeb577ad29b303 + phase: final_answer + role: assistant + status: completed + type: message + - agent: + agent_name: /root + author: /root/correctness_review + content: + - encrypted_content: enc_rLcUyEe-lvNU9G2eM7l4oVbuz4mJI6IW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_PpJSaRQJbAye4JrVo5OzOWaoTnVBOntR3NndoupF8IZGUZt6h44ibNtl7fQ3yz0o7a_qf6hGepSvN98ehmBCZPU8y6N0Xmu7AygkEUsD_MpyaxVyRgqcryDRsiRStPnDZ4_fVTUPZIk7YU3fzocr6B51DSuotWORYc9hsdzg4vN-XKgxqCO9IjlBxQw58rLYlRqr4X0i2u2Z0LU_hyQRUl27S7ieU_ca5Xr53odTqSf1-mVDPojATfmuUG2PJIwim4JrDaNopTWGt_zVjd2NCnJfXVZUXErl_DSVGYXtunCRTbioJKycFhKjelKcUrc7WG_W2_8KblMKVOqsdgtGMFd89hdYV9uD1q7aPMDTKLWghYgBLm83zDH3k1242mhqTDZLXrFZps-HWSgphVxeMdDcGqtMZGgCa7A4_o9_OZ235Z6BmjR1yTqKVpHzxpQ950epPTfLhnjeMj2bvh7PQ7-wWN7fFJ3TilB9jeG4Tx7gtONz0yEob2Okq4HMr6DeIOrFtX0WFEWVl12ly_em74c5xoOIB2Zgo2_CxYaSdYBkwahgLEmd-edTsO-PF_ukPMOqUMYWASfdg + type: encrypted_content + id: amsg_01a1686b-5282-7a32-9b23-c75d789a643a + recipient: /root + type: agent_message + - action: wait_agent + agent: + agent_name: /root + call_id: chatcmpl-tool-ab98420abeedd69c + id: maco_01a1686b-5282-7a32-9b23-c7760c17d458 + output: + - annotations: [] + text: '{"message":"Agent mailbox updated.","timed_out":false}' + type: output_text + type: multi_agent_call_output + - agent: + agent_name: /root + content: + - text: 'Two of the three reviews are in. I''m still waiting for the missing_tests + agent to complete. Let me wait for it. + + ' + type: reasoning_text + id: rs_aad46c74173698ab + summary: [] + type: reasoning + - agent: + agent_name: /root + content: + - annotations: [] + text: Two reviews complete. Waiting for the missing tests review. + type: output_text + id: msg_969d0d12e7a47035 + role: assistant + status: completed + type: message + - action: wait_agent + agent: + agent_name: /root + arguments: '{"timeout_ms":120000}' + call_id: chatcmpl-tool-afc49a7b2cfc2b4c + id: mac_01a1686b-5ef2-7421-9cb8-d9284a360863 + type: multi_agent_call + - agent: + agent_name: /root/missing_tests + content: + - text: 'I can''t spawn another agent because the slot is full. But my assignment + IS to do the missing tests review myself — I''m `/root/missing_tests`. + Let me just complete the work directly and return my findings. + + ' + type: reasoning_text + id: rs_abe99740748e3d46 + summary: [] + type: reasoning + - agent: + agent_name: /root/missing_tests + content: + - annotations: [] + text: ' + + + I''m `/root/missing_tests` myself — I don''t need to spawn another agent. + Let me complete this assignment directly and return my findings. + + + Here is my full review of missing tests for `cache.py`: + + + --- + + + ## Missing Test Report — `cache.py` + + + ### 1. Caching Semantics + + + **1a. `test_second_call_returns_cached_value_not_reloaded`** + + - **Input:** Call `load_profile("alice", pickle.dumps({"name": "Alice", + "age": 30}))` twice. + + - **Verify:** The second call returns the same object (identity check: + `assert result1 is result2`). Also verify that if `pickle.loads` were + instrumented (e.g., via a spy or by passing a payload that would raise + on a second decode), it is not re-invoked. + + - **Why it matters:** Confirms the cache actually caches. A regression + that accidentally re-deserializes on every call (e.g., a logic inversion) + would be caught. + + + **1b. `test_first_write_wins_subsequent_payload_ignored`** + + - **Input:** Call `load_profile("bob", pickle.dumps({"role": "admin"}))`, + then call `load_profile("bob", pickle.dumps({"role": "viewer"}))`. + + - **Verify:** The second call returns `{"role": "admin"}`, not `{"role": + "viewer"}`. + + - **Why it matters:** Documents and locks in the "first writer wins" caching + contract. A regression that overwrites existing cache entries (e.g., switching + to an unconditional assignment) would silently allow one request to overwrite + another user''s cached profile. + + + **1c. `test_different_users_get_independent_entries`** + + - **Input:** `load_profile("alice", pickle.dumps({"a": 1}))` and `load_profile("bob", + pickle.dumps({"b": 2}))`. + + - **Verify:** `CACHE["alice"] == {"a": 1}` and `CACHE["bob"] == {"b": + 2}`; mutating one does not affect the other. + + - **Why it matters:** Catches a regression where the cache key is accidentally + ignored (e.g., a single global slot) or where entries are aliased. + + + **1d. `test_cache_grows_without_bound`** + + - **Input:** Call `load_profile` with N unique user_ids (e.g., 10,000). + + - **Verify:** `len(CACHE) == N` after all calls. (This is a "documents + current behavior" test — it would fail if a TTL or eviction mechanism + were added.) + + - **Why it matters:** Pins the memory-leak behavior so that a future regression + or intentional fix to add eviction is a conscious, visible change rather + than an accidental side-effect of a refactor. + + + --- + + + ### 2. Edge Cases / Input Validation + + + **2a. `test_empty_user_id`** + + - **Input:** `load_profile("", pickle.dumps({"x": 1}))`. + + - **Verify:** Returns `{"x": 1}` and `CACHE[""]` exists. + + - **Why it matters:** An empty string is a valid dict key in Python but + may indicate a missing or malformed user identifier upstream. Catches + an accidental `if not user_id` guard that would break valid-but-empty + keys, or conversely documents that no such guard exists. + + + **2b. `test_non_string_user_id`** + + - **Input:** `load_profile(12345, pickle.dumps({"x": 1}))` (integer key). + + - **Verify:** Returns `{"x": 1}` and `CACHE[12345]` exists. A subsequent + call with `load_profile("12345", ...)` should create a *separate* entry. + + - **Why it matters:** If the upstream layer ever coerces user IDs to strings, + an int-vs-str mismatch would silently create duplicate cache entries and + break the "one profile per user" invariant. + + + **2c. `test_empty_payload`** + + - **Input:** `load_profile("carol", b"")`. + + - **Verify:** Raises `pickle.UnpicklingError` (or `EOFError`). The cache + entry for "carol" should NOT be created (i.e., `"carol" not in CACHE` + after the exception). + + - **Why it matters:** Confirms that a failed deserialization does not + pollute the cache. A regression that assigns `CACHE[user_id]` before the + `pickle.loads` call succeeds (e.g., refactoring to pre-allocate) would + leave a `None` or partial entry that poisons all future requests for that + user. + + + **2d. `test_payload_deserializes_to_none`** + + - **Input:** `load_profile("dave", pickle.dumps(None))`. + + - **Verify:** Returns `None`. `CACHE["dave"] is None`. + + - **Why it matters:** If downstream code assumes the result is always + a dict (e.g., calls `result["key"]`), a `None` entry causes an `AttributeError`. + This test documents that the function does not validate the deserialized + type. + + + **2e. `test_payload_deserializes_to_non_dict`** + + - **Input:** `load_profile("eve", pickle.dumps([1, 2, 3]))` (a list, not + a dict). + + - **Verify:** Returns `[1, 2, 3]`. + + - **Why it matters:** The docstring/context says the result is a "mutable + dict," but the function enforces no type. This test documents the absence + of a type contract and would catch a regression that adds one (or the + lack thereof, if downstream code relies on dict behavior). + + + **2f. `test_payload_deserializes_to_empty_dict`** + + - **Input:** `load_profile("frank", pickle.dumps({}))`. + + - **Verify:** Returns `{}`. Subsequent call with same user_id returns + the same empty dict object (identity). + + - **Why it matters:** An empty dict is falsy in Python. A regression that + uses `if not CACHE.get(user_id)` instead of `if user_id not in CACHE` + would re-deserialize on every call for empty profiles, breaking the cache + contract. + + + **2g. `test_none_payload`** + + - **Input:** `load_profile("grace", None)`. + + - **Verify:** Raises `TypeError` (or similar). No cache entry created. + + - **Why it matters:** Documents that the function does not guard against + `None` input. A regression that adds a truthiness check (`if payload:`) + would silently skip caching for `None` without raising — a different (and + possibly worse) failure mode. + + + **2h. `test_string_payload_instead_of_bytes`** + + - **Input:** `load_profile("heidi", "some_string")`. + + - **Verify:** Raises `TypeError` (pickle expects bytes). No cache entry + created. + + - **Why it matters:** In Python 3, passing a `str` to `pickle.loads` is + a type error. This test pins the expected exception type so a regression + that silently encodes the string would be caught. + + + --- + + + ### 3. Error Handling + + + **3a. `test_malformed_pickle_raises`** + + - **Input:** `load_profile("ivan", b"\xff\xff\xff not real pickle")`. + + - **Verify:** Raises `pickle.UnpicklingError` (or a subclass). `"ivan" + not in CACHE` after the exception. + + - **Why it matters:** The most critical error-path test. Confirms that + a failed deserialization does NOT leave a partial or poison entry in the + cache. A TOCTOU-style refactor (e.g., setting `CACHE[user_id] = None` + before calling `pickle.loads`) would pass the happy path but fail this + test. + + + **3b. `test_pickle_raises_during_unpickling_of_nested_object`** + + - **Input:** A payload that is structurally valid pickle but whose `__reduce__` + or `__setstate__` raises during reconstruction. + + - **Verify:** The exception propagates. No cache entry is created. + + - **Why it matters:** Distinguishes "malformed bytes" from "valid pickle, + failing object." Both must leave the cache clean. + + + **3c. `test_exception_does_not_create_cache_entry`** + + - **Input:** Any payload that causes `pickle.loads` to raise (use a `mock.patch` + on `pickle.loads` to raise a custom exception). + + - **Verify:** After the exception, `user_id not in CACHE`. + + - **Why it matters:** This is the key invariant: the cache must be all-or-nothing + per entry. A refactor that wraps the assignment in a try/except and still + assigns would violate this. + + + --- + + + ### 4. Concurrency / Thread Safety + + + **4a. `test_concurrent_same_user_id_single_deserialization`** + + - **Input:** Launch N threads (e.g., 50) that all call `load_profile("shared", + payload)` simultaneously (use a barrier to synchronize the start). + + - **Verify:** All threads receive the same object (`all(r is results[0] + for r in results)`). `pickle.loads` is called exactly once (instrument + with a counter or spy). + + - **Why it matters:** The check-then-act pattern (`if user_id not in CACHE: + CACHE[user_id] = ...`) is a classic race. Without a lock, multiple threads + can pass the `not in` check, each call `pickle.loads`, and the last writer + wins. While the final value may be correct (same payload), the test catches + unintended redundant deserialization and, more importantly, would fail + if different payloads were in play (see 4b). + + + **4b. `test_con' + type: output_text + id: msg_a78a40af81c14eca + phase: final_answer + role: assistant + status: completed + type: message + - agent: + agent_name: /root + author: /root/missing_tests + content: + - encrypted_content: enc_nxrnjVqdicjf0g9oDCODZMR1IPQ1vZcAu4veAL9hcZTaVmzkiB61dHneGx6WjHHpFwKGs1X7uw7w-w3Y-Tbe-PRyYZXsqNfojlr78vcpx76l7OzOvkBqnZzNmy7OfmNk_5pB6oUQsQRocZzMzjN4wGuASj_qIM3FU7rGWaI-gvmE6fJ166hXTP2WqJeaDMyZRu0SWA5Snj5Jg_2nmOGGKAl-iT1RfFUBN_NUuZmslamLpt8ElFDxRbyF0v7zTFQOIY1M2OGq7zRGu4B_7DblQYzfzLwTKMIuLQBOKH5Jjrb7iQcet-SwchgZqTtq9CoyG1SZqYOy_F1zHghK8I8Dy3-4qcXYSUCFwsEIAeTYX1YBbK5Zwsv19zD4ZZl38ELdy4PDvMxUtl-IjbRhv_eaEdKH8SryLABZVevr9jl4dHVi24mmEOqtONuwp9e8tpNbtZSWxa99IA-HhrdreDdHONjomKvrKAzHCvWaoDBLhVwVoV2NQCNQrhQ0AqV2hmqsguM76hQiqhzHZlYq059tefu6uypA5kViPJEJU5HOV0GRJ2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dcFuEMXEwfBKseagt3EvdrlgQrl7PNDkon3Og45y9ehVsCKpR10OIMGyZA61OTm4LC2sW6Lqhp-0g39HHuyofoF18mrWf5zpAxxf3pYWyhqXGbI-uEkeREr1ygZLxmsMUxNdjzjpkix0QNO8i_cjgo_Z8tk1hBf4P3UsW2IXceSn909EDBmdGc9fvUjJcD6qe7V3q3ehRN9ICmCa17C3ZoanAX7b110XUgx5dEpm5aXv94NKKkRSNSyNe51MVHchcS9b1pW_NnQT7aqAHkIeY7arSA4yuo4DxsCY4Y5AwN0uguQmo2i4UBOsSJ-R7t4YDdVuSpdjd0653SkCKbIH3fFOp1rUPT0EWm52cz-lfJcUIxzUHx6EsO08mC6NDNklKea0wjgOid6fSSUkQEXf6dNX_TW4L8 + type: encrypted_content + id: amsg_01a1686b-dc2a-78b2-8e60-9ce94668c444 + recipient: /root + type: agent_message + - action: wait_agent + agent: + agent_name: /root + call_id: chatcmpl-tool-afc49a7b2cfc2b4c + id: maco_01a1686b-dc2a-78b2-8e60-9d0340d8f459 + output: + - annotations: [] + text: '{"message":"Agent mailbox updated.","timed_out":false}' + type: output_text + type: multi_agent_call_output + - agent: + agent_name: /root + content: + - text: 'The missing tests review appears to have been cut off at the end. + Let me check what I have and whether I need to follow up with that agent. + The response was cut off at "4b. `test_con" — it seems like the agent''s + response was truncated. Let me check if the agent is still running or + if this is the final answer that was just truncated in display. + + + Looking at the message, it says "Message Type: FINAL_ANSWER" so this is + the agent''s final answer, but it appears to have been cut off in the + display. I have enough content to synthesize a comprehensive review. Let + me compile the results from all three agents and present them to the user. + + + Actually, let me check - the response seems to be cut off mid-sentence + at "4b. `test_con". This might just be a display truncation. I have substantial + content from all three agents. Let me compile the final review. + + + Let me synthesize all three reviews into a coherent final answer. + + ' + type: reasoning_text + id: rs_a89b80782feb1644 + summary: [] + type: reasoning + - agent: + agent_name: /root + content: + - annotations: [] + text: "\n\nAll three reviews are complete. Here's the consolidated report:\n\ + \n---\n\n# Code Review: `cache.py`\n\n```python\nimport pickle\nCACHE\ + \ = {}\ndef load_profile(user_id, payload):\n if user_id not in CACHE:\n\ + \ CACHE[user_id] = pickle.loads(payload)\n return CACHE[user_id]\n\ + ```\n\n---\n\n## \U0001F534 Security Findings\n\n| # | Finding | Severity\ + \ | Lines |\n|---|---------|----------|-------|\n| S1 | **RCE via `pickle.loads`\ + \ on untrusted input** — Attacker-controlled bytes from an unauthenticated\ + \ request are deserialized by pickle, which can execute arbitrary code\ + \ during `__reduce__`/`__setstate__`. | **Critical** | 5 |\n| S2 | **No\ + \ authentication/authorization** — No identity check; any anonymous caller\ + \ can trigger deserialization, read any profile, or write arbitrary cache\ + \ entries. | **Critical** | 3 (whole file) |\n| S3 | **Cross-user cache\ + \ poisoning** — First request for a `user_id` populates the cache permanently;\ + \ an attacker can pre-seed a victim's `user_id` with malicious data. |\ + \ **High** | 4–5 |\n| S4 | **Shared mutable state → tampering & info leak**\ + \ — Returns the cached dict object by reference; downstream mutation silently\ + \ rewrites state for all callers. | **High** | 2, 6 |\n| S5 | **Unbounded\ + \ cache → memory DoS** — No size limit, TTL, or eviction; attacker can\ + \ exhaust process memory with millions of unique keys. | **Medium** |\ + \ 2, 4–5 |\n| S6 | **User enumeration** — Observable differences between\ + \ cache hit/miss (timing, errors) allow probing valid `user_id`s. | **Low**\ + \ | 4, 6 |\n\n**Top mitigations:**\n- Replace `pickle` with a safe format\ + \ (JSON, Protocol Buffers) or restrict to authenticated/mutual-TLS channels.\n\ + - Authenticate callers and enforce `caller == user_id` or explicit ACL.\n\ + - Return `copy.deepcopy(...)` or an immutable view.\n- Use a bounded,\ + \ TTL-backed cache (`cachetools.TTLCache`, Redis with `maxmemory`).\n\n\ + ---\n\n## \U0001F7E0 Correctness Findings\n\n| # | Finding | Severity\ + \ | Lines |\n|---|---------|----------|-------|\n| C1 | **TOCTOU race\ + \ (check-then-act)** — Two threads can both see `user_id not in CACHE`\ + \ as `True`, both deserialize, and the last writer wins non-deterministically.\ + \ | **High** (concurrency) | 4–5 |\n| C2 | **Stale / never-invalidated\ + \ cache** — First write wins forever; subsequent calls with updated payloads\ + \ are silently ignored. No TTL, version, or invalidation path. | **High**\ + \ (correctness) | 4–5 |\n| C3 | **No type validation on deserialized object**\ + \ — `pickle.loads` can return any Python object; downstream code assuming\ + \ a dict will crash. | **Medium** | 5 |\n| C4 | **Unhandled exceptions\ + \ on bad input** — Malformed bytes, `None`, or `str` payloads raise unhandled\ + \ exceptions (500s); no input-type guard. | **Medium** | 5 |\n| C5 | **Unbounded\ + \ cache growth** — No eviction; long-running process will eventually OOM.\ + \ | **Medium** (liveness) | 2 |\n| C6 | **Mutable value returned by reference**\ + \ — Caller mutation corrupts cached state for all future callers. | **Medium**\ + \ (data integrity) | 6 |\n\n**Top fixes:**\n```python\nimport threading,\ + \ copy\n_CACHE_LOCK = threading.Lock()\n\ndef load_profile(user_id, payload):\n\ + \ if not isinstance(payload, (bytes, bytearray, memoryview)):\n \ + \ raise TypeError(\"payload must be bytes\")\n with _CACHE_LOCK:\n\ + \ if user_id not in CACHE:\n obj = pickle.loads(payload)\ + \ # replace with safe format\n if not isinstance(obj, dict):\n\ + \ raise ValueError(f\"Expected dict, got {type(obj).__name__}\"\ + )\n CACHE[user_id] = obj\n return copy.deepcopy(CACHE[user_id])\n\ + ```\n\n---\n\n## \U0001F7E1 Missing Tests\n\nThe single existing test\ + \ (one valid payload, one user) leaves the following untested:\n\n###\ + \ Caching Semantics\n| Test | What it verifies |\n|------|-----------------|\n\ + | `test_second_call_returns_cached_value_not_reloaded` | Cache actually\ + \ caches (identity check + spy on `pickle.loads`) |\n| `test_first_write_wins_subsequent_payload_ignored`\ + \ | Documents the \"first writer wins\" contract |\n| `test_different_users_get_independent_entries`\ + \ | No cross-contamination between keys |\n| `test_empty_dict_profile_is_cached`\ + \ | Guards against a truthiness-based check (`if not CACHE.get(...)`)\ + \ |\n\n### Input Validation / Edge Cases\n| Test | What it verifies |\n\ + |------|-----------------|\n| `test_empty_user_id` | Behavior with `\"\ + \"` as key |\n| `test_non_string_user_id` | int vs. str key mismatch creates\ + \ separate entries |\n| `test_empty_payload` | `b\"\"` raises; **no cache\ + \ entry created** |\n| `test_payload_deserializes_to_none` | Documents\ + \ lack of type contract |\n| `test_payload_deserializes_to_non_dict` |\ + \ List/int payload stored as-is |\n| `test_none_payload` | `None` input\ + \ raises `TypeError`; no entry created |\n| `test_string_payload_instead_of_bytes`\ + \ | `str` input raises `TypeError` |\n\n### Error Handling\n| Test | What\ + \ it verifies |\n|------|-----------------|\n| `test_malformed_pickle_raises`\ + \ | Garbage bytes raise `UnpicklingError`; cache stays clean |\n| `test_exception_does_not_create_cache_entry`\ + \ | **Key invariant:** failed deserialization never poisons the cache\ + \ |\n| `test_pickle_raises_during_object_reconstruction` | Valid pickle,\ + \ failing `__reduce__` — cache stays clean |\n\n### Concurrency\n| Test\ + \ | What it verifies |\n|------|-----------------|\n| `test_concurrent_same_user_id_single_deserialization`\ + \ | N threads, same key → `pickle.loads` called exactly once |\n| `test_concurrent_different_user_ids_no_interference`\ + \ | Parallel distinct keys don't corrupt each other |\n\n---\n\n## Summary\n\ + \nThe code has **two critical security vulnerabilities** (remote code\ + \ execution and missing authentication), a high-severity cache-poisoning\ + \ vector, and multiple correctness issues around concurrency, staleness,\ + \ and data integrity. The test suite is essentially empty — it covers\ + \ only the happy path for a single user and provides no protection against\ + \ any of the failure modes identified above. The most urgent fixes are:\ + \ (1) replace pickle with a safe deserializer, (2) add authentication,\ + \ and (3) add a lock around the check-and-set." + type: output_text + id: msg_9876395e7e41277c + phase: final_answer + role: assistant + status: completed + type: message + - content: + - text: Do not call tools again. Reply only OK. + type: input_text + id: msg_01a1686c-80cc-74d0-95bd-912128a8645c + role: user + status: completed + type: message + first_id: msg_01a1686c-71e5-7a92-bb27-7ccd32a8b1cb + has_more: false + last_id: msg_01a1686c-80cc-74d0-95bd-912128a8645c + object: list + headers: + content-type: application/json + status_code: 200 diff --git a/crates/agentic-server-core/tests/cassettes/responses/response-tool-items-openai.yaml b/crates/agentic-server-core/tests/cassettes/responses/response-tool-items-openai.yaml new file mode 100644 index 000000000..246c859fa --- /dev/null +++ b/crates/agentic-server-core/tests/cassettes/responses/response-tool-items-openai.yaml @@ -0,0 +1,7182 @@ +turns: +- filename: t1 + request: + body: + input: 'Do two separate web_search calls in parallel, in this single turn -- + do not wait for one to finish before starting the other. The first web_search + call must batch two exact queries together: "potato nutrition facts" and "tomato + nutrition facts". The second web_search call must batch two different exact + queries together: "cucumber nutrition facts" and "carrot nutrition facts". + Issue both calls now, then summarize each of the four results in one sentence.' + max_output_tokens: 2048 + model: gpt-5.6 + parallel_tool_calls: true + store: true + stream: false + tool_choice: auto + tools: + - type: web_search_preview + - allowed_tools: + - search_tiktoken_documentation + require_approval: never + server_label: gitmcp_tiktoken + server_url: https://gitmcp.io/openai/tiktoken + type: mcp + headers: + accept: '*/*' + authorization: Bearer *** + content-type: application/json + user-agent: python-httpx/0.28.1 + method: POST + path: /v1/responses + query_params: {} + response: + body: + access_programs: null + background: false + billing: + payer: developer + completed_at: 1792751797 + created_at: 1792751782 + error: null + frequency_penalty: 0.0 + id: resp_028582086f036f90006adb38a6029887d09022c2dc4c9549ba + incomplete_details: null + instructions: null + max_output_tokens: 2048 + max_tool_calls: null + metadata: {} + model: gpt-5.6-sol + moderation: null + object: response + output: + - id: mcpl_028582086f036f90006adb38a6333c87d0a7527c0158e5d25b + server_label: gitmcp_tiktoken + tools: + - annotations: + read_only: false + description: 'Semantically search within the fetched documentation from + GitHub repository: openai/tiktoken. Useful for specific queries.' + input_schema: + $schema: http://json-schema.org/draft-07/schema# + additionalProperties: false + properties: + query: + description: The search query to find relevant documentation + type: string + required: + - query + type: object + name: search_tiktoken_documentation + type: mcp_list_tools + - content: [] + encrypted_content: gAAAAABq2zi1UOdNvGlQQsUdKkWtmqQGXlIxlzVVZiJ60m4D0CBY3P17daqHTFAAIXoYtJqYBFP-a7W66O2e-qlBK086tM4qUHjvS9SJtcOyvbMMv1Vb9Ey_IKVs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ZrpX7j4fBKC9tmnmJBKeOjXZjPIDhlnoYqG9gS3kU69fY8SFJ2sGaRSyAh5cptnfWHbfgUj-Upsu9f97a4sjTY6_sRl2wzLSuM_OYyfUSGyLtmconx29Q5p2VKi172Ri1Gb6eEGxIXFN9F5-bW5U7eSQCvtCW41W7fAuRJ0bUxZoit_wf7BN3iTfmzK0cOaRCXG_MMDiGfbjSe5MlWRO15Z-JcbrdyIuPb17r13bTv_A28RPt3bcC9E0fsn4l97qbMktQl4XcnjGWLlLyo_LWwb1TGwG4BsoYNIbueuqO7zAo2zGLNpPblviqtgZbqqF-9vKER-qHtPg6QK8nr-daSawv28UUVuC2PmElLCVLHpTZUXxtSWpJD9VW5_YPRRmvonIdoHRN1f86kJ8QpZCuWn2vt-ZCBl62oWc8-ZNuRjX0XnOPF05pl4scRyaGgglFBhiKJMmHshurSTYFvCCjXj_EmGb1C0BfPONd33XO_y5K_C3njbpmDa3OATXJ2Gztb-46YLQMFwYPyYtbErm2NX8vfemG80GWFG8mm-uShdByW55fOgAH49kekz65iyqB9Drg1MYm8ZIQ68LFeKRCRVgMLTBN0thNNjmmMTygKgtNIzn1KUMsYvWeL2QuVWEXkH3z76vVxJ79Db80TFJDje2tT6bT_WyJz3OEEQa5EkXsD5mIz1L3w2vMpDaXlyUpM8Vn_IZ7JetwUAdBTtRPGw8S6J3LMXumc9OD1D6P4HkUdEvvc8ppGtE6ZzgHSAN3s= + id: rs_028582086f036f90006adb38a8933c87d09fb12987127552e3 + summary: [] + type: reasoning + - action: + queries: + - potato nutrition facts + - tomato nutrition facts + query: potato nutrition facts + type: search + id: ws_028582086f036f90006adb38a91ca087d0bdb5f35f1d6bf3e9 + status: completed + type: web_search_call + - action: + queries: + - cucumber nutrition facts + - carrot nutrition facts + query: cucumber nutrition facts + type: search + id: ws_028582086f036f90006adb38ac260887d09b71c0ad11d3f615 + status: completed + type: web_search_call + - content: [] + encrypted_content: gAAAAABq2zi14HsARCbIKMxz0-ISOPlbzzhmHJ3Yb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aQkVFF4eGNJ7eXx7ZNXZMgVK-L98k8oq3slIiD9a_OlpGMG1PVTOeNz-bi2vX8N8lU2qYGJHse5GG5qAVOLmHUkg0U7qAna6dOBWC2Vp3tfvjDXLoFsCngkO5-_aRocXXmNY0ae-aupyqs-ttNqnFkooESKVcDxCv7dkPG-F4XDDwAlAnEbbmJdRTPUdrG45gCB2nGG6CbmpwlPwOc2aVqVYcQJpsSOzb4SKLn2TN8CjdjkULVvkVykFeKpwrO3A8p2CZkotmwUr9oQja7Vth5TI124dqimJA5KDigxaqCG94zkB1VFJmUORr55mbAVKYCpn1XXi75nnj8NZKupggCzucFf9KQWf16TOrL058mcBIWV0KGLD9l-26sfwToMr1NWPTRbHEiICln6J__mLrWbbOWqhpMUkbElL0yE7RJrRtihms2wD5sLGhPseCmrTxVrry6RnzVJ53nEmGh1FBUf26P_R81Og2lYhko7jJtJDZQ5q0CBfXN2FCpcGbbHQkEcuqLZOkOLh8PBceS0VVflYrlYwMovH4M4-IZmM7zy-nRfVJ-unuixwic74dpFG-QaaN4FLiy2UoNWNRYDSYbs9KbfHILtLAJq1hx2Rz_escMxVlW-HsL3ciGvSAnwBu63VZ5zdy38yj2BvDCf5rbrg== + id: rs_028582086f036f90006adb38b00b5087d0b3420318146f3aa4 + summary: [] + type: reasoning + - action: + type: open_page + url: https://www.fda.gov/food/nutrition-food-labeling-and-critical-foods/nutrition-information-raw-vegetables?source=foo + id: ws_028582086f036f90006adb38b192c087d0acac3b7f7a3a0fa3 + status: completed + type: web_search_call + - content: + - annotations: + - end_index: 262 + start_index: 134 + title: Nutrition Information for Raw Vegetables | FDA + type: url_citation + url: https://www.fda.gov/food/nutrition-food-labeling-and-critical-foods/nutrition-information-raw-vegetables?source=foo + - end_index: 528 + start_index: 400 + title: Nutrition Information for Raw Vegetables | FDA + type: url_citation + url: https://www.fda.gov/food/nutrition-food-labeling-and-critical-foods/nutrition-information-raw-vegetables?source=foo + - end_index: 808 + start_index: 680 + title: Nutrition Information for Raw Vegetables | FDA + type: url_citation + url: https://www.fda.gov/food/nutrition-food-labeling-and-critical-foods/nutrition-information-raw-vegetables?source=foo + - end_index: 1073 + start_index: 945 + title: Nutrition Information for Raw Vegetables | FDA + type: url_citation + url: https://www.fda.gov/food/nutrition-food-labeling-and-critical-foods/nutrition-information-raw-vegetables?source=foo + logprobs: [] + text: '- **Potato:** One medium raw potato (148 g) has about 110 calories, + 26 g carbohydrates, 2 g fiber, 3 g protein, and 620 mg potassium. ([fda.gov](https://www.fda.gov/food/nutrition-food-labeling-and-critical-foods/nutrition-information-raw-vegetables?source=foo)) + + - **Tomato:** One medium raw tomato (148 g) provides about 25 calories, + 5 g carbohydrates, 1 g fiber, 1 g protein, and 340 mg potassium. ([fda.gov](https://www.fda.gov/food/nutrition-food-labeling-and-critical-foods/nutrition-information-raw-vegetables?source=foo)) + + - **Cucumber:** One-third of a medium raw cucumber (99 g) contains about + 10 calories, 2 g carbohydrates, 1 g fiber, 1 g protein, and 140 mg potassium. + ([fda.gov](https://www.fda.gov/food/nutrition-food-labeling-and-critical-foods/nutrition-information-raw-vegetables?source=foo)) + + - **Carrot:** One raw 7-inch carrot (78 g) supplies about 30 calories, + 7 g carbohydrates, 2 g fiber, 1 g protein, and 250 mg potassium. ([fda.gov](https://www.fda.gov/food/nutrition-food-labeling-and-critical-foods/nutrition-information-raw-vegetables?source=foo))' + type: output_text + id: msg_028582086f036f90006adb38b32cd487d0b059e5f3d6a1898e + phase: final_answer + role: assistant + status: completed + type: message + parallel_tool_calls: true + presence_penalty: 0.0 + previous_response_id: null + prompt_cache_key: null + prompt_cache_retention: 24h + reasoning: + context: all_turns + effort: medium + mode: standard + summary: null + safety_identifier: null + service_tier: default + status: completed + store: true + temperature: 1.0 + text: + format: + type: text + verbosity: medium + tool_choice: auto + tool_usage: + image_gen: + input_tokens: 0 + input_tokens_details: + image_tokens: 0 + text_tokens: 0 + output_tokens: 0 + output_tokens_details: + image_tokens: 0 + text_tokens: 0 + total_tokens: 0 + web_search: + num_requests: 2 + tools: + - search_content_types: + - text + search_context_size: medium + type: web_search_preview + user_location: + city: null + country: US + region: null + timezone: null + type: approximate + - allowed_tools: + - search_tiktoken_documentation + headers: null + require_approval: never + server_description: null + server_label: gitmcp_tiktoken + server_url: https://gitmcp.io/openai/tiktoken + type: mcp + top_logprobs: 0 + top_p: 0.98 + truncation: disabled + usage: + input_tokens: 17132 + input_tokens_details: + cache_write_tokens: 0 + cached_tokens: 4683 + output_tokens: 488 + output_tokens_details: + reasoning_tokens: 260 + total_tokens: 17620 + user: null + headers: + content-type: application/json + status_code: 200 +- filename: t2 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_028582086f036f90006adb38a6029887d09022c2dc4c9549ba/input_items + query_params: + limit: '100' + order: asc + response: + body: + data: + - content: + - text: 'Do two separate web_search calls in parallel, in this single turn + -- do not wait for one to finish before starting the other. The first + web_search call must batch two exact queries together: "potato nutrition + facts" and "tomato nutrition facts". The second web_search call must batch + two different exact queries together: "cucumber nutrition facts" and "carrot + nutrition facts". Issue both calls now, then summarize each of the four + results in one sentence.' + type: input_text + id: msg_028582086f036f90006adb38a62ee087d0b021d27a63342ecb + role: user + status: completed + type: message + first_id: msg_028582086f036f90006adb38a62ee087d0b021d27a63342ecb + has_more: false + last_id: msg_028582086f036f90006adb38a62ee087d0b021d27a63342ecb + object: list + headers: + content-type: application/json + status_code: 200 +- filename: t3 + request: + body: + input: + - content: 'Call gitmcp_tiktoken__search_tiktoken_documentation in parallel + for two separate exact queries -- do not wait for one to finish before starting + the other: (1) {"query":"encoding"} and (2) {"query":"tokenizer"}. Issue + both calls now in this single turn, then summarize each result in one sentence.' + role: user + type: message + max_output_tokens: 2048 + model: gpt-5.6 + parallel_tool_calls: true + previous_response_id: resp_028582086f036f90006adb38a6029887d09022c2dc4c9549ba + store: true + stream: false + tool_choice: auto + tools: + - type: web_search_preview + - allowed_tools: + - search_tiktoken_documentation + require_approval: never + server_label: gitmcp_tiktoken + server_url: https://gitmcp.io/openai/tiktoken + type: mcp + headers: + accept: '*/*' + authorization: Bearer *** + content-type: application/json + user-agent: python-httpx/0.28.1 + method: POST + path: /v1/responses + query_params: {} + response: + body: + access_programs: null + background: false + billing: + payer: developer + completed_at: 1792751810 + created_at: 1792751798 + error: null + frequency_penalty: 0.0 + id: resp_028582086f036f90006adb38b6924887d09b92d1e117ec7697 + incomplete_details: null + instructions: null + max_output_tokens: 2048 + max_tool_calls: null + metadata: {} + model: gpt-5.6-sol + moderation: null + object: response + output: + - content: [] + encrypted_content: gAAAAABq2zjCFvgMCpkjUaESR9j4pAi9oWEdAgv-ZLG1ElVddrJUdTLgQwzYJT4pflxN9zb6Xc-DmlxplToAF5VzS0xWEvubDC5LjrK1pdIU_bDP0nfpB1DdTweJFdgHtTjE4EXjMz0iTF4vWPfsxRS34MXgI6IFeFtiadA511eV8RCsxPO_6Dzn78bQGVj9yc9ugsgeye7-Mjpuw9bBVLnVKVrPtZG5c0c01v_5Hl8ZIQWt1YFmu3JxjQFEYindHButXXrxqlawCfIooiv5Ux4P-STLxYB-DivGCfO27WVn9ydMFlcywjcNQ4OeT0F3FCrfMk2uFz9NCMLr-mzKrAMl2U0qdJ2OmbmtOMGxz3DEPLF_1VSoBYR5zEuOj-oOI3eIFeM7M1LGY8mTVyIAR1zFyFzx9z8k6m8Rt9UY3x1AzDWLt6TbHmfJ7tuH0zAGmCiYQaq_NTC0B_IusSAl3lOZ7OeX4MaJQTob8Dwnjj513fxRtSuLTVq47h_VhShJeO0nobmH5bDAiWjNjP43kvyHqpGNbp2G7lrp5RFHdDrbGtA2fxFY3KRGMmuua7_wlxN_AORZXkbLPKNPwXR4iV_Yzmeb6GDliXAUFD4EFPVFTBQdFwZDkquyQ4jXmc2AEaDcJTglRCjJeIz44AGxabjaHeV4W1LkNpV2VGMJJyJasaQ6xTX1EMKNyq0biTvXi2FMMXlpfNA-pY1vU10g82M3WFMaLMguee01kwqsdDIre4jRjN_JecsuakaChluoVCWU9fVnIulfqbasH-F4vGCaj0HOwMer4Y5vjHhzzPzzaDfxQxLrWV8lstXTO2O58UN_7YafxP0fd1FG3PBxs9d9dUs53FQh0h2ZWiFR6OnLcegNUsABGBVy-GWuORsSgoNRD3XCKjjPU0DKiUcRnCIFooopSgk_0Rie22fRwPiwb-SEFfxBg46QPxY8EWzlFzsSEVJzKdTx5J7RAMat9Vk7j9LhDAqF1V_mbZlr0gR-R7UrGeF7ucGXkw-XsBRpHtetPNU92hHj2pi7v5ppTPtrfxDwhRG-HydO4vy-cDIlsVm04560ZyHaGpVLUyBsN2Dsf7EGdsM-7J2bprpD9WESmp_w0-hNwqVPMVfMdqPAhp9tSnXG4kH9wg0LhHhN0XErYDd5l13S4cKFnRuRbTqduTATGn-_J3WegYQQz2QZ03XyfGRws9f6R4yUUgwyc2Xc6QsVcU92FqiYEP3zVIvMhd6uWq14L60D8VO8PjXPc1lKXOGoE4O2uykwmEugC1tWK8srH8_uLWADSvTc9AwNkWVUFS-AR8u2zUjNhHY5A2NVbn_erV3wunNdoyzhhgH1WNYiScmL7P4Nd9kJrezlw-VL3tRqbgfvXU1xBB3F9gOdmyobdxcKW3-xLwyRsmKrZv-wWDZqYa1CfdJhWyy45_3wOfSOPpQGF7FmbkZo_F_OieHjtxjj2ABHclbkCpWKumFLwCHha4jNKoicTzXqKTG45X6yEhOdp-XdD_DYxYdi6RjVtYzn8LBHBWTO2b52ddPg95nKoIq5mbihvO0lJs-nEatfUBaIRGQvPkIKDGh1bRMU0Wo= + id: rs_028582086f036f90006adb38b9043c87d0a251db279fc9b317 + summary: [] + type: reasoning + - approval_request_id: null + arguments: '{"query":"encoding"}' + error: null + id: mcp_028582086f036f90006adb38b95aa487d09c3039d3a5c93662 + name: search_tiktoken_documentation + output: "### Search Results for: \"encoding\"\n\nNo relevant documentation\ + \ found for your query. It's either being indexed or the search query did\ + \ not match any documentation.\n\nAs a fallback, this is the documentation\ + \ for openai/tiktoken:\n\n# ⏳ tiktoken\n\ntiktoken is a fast [BPE](https://en.wikipedia.org/wiki/Byte_pair_encoding)\ + \ tokeniser for use with\nOpenAI's models.\n\n```python\nimport tiktoken\n\ + enc = tiktoken.get_encoding(\"o200k_base\")\nassert enc.decode(enc.encode(\"\ + hello world\")) == \"hello world\"\n\n# To get the tokeniser corresponding\ + \ to a specific model in the OpenAI API:\nenc = tiktoken.encoding_for_model(\"\ + gpt-4o\")\n```\n\nThe open source version of `tiktoken` can be installed\ + \ from [PyPI](https://pypi.org/project/tiktoken):\n```\npip install tiktoken\n\ + ```\n\nThe tokeniser API is documented in `tiktoken/core.py`.\n\nExample\ + \ code using `tiktoken` can be found in the\n[OpenAI Cookbook](https://github.com/openai/openai-cookbook/blob/main/examples/How_to_count_tokens_with_tiktoken.ipynb).\n\ + \n\n## Performance\n\n`tiktoken` is between 3-6x faster than a comparable\ + \ open source tokeniser:\n\n![image](https://raw.githubusercontent.com/openai/tiktoken/main/perf.svg)\n\ + \nPerformance measured on 1GB of text using the GPT-2 tokeniser, using `GPT2TokenizerFast`\ + \ from\n`tokenizers==0.13.2`, `transformers==4.24.0` and `tiktoken==0.2.0`.\n\ + \n\n## Getting help\n\nPlease post questions in the [issue tracker](https://github.com/openai/tiktoken/issues).\n\ + \nIf you work at OpenAI, make sure to check the internal documentation or\ + \ feel free to contact\n@shantanu.\n\n## What is BPE anyway?\n\nLanguage\ + \ models don't see text like you and I, instead they see a sequence of numbers\ + \ (known as tokens).\nByte pair encoding (BPE) is a way of converting text\ + \ into tokens. It has a couple desirable\nproperties:\n1) It's reversible\ + \ and lossless, so you can convert tokens back into the original text\n\ + 2) It works on arbitrary text, even text that is not in the tokeniser's\ + \ training data\n3) It compresses the text: the token sequence is shorter\ + \ than the bytes corresponding to the\n original text. On average, in\ + \ practice, each token corresponds to about 4 bytes.\n4) It attempts to\ + \ let the model see common subwords. For instance, \"ing\" is a common subword\ + \ in\n English, so BPE encodings will often split \"encoding\" into tokens\ + \ like \"encod\" and \"ing\"\n (instead of e.g. \"enc\" and \"oding\"\ + ). Because the model will then see the \"ing\" token again and\n again\ + \ in different contexts, it helps models generalise and better understand\ + \ grammar.\n\n`tiktoken` contains an educational submodule that is friendlier\ + \ if you want to learn more about\nthe details of BPE, including code that\ + \ helps visualise the BPE procedure:\n```python\nfrom tiktoken._educational\ + \ import *\n\n# Train a BPE tokeniser on a small amount of text\nenc = train_simple_encoding()\n\ + \n# Visualise how the GPT-4 encoder encodes text\nenc = SimpleBytePairEncoding.from_tiktoken(\"\ + cl100k_base\")\nenc.encode(\"hello world aaaaaaaaaaaa\")\n```\n\n\n## Extending\ + \ tiktoken\n\nYou may wish to extend `tiktoken` to support new encodings.\ + \ There are two ways to do this.\n\n\n**Create your `Encoding` object exactly\ + \ the way you want and simply pass it around.**\n\n```python\ncl100k_base\ + \ = tiktoken.get_encoding(\"cl100k_base\")\n\n# In production, load the\ + \ arguments directly instead of accessing private attributes\n# See openai_public.py\ + \ for examples of arguments for specific encodings\nenc = tiktoken.Encoding(\n\ + \ # If you're changing the set of special tokens, make sure to use a\ + \ different name\n # It should be clear from the name what behaviour\ + \ to expect.\n name=\"cl100k_im\",\n pat_str=cl100k_base._pat_str,\n\ + \ mergeable_ranks=cl100k_base._mergeable_ranks,\n special_tokens={\n\ + \ **cl100k_base._special_tokens,\n \"<|im_start|>\": 100264,\n\ + \ \"<|im_end|>\": 100265,\n }\n)\n```\n\n**Use the `tiktoken_ext`\ + \ plugin mechanism to register your `Encoding` objects with `tiktoken`.**\n\ + \nThis is only useful if you need `tiktoken.get_encoding` to find your encoding,\ + \ otherwise prefer\noption 1.\n\nTo do this, you'll need to create a namespace\ + \ package under `tiktoken_ext`.\n\nLayout your project like this, making\ + \ sure to omit the `tiktoken_ext/__init__.py` file:\n```\nmy_tiktoken_extension\n\ + ├── tiktoken_ext\n│   └── my_encodings.py\n└── setup.py\n```\n\n`my_encodings.py`\ + \ should be a module that contains a variable named `ENCODING_CONSTRUCTORS`.\n\ + This is a dictionary from an encoding name to a function that takes no arguments\ + \ and returns\narguments that can be passed to `tiktoken.Encoding` to construct\ + \ that encoding. For an example, see\n`tiktoken_ext/openai_public.py`. For\ + \ precise details, see `tiktoken/registry.py`.\n\nYour `setup.py` should\ + \ look something like this:\n```python\nfrom setuptools import setup, find_namespace_packages\n\ + \nsetup(\n name=\"my_tiktoken_extension\",\n packages=find_namespace_packages(include=['tiktoken_ext*']),\n\ + \ install_requires=[\"tiktoken\"],\n ...\n)\n```\n\nThen simply `pip\ + \ install ./my_tiktoken_extension` and you should be able to use your\n\ + custom encodings! Make sure **not** to use an editable install.\n\n\n\n\ + If you'd like to retry the search, try changing the query to increase the\ + \ likelihood of a match." + server_label: gitmcp_tiktoken + status: completed + type: mcp_call + - approval_request_id: null + arguments: '{"query":"tokenizer"}' + error: null + id: mcp_028582086f036f90006adb38bddf1887d09e788e30fc1cdc50 + name: search_tiktoken_documentation + output: "### Search Results for: \"tokenizer\"\n\nNo relevant documentation\ + \ found for your query. It's either being indexed or the search query did\ + \ not match any documentation.\n\nAs a fallback, this is the documentation\ + \ for openai/tiktoken:\n\n# ⏳ tiktoken\n\ntiktoken is a fast [BPE](https://en.wikipedia.org/wiki/Byte_pair_encoding)\ + \ tokeniser for use with\nOpenAI's models.\n\n```python\nimport tiktoken\n\ + enc = tiktoken.get_encoding(\"o200k_base\")\nassert enc.decode(enc.encode(\"\ + hello world\")) == \"hello world\"\n\n# To get the tokeniser corresponding\ + \ to a specific model in the OpenAI API:\nenc = tiktoken.encoding_for_model(\"\ + gpt-4o\")\n```\n\nThe open source version of `tiktoken` can be installed\ + \ from [PyPI](https://pypi.org/project/tiktoken):\n```\npip install tiktoken\n\ + ```\n\nThe tokeniser API is documented in `tiktoken/core.py`.\n\nExample\ + \ code using `tiktoken` can be found in the\n[OpenAI Cookbook](https://github.com/openai/openai-cookbook/blob/main/examples/How_to_count_tokens_with_tiktoken.ipynb).\n\ + \n\n## Performance\n\n`tiktoken` is between 3-6x faster than a comparable\ + \ open source tokeniser:\n\n![image](https://raw.githubusercontent.com/openai/tiktoken/main/perf.svg)\n\ + \nPerformance measured on 1GB of text using the GPT-2 tokeniser, using `GPT2TokenizerFast`\ + \ from\n`tokenizers==0.13.2`, `transformers==4.24.0` and `tiktoken==0.2.0`.\n\ + \n\n## Getting help\n\nPlease post questions in the [issue tracker](https://github.com/openai/tiktoken/issues).\n\ + \nIf you work at OpenAI, make sure to check the internal documentation or\ + \ feel free to contact\n@shantanu.\n\n## What is BPE anyway?\n\nLanguage\ + \ models don't see text like you and I, instead they see a sequence of numbers\ + \ (known as tokens).\nByte pair encoding (BPE) is a way of converting text\ + \ into tokens. It has a couple desirable\nproperties:\n1) It's reversible\ + \ and lossless, so you can convert tokens back into the original text\n\ + 2) It works on arbitrary text, even text that is not in the tokeniser's\ + \ training data\n3) It compresses the text: the token sequence is shorter\ + \ than the bytes corresponding to the\n original text. On average, in\ + \ practice, each token corresponds to about 4 bytes.\n4) It attempts to\ + \ let the model see common subwords. For instance, \"ing\" is a common subword\ + \ in\n English, so BPE encodings will often split \"encoding\" into tokens\ + \ like \"encod\" and \"ing\"\n (instead of e.g. \"enc\" and \"oding\"\ + ). Because the model will then see the \"ing\" token again and\n again\ + \ in different contexts, it helps models generalise and better understand\ + \ grammar.\n\n`tiktoken` contains an educational submodule that is friendlier\ + \ if you want to learn more about\nthe details of BPE, including code that\ + \ helps visualise the BPE procedure:\n```python\nfrom tiktoken._educational\ + \ import *\n\n# Train a BPE tokeniser on a small amount of text\nenc = train_simple_encoding()\n\ + \n# Visualise how the GPT-4 encoder encodes text\nenc = SimpleBytePairEncoding.from_tiktoken(\"\ + cl100k_base\")\nenc.encode(\"hello world aaaaaaaaaaaa\")\n```\n\n\n## Extending\ + \ tiktoken\n\nYou may wish to extend `tiktoken` to support new encodings.\ + \ There are two ways to do this.\n\n\n**Create your `Encoding` object exactly\ + \ the way you want and simply pass it around.**\n\n```python\ncl100k_base\ + \ = tiktoken.get_encoding(\"cl100k_base\")\n\n# In production, load the\ + \ arguments directly instead of accessing private attributes\n# See openai_public.py\ + \ for examples of arguments for specific encodings\nenc = tiktoken.Encoding(\n\ + \ # If you're changing the set of special tokens, make sure to use a\ + \ different name\n # It should be clear from the name what behaviour\ + \ to expect.\n name=\"cl100k_im\",\n pat_str=cl100k_base._pat_str,\n\ + \ mergeable_ranks=cl100k_base._mergeable_ranks,\n special_tokens={\n\ + \ **cl100k_base._special_tokens,\n \"<|im_start|>\": 100264,\n\ + \ \"<|im_end|>\": 100265,\n }\n)\n```\n\n**Use the `tiktoken_ext`\ + \ plugin mechanism to register your `Encoding` objects with `tiktoken`.**\n\ + \nThis is only useful if you need `tiktoken.get_encoding` to find your encoding,\ + \ otherwise prefer\noption 1.\n\nTo do this, you'll need to create a namespace\ + \ package under `tiktoken_ext`.\n\nLayout your project like this, making\ + \ sure to omit the `tiktoken_ext/__init__.py` file:\n```\nmy_tiktoken_extension\n\ + ├── tiktoken_ext\n│   └── my_encodings.py\n└── setup.py\n```\n\n`my_encodings.py`\ + \ should be a module that contains a variable named `ENCODING_CONSTRUCTORS`.\n\ + This is a dictionary from an encoding name to a function that takes no arguments\ + \ and returns\narguments that can be passed to `tiktoken.Encoding` to construct\ + \ that encoding. For an example, see\n`tiktoken_ext/openai_public.py`. For\ + \ precise details, see `tiktoken/registry.py`.\n\nYour `setup.py` should\ + \ look something like this:\n```python\nfrom setuptools import setup, find_namespace_packages\n\ + \nsetup(\n name=\"my_tiktoken_extension\",\n packages=find_namespace_packages(include=['tiktoken_ext*']),\n\ + \ install_requires=[\"tiktoken\"],\n ...\n)\n```\n\nThen simply `pip\ + \ install ./my_tiktoken_extension` and you should be able to use your\n\ + custom encodings! Make sure **not** to use an editable install.\n\n\n\n\ + If you'd like to retry the search, try changing the query to increase the\ + \ likelihood of a match." + server_label: gitmcp_tiktoken + status: completed + type: mcp_call + - content: + - annotations: [] + logprobs: [] + text: '- **“encoding”:** No direct match was found, but the fallback documentation + explains how to retrieve, use, customize, and register tiktoken `Encoding` + objects. + + - **“tokenizer”:** No direct match was found, but the fallback describes + tiktoken as a fast, reversible BPE tokenizer for OpenAI models, with model-specific + selection via `encoding_for_model()`.' + type: output_text + id: msg_028582086f036f90006adb38c1ba9887d082bf4912bcf37cc9 + phase: final_answer + role: assistant + status: completed + type: message + parallel_tool_calls: true + presence_penalty: 0.0 + previous_response_id: resp_028582086f036f90006adb38a6029887d09022c2dc4c9549ba + prompt_cache_key: null + prompt_cache_retention: 24h + reasoning: + context: all_turns + effort: medium + mode: standard + summary: null + safety_identifier: null + service_tier: default + status: completed + store: true + temperature: 1.0 + text: + format: + type: text + verbosity: medium + tool_choice: auto + tool_usage: + image_gen: + input_tokens: 0 + input_tokens_details: + image_tokens: 0 + text_tokens: 0 + output_tokens: 0 + output_tokens_details: + image_tokens: 0 + text_tokens: 0 + total_tokens: 0 + web_search: + num_requests: 0 + tools: + - search_content_types: + - text + search_context_size: medium + type: web_search_preview + user_location: + city: null + country: US + region: null + timezone: null + type: approximate + - allowed_tools: + - search_tiktoken_documentation + headers: null + require_approval: never + server_description: null + server_label: gitmcp_tiktoken + server_url: https://gitmcp.io/openai/tiktoken + type: mcp + top_logprobs: 0 + top_p: 0.98 + truncation: disabled + usage: + input_tokens: 20221 + input_tokens_details: + cache_write_tokens: 0 + cached_tokens: 17024 + output_tokens: 156 + output_tokens_details: + reasoning_tokens: 14 + total_tokens: 20377 + user: null + headers: + content-type: application/json + status_code: 200 +- filename: t4 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_028582086f036f90006adb38b6924887d09b92d1e117ec7697/input_items + query_params: + limit: '100' + order: asc + response: + body: + data: + - content: + - text: 'Do two separate web_search calls in parallel, in this single turn + -- do not wait for one to finish before starting the other. The first + web_search call must batch two exact queries together: "potato nutrition + facts" and "tomato nutrition facts". The second web_search call must batch + two different exact queries together: "cucumber nutrition facts" and "carrot + nutrition facts". Issue both calls now, then summarize each of the four + results in one sentence.' + type: input_text + id: msg_028582086f036f90006adb38a62ee087d0b021d27a63342ecb + role: user + status: completed + type: message + - id: mcpl_028582086f036f90006adb38a6333c87d0a7527c0158e5d25b + server_label: gitmcp_tiktoken + tools: + - annotations: + read_only: false + description: 'Semantically search within the fetched documentation from + GitHub repository: openai/tiktoken. Useful for specific queries.' + input_schema: + $schema: http://json-schema.org/draft-07/schema# + additionalProperties: false + properties: + query: + description: The search query to find relevant documentation + type: string + required: + - query + type: object + name: search_tiktoken_documentation + type: mcp_list_tools + - content: [] + id: rs_028582086f036f90006adb38a8933c87d09fb12987127552e3 + summary: [] + type: reasoning + - action: + queries: + - potato nutrition facts + - tomato nutrition facts + query: potato nutrition facts + type: search + id: ws_028582086f036f90006adb38a91ca087d0bdb5f35f1d6bf3e9 + status: completed + type: web_search_call + - action: + queries: + - cucumber nutrition facts + - carrot nutrition facts + query: cucumber nutrition facts + type: search + id: ws_028582086f036f90006adb38ac260887d09b71c0ad11d3f615 + status: completed + type: web_search_call + - content: [] + id: rs_028582086f036f90006adb38b00b5087d0b3420318146f3aa4 + summary: [] + type: reasoning + - action: + type: open_page + url: https://www.fda.gov/media/76886/download + id: ws_028582086f036f90006adb38b192c087d0acac3b7f7a3a0fa3 + status: completed + type: web_search_call + - content: + - annotations: + - end_index: 262 + start_index: 134 + title: Nutrition Information for Raw Vegetables | FDA + type: url_citation + url: https://www.fda.gov/food/nutrition-food-labeling-and-critical-foods/nutrition-information-raw-vegetables?source=foo + - end_index: 528 + start_index: 400 + title: Nutrition Information for Raw Vegetables | FDA + type: url_citation + url: https://www.fda.gov/food/nutrition-food-labeling-and-critical-foods/nutrition-information-raw-vegetables?source=foo + - end_index: 808 + start_index: 680 + title: Nutrition Information for Raw Vegetables | FDA + type: url_citation + url: https://www.fda.gov/food/nutrition-food-labeling-and-critical-foods/nutrition-information-raw-vegetables?source=foo + - end_index: 1073 + start_index: 945 + title: Nutrition Information for Raw Vegetables | FDA + type: url_citation + url: https://www.fda.gov/food/nutrition-food-labeling-and-critical-foods/nutrition-information-raw-vegetables?source=foo + logprobs: [] + text: '- **Potato:** One medium raw potato (148 g) has about 110 calories, + 26 g carbohydrates, 2 g fiber, 3 g protein, and 620 mg potassium. ([fda.gov](https://www.fda.gov/food/nutrition-food-labeling-and-critical-foods/nutrition-information-raw-vegetables?source=foo)) + + - **Tomato:** One medium raw tomato (148 g) provides about 25 calories, + 5 g carbohydrates, 1 g fiber, 1 g protein, and 340 mg potassium. ([fda.gov](https://www.fda.gov/food/nutrition-food-labeling-and-critical-foods/nutrition-information-raw-vegetables?source=foo)) + + - **Cucumber:** One-third of a medium raw cucumber (99 g) contains about + 10 calories, 2 g carbohydrates, 1 g fiber, 1 g protein, and 140 mg potassium. + ([fda.gov](https://www.fda.gov/food/nutrition-food-labeling-and-critical-foods/nutrition-information-raw-vegetables?source=foo)) + + - **Carrot:** One raw 7-inch carrot (78 g) supplies about 30 calories, + 7 g carbohydrates, 2 g fiber, 1 g protein, and 250 mg potassium. ([fda.gov](https://www.fda.gov/food/nutrition-food-labeling-and-critical-foods/nutrition-information-raw-vegetables?source=foo))' + type: output_text + id: msg_028582086f036f90006adb38b32cd487d0b059e5f3d6a1898e + phase: final_answer + role: assistant + status: completed + type: message + - content: + - text: 'Call gitmcp_tiktoken__search_tiktoken_documentation in parallel for + two separate exact queries -- do not wait for one to finish before starting + the other: (1) {"query":"encoding"} and (2) {"query":"tokenizer"}. Issue + both calls now in this single turn, then summarize each result in one + sentence.' + type: input_text + id: msg_028582086f036f90006adb38b6b01c87d0b98150cd87c47ffd + role: user + status: completed + type: message + first_id: msg_028582086f036f90006adb38a62ee087d0b021d27a63342ecb + has_more: false + last_id: msg_028582086f036f90006adb38b6b01c87d0b98150cd87c47ffd + object: list + headers: + content-type: application/json + status_code: 200 +- filename: t5 + request: + body: + input: + - content: 'Do both of these right now, in parallel, in this single turn -- + do not wait for one to finish before starting the other: (1) search the + web for the exact query "latest vLLM release notes", and (2) call gitmcp_tiktoken__search_tiktoken_documentation + with {"query":"encoding"}. Do not call any other tool.' + role: user + type: message + max_output_tokens: 2048 + model: gpt-5.6 + parallel_tool_calls: true + previous_response_id: resp_028582086f036f90006adb38b6924887d09b92d1e117ec7697 + store: true + stream: false + tool_choice: auto + tools: + - type: web_search_preview + - allowed_tools: + - search_tiktoken_documentation + require_approval: never + server_label: gitmcp_tiktoken + server_url: https://gitmcp.io/openai/tiktoken + type: mcp + headers: + accept: '*/*' + authorization: Bearer *** + content-type: application/json + user-agent: python-httpx/0.28.1 + method: POST + path: /v1/responses + query_params: {} + response: + body: + access_programs: null + background: false + billing: + payer: developer + completed_at: 1792751822 + created_at: 1792751811 + error: null + frequency_penalty: 0.0 + id: resp_028582086f036f90006adb38c3b06487d0963b8de31aa5af01 + incomplete_details: null + instructions: null + max_output_tokens: 2048 + max_tool_calls: null + metadata: {} + model: gpt-5.6-sol + moderation: null + object: response + output: + - content: [] + encrypted_content: gAAAAABq2zjOicIf4pfVUsJmWJqHw3d-dth6S9BihBUZFKzfIePUtzb1ytMKsD0phdmeNgUTJss1zts-ug6nJhiUiJUzfHkU6T9fFpjCuF5J_Uk0YKwZBg55PJGON90W2wuXhRD4SViTnzY58lGOqPNoDjJBpivTzca4goGa4K3xRI-aZsw5I0l3CLyTOLiia40g8oRho9wxYiszQCt6N4McPV0GWMg0fz2dkspPXS_DFU-8xwEhY2oZRpkk2owq7eA6wYcfvLOCdUEncsBrfRLA3JfdrbfUvi_j9H7fd-0CCxpKY-L0RYsiOhI6iJhlAcfo_Fm231BVB0FtBUNDGh9K7HcbJPEzGElCED_Stey8AyYygpdWWJ8c0lWz2nFhnOf7YCtgL_9NfisWvLP_AlQwS6frBnzxb3Jreflsg9nRK8JuIdtv28h0XYeKk9dUY3FmOplRVAZqXV5A6H88BsMSsBK_8YQL7bu9lEPkCaGT0f25zQcUzpX4xCPYyK6aRS67Gk0NPEY9RLPXgdVeNOH7mu6ZJfpn-YH7VBuXYLeNqsu8HN3gO0E-v7QqgM42MHGonsgvzf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ca4s8p-qxfIU0h_7Nh9YkkZ064TN5tVUPhIjYg== + id: rs_028582086f036f90006adb38c48bd087d09cf2d6b9d00c3424 + summary: [] + type: reasoning + - action: + queries: + - latest vLLM release notes + query: latest vLLM release notes + type: search + id: ws_028582086f036f90006adb38c4ffcc87d08f2761f66559b187 + status: completed + type: web_search_call + - approval_request_id: null + arguments: '{"query":"encoding"}' + error: null + id: mcp_028582086f036f90006adb38c9505c87d09f63f61480673f82 + name: search_tiktoken_documentation + output: "### Search Results for: \"encoding\"\n\nNo relevant documentation\ + \ found for your query. It's either being indexed or the search query did\ + \ not match any documentation.\n\nAs a fallback, this is the documentation\ + \ for openai/tiktoken:\n\n# ⏳ tiktoken\n\ntiktoken is a fast [BPE](https://en.wikipedia.org/wiki/Byte_pair_encoding)\ + \ tokeniser for use with\nOpenAI's models.\n\n```python\nimport tiktoken\n\ + enc = tiktoken.get_encoding(\"o200k_base\")\nassert enc.decode(enc.encode(\"\ + hello world\")) == \"hello world\"\n\n# To get the tokeniser corresponding\ + \ to a specific model in the OpenAI API:\nenc = tiktoken.encoding_for_model(\"\ + gpt-4o\")\n```\n\nThe open source version of `tiktoken` can be installed\ + \ from [PyPI](https://pypi.org/project/tiktoken):\n```\npip install tiktoken\n\ + ```\n\nThe tokeniser API is documented in `tiktoken/core.py`.\n\nExample\ + \ code using `tiktoken` can be found in the\n[OpenAI Cookbook](https://github.com/openai/openai-cookbook/blob/main/examples/How_to_count_tokens_with_tiktoken.ipynb).\n\ + \n\n## Performance\n\n`tiktoken` is between 3-6x faster than a comparable\ + \ open source tokeniser:\n\n![image](https://raw.githubusercontent.com/openai/tiktoken/main/perf.svg)\n\ + \nPerformance measured on 1GB of text using the GPT-2 tokeniser, using `GPT2TokenizerFast`\ + \ from\n`tokenizers==0.13.2`, `transformers==4.24.0` and `tiktoken==0.2.0`.\n\ + \n\n## Getting help\n\nPlease post questions in the [issue tracker](https://github.com/openai/tiktoken/issues).\n\ + \nIf you work at OpenAI, make sure to check the internal documentation or\ + \ feel free to contact\n@shantanu.\n\n## What is BPE anyway?\n\nLanguage\ + \ models don't see text like you and I, instead they see a sequence of numbers\ + \ (known as tokens).\nByte pair encoding (BPE) is a way of converting text\ + \ into tokens. It has a couple desirable\nproperties:\n1) It's reversible\ + \ and lossless, so you can convert tokens back into the original text\n\ + 2) It works on arbitrary text, even text that is not in the tokeniser's\ + \ training data\n3) It compresses the text: the token sequence is shorter\ + \ than the bytes corresponding to the\n original text. On average, in\ + \ practice, each token corresponds to about 4 bytes.\n4) It attempts to\ + \ let the model see common subwords. For instance, \"ing\" is a common subword\ + \ in\n English, so BPE encodings will often split \"encoding\" into tokens\ + \ like \"encod\" and \"ing\"\n (instead of e.g. \"enc\" and \"oding\"\ + ). Because the model will then see the \"ing\" token again and\n again\ + \ in different contexts, it helps models generalise and better understand\ + \ grammar.\n\n`tiktoken` contains an educational submodule that is friendlier\ + \ if you want to learn more about\nthe details of BPE, including code that\ + \ helps visualise the BPE procedure:\n```python\nfrom tiktoken._educational\ + \ import *\n\n# Train a BPE tokeniser on a small amount of text\nenc = train_simple_encoding()\n\ + \n# Visualise how the GPT-4 encoder encodes text\nenc = SimpleBytePairEncoding.from_tiktoken(\"\ + cl100k_base\")\nenc.encode(\"hello world aaaaaaaaaaaa\")\n```\n\n\n## Extending\ + \ tiktoken\n\nYou may wish to extend `tiktoken` to support new encodings.\ + \ There are two ways to do this.\n\n\n**Create your `Encoding` object exactly\ + \ the way you want and simply pass it around.**\n\n```python\ncl100k_base\ + \ = tiktoken.get_encoding(\"cl100k_base\")\n\n# In production, load the\ + \ arguments directly instead of accessing private attributes\n# See openai_public.py\ + \ for examples of arguments for specific encodings\nenc = tiktoken.Encoding(\n\ + \ # If you're changing the set of special tokens, make sure to use a\ + \ different name\n # It should be clear from the name what behaviour\ + \ to expect.\n name=\"cl100k_im\",\n pat_str=cl100k_base._pat_str,\n\ + \ mergeable_ranks=cl100k_base._mergeable_ranks,\n special_tokens={\n\ + \ **cl100k_base._special_tokens,\n \"<|im_start|>\": 100264,\n\ + \ \"<|im_end|>\": 100265,\n }\n)\n```\n\n**Use the `tiktoken_ext`\ + \ plugin mechanism to register your `Encoding` objects with `tiktoken`.**\n\ + \nThis is only useful if you need `tiktoken.get_encoding` to find your encoding,\ + \ otherwise prefer\noption 1.\n\nTo do this, you'll need to create a namespace\ + \ package under `tiktoken_ext`.\n\nLayout your project like this, making\ + \ sure to omit the `tiktoken_ext/__init__.py` file:\n```\nmy_tiktoken_extension\n\ + ├── tiktoken_ext\n│   └── my_encodings.py\n└── setup.py\n```\n\n`my_encodings.py`\ + \ should be a module that contains a variable named `ENCODING_CONSTRUCTORS`.\n\ + This is a dictionary from an encoding name to a function that takes no arguments\ + \ and returns\narguments that can be passed to `tiktoken.Encoding` to construct\ + \ that encoding. For an example, see\n`tiktoken_ext/openai_public.py`. For\ + \ precise details, see `tiktoken/registry.py`.\n\nYour `setup.py` should\ + \ look something like this:\n```python\nfrom setuptools import setup, find_namespace_packages\n\ + \nsetup(\n name=\"my_tiktoken_extension\",\n packages=find_namespace_packages(include=['tiktoken_ext*']),\n\ + \ install_requires=[\"tiktoken\"],\n ...\n)\n```\n\nThen simply `pip\ + \ install ./my_tiktoken_extension` and you should be able to use your\n\ + custom encodings! Make sure **not** to use an editable install.\n\n\n\n\ + If you'd like to retry the search, try changing the query to increase the\ + \ likelihood of a match." + server_label: gitmcp_tiktoken + status: completed + type: mcp_call + - content: [] + encrypted_content: gAAAAABq2zjOa8-gQ4LtbZh0cpdwR00mc1Z_kIbTag0rkY_SdozVpozjBK1SkI7Rma55Q1CJYM-PYpjR7a-mAtb3uthASyEFf1Y0lInm7w90EXt44H5xUcp483XqP8KZOnJKGPpLSblPvxE8lVJVBHKsY6syXjH1hVolr3eGRW7WXkBuWuPC4x0r3bbS8WkfGXDqc3s4dYqr3-3dNFxk97xrXLkEc80upAC8SAbV5CixRD-RdysHvI85wDZMFhJTLCT3J6ocOtA8m5B68N21VgnlGsJx2QSk5KGaDXiJx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3MQe5sfsqjmNFh1laHJxWU7PkohoFn44xD3EyKpd2GSs5uOSvhUrWjzluzufSX8mRiQFPxa6z-lGqwaC7QTq8fd875Js-8WUYsOCa7CGzKOzjjl3T0sZ734qI3No6VL105P2Wr0AaRXD43IWEG6tgHNyrjimOVM_n-zCEtD55dw0grhvE7B5NqKHlYoqljk4YFsFrnC308YhazZfNlw3LhhuyjFBOHFgPlJUF0serad13HcNNutE2R2w1otj4czo0-TQIWhD4qBSB6usoj5_jUKxgu8cbiq6MZi1dic_Uo4b8hdEY1c-1anwu3pbao-U4REeFK3A678E5QNeb0cbD_bdB_f09NmrVNZQLhSI5x2wvMnnvvumLyvvBNUrYOfY40TFnFA5iXFU_nFSb4XmqE4wUKyP_9h8rGJ6FMqt0rXM8Iuk1OLHQvvvWVBjCt3hmNAE-qEhkyg-HtxFemNgRJFr31IPeJpo_hPrLChDi9Q6asn4H2x5IsB4fOMz2rKk3ps6xoen9tYIxOLMK46vyeikivixtKGGdGb4FOlRgS1XQY1LhZwT-Rmo5FiqCVJ59Ohqg6EWBBxnzlpdCOVz0DYPuZVy6UwRloPv9iheoSxSk9Jw3r6H_x00JGRMuZew1bBNLzPtL7Gf91Z4sYX7HnTl7eWh2TtV26tDweUwo_sc9Ym4DHMsLMRpzSSrXjSr0jfEWhsFCW5moqxmyJUZYwQOsiLPHsD7nePwWXDqVHoXELiHwALPxspI8eKGKv5ZGeEgCg131cJMyvz9LtOB56RLZgDKsNkN5ilW-20LHDvoSnKJxZhlHbMyFRlC5k7n60AaiFFU8GXXfWgV5QmTJuVCV9H7ix8rlW7dVRilOfJ-dQ0feWWvzKECaggbly4i_XbbMzJcHe5TUuazvEo= + id: rs_028582086f036f90006adb38caf05087d0b82880a44827ea47 + summary: [] + type: reasoning + - content: + - annotations: + - end_index: 261 + start_index: 182 + title: Releases · vllm-project/vllm · GitHub + type: url_citation + url: https://github.com/vllm-project/vllm/releases?utm_source=openai + logprobs: [] + text: '- **Web search:** Results surfaced vLLM’s official GitHub releases + page, while a secondary release tracker identifies **vLLM 0.32.0**, dated + October 18, 2026, as the latest release. ([github.com](https://github.com/vllm-project/vllm/releases?utm_source=openai)) + + - **tiktoken documentation:** No direct match for “encoding” was found, + but fallback documentation covered retrieving standard encodings, selecting + model-specific encodings, and creating or registering custom `Encoding` + objects.' + type: output_text + id: msg_028582086f036f90006adb38cca54487d09c437c871528144a + phase: final_answer + role: assistant + status: completed + type: message + parallel_tool_calls: true + presence_penalty: 0.0 + previous_response_id: resp_028582086f036f90006adb38b6924887d09b92d1e117ec7697 + prompt_cache_key: null + prompt_cache_retention: 24h + reasoning: + context: all_turns + effort: medium + mode: standard + summary: null + safety_identifier: null + service_tier: default + status: completed + store: true + temperature: 1.0 + text: + format: + type: text + verbosity: medium + tool_choice: auto + tool_usage: + image_gen: + input_tokens: 0 + input_tokens_details: + image_tokens: 0 + text_tokens: 0 + output_tokens: 0 + output_tokens_details: + image_tokens: 0 + text_tokens: 0 + total_tokens: 0 + web_search: + num_requests: 1 + tools: + - search_content_types: + - text + search_context_size: medium + type: web_search_preview + user_location: + city: null + country: US + region: null + timezone: null + type: approximate + - allowed_tools: + - search_tiktoken_documentation + headers: null + require_approval: never + server_description: null + server_label: gitmcp_tiktoken + server_url: https://gitmcp.io/openai/tiktoken + type: mcp + top_logprobs: 0 + top_p: 0.98 + truncation: disabled + usage: + input_tokens: 25809 + input_tokens_details: + cache_write_tokens: 0 + cached_tokens: 17024 + output_tokens: 357 + output_tokens_details: + reasoning_tokens: 211 + total_tokens: 26166 + user: null + headers: + content-type: application/json + status_code: 200 +- filename: t6 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_028582086f036f90006adb38c3b06487d0963b8de31aa5af01/input_items + query_params: + limit: '100' + order: asc + response: + body: + data: + - content: + - text: 'Do two separate web_search calls in parallel, in this single turn + -- do not wait for one to finish before starting the other. The first + web_search call must batch two exact queries together: "potato nutrition + facts" and "tomato nutrition facts". The second web_search call must batch + two different exact queries together: "cucumber nutrition facts" and "carrot + nutrition facts". Issue both calls now, then summarize each of the four + results in one sentence.' + type: input_text + id: msg_028582086f036f90006adb38a62ee087d0b021d27a63342ecb + role: user + status: completed + type: message + - id: mcpl_028582086f036f90006adb38a6333c87d0a7527c0158e5d25b + server_label: gitmcp_tiktoken + tools: + - annotations: + read_only: false + description: 'Semantically search within the fetched documentation from + GitHub repository: openai/tiktoken. Useful for specific queries.' + input_schema: + $schema: http://json-schema.org/draft-07/schema# + additionalProperties: false + properties: + query: + description: The search query to find relevant documentation + type: string + required: + - query + type: object + name: search_tiktoken_documentation + type: mcp_list_tools + - content: [] + id: rs_028582086f036f90006adb38a8933c87d09fb12987127552e3 + summary: [] + type: reasoning + - action: + queries: + - potato nutrition facts + - tomato nutrition facts + query: potato nutrition facts + type: search + id: ws_028582086f036f90006adb38a91ca087d0bdb5f35f1d6bf3e9 + status: completed + type: web_search_call + - action: + queries: + - cucumber nutrition facts + - carrot nutrition facts + query: cucumber nutrition facts + type: search + id: ws_028582086f036f90006adb38ac260887d09b71c0ad11d3f615 + status: completed + type: web_search_call + - content: [] + id: rs_028582086f036f90006adb38b00b5087d0b3420318146f3aa4 + summary: [] + type: reasoning + - action: + type: open_page + url: https://www.fda.gov/media/76886/download + id: ws_028582086f036f90006adb38b192c087d0acac3b7f7a3a0fa3 + status: completed + type: web_search_call + - content: + - annotations: + - end_index: 262 + start_index: 134 + title: Nutrition Information for Raw Vegetables | FDA + type: url_citation + url: https://www.fda.gov/food/nutrition-food-labeling-and-critical-foods/nutrition-information-raw-vegetables?source=foo + - end_index: 528 + start_index: 400 + title: Nutrition Information for Raw Vegetables | FDA + type: url_citation + url: https://www.fda.gov/food/nutrition-food-labeling-and-critical-foods/nutrition-information-raw-vegetables?source=foo + - end_index: 808 + start_index: 680 + title: Nutrition Information for Raw Vegetables | FDA + type: url_citation + url: https://www.fda.gov/food/nutrition-food-labeling-and-critical-foods/nutrition-information-raw-vegetables?source=foo + - end_index: 1073 + start_index: 945 + title: Nutrition Information for Raw Vegetables | FDA + type: url_citation + url: https://www.fda.gov/food/nutrition-food-labeling-and-critical-foods/nutrition-information-raw-vegetables?source=foo + logprobs: [] + text: '- **Potato:** One medium raw potato (148 g) has about 110 calories, + 26 g carbohydrates, 2 g fiber, 3 g protein, and 620 mg potassium. ([fda.gov](https://www.fda.gov/food/nutrition-food-labeling-and-critical-foods/nutrition-information-raw-vegetables?source=foo)) + + - **Tomato:** One medium raw tomato (148 g) provides about 25 calories, + 5 g carbohydrates, 1 g fiber, 1 g protein, and 340 mg potassium. ([fda.gov](https://www.fda.gov/food/nutrition-food-labeling-and-critical-foods/nutrition-information-raw-vegetables?source=foo)) + + - **Cucumber:** One-third of a medium raw cucumber (99 g) contains about + 10 calories, 2 g carbohydrates, 1 g fiber, 1 g protein, and 140 mg potassium. + ([fda.gov](https://www.fda.gov/food/nutrition-food-labeling-and-critical-foods/nutrition-information-raw-vegetables?source=foo)) + + - **Carrot:** One raw 7-inch carrot (78 g) supplies about 30 calories, + 7 g carbohydrates, 2 g fiber, 1 g protein, and 250 mg potassium. ([fda.gov](https://www.fda.gov/food/nutrition-food-labeling-and-critical-foods/nutrition-information-raw-vegetables?source=foo))' + type: output_text + id: msg_028582086f036f90006adb38b32cd487d0b059e5f3d6a1898e + phase: final_answer + role: assistant + status: completed + type: message + - content: + - text: 'Call gitmcp_tiktoken__search_tiktoken_documentation in parallel for + two separate exact queries -- do not wait for one to finish before starting + the other: (1) {"query":"encoding"} and (2) {"query":"tokenizer"}. Issue + both calls now in this single turn, then summarize each result in one + sentence.' + type: input_text + id: msg_028582086f036f90006adb38b6b01c87d0b98150cd87c47ffd + role: user + status: completed + type: message + - content: [] + id: rs_028582086f036f90006adb38b9043c87d0a251db279fc9b317 + summary: [] + type: reasoning + - approval_request_id: null + arguments: '{"query":"encoding"}' + error: null + id: mcp_028582086f036f90006adb38b95aa487d09c3039d3a5c93662 + name: search_tiktoken_documentation + output: "### Search Results for: \"encoding\"\n\nNo relevant documentation\ + \ found for your query. It's either being indexed or the search query did\ + \ not match any documentation.\n\nAs a fallback, this is the documentation\ + \ for openai/tiktoken:\n\n# ⏳ tiktoken\n\ntiktoken is a fast [BPE](https://en.wikipedia.org/wiki/Byte_pair_encoding)\ + \ tokeniser for use with\nOpenAI's models.\n\n```python\nimport tiktoken\n\ + enc = tiktoken.get_encoding(\"o200k_base\")\nassert enc.decode(enc.encode(\"\ + hello world\")) == \"hello world\"\n\n# To get the tokeniser corresponding\ + \ to a specific model in the OpenAI API:\nenc = tiktoken.encoding_for_model(\"\ + gpt-4o\")\n```\n\nThe open source version of `tiktoken` can be installed\ + \ from [PyPI](https://pypi.org/project/tiktoken):\n```\npip install tiktoken\n\ + ```\n\nThe tokeniser API is documented in `tiktoken/core.py`.\n\nExample\ + \ code using `tiktoken` can be found in the\n[OpenAI Cookbook](https://github.com/openai/openai-cookbook/blob/main/examples/How_to_count_tokens_with_tiktoken.ipynb).\n\ + \n\n## Performance\n\n`tiktoken` is between 3-6x faster than a comparable\ + \ open source tokeniser:\n\n![image](https://raw.githubusercontent.com/openai/tiktoken/main/perf.svg)\n\ + \nPerformance measured on 1GB of text using the GPT-2 tokeniser, using `GPT2TokenizerFast`\ + \ from\n`tokenizers==0.13.2`, `transformers==4.24.0` and `tiktoken==0.2.0`.\n\ + \n\n## Getting help\n\nPlease post questions in the [issue tracker](https://github.com/openai/tiktoken/issues).\n\ + \nIf you work at OpenAI, make sure to check the internal documentation or\ + \ feel free to contact\n@shantanu.\n\n## What is BPE anyway?\n\nLanguage\ + \ models don't see text like you and I, instead they see a sequence of numbers\ + \ (known as tokens).\nByte pair encoding (BPE) is a way of converting text\ + \ into tokens. It has a couple desirable\nproperties:\n1) It's reversible\ + \ and lossless, so you can convert tokens back into the original text\n\ + 2) It works on arbitrary text, even text that is not in the tokeniser's\ + \ training data\n3) It compresses the text: the token sequence is shorter\ + \ than the bytes corresponding to the\n original text. On average, in\ + \ practice, each token corresponds to about 4 bytes.\n4) It attempts to\ + \ let the model see common subwords. For instance, \"ing\" is a common subword\ + \ in\n English, so BPE encodings will often split \"encoding\" into tokens\ + \ like \"encod\" and \"ing\"\n (instead of e.g. \"enc\" and \"oding\"\ + ). Because the model will then see the \"ing\" token again and\n again\ + \ in different contexts, it helps models generalise and better understand\ + \ grammar.\n\n`tiktoken` contains an educational submodule that is friendlier\ + \ if you want to learn more about\nthe details of BPE, including code that\ + \ helps visualise the BPE procedure:\n```python\nfrom tiktoken._educational\ + \ import *\n\n# Train a BPE tokeniser on a small amount of text\nenc = train_simple_encoding()\n\ + \n# Visualise how the GPT-4 encoder encodes text\nenc = SimpleBytePairEncoding.from_tiktoken(\"\ + cl100k_base\")\nenc.encode(\"hello world aaaaaaaaaaaa\")\n```\n\n\n## Extending\ + \ tiktoken\n\nYou may wish to extend `tiktoken` to support new encodings.\ + \ There are two ways to do this.\n\n\n**Create your `Encoding` object exactly\ + \ the way you want and simply pass it around.**\n\n```python\ncl100k_base\ + \ = tiktoken.get_encoding(\"cl100k_base\")\n\n# In production, load the\ + \ arguments directly instead of accessing private attributes\n# See openai_public.py\ + \ for examples of arguments for specific encodings\nenc = tiktoken.Encoding(\n\ + \ # If you're changing the set of special tokens, make sure to use a\ + \ different name\n # It should be clear from the name what behaviour\ + \ to expect.\n name=\"cl100k_im\",\n pat_str=cl100k_base._pat_str,\n\ + \ mergeable_ranks=cl100k_base._mergeable_ranks,\n special_tokens={\n\ + \ **cl100k_base._special_tokens,\n \"<|im_start|>\": 100264,\n\ + \ \"<|im_end|>\": 100265,\n }\n)\n```\n\n**Use the `tiktoken_ext`\ + \ plugin mechanism to register your `Encoding` objects with `tiktoken`.**\n\ + \nThis is only useful if you need `tiktoken.get_encoding` to find your encoding,\ + \ otherwise prefer\noption 1.\n\nTo do this, you'll need to create a namespace\ + \ package under `tiktoken_ext`.\n\nLayout your project like this, making\ + \ sure to omit the `tiktoken_ext/__init__.py` file:\n```\nmy_tiktoken_extension\n\ + ├── tiktoken_ext\n│   └── my_encodings.py\n└── setup.py\n```\n\n`my_encodings.py`\ + \ should be a module that contains a variable named `ENCODING_CONSTRUCTORS`.\n\ + This is a dictionary from an encoding name to a function that takes no arguments\ + \ and returns\narguments that can be passed to `tiktoken.Encoding` to construct\ + \ that encoding. For an example, see\n`tiktoken_ext/openai_public.py`. For\ + \ precise details, see `tiktoken/registry.py`.\n\nYour `setup.py` should\ + \ look something like this:\n```python\nfrom setuptools import setup, find_namespace_packages\n\ + \nsetup(\n name=\"my_tiktoken_extension\",\n packages=find_namespace_packages(include=['tiktoken_ext*']),\n\ + \ install_requires=[\"tiktoken\"],\n ...\n)\n```\n\nThen simply `pip\ + \ install ./my_tiktoken_extension` and you should be able to use your\n\ + custom encodings! Make sure **not** to use an editable install.\n\n\n\n\ + If you'd like to retry the search, try changing the query to increase the\ + \ likelihood of a match." + server_label: gitmcp_tiktoken + status: completed + type: mcp_call + - approval_request_id: null + arguments: '{"query":"tokenizer"}' + error: null + id: mcp_028582086f036f90006adb38bddf1887d09e788e30fc1cdc50 + name: search_tiktoken_documentation + output: "### Search Results for: \"tokenizer\"\n\nNo relevant documentation\ + \ found for your query. It's either being indexed or the search query did\ + \ not match any documentation.\n\nAs a fallback, this is the documentation\ + \ for openai/tiktoken:\n\n# ⏳ tiktoken\n\ntiktoken is a fast [BPE](https://en.wikipedia.org/wiki/Byte_pair_encoding)\ + \ tokeniser for use with\nOpenAI's models.\n\n```python\nimport tiktoken\n\ + enc = tiktoken.get_encoding(\"o200k_base\")\nassert enc.decode(enc.encode(\"\ + hello world\")) == \"hello world\"\n\n# To get the tokeniser corresponding\ + \ to a specific model in the OpenAI API:\nenc = tiktoken.encoding_for_model(\"\ + gpt-4o\")\n```\n\nThe open source version of `tiktoken` can be installed\ + \ from [PyPI](https://pypi.org/project/tiktoken):\n```\npip install tiktoken\n\ + ```\n\nThe tokeniser API is documented in `tiktoken/core.py`.\n\nExample\ + \ code using `tiktoken` can be found in the\n[OpenAI Cookbook](https://github.com/openai/openai-cookbook/blob/main/examples/How_to_count_tokens_with_tiktoken.ipynb).\n\ + \n\n## Performance\n\n`tiktoken` is between 3-6x faster than a comparable\ + \ open source tokeniser:\n\n![image](https://raw.githubusercontent.com/openai/tiktoken/main/perf.svg)\n\ + \nPerformance measured on 1GB of text using the GPT-2 tokeniser, using `GPT2TokenizerFast`\ + \ from\n`tokenizers==0.13.2`, `transformers==4.24.0` and `tiktoken==0.2.0`.\n\ + \n\n## Getting help\n\nPlease post questions in the [issue tracker](https://github.com/openai/tiktoken/issues).\n\ + \nIf you work at OpenAI, make sure to check the internal documentation or\ + \ feel free to contact\n@shantanu.\n\n## What is BPE anyway?\n\nLanguage\ + \ models don't see text like you and I, instead they see a sequence of numbers\ + \ (known as tokens).\nByte pair encoding (BPE) is a way of converting text\ + \ into tokens. It has a couple desirable\nproperties:\n1) It's reversible\ + \ and lossless, so you can convert tokens back into the original text\n\ + 2) It works on arbitrary text, even text that is not in the tokeniser's\ + \ training data\n3) It compresses the text: the token sequence is shorter\ + \ than the bytes corresponding to the\n original text. On average, in\ + \ practice, each token corresponds to about 4 bytes.\n4) It attempts to\ + \ let the model see common subwords. For instance, \"ing\" is a common subword\ + \ in\n English, so BPE encodings will often split \"encoding\" into tokens\ + \ like \"encod\" and \"ing\"\n (instead of e.g. \"enc\" and \"oding\"\ + ). Because the model will then see the \"ing\" token again and\n again\ + \ in different contexts, it helps models generalise and better understand\ + \ grammar.\n\n`tiktoken` contains an educational submodule that is friendlier\ + \ if you want to learn more about\nthe details of BPE, including code that\ + \ helps visualise the BPE procedure:\n```python\nfrom tiktoken._educational\ + \ import *\n\n# Train a BPE tokeniser on a small amount of text\nenc = train_simple_encoding()\n\ + \n# Visualise how the GPT-4 encoder encodes text\nenc = SimpleBytePairEncoding.from_tiktoken(\"\ + cl100k_base\")\nenc.encode(\"hello world aaaaaaaaaaaa\")\n```\n\n\n## Extending\ + \ tiktoken\n\nYou may wish to extend `tiktoken` to support new encodings.\ + \ There are two ways to do this.\n\n\n**Create your `Encoding` object exactly\ + \ the way you want and simply pass it around.**\n\n```python\ncl100k_base\ + \ = tiktoken.get_encoding(\"cl100k_base\")\n\n# In production, load the\ + \ arguments directly instead of accessing private attributes\n# See openai_public.py\ + \ for examples of arguments for specific encodings\nenc = tiktoken.Encoding(\n\ + \ # If you're changing the set of special tokens, make sure to use a\ + \ different name\n # It should be clear from the name what behaviour\ + \ to expect.\n name=\"cl100k_im\",\n pat_str=cl100k_base._pat_str,\n\ + \ mergeable_ranks=cl100k_base._mergeable_ranks,\n special_tokens={\n\ + \ **cl100k_base._special_tokens,\n \"<|im_start|>\": 100264,\n\ + \ \"<|im_end|>\": 100265,\n }\n)\n```\n\n**Use the `tiktoken_ext`\ + \ plugin mechanism to register your `Encoding` objects with `tiktoken`.**\n\ + \nThis is only useful if you need `tiktoken.get_encoding` to find your encoding,\ + \ otherwise prefer\noption 1.\n\nTo do this, you'll need to create a namespace\ + \ package under `tiktoken_ext`.\n\nLayout your project like this, making\ + \ sure to omit the `tiktoken_ext/__init__.py` file:\n```\nmy_tiktoken_extension\n\ + ├── tiktoken_ext\n│   └── my_encodings.py\n└── setup.py\n```\n\n`my_encodings.py`\ + \ should be a module that contains a variable named `ENCODING_CONSTRUCTORS`.\n\ + This is a dictionary from an encoding name to a function that takes no arguments\ + \ and returns\narguments that can be passed to `tiktoken.Encoding` to construct\ + \ that encoding. For an example, see\n`tiktoken_ext/openai_public.py`. For\ + \ precise details, see `tiktoken/registry.py`.\n\nYour `setup.py` should\ + \ look something like this:\n```python\nfrom setuptools import setup, find_namespace_packages\n\ + \nsetup(\n name=\"my_tiktoken_extension\",\n packages=find_namespace_packages(include=['tiktoken_ext*']),\n\ + \ install_requires=[\"tiktoken\"],\n ...\n)\n```\n\nThen simply `pip\ + \ install ./my_tiktoken_extension` and you should be able to use your\n\ + custom encodings! Make sure **not** to use an editable install.\n\n\n\n\ + If you'd like to retry the search, try changing the query to increase the\ + \ likelihood of a match." + server_label: gitmcp_tiktoken + status: completed + type: mcp_call + - content: + - annotations: [] + logprobs: [] + text: '- **“encoding”:** No direct match was found, but the fallback documentation + explains how to retrieve, use, customize, and register tiktoken `Encoding` + objects. + + - **“tokenizer”:** No direct match was found, but the fallback describes + tiktoken as a fast, reversible BPE tokenizer for OpenAI models, with model-specific + selection via `encoding_for_model()`.' + type: output_text + id: msg_028582086f036f90006adb38c1ba9887d082bf4912bcf37cc9 + phase: final_answer + role: assistant + status: completed + type: message + - content: + - text: 'Do both of these right now, in parallel, in this single turn -- do + not wait for one to finish before starting the other: (1) search the web + for the exact query "latest vLLM release notes", and (2) call gitmcp_tiktoken__search_tiktoken_documentation + with {"query":"encoding"}. Do not call any other tool.' + type: input_text + id: msg_028582086f036f90006adb38c3bfd487d09a64dac3753227b8 + role: user + status: completed + type: message + first_id: msg_028582086f036f90006adb38a62ee087d0b021d27a63342ecb + has_more: false + last_id: msg_028582086f036f90006adb38c3bfd487d09a64dac3753227b8 + object: list + headers: + content-type: application/json + status_code: 200 +- filename: t7 + request: + body: + input: + - content: Do not call tools again. Reply only OK. + role: user + type: message + max_output_tokens: 2048 + model: gpt-5.6 + parallel_tool_calls: true + previous_response_id: resp_028582086f036f90006adb38c3b06487d0963b8de31aa5af01 + store: true + stream: false + tool_choice: none + tools: + - type: web_search_preview + - allowed_tools: + - search_tiktoken_documentation + require_approval: never + server_label: gitmcp_tiktoken + server_url: https://gitmcp.io/openai/tiktoken + type: mcp + headers: + accept: '*/*' + authorization: Bearer *** + content-type: application/json + user-agent: python-httpx/0.28.1 + method: POST + path: /v1/responses + query_params: {} + response: + body: + access_programs: null + background: false + billing: + payer: developer + completed_at: 1792751825 + created_at: 1792751824 + error: null + frequency_penalty: 0.0 + id: resp_028582086f036f90006adb38cff3c487d0919c6ee4e9c0fb06 + incomplete_details: null + instructions: null + max_output_tokens: 2048 + max_tool_calls: null + metadata: {} + model: gpt-5.6-sol + moderation: null + object: response + output: + - content: + - annotations: [] + logprobs: [] + text: OK + type: output_text + id: msg_028582086f036f90006adb38d0d3a087d0b8ef41aedd71f9b4 + phase: final_answer + role: assistant + status: completed + type: message + parallel_tool_calls: true + presence_penalty: 0.0 + previous_response_id: resp_028582086f036f90006adb38c3b06487d0963b8de31aa5af01 + prompt_cache_key: null + prompt_cache_retention: 24h + reasoning: + context: all_turns + effort: medium + mode: standard + summary: null + safety_identifier: null + service_tier: default + status: completed + store: true + temperature: 1.0 + text: + format: + type: text + verbosity: medium + tool_choice: none + tool_usage: + image_gen: + input_tokens: 0 + input_tokens_details: + image_tokens: 0 + text_tokens: 0 + output_tokens: 0 + output_tokens_details: + image_tokens: 0 + text_tokens: 0 + total_tokens: 0 + web_search: + num_requests: 0 + tools: + - search_content_types: + - text + search_context_size: medium + type: web_search_preview + user_location: + city: null + country: US + region: null + timezone: null + type: approximate + - allowed_tools: + - search_tiktoken_documentation + headers: null + require_approval: never + server_description: null + server_label: gitmcp_tiktoken + server_url: https://gitmcp.io/openai/tiktoken + type: mcp + top_logprobs: 0 + top_p: 0.98 + truncation: disabled + usage: + input_tokens: 26091 + input_tokens_details: + cache_write_tokens: 0 + cached_tokens: 24064 + output_tokens: 5 + output_tokens_details: + reasoning_tokens: 0 + total_tokens: 26096 + user: null + headers: + content-type: application/json + status_code: 200 +- filename: t8 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_028582086f036f90006adb38cff3c487d0919c6ee4e9c0fb06/input_items + query_params: + limit: '100' + order: asc + response: + body: + data: + - content: + - text: 'Do two separate web_search calls in parallel, in this single turn + -- do not wait for one to finish before starting the other. The first + web_search call must batch two exact queries together: "potato nutrition + facts" and "tomato nutrition facts". The second web_search call must batch + two different exact queries together: "cucumber nutrition facts" and "carrot + nutrition facts". Issue both calls now, then summarize each of the four + results in one sentence.' + type: input_text + id: msg_028582086f036f90006adb38a62ee087d0b021d27a63342ecb + role: user + status: completed + type: message + - id: mcpl_028582086f036f90006adb38a6333c87d0a7527c0158e5d25b + server_label: gitmcp_tiktoken + tools: + - annotations: + read_only: false + description: 'Semantically search within the fetched documentation from + GitHub repository: openai/tiktoken. Useful for specific queries.' + input_schema: + $schema: http://json-schema.org/draft-07/schema# + additionalProperties: false + properties: + query: + description: The search query to find relevant documentation + type: string + required: + - query + type: object + name: search_tiktoken_documentation + type: mcp_list_tools + - content: [] + id: rs_028582086f036f90006adb38a8933c87d09fb12987127552e3 + summary: [] + type: reasoning + - action: + queries: + - potato nutrition facts + - tomato nutrition facts + query: potato nutrition facts + type: search + id: ws_028582086f036f90006adb38a91ca087d0bdb5f35f1d6bf3e9 + status: completed + type: web_search_call + - action: + queries: + - cucumber nutrition facts + - carrot nutrition facts + query: cucumber nutrition facts + type: search + id: ws_028582086f036f90006adb38ac260887d09b71c0ad11d3f615 + status: completed + type: web_search_call + - content: [] + id: rs_028582086f036f90006adb38b00b5087d0b3420318146f3aa4 + summary: [] + type: reasoning + - action: + type: open_page + url: https://www.fda.gov/media/76886/download + id: ws_028582086f036f90006adb38b192c087d0acac3b7f7a3a0fa3 + status: completed + type: web_search_call + - content: + - annotations: + - end_index: 262 + start_index: 134 + title: Nutrition Information for Raw Vegetables | FDA + type: url_citation + url: https://www.fda.gov/food/nutrition-food-labeling-and-critical-foods/nutrition-information-raw-vegetables?source=foo + - end_index: 528 + start_index: 400 + title: Nutrition Information for Raw Vegetables | FDA + type: url_citation + url: https://www.fda.gov/food/nutrition-food-labeling-and-critical-foods/nutrition-information-raw-vegetables?source=foo + - end_index: 808 + start_index: 680 + title: Nutrition Information for Raw Vegetables | FDA + type: url_citation + url: https://www.fda.gov/food/nutrition-food-labeling-and-critical-foods/nutrition-information-raw-vegetables?source=foo + - end_index: 1073 + start_index: 945 + title: Nutrition Information for Raw Vegetables | FDA + type: url_citation + url: https://www.fda.gov/food/nutrition-food-labeling-and-critical-foods/nutrition-information-raw-vegetables?source=foo + logprobs: [] + text: '- **Potato:** One medium raw potato (148 g) has about 110 calories, + 26 g carbohydrates, 2 g fiber, 3 g protein, and 620 mg potassium. ([fda.gov](https://www.fda.gov/food/nutrition-food-labeling-and-critical-foods/nutrition-information-raw-vegetables?source=foo)) + + - **Tomato:** One medium raw tomato (148 g) provides about 25 calories, + 5 g carbohydrates, 1 g fiber, 1 g protein, and 340 mg potassium. ([fda.gov](https://www.fda.gov/food/nutrition-food-labeling-and-critical-foods/nutrition-information-raw-vegetables?source=foo)) + + - **Cucumber:** One-third of a medium raw cucumber (99 g) contains about + 10 calories, 2 g carbohydrates, 1 g fiber, 1 g protein, and 140 mg potassium. + ([fda.gov](https://www.fda.gov/food/nutrition-food-labeling-and-critical-foods/nutrition-information-raw-vegetables?source=foo)) + + - **Carrot:** One raw 7-inch carrot (78 g) supplies about 30 calories, + 7 g carbohydrates, 2 g fiber, 1 g protein, and 250 mg potassium. ([fda.gov](https://www.fda.gov/food/nutrition-food-labeling-and-critical-foods/nutrition-information-raw-vegetables?source=foo))' + type: output_text + id: msg_028582086f036f90006adb38b32cd487d0b059e5f3d6a1898e + phase: final_answer + role: assistant + status: completed + type: message + - content: + - text: 'Call gitmcp_tiktoken__search_tiktoken_documentation in parallel for + two separate exact queries -- do not wait for one to finish before starting + the other: (1) {"query":"encoding"} and (2) {"query":"tokenizer"}. Issue + both calls now in this single turn, then summarize each result in one + sentence.' + type: input_text + id: msg_028582086f036f90006adb38b6b01c87d0b98150cd87c47ffd + role: user + status: completed + type: message + - content: [] + id: rs_028582086f036f90006adb38b9043c87d0a251db279fc9b317 + summary: [] + type: reasoning + - approval_request_id: null + arguments: '{"query":"encoding"}' + error: null + id: mcp_028582086f036f90006adb38b95aa487d09c3039d3a5c93662 + name: search_tiktoken_documentation + output: "### Search Results for: \"encoding\"\n\nNo relevant documentation\ + \ found for your query. It's either being indexed or the search query did\ + \ not match any documentation.\n\nAs a fallback, this is the documentation\ + \ for openai/tiktoken:\n\n# ⏳ tiktoken\n\ntiktoken is a fast [BPE](https://en.wikipedia.org/wiki/Byte_pair_encoding)\ + \ tokeniser for use with\nOpenAI's models.\n\n```python\nimport tiktoken\n\ + enc = tiktoken.get_encoding(\"o200k_base\")\nassert enc.decode(enc.encode(\"\ + hello world\")) == \"hello world\"\n\n# To get the tokeniser corresponding\ + \ to a specific model in the OpenAI API:\nenc = tiktoken.encoding_for_model(\"\ + gpt-4o\")\n```\n\nThe open source version of `tiktoken` can be installed\ + \ from [PyPI](https://pypi.org/project/tiktoken):\n```\npip install tiktoken\n\ + ```\n\nThe tokeniser API is documented in `tiktoken/core.py`.\n\nExample\ + \ code using `tiktoken` can be found in the\n[OpenAI Cookbook](https://github.com/openai/openai-cookbook/blob/main/examples/How_to_count_tokens_with_tiktoken.ipynb).\n\ + \n\n## Performance\n\n`tiktoken` is between 3-6x faster than a comparable\ + \ open source tokeniser:\n\n![image](https://raw.githubusercontent.com/openai/tiktoken/main/perf.svg)\n\ + \nPerformance measured on 1GB of text using the GPT-2 tokeniser, using `GPT2TokenizerFast`\ + \ from\n`tokenizers==0.13.2`, `transformers==4.24.0` and `tiktoken==0.2.0`.\n\ + \n\n## Getting help\n\nPlease post questions in the [issue tracker](https://github.com/openai/tiktoken/issues).\n\ + \nIf you work at OpenAI, make sure to check the internal documentation or\ + \ feel free to contact\n@shantanu.\n\n## What is BPE anyway?\n\nLanguage\ + \ models don't see text like you and I, instead they see a sequence of numbers\ + \ (known as tokens).\nByte pair encoding (BPE) is a way of converting text\ + \ into tokens. It has a couple desirable\nproperties:\n1) It's reversible\ + \ and lossless, so you can convert tokens back into the original text\n\ + 2) It works on arbitrary text, even text that is not in the tokeniser's\ + \ training data\n3) It compresses the text: the token sequence is shorter\ + \ than the bytes corresponding to the\n original text. On average, in\ + \ practice, each token corresponds to about 4 bytes.\n4) It attempts to\ + \ let the model see common subwords. For instance, \"ing\" is a common subword\ + \ in\n English, so BPE encodings will often split \"encoding\" into tokens\ + \ like \"encod\" and \"ing\"\n (instead of e.g. \"enc\" and \"oding\"\ + ). Because the model will then see the \"ing\" token again and\n again\ + \ in different contexts, it helps models generalise and better understand\ + \ grammar.\n\n`tiktoken` contains an educational submodule that is friendlier\ + \ if you want to learn more about\nthe details of BPE, including code that\ + \ helps visualise the BPE procedure:\n```python\nfrom tiktoken._educational\ + \ import *\n\n# Train a BPE tokeniser on a small amount of text\nenc = train_simple_encoding()\n\ + \n# Visualise how the GPT-4 encoder encodes text\nenc = SimpleBytePairEncoding.from_tiktoken(\"\ + cl100k_base\")\nenc.encode(\"hello world aaaaaaaaaaaa\")\n```\n\n\n## Extending\ + \ tiktoken\n\nYou may wish to extend `tiktoken` to support new encodings.\ + \ There are two ways to do this.\n\n\n**Create your `Encoding` object exactly\ + \ the way you want and simply pass it around.**\n\n```python\ncl100k_base\ + \ = tiktoken.get_encoding(\"cl100k_base\")\n\n# In production, load the\ + \ arguments directly instead of accessing private attributes\n# See openai_public.py\ + \ for examples of arguments for specific encodings\nenc = tiktoken.Encoding(\n\ + \ # If you're changing the set of special tokens, make sure to use a\ + \ different name\n # It should be clear from the name what behaviour\ + \ to expect.\n name=\"cl100k_im\",\n pat_str=cl100k_base._pat_str,\n\ + \ mergeable_ranks=cl100k_base._mergeable_ranks,\n special_tokens={\n\ + \ **cl100k_base._special_tokens,\n \"<|im_start|>\": 100264,\n\ + \ \"<|im_end|>\": 100265,\n }\n)\n```\n\n**Use the `tiktoken_ext`\ + \ plugin mechanism to register your `Encoding` objects with `tiktoken`.**\n\ + \nThis is only useful if you need `tiktoken.get_encoding` to find your encoding,\ + \ otherwise prefer\noption 1.\n\nTo do this, you'll need to create a namespace\ + \ package under `tiktoken_ext`.\n\nLayout your project like this, making\ + \ sure to omit the `tiktoken_ext/__init__.py` file:\n```\nmy_tiktoken_extension\n\ + ├── tiktoken_ext\n│   └── my_encodings.py\n└── setup.py\n```\n\n`my_encodings.py`\ + \ should be a module that contains a variable named `ENCODING_CONSTRUCTORS`.\n\ + This is a dictionary from an encoding name to a function that takes no arguments\ + \ and returns\narguments that can be passed to `tiktoken.Encoding` to construct\ + \ that encoding. For an example, see\n`tiktoken_ext/openai_public.py`. For\ + \ precise details, see `tiktoken/registry.py`.\n\nYour `setup.py` should\ + \ look something like this:\n```python\nfrom setuptools import setup, find_namespace_packages\n\ + \nsetup(\n name=\"my_tiktoken_extension\",\n packages=find_namespace_packages(include=['tiktoken_ext*']),\n\ + \ install_requires=[\"tiktoken\"],\n ...\n)\n```\n\nThen simply `pip\ + \ install ./my_tiktoken_extension` and you should be able to use your\n\ + custom encodings! Make sure **not** to use an editable install.\n\n\n\n\ + If you'd like to retry the search, try changing the query to increase the\ + \ likelihood of a match." + server_label: gitmcp_tiktoken + status: completed + type: mcp_call + - approval_request_id: null + arguments: '{"query":"tokenizer"}' + error: null + id: mcp_028582086f036f90006adb38bddf1887d09e788e30fc1cdc50 + name: search_tiktoken_documentation + output: "### Search Results for: \"tokenizer\"\n\nNo relevant documentation\ + \ found for your query. It's either being indexed or the search query did\ + \ not match any documentation.\n\nAs a fallback, this is the documentation\ + \ for openai/tiktoken:\n\n# ⏳ tiktoken\n\ntiktoken is a fast [BPE](https://en.wikipedia.org/wiki/Byte_pair_encoding)\ + \ tokeniser for use with\nOpenAI's models.\n\n```python\nimport tiktoken\n\ + enc = tiktoken.get_encoding(\"o200k_base\")\nassert enc.decode(enc.encode(\"\ + hello world\")) == \"hello world\"\n\n# To get the tokeniser corresponding\ + \ to a specific model in the OpenAI API:\nenc = tiktoken.encoding_for_model(\"\ + gpt-4o\")\n```\n\nThe open source version of `tiktoken` can be installed\ + \ from [PyPI](https://pypi.org/project/tiktoken):\n```\npip install tiktoken\n\ + ```\n\nThe tokeniser API is documented in `tiktoken/core.py`.\n\nExample\ + \ code using `tiktoken` can be found in the\n[OpenAI Cookbook](https://github.com/openai/openai-cookbook/blob/main/examples/How_to_count_tokens_with_tiktoken.ipynb).\n\ + \n\n## Performance\n\n`tiktoken` is between 3-6x faster than a comparable\ + \ open source tokeniser:\n\n![image](https://raw.githubusercontent.com/openai/tiktoken/main/perf.svg)\n\ + \nPerformance measured on 1GB of text using the GPT-2 tokeniser, using `GPT2TokenizerFast`\ + \ from\n`tokenizers==0.13.2`, `transformers==4.24.0` and `tiktoken==0.2.0`.\n\ + \n\n## Getting help\n\nPlease post questions in the [issue tracker](https://github.com/openai/tiktoken/issues).\n\ + \nIf you work at OpenAI, make sure to check the internal documentation or\ + \ feel free to contact\n@shantanu.\n\n## What is BPE anyway?\n\nLanguage\ + \ models don't see text like you and I, instead they see a sequence of numbers\ + \ (known as tokens).\nByte pair encoding (BPE) is a way of converting text\ + \ into tokens. It has a couple desirable\nproperties:\n1) It's reversible\ + \ and lossless, so you can convert tokens back into the original text\n\ + 2) It works on arbitrary text, even text that is not in the tokeniser's\ + \ training data\n3) It compresses the text: the token sequence is shorter\ + \ than the bytes corresponding to the\n original text. On average, in\ + \ practice, each token corresponds to about 4 bytes.\n4) It attempts to\ + \ let the model see common subwords. For instance, \"ing\" is a common subword\ + \ in\n English, so BPE encodings will often split \"encoding\" into tokens\ + \ like \"encod\" and \"ing\"\n (instead of e.g. \"enc\" and \"oding\"\ + ). Because the model will then see the \"ing\" token again and\n again\ + \ in different contexts, it helps models generalise and better understand\ + \ grammar.\n\n`tiktoken` contains an educational submodule that is friendlier\ + \ if you want to learn more about\nthe details of BPE, including code that\ + \ helps visualise the BPE procedure:\n```python\nfrom tiktoken._educational\ + \ import *\n\n# Train a BPE tokeniser on a small amount of text\nenc = train_simple_encoding()\n\ + \n# Visualise how the GPT-4 encoder encodes text\nenc = SimpleBytePairEncoding.from_tiktoken(\"\ + cl100k_base\")\nenc.encode(\"hello world aaaaaaaaaaaa\")\n```\n\n\n## Extending\ + \ tiktoken\n\nYou may wish to extend `tiktoken` to support new encodings.\ + \ There are two ways to do this.\n\n\n**Create your `Encoding` object exactly\ + \ the way you want and simply pass it around.**\n\n```python\ncl100k_base\ + \ = tiktoken.get_encoding(\"cl100k_base\")\n\n# In production, load the\ + \ arguments directly instead of accessing private attributes\n# See openai_public.py\ + \ for examples of arguments for specific encodings\nenc = tiktoken.Encoding(\n\ + \ # If you're changing the set of special tokens, make sure to use a\ + \ different name\n # It should be clear from the name what behaviour\ + \ to expect.\n name=\"cl100k_im\",\n pat_str=cl100k_base._pat_str,\n\ + \ mergeable_ranks=cl100k_base._mergeable_ranks,\n special_tokens={\n\ + \ **cl100k_base._special_tokens,\n \"<|im_start|>\": 100264,\n\ + \ \"<|im_end|>\": 100265,\n }\n)\n```\n\n**Use the `tiktoken_ext`\ + \ plugin mechanism to register your `Encoding` objects with `tiktoken`.**\n\ + \nThis is only useful if you need `tiktoken.get_encoding` to find your encoding,\ + \ otherwise prefer\noption 1.\n\nTo do this, you'll need to create a namespace\ + \ package under `tiktoken_ext`.\n\nLayout your project like this, making\ + \ sure to omit the `tiktoken_ext/__init__.py` file:\n```\nmy_tiktoken_extension\n\ + ├── tiktoken_ext\n│   └── my_encodings.py\n└── setup.py\n```\n\n`my_encodings.py`\ + \ should be a module that contains a variable named `ENCODING_CONSTRUCTORS`.\n\ + This is a dictionary from an encoding name to a function that takes no arguments\ + \ and returns\narguments that can be passed to `tiktoken.Encoding` to construct\ + \ that encoding. For an example, see\n`tiktoken_ext/openai_public.py`. For\ + \ precise details, see `tiktoken/registry.py`.\n\nYour `setup.py` should\ + \ look something like this:\n```python\nfrom setuptools import setup, find_namespace_packages\n\ + \nsetup(\n name=\"my_tiktoken_extension\",\n packages=find_namespace_packages(include=['tiktoken_ext*']),\n\ + \ install_requires=[\"tiktoken\"],\n ...\n)\n```\n\nThen simply `pip\ + \ install ./my_tiktoken_extension` and you should be able to use your\n\ + custom encodings! Make sure **not** to use an editable install.\n\n\n\n\ + If you'd like to retry the search, try changing the query to increase the\ + \ likelihood of a match." + server_label: gitmcp_tiktoken + status: completed + type: mcp_call + - content: + - annotations: [] + logprobs: [] + text: '- **“encoding”:** No direct match was found, but the fallback documentation + explains how to retrieve, use, customize, and register tiktoken `Encoding` + objects. + + - **“tokenizer”:** No direct match was found, but the fallback describes + tiktoken as a fast, reversible BPE tokenizer for OpenAI models, with model-specific + selection via `encoding_for_model()`.' + type: output_text + id: msg_028582086f036f90006adb38c1ba9887d082bf4912bcf37cc9 + phase: final_answer + role: assistant + status: completed + type: message + - content: + - text: 'Do both of these right now, in parallel, in this single turn -- do + not wait for one to finish before starting the other: (1) search the web + for the exact query "latest vLLM release notes", and (2) call gitmcp_tiktoken__search_tiktoken_documentation + with {"query":"encoding"}. Do not call any other tool.' + type: input_text + id: msg_028582086f036f90006adb38c3bfd487d09a64dac3753227b8 + role: user + status: completed + type: message + - content: [] + id: rs_028582086f036f90006adb38c48bd087d09cf2d6b9d00c3424 + summary: [] + type: reasoning + - action: + queries: + - latest vLLM release notes + query: latest vLLM release notes + type: search + id: ws_028582086f036f90006adb38c4ffcc87d08f2761f66559b187 + status: completed + type: web_search_call + first_id: msg_028582086f036f90006adb38a62ee087d0b021d27a63342ecb + has_more: true + last_id: ws_028582086f036f90006adb38c4ffcc87d08f2761f66559b187 + object: list + headers: + content-type: application/json + status_code: 200 +- filename: t9 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_028582086f036f90006adb38cff3c487d0919c6ee4e9c0fb06/input_items + query_params: + after: ws_028582086f036f90006adb38c4ffcc87d08f2761f66559b187 + limit: '100' + order: asc + response: + body: + data: + - approval_request_id: null + arguments: '{"query":"encoding"}' + error: null + id: mcp_028582086f036f90006adb38c9505c87d09f63f61480673f82 + name: search_tiktoken_documentation + output: "### Search Results for: \"encoding\"\n\nNo relevant documentation\ + \ found for your query. It's either being indexed or the search query did\ + \ not match any documentation.\n\nAs a fallback, this is the documentation\ + \ for openai/tiktoken:\n\n# ⏳ tiktoken\n\ntiktoken is a fast [BPE](https://en.wikipedia.org/wiki/Byte_pair_encoding)\ + \ tokeniser for use with\nOpenAI's models.\n\n```python\nimport tiktoken\n\ + enc = tiktoken.get_encoding(\"o200k_base\")\nassert enc.decode(enc.encode(\"\ + hello world\")) == \"hello world\"\n\n# To get the tokeniser corresponding\ + \ to a specific model in the OpenAI API:\nenc = tiktoken.encoding_for_model(\"\ + gpt-4o\")\n```\n\nThe open source version of `tiktoken` can be installed\ + \ from [PyPI](https://pypi.org/project/tiktoken):\n```\npip install tiktoken\n\ + ```\n\nThe tokeniser API is documented in `tiktoken/core.py`.\n\nExample\ + \ code using `tiktoken` can be found in the\n[OpenAI Cookbook](https://github.com/openai/openai-cookbook/blob/main/examples/How_to_count_tokens_with_tiktoken.ipynb).\n\ + \n\n## Performance\n\n`tiktoken` is between 3-6x faster than a comparable\ + \ open source tokeniser:\n\n![image](https://raw.githubusercontent.com/openai/tiktoken/main/perf.svg)\n\ + \nPerformance measured on 1GB of text using the GPT-2 tokeniser, using `GPT2TokenizerFast`\ + \ from\n`tokenizers==0.13.2`, `transformers==4.24.0` and `tiktoken==0.2.0`.\n\ + \n\n## Getting help\n\nPlease post questions in the [issue tracker](https://github.com/openai/tiktoken/issues).\n\ + \nIf you work at OpenAI, make sure to check the internal documentation or\ + \ feel free to contact\n@shantanu.\n\n## What is BPE anyway?\n\nLanguage\ + \ models don't see text like you and I, instead they see a sequence of numbers\ + \ (known as tokens).\nByte pair encoding (BPE) is a way of converting text\ + \ into tokens. It has a couple desirable\nproperties:\n1) It's reversible\ + \ and lossless, so you can convert tokens back into the original text\n\ + 2) It works on arbitrary text, even text that is not in the tokeniser's\ + \ training data\n3) It compresses the text: the token sequence is shorter\ + \ than the bytes corresponding to the\n original text. On average, in\ + \ practice, each token corresponds to about 4 bytes.\n4) It attempts to\ + \ let the model see common subwords. For instance, \"ing\" is a common subword\ + \ in\n English, so BPE encodings will often split \"encoding\" into tokens\ + \ like \"encod\" and \"ing\"\n (instead of e.g. \"enc\" and \"oding\"\ + ). Because the model will then see the \"ing\" token again and\n again\ + \ in different contexts, it helps models generalise and better understand\ + \ grammar.\n\n`tiktoken` contains an educational submodule that is friendlier\ + \ if you want to learn more about\nthe details of BPE, including code that\ + \ helps visualise the BPE procedure:\n```python\nfrom tiktoken._educational\ + \ import *\n\n# Train a BPE tokeniser on a small amount of text\nenc = train_simple_encoding()\n\ + \n# Visualise how the GPT-4 encoder encodes text\nenc = SimpleBytePairEncoding.from_tiktoken(\"\ + cl100k_base\")\nenc.encode(\"hello world aaaaaaaaaaaa\")\n```\n\n\n## Extending\ + \ tiktoken\n\nYou may wish to extend `tiktoken` to support new encodings.\ + \ There are two ways to do this.\n\n\n**Create your `Encoding` object exactly\ + \ the way you want and simply pass it around.**\n\n```python\ncl100k_base\ + \ = tiktoken.get_encoding(\"cl100k_base\")\n\n# In production, load the\ + \ arguments directly instead of accessing private attributes\n# See openai_public.py\ + \ for examples of arguments for specific encodings\nenc = tiktoken.Encoding(\n\ + \ # If you're changing the set of special tokens, make sure to use a\ + \ different name\n # It should be clear from the name what behaviour\ + \ to expect.\n name=\"cl100k_im\",\n pat_str=cl100k_base._pat_str,\n\ + \ mergeable_ranks=cl100k_base._mergeable_ranks,\n special_tokens={\n\ + \ **cl100k_base._special_tokens,\n \"<|im_start|>\": 100264,\n\ + \ \"<|im_end|>\": 100265,\n }\n)\n```\n\n**Use the `tiktoken_ext`\ + \ plugin mechanism to register your `Encoding` objects with `tiktoken`.**\n\ + \nThis is only useful if you need `tiktoken.get_encoding` to find your encoding,\ + \ otherwise prefer\noption 1.\n\nTo do this, you'll need to create a namespace\ + \ package under `tiktoken_ext`.\n\nLayout your project like this, making\ + \ sure to omit the `tiktoken_ext/__init__.py` file:\n```\nmy_tiktoken_extension\n\ + ├── tiktoken_ext\n│   └── my_encodings.py\n└── setup.py\n```\n\n`my_encodings.py`\ + \ should be a module that contains a variable named `ENCODING_CONSTRUCTORS`.\n\ + This is a dictionary from an encoding name to a function that takes no arguments\ + \ and returns\narguments that can be passed to `tiktoken.Encoding` to construct\ + \ that encoding. For an example, see\n`tiktoken_ext/openai_public.py`. For\ + \ precise details, see `tiktoken/registry.py`.\n\nYour `setup.py` should\ + \ look something like this:\n```python\nfrom setuptools import setup, find_namespace_packages\n\ + \nsetup(\n name=\"my_tiktoken_extension\",\n packages=find_namespace_packages(include=['tiktoken_ext*']),\n\ + \ install_requires=[\"tiktoken\"],\n ...\n)\n```\n\nThen simply `pip\ + \ install ./my_tiktoken_extension` and you should be able to use your\n\ + custom encodings! Make sure **not** to use an editable install.\n\n\n\n\ + If you'd like to retry the search, try changing the query to increase the\ + \ likelihood of a match." + server_label: gitmcp_tiktoken + status: completed + type: mcp_call + - content: [] + id: rs_028582086f036f90006adb38caf05087d0b82880a44827ea47 + summary: [] + type: reasoning + - content: + - annotations: + - end_index: 261 + start_index: 182 + title: Releases · vllm-project/vllm · GitHub + type: url_citation + url: https://github.com/vllm-project/vllm/releases?utm_source=openai + logprobs: [] + text: '- **Web search:** Results surfaced vLLM’s official GitHub releases + page, while a secondary release tracker identifies **vLLM 0.32.0**, dated + October 18, 2026, as the latest release. ([github.com](https://github.com/vllm-project/vllm/releases?utm_source=openai)) + + - **tiktoken documentation:** No direct match for “encoding” was found, + but fallback documentation covered retrieving standard encodings, selecting + model-specific encodings, and creating or registering custom `Encoding` + objects.' + type: output_text + id: msg_028582086f036f90006adb38cca54487d09c437c871528144a + phase: final_answer + role: assistant + status: completed + type: message + - content: + - text: Do not call tools again. Reply only OK. + type: input_text + id: msg_028582086f036f90006adb38d00b1c87d08abeadd6f06bfe82 + role: user + status: completed + type: message + first_id: mcp_028582086f036f90006adb38c9505c87d09f63f61480673f82 + has_more: false + last_id: msg_028582086f036f90006adb38d00b1c87d08abeadd6f06bfe82 + object: list + headers: + content-type: application/json + status_code: 200 +- filename: t10 + request: + body: + input: 'Do all three of these right now, in parallel, in this single turn -- + do not wait for one before starting another: (1) call get_weather for "Tokyo", + (2) call get_stock_price for "AAPL", and (3) call set_temperature_unit to + set my preferred unit to "fahrenheit" for the rest of this conversation.' + max_output_tokens: 2048 + model: gpt-5.6 + parallel_tool_calls: true + store: true + stream: false + tool_choice: auto + tools: + - description: Get the current weather for a given city. + name: get_weather + parameters: + additionalProperties: false + properties: + city: + description: City name, e.g. Paris + type: string + required: + - city + type: object + strict: true + type: function + - description: Get the current stock price for a given ticker symbol. + name: get_stock_price + parameters: + additionalProperties: false + properties: + ticker: + description: Stock ticker symbol, e.g. AAPL + type: string + required: + - ticker + type: object + strict: true + type: function + - description: Set the user's preferred temperature unit. This changes how temperatures + should be reported for the rest of this conversation. Call with the raw + unit as plain text input, e.g. fahrenheit -- not JSON. + name: set_temperature_unit + type: custom + headers: + accept: '*/*' + authorization: Bearer *** + content-type: application/json + user-agent: python-httpx/0.28.1 + method: POST + path: /v1/responses + query_params: {} + response: + body: + access_programs: null + background: false + billing: + payer: developer + completed_at: 1792751829 + created_at: 1792751827 + error: null + frequency_penalty: 0.0 + id: resp_04129cd8130df26a006adb38d3b9c087d08af4c0a6518b95ce + incomplete_details: null + instructions: null + max_output_tokens: 2048 + max_tool_calls: null + metadata: {} + model: gpt-5.6-sol + moderation: null + object: response + output: + - content: [] + encrypted_content: gAAAAABq2zjVKHZ_Yvy6nOqXgvtgg10Y_zM3rTM8pdRRoeymLBSqOYPAKw3EWHJIGTpG5pffgUuT6Jtzgnk1dUurqouCyO5DDFBMLtwcJT66M0qqxj9D593KmxDE2oLmBUx3IFa-sWhz0E_iqQLZ7rQZUd41GqefsRjdu9C0WPlOAYt0JVSXhdR79n3vbAZEdaHeR863dKa8wcSp7FBpXs-U3KHpUHe4k8yPSzQ3fCw-IQpCwpGzgDNBUIO9rwOFQKyExziLb5_uhUI9E4ef9YCKgBGQs3lMAvcFhVVxjBaCC7a7lBftHnzbV7cg8uBMyoCZe5rmFxsBR_kalJAV43EB-aaERJkWG017jA_A4sGFzkWvqVGRXwsb2qQeru50yV7IgqJrF0gZLItwzXu6NAHq7Kw8c9ppZDYRv_cv8RtU9t7wmTepDrKHuanaALLWZ0NyUb3WekgLsXGj9kzfWxDRI5o-hH354AV8YMk64s6xXK65r0GS8kDpU9ecTqa4QpACuw_l64nvXXfRMWSaE5Nizrcr_wmS681ll4PzJjGFQ7Wf3wzo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ZMvqCEAzjag-KonDI6kgZOUR7CjfE7vjwJS8RTPolyoYEVXBn4fftnVzD79L1J5QQHrB0cePTSldFT-TDki0vGfgmece89iddGRCL6gRP8xXx_iv6eo7ID6OzgaaiM9ey4sfFQQHi_asYQLyrVJhFhO32NS_ZnIImmflHfmSP2OpTwMTdmXyy1HDoQ9lp66mdbqr5mBQaBimzy_bgHj_hgREJPL_5aHWC4FC0_Lh8ufJOchAsLGh6lrSYwejWTJtMnT8P4UFd01IsYcZ8LbKYIcnd7g_sXjOwqDQ6U7-2ElTXzMKhJU1GVDk-Q9kPfHTOAJ4yqQTljox3xnQhjxGVwU3XX1u2g4MrkZk0zm15ztBBBT0OYfDL6U3aZbX7f83_FDXEEM_NNCFXbel2gqth2-J26ejwqdDA-9MFybsXPpSFbSPxwheoE-m64SGi5kEJeE9DKXZTXv6D8qN3sAN7-OQQxoG4J-PLuf9APsopHi6uZ8KhoeQ_7ieK0Q8gBc0zSbd3EDt6oaeg3Cp7lAsz5KZodWk6atpopZBRR9gb4BHpZuWd5RY2-omDpET4yANdW-EOqtyQdygxGscoRY9GDVjR1fqAktsMWKU1JnmJjmz084LDJLBzb1dnT9ui-_eF64hgqzT4RhUpWMG6qJ5k42cd2M3nRNYI99v2-LkP9MlWV9uGqdCSxN3QQpLECq5_6IdalQp-qK5rFkyn82mNnxGE02aQ_0OoYxQ6ZDA8qt-DsjgPmVBoz4sa09JZFUEqQreC_7su26Xo5tTQXC_OBUlUM-dPWWJfTYiboNlXCRuHz8spCD13DoiO7Z0AYZjzp7qlo-EPEQyg1l65Ga5eaLGUTc7J04GBKWlWG8zhRb3Eow8UTCf9WbHLpPoqcP5TMi0Kqahwk59BEYwm8T0NfEbrhMryXzaayL5EocfuirT5cnLLL9GMq26DI2Vzc-dyVfrEEF_TrIqKc= + id: rs_04129cd8130df26a006adb38d4324c87d09716372ce68d8c5c + summary: [] + type: reasoning + - call_id: call_bThuNT6uHSEesGGGfFydRfHD + id: ctc_04129cd8130df26a006adb38d5638c87d09c6ce0569b880ef2 + input: 'fahrenheit + + ' + name: set_temperature_unit + status: completed + type: custom_tool_call + parallel_tool_calls: true + presence_penalty: 0.0 + previous_response_id: null + prompt_cache_key: null + prompt_cache_retention: 24h + reasoning: + context: all_turns + effort: medium + mode: standard + summary: null + safety_identifier: null + service_tier: default + status: completed + store: true + temperature: 1.0 + text: + format: + type: text + verbosity: medium + tool_choice: auto + tool_usage: + image_gen: + input_tokens: 0 + input_tokens_details: + image_tokens: 0 + text_tokens: 0 + output_tokens: 0 + output_tokens_details: + image_tokens: 0 + text_tokens: 0 + total_tokens: 0 + web_search: + num_requests: 0 + tools: + - description: Get the current weather for a given city. + name: get_weather + output_schema: null + parameters: + additionalProperties: false + properties: + city: + description: City name, e.g. Paris + type: string + required: + - city + type: object + strict: true + type: function + - description: Get the current stock price for a given ticker symbol. + name: get_stock_price + output_schema: null + parameters: + additionalProperties: false + properties: + ticker: + description: Stock ticker symbol, e.g. AAPL + type: string + required: + - ticker + type: object + strict: true + type: function + - description: Set the user's preferred temperature unit. This changes how temperatures + should be reported for the rest of this conversation. Call with the raw + unit as plain text input, e.g. fahrenheit -- not JSON. + format: + type: text + name: set_temperature_unit + type: custom + top_logprobs: 0 + top_p: 0.98 + truncation: disabled + usage: + input_tokens: 228 + input_tokens_details: + cache_write_tokens: 0 + cached_tokens: 0 + output_tokens: 111 + output_tokens_details: + reasoning_tokens: 94 + total_tokens: 339 + user: null + headers: + content-type: application/json + status_code: 200 +- filename: t11 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_04129cd8130df26a006adb38d3b9c087d08af4c0a6518b95ce/input_items + query_params: + limit: '100' + order: asc + response: + body: + data: + - content: + - text: 'Do all three of these right now, in parallel, in this single turn + -- do not wait for one before starting another: (1) call get_weather for + "Tokyo", (2) call get_stock_price for "AAPL", and (3) call set_temperature_unit + to set my preferred unit to "fahrenheit" for the rest of this conversation.' + type: input_text + id: msg_04129cd8130df26a006adb38d3c5ec87d0aa85e4a251c611e2 + role: user + status: completed + type: message + first_id: msg_04129cd8130df26a006adb38d3c5ec87d0aa85e4a251c611e2 + has_more: false + last_id: msg_04129cd8130df26a006adb38d3c5ec87d0aa85e4a251c611e2 + object: list + headers: + content-type: application/json + status_code: 200 +- filename: t12 + request: + body: + input: + - call_id: call_bThuNT6uHSEesGGGfFydRfHD + output: '{"status": "ok", "unit": "fahrenheit"}' + type: custom_tool_call_output + - content: What did you find for the weather and the stock price, and what temperature + unit did you just set? + role: user + type: message + max_output_tokens: 2048 + model: gpt-5.6 + parallel_tool_calls: true + previous_response_id: resp_04129cd8130df26a006adb38d3b9c087d08af4c0a6518b95ce + store: true + stream: false + tool_choice: auto + tools: + - description: Get the current weather for a given city. + name: get_weather + parameters: + additionalProperties: false + properties: + city: + description: City name, e.g. Paris + type: string + required: + - city + type: object + strict: true + type: function + - description: Get the current stock price for a given ticker symbol. + name: get_stock_price + parameters: + additionalProperties: false + properties: + ticker: + description: Stock ticker symbol, e.g. AAPL + type: string + required: + - ticker + type: object + strict: true + type: function + - description: Set the user's preferred temperature unit. This changes how temperatures + should be reported for the rest of this conversation. Call with the raw + unit as plain text input, e.g. fahrenheit -- not JSON. + name: set_temperature_unit + type: custom + headers: + accept: '*/*' + authorization: Bearer *** + content-type: application/json + user-agent: python-httpx/0.28.1 + method: POST + path: /v1/responses + query_params: {} + response: + body: + access_programs: null + background: false + billing: + payer: developer + completed_at: 1792751844 + created_at: 1792751842 + error: null + frequency_penalty: 0.0 + id: resp_04129cd8130df26a006adb38e2687487d0aa7eb850fd3dc49b + incomplete_details: null + instructions: null + max_output_tokens: 2048 + max_tool_calls: null + metadata: {} + model: gpt-5.6-sol + moderation: null + object: response + output: + - content: [] + encrypted_content: gAAAAABq2zjk-Q88j6343lMXRDqYMj6SVAjaqaSqCE0krxWASwZsueveToMDqb0Ih01Uyt4A7XwVoKv1RGm2wCMzQBXGtj-WsQ-XUq7J7GavcDr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QZ2dELjNequCFCo0TXLTuAoZmGhqAo4Lff0x-JU6YcgGxrJQi_FmLAYdDeNOVfL-KTa8D5_rDY7zMdQgshiV7PzyoP4wY9vHJj7B9803vC6h1wGCUpptkcRWboRtlLr3QP_7ACxmYJbcWO2a5uOjUxVm12EOfM8jq3K6AEnnvTBMHqCz_FOBsm9Y_PMPsW3vVVrIbFFnrzJ1rgUZmqYNEeRsIbhVjyfCwv3snmthPV-lFL5lIgMWYMfRiEAJzV0qrYFfKiGYTmONSPZgJi6Mmflk7ldGeKna80baImyR7S9yy6xFPCKDbsaf9B1nuwgFh0D7lPXIrNaaRgXOBe3CrfGYrROHMaKcqVwnnVaRZBOfbGmv8oL11WVVhEqz95k2RMWoXuphUzblWPL12oLOM2PRFlmWzAfirK01UOklracwHZVzH1qoksah-8w0da-Y1yLkkMzTpAiVo= + id: rs_04129cd8130df26a006adb38e37a3487d0b740e78a1882f194 + summary: [] + type: reasoning + - arguments: '{"city":"Tokyo"}' + call_id: call_1QGTsq7QjZvsBbqV7PI1laDZ + id: fc_04129cd8130df26a006adb38e4077887d091779ed5c296e758 + name: get_weather + status: completed + type: function_call + - arguments: '{"ticker":"AAPL"}' + call_id: call_h9C8lU46xPL4Q3ZV4G0Wk68a + id: fc_04129cd8130df26a006adb38e4079087d0872a5b5e6e151666 + name: get_stock_price + status: completed + type: function_call + parallel_tool_calls: true + presence_penalty: 0.0 + previous_response_id: resp_04129cd8130df26a006adb38d3b9c087d08af4c0a6518b95ce + prompt_cache_key: null + prompt_cache_retention: 24h + reasoning: + context: all_turns + effort: medium + mode: standard + summary: null + safety_identifier: null + service_tier: default + status: completed + store: true + temperature: 1.0 + text: + format: + type: text + verbosity: medium + tool_choice: auto + tool_usage: + image_gen: + input_tokens: 0 + input_tokens_details: + image_tokens: 0 + text_tokens: 0 + output_tokens: 0 + output_tokens_details: + image_tokens: 0 + text_tokens: 0 + total_tokens: 0 + web_search: + num_requests: 0 + tools: + - description: Get the current weather for a given city. + name: get_weather + output_schema: null + parameters: + additionalProperties: false + properties: + city: + description: City name, e.g. Paris + type: string + required: + - city + type: object + strict: true + type: function + - description: Get the current stock price for a given ticker symbol. + name: get_stock_price + output_schema: null + parameters: + additionalProperties: false + properties: + ticker: + description: Stock ticker symbol, e.g. AAPL + type: string + required: + - ticker + type: object + strict: true + type: function + - description: Set the user's preferred temperature unit. This changes how temperatures + should be reported for the rest of this conversation. Call with the raw + unit as plain text input, e.g. fahrenheit -- not JSON. + format: + type: text + name: set_temperature_unit + type: custom + top_logprobs: 0 + top_p: 0.98 + truncation: disabled + usage: + input_tokens: 389 + input_tokens_details: + cache_write_tokens: 0 + cached_tokens: 0 + output_tokens: 68 + output_tokens_details: + reasoning_tokens: 16 + total_tokens: 457 + user: null + headers: + content-type: application/json + status_code: 200 +- filename: t13 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_04129cd8130df26a006adb38e2687487d0aa7eb850fd3dc49b/input_items + query_params: + limit: '100' + order: asc + response: + body: + data: + - content: + - text: 'Do all three of these right now, in parallel, in this single turn + -- do not wait for one before starting another: (1) call get_weather for + "Tokyo", (2) call get_stock_price for "AAPL", and (3) call set_temperature_unit + to set my preferred unit to "fahrenheit" for the rest of this conversation.' + type: input_text + id: msg_04129cd8130df26a006adb38d3c5ec87d0aa85e4a251c611e2 + role: user + status: completed + type: message + - content: [] + id: rs_04129cd8130df26a006adb38d4324c87d09716372ce68d8c5c + summary: [] + type: reasoning + - call_id: call_bThuNT6uHSEesGGGfFydRfHD + id: ctc_04129cd8130df26a006adb38d5638c87d09c6ce0569b880ef2 + input: 'fahrenheit + + ' + name: set_temperature_unit + status: completed + type: custom_tool_call + - call_id: call_bThuNT6uHSEesGGGfFydRfHD + id: ctco_04129cd8130df26a006adb38e274e087d0b728c283ec955761 + output: '{"status": "ok", "unit": "fahrenheit"}' + status: completed + type: custom_tool_call_output + - content: + - text: What did you find for the weather and the stock price, and what temperature + unit did you just set? + type: input_text + id: msg_04129cd8130df26a006adb38e2750c87d0a70dd0177d1f054f + role: user + status: completed + type: message + first_id: msg_04129cd8130df26a006adb38d3c5ec87d0aa85e4a251c611e2 + has_more: false + last_id: msg_04129cd8130df26a006adb38e2750c87d0a70dd0177d1f054f + object: list + headers: + content-type: application/json + status_code: 200 +- filename: t14 + request: + body: + input: + - call_id: call_1QGTsq7QjZvsBbqV7PI1laDZ + output: '{"city": "Tokyo", "temperature_c": 22, "condition": "Clear"}' + type: function_call_output + - call_id: call_h9C8lU46xPL4Q3ZV4G0Wk68a + output: '{"ticker": "AAPL", "price": 231.45, "currency": "USD"}' + type: function_call_output + - content: 'Do both of these right now, in parallel, in this single turn -- + do not wait for one before starting another: (1) call get_weather for "Tokyo", + and (2) call get_weather for "Paris".' + role: user + type: message + max_output_tokens: 2048 + model: gpt-5.6 + parallel_tool_calls: true + previous_response_id: resp_04129cd8130df26a006adb38e2687487d0aa7eb850fd3dc49b + store: true + stream: false + tool_choice: auto + tools: + - description: Get the current weather for a given city. + name: get_weather + parameters: + additionalProperties: false + properties: + city: + description: City name, e.g. Paris + type: string + required: + - city + type: object + strict: true + type: function + - description: Get the current stock price for a given ticker symbol. + name: get_stock_price + parameters: + additionalProperties: false + properties: + ticker: + description: Stock ticker symbol, e.g. AAPL + type: string + required: + - ticker + type: object + strict: true + type: function + - description: Set the user's preferred temperature unit. This changes how temperatures + should be reported for the rest of this conversation. Call with the raw + unit as plain text input, e.g. fahrenheit -- not JSON. + name: set_temperature_unit + type: custom + headers: + accept: '*/*' + authorization: Bearer *** + content-type: application/json + user-agent: python-httpx/0.28.1 + method: POST + path: /v1/responses + query_params: {} + response: + body: + access_programs: null + background: false + billing: + payer: developer + completed_at: 1792751847 + created_at: 1792751846 + error: null + frequency_penalty: 0.0 + id: resp_04129cd8130df26a006adb38e6292087d0844805567e083e12 + incomplete_details: null + instructions: null + max_output_tokens: 2048 + max_tool_calls: null + metadata: {} + model: gpt-5.6-sol + moderation: null +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O-2hhSa2agxMX_01BouIBtYS9-U-CRNcw9CxyLEwhufTIjPBCnAcZo9GHbFZelTG3k8DjO0c7rJUmOjUGT9thP2-7RNFqlHxpiNZP_5aNOYtJg2k6DoHiJlWuUzkOft49ymAXqV1fsDnOKtQUWybAr6kDPDm2i5AkOT2Q62sFvnlj_2iBWaCuGi9lbF7H1I4bTSemwVueO9xjN12KkOss07CXQs4b46Oq7ClPiPcPH_nN3gwnZ2sxfgQ-2lxudttrd4m0DTUzjFuKYvJ9yEaQzs5W-BAuULPmMjAQ4GrLe5aNMoqr_EjCltiG1RNbcQjkuY6pZ4MMfZPinY_9xRjSqjxJszYEQZKCCr6oFdzWmJQMmeCF-vhMTZfyfEEQIbsOwOhOOURrK5gAcFceVBQwqNEpleLwNE51GwsLdwTGAG-5JSjxwtNXBlCQWDVQRazfDdVPjRQP8vBVuk7XJ8Z-Rv25MznSd3ex3aNAXYeM7pYnqqCTjTbOdT_nViCwPT4Ln0DXWJtNd88MG53B2MjXjw= + id: rs_04129cd8130df26a006adb38e6bf3087d0b211b13918eab15b + summary: [] + type: reasoning + - arguments: '{"city":"Tokyo"}' + call_id: call_SQDtr2NwQhbeXCPLktdfyDSX + id: fc_04129cd8130df26a006adb38e73f0c87d0b98cb10fc48fa31a + name: get_weather + status: completed + type: function_call + - arguments: '{"city":"Paris"}' + call_id: call_yyXC5pmY7FCLCbWYJxi81IgT + id: fc_04129cd8130df26a006adb38e73f1c87d0aae66b51389c1a79 + name: get_weather + status: completed + type: function_call + parallel_tool_calls: true + presence_penalty: 0.0 + previous_response_id: resp_04129cd8130df26a006adb38e2687487d0aa7eb850fd3dc49b + prompt_cache_key: null + prompt_cache_retention: 24h + reasoning: + context: all_turns + effort: medium + mode: standard + summary: null + safety_identifier: null + service_tier: default + status: completed + store: true + temperature: 1.0 + text: + format: + type: text + verbosity: medium + tool_choice: auto + tool_usage: + image_gen: + input_tokens: 0 + input_tokens_details: + image_tokens: 0 + text_tokens: 0 + output_tokens: 0 + output_tokens_details: + image_tokens: 0 + text_tokens: 0 + total_tokens: 0 + web_search: + num_requests: 0 + tools: + - description: Get the current weather for a given city. + name: get_weather + output_schema: null + parameters: + additionalProperties: false + properties: + city: + description: City name, e.g. Paris + type: string + required: + - city + type: object + strict: true + type: function + - description: Get the current stock price for a given ticker symbol. + name: get_stock_price + output_schema: null + parameters: + additionalProperties: false + properties: + ticker: + description: Stock ticker symbol, e.g. AAPL + type: string + required: + - ticker + type: object + strict: true + type: function + - description: Set the user's preferred temperature unit. This changes how temperatures + should be reported for the rest of this conversation. Call with the raw + unit as plain text input, e.g. fahrenheit -- not JSON. + format: + type: text + name: set_temperature_unit + type: custom + top_logprobs: 0 + top_p: 0.98 + truncation: disabled + usage: + input_tokens: 567 + input_tokens_details: + cache_write_tokens: 0 + cached_tokens: 0 + output_tokens: 63 + output_tokens_details: + reasoning_tokens: 13 + total_tokens: 630 + user: null + headers: + content-type: application/json + status_code: 200 +- filename: t15 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_04129cd8130df26a006adb38e6292087d0844805567e083e12/input_items + query_params: + limit: '100' + order: asc + response: + body: + data: + - content: + - text: 'Do all three of these right now, in parallel, in this single turn + -- do not wait for one before starting another: (1) call get_weather for + "Tokyo", (2) call get_stock_price for "AAPL", and (3) call set_temperature_unit + to set my preferred unit to "fahrenheit" for the rest of this conversation.' + type: input_text + id: msg_04129cd8130df26a006adb38d3c5ec87d0aa85e4a251c611e2 + role: user + status: completed + type: message + - content: [] + id: rs_04129cd8130df26a006adb38d4324c87d09716372ce68d8c5c + summary: [] + type: reasoning + - call_id: call_bThuNT6uHSEesGGGfFydRfHD + id: ctc_04129cd8130df26a006adb38d5638c87d09c6ce0569b880ef2 + input: 'fahrenheit + + ' + name: set_temperature_unit + status: completed + type: custom_tool_call + - call_id: call_bThuNT6uHSEesGGGfFydRfHD + id: ctco_04129cd8130df26a006adb38e274e087d0b728c283ec955761 + output: '{"status": "ok", "unit": "fahrenheit"}' + status: completed + type: custom_tool_call_output + - content: + - text: What did you find for the weather and the stock price, and what temperature + unit did you just set? + type: input_text + id: msg_04129cd8130df26a006adb38e2750c87d0a70dd0177d1f054f + role: user + status: completed + type: message + - content: [] + id: rs_04129cd8130df26a006adb38e37a3487d0b740e78a1882f194 + summary: [] + type: reasoning + - arguments: '{"city":"Tokyo"}' + call_id: call_1QGTsq7QjZvsBbqV7PI1laDZ + id: fc_04129cd8130df26a006adb38e4077887d091779ed5c296e758 + name: get_weather + status: completed + type: function_call + - arguments: '{"ticker":"AAPL"}' + call_id: call_h9C8lU46xPL4Q3ZV4G0Wk68a + id: fc_04129cd8130df26a006adb38e4079087d0872a5b5e6e151666 + name: get_stock_price + status: completed + type: function_call + - call_id: call_1QGTsq7QjZvsBbqV7PI1laDZ + id: fc_04129cd8130df26a006adb38e6362487d0a1e72650acb1c425 + output: '{"city": "Tokyo", "temperature_c": 22, "condition": "Clear"}' + status: completed + type: function_call_output + - call_id: call_h9C8lU46xPL4Q3ZV4G0Wk68a + id: fc_04129cd8130df26a006adb38e6364487d0ba35541709380bc4 + output: '{"ticker": "AAPL", "price": 231.45, "currency": "USD"}' + status: completed + type: function_call_output + - content: + - text: 'Do both of these right now, in parallel, in this single turn -- do + not wait for one before starting another: (1) call get_weather for "Tokyo", + and (2) call get_weather for "Paris".' + type: input_text + id: msg_04129cd8130df26a006adb38e6365c87d0b23e95f98b2b71c1 + role: user + status: completed + type: message + first_id: msg_04129cd8130df26a006adb38d3c5ec87d0aa85e4a251c611e2 + has_more: false + last_id: msg_04129cd8130df26a006adb38e6365c87d0b23e95f98b2b71c1 + object: list + headers: + content-type: application/json + status_code: 200 +- filename: t16 + request: + body: + input: + - call_id: call_SQDtr2NwQhbeXCPLktdfyDSX + output: '{"city": "Tokyo", "temperature_c": 22, "condition": "Clear"}' + type: function_call_output + - call_id: call_yyXC5pmY7FCLCbWYJxi81IgT + output: '{"city": "Paris", "temperature_c": 22, "condition": "Clear"}' + type: function_call_output + - content: What's the weather in each of those two cities? + role: user + type: message + max_output_tokens: 2048 + model: gpt-5.6 + parallel_tool_calls: true + previous_response_id: resp_04129cd8130df26a006adb38e6292087d0844805567e083e12 + store: true + stream: false + tool_choice: auto + tools: + - description: Get the current weather for a given city. + name: get_weather + parameters: + additionalProperties: false + properties: + city: + description: City name, e.g. Paris + type: string + required: + - city + type: object + strict: true + type: function + - description: Get the current stock price for a given ticker symbol. + name: get_stock_price + parameters: + additionalProperties: false + properties: + ticker: + description: Stock ticker symbol, e.g. AAPL + type: string + required: + - ticker + type: object + strict: true + type: function + - description: Set the user's preferred temperature unit. This changes how temperatures + should be reported for the rest of this conversation. Call with the raw + unit as plain text input, e.g. fahrenheit -- not JSON. + name: set_temperature_unit + type: custom + headers: + accept: '*/*' + authorization: Bearer *** + content-type: application/json + user-agent: python-httpx/0.28.1 + method: POST + path: /v1/responses + query_params: {} + response: + body: + access_programs: null + background: false + billing: + payer: developer + completed_at: 1792751852 + created_at: 1792751851 + error: null + frequency_penalty: 0.0 + id: resp_04129cd8130df26a006adb38eb6fac87d0bfafa9e5182f1a4f + incomplete_details: null + instructions: null + max_output_tokens: 2048 + max_tool_calls: null + metadata: {} + model: gpt-5.6-sol + moderation: null + object: response + output: + - content: [] + encrypted_content: gAAAAABq2zjtsLDuG3Ef6PrszFTKmiaY_YBB4v2lwyXMGKEG8k8m79UhSAFJoulroV6ZppxMSqt-D7AJmIvD06N9F_Jm6zqKEsrPAMONMIfaX2sWHqSRFdtQJXHQuhygh280NZ9vqjH00_F4GaZ48A8VCZqqYOC7Wte29t89K-Q2xQb-wqgshAhTl6datyggOT8loYoJjgatggBxN7DZpGRrquriFDwpE1HM3har-DvHWKPrHAi53RSEQCl-u6Ef7T9fpeWglvTigHPbR9U3iEelK50NQ0B9_Yas4LMhuum1QkparrkgRh1ydV_1HumXwWkLjjt0LPtPYJNrc5jmi-HlSgGZGzXGFIOQNt_XbH7yw5bdyTlw6EDlwgGy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VsidhoFyrzIRUZSYXG91_rrrDbmcpf477_Er3H9t_qEUs9ZQ0dLYyFPUW5KwgWiJbuJX57YwmYAxDn--DZ19aKK6wNnxzY2syvIHisc8y-BhQBttB6VNqOGhsjiwGlMTej0A4veISKGwnwooxB21mJ-jQaxKAiAj9dBDttzniAEDLnszKHKBauNKA7ouwnlb_Ayv7P2-h_Pa3a3ZwbTtcaLRyOnA5ic-27Z-2MkA3iOgA== + id: rs_04129cd8130df26a006adb38ec332887d0a18b5f9366fd8e0c + summary: [] + type: reasoning + - content: + - annotations: [] + logprobs: [] + text: '- **Tokyo:** Clear, **71.6°F** + + - **Paris:** Clear, **71.6°F**' + type: output_text + id: msg_04129cd8130df26a006adb38ec70fc87d0aef01d0bf66fab89 + phase: final_answer + role: assistant + status: completed + type: message + parallel_tool_calls: true + presence_penalty: 0.0 + previous_response_id: resp_04129cd8130df26a006adb38e6292087d0844805567e083e12 + prompt_cache_key: null + prompt_cache_retention: 24h + reasoning: + context: all_turns + effort: medium + mode: standard + summary: null + safety_identifier: null + service_tier: default + status: completed + store: true + temperature: 1.0 + text: + format: + type: text + verbosity: medium + tool_choice: auto + tool_usage: + image_gen: + input_tokens: 0 + input_tokens_details: + image_tokens: 0 + text_tokens: 0 + output_tokens: 0 + output_tokens_details: + image_tokens: 0 + text_tokens: 0 + total_tokens: 0 + web_search: + num_requests: 0 + tools: + - description: Get the current weather for a given city. + name: get_weather + output_schema: null + parameters: + additionalProperties: false + properties: + city: + description: City name, e.g. Paris + type: string + required: + - city + type: object + strict: true + type: function + - description: Get the current stock price for a given ticker symbol. + name: get_stock_price + output_schema: null + parameters: + additionalProperties: false + properties: + ticker: + description: Stock ticker symbol, e.g. AAPL + type: string + required: + - ticker + type: object + strict: true + type: function + - description: Set the user's preferred temperature unit. This changes how temperatures + should be reported for the rest of this conversation. Call with the raw + unit as plain text input, e.g. fahrenheit -- not JSON. + format: + type: text + name: set_temperature_unit + type: custom + top_logprobs: 0 + top_p: 0.98 + truncation: disabled + usage: + input_tokens: 702 + input_tokens_details: + cache_write_tokens: 0 + cached_tokens: 0 + output_tokens: 56 + output_tokens_details: + reasoning_tokens: 26 + total_tokens: 758 + user: null + headers: + content-type: application/json + status_code: 200 +- filename: t17 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_04129cd8130df26a006adb38eb6fac87d0bfafa9e5182f1a4f/input_items + query_params: + limit: '100' + order: asc + response: + body: + data: + - content: + - text: 'Do all three of these right now, in parallel, in this single turn + -- do not wait for one before starting another: (1) call get_weather for + "Tokyo", (2) call get_stock_price for "AAPL", and (3) call set_temperature_unit + to set my preferred unit to "fahrenheit" for the rest of this conversation.' + type: input_text + id: msg_04129cd8130df26a006adb38d3c5ec87d0aa85e4a251c611e2 + role: user + status: completed + type: message + - content: [] + id: rs_04129cd8130df26a006adb38d4324c87d09716372ce68d8c5c + summary: [] + type: reasoning + - call_id: call_bThuNT6uHSEesGGGfFydRfHD + id: ctc_04129cd8130df26a006adb38d5638c87d09c6ce0569b880ef2 + input: 'fahrenheit + + ' + name: set_temperature_unit + status: completed + type: custom_tool_call + - call_id: call_bThuNT6uHSEesGGGfFydRfHD + id: ctco_04129cd8130df26a006adb38e274e087d0b728c283ec955761 + output: '{"status": "ok", "unit": "fahrenheit"}' + status: completed + type: custom_tool_call_output + - content: + - text: What did you find for the weather and the stock price, and what temperature + unit did you just set? + type: input_text + id: msg_04129cd8130df26a006adb38e2750c87d0a70dd0177d1f054f + role: user + status: completed + type: message + - content: [] + id: rs_04129cd8130df26a006adb38e37a3487d0b740e78a1882f194 + summary: [] + type: reasoning + - arguments: '{"city":"Tokyo"}' + call_id: call_1QGTsq7QjZvsBbqV7PI1laDZ + id: fc_04129cd8130df26a006adb38e4077887d091779ed5c296e758 + name: get_weather + status: completed + type: function_call + - arguments: '{"ticker":"AAPL"}' + call_id: call_h9C8lU46xPL4Q3ZV4G0Wk68a + id: fc_04129cd8130df26a006adb38e4079087d0872a5b5e6e151666 + name: get_stock_price + status: completed + type: function_call + - call_id: call_1QGTsq7QjZvsBbqV7PI1laDZ + id: fc_04129cd8130df26a006adb38e6362487d0a1e72650acb1c425 + output: '{"city": "Tokyo", "temperature_c": 22, "condition": "Clear"}' + status: completed + type: function_call_output + - call_id: call_h9C8lU46xPL4Q3ZV4G0Wk68a + id: fc_04129cd8130df26a006adb38e6364487d0ba35541709380bc4 + output: '{"ticker": "AAPL", "price": 231.45, "currency": "USD"}' + status: completed + type: function_call_output + - content: + - text: 'Do both of these right now, in parallel, in this single turn -- do + not wait for one before starting another: (1) call get_weather for "Tokyo", + and (2) call get_weather for "Paris".' + type: input_text + id: msg_04129cd8130df26a006adb38e6365c87d0b23e95f98b2b71c1 + role: user + status: completed + type: message + - content: [] + id: rs_04129cd8130df26a006adb38e6bf3087d0b211b13918eab15b + summary: [] + type: reasoning + - arguments: '{"city":"Tokyo"}' + call_id: call_SQDtr2NwQhbeXCPLktdfyDSX + id: fc_04129cd8130df26a006adb38e73f0c87d0b98cb10fc48fa31a + name: get_weather + status: completed + type: function_call + - arguments: '{"city":"Paris"}' + call_id: call_yyXC5pmY7FCLCbWYJxi81IgT + id: fc_04129cd8130df26a006adb38e73f1c87d0aae66b51389c1a79 + name: get_weather + status: completed + type: function_call + - call_id: call_SQDtr2NwQhbeXCPLktdfyDSX + id: fc_04129cd8130df26a006adb38eb7b3887d0b90de6204c87905f + output: '{"city": "Tokyo", "temperature_c": 22, "condition": "Clear"}' + status: completed + type: function_call_output + - call_id: call_yyXC5pmY7FCLCbWYJxi81IgT + id: fc_04129cd8130df26a006adb38eb7b5887d09aa80da51ec701f5 + output: '{"city": "Paris", "temperature_c": 22, "condition": "Clear"}' + status: completed + type: function_call_output + - content: + - text: What's the weather in each of those two cities? + type: input_text + id: msg_04129cd8130df26a006adb38eb7b7487d093df0daf75619730 + role: user + status: completed + type: message + first_id: msg_04129cd8130df26a006adb38d3c5ec87d0aa85e4a251c611e2 + has_more: false + last_id: msg_04129cd8130df26a006adb38eb7b7487d093df0daf75619730 + object: list + headers: + content-type: application/json + status_code: 200 +- filename: t18 + request: + body: + input: + - content: Do not call tools again. Reply only OK. + role: user + type: message + max_output_tokens: 2048 + model: gpt-5.6 + parallel_tool_calls: true + previous_response_id: resp_04129cd8130df26a006adb38eb6fac87d0bfafa9e5182f1a4f + store: true + stream: false + tool_choice: none + tools: + - description: Get the current weather for a given city. + name: get_weather + parameters: + additionalProperties: false + properties: + city: + description: City name, e.g. Paris + type: string + required: + - city + type: object + strict: true + type: function + - description: Get the current stock price for a given ticker symbol. + name: get_stock_price + parameters: + additionalProperties: false + properties: + ticker: + description: Stock ticker symbol, e.g. AAPL + type: string + required: + - ticker + type: object + strict: true + type: function + - description: Set the user's preferred temperature unit. This changes how temperatures + should be reported for the rest of this conversation. Call with the raw + unit as plain text input, e.g. fahrenheit -- not JSON. + name: set_temperature_unit + type: custom + headers: + accept: '*/*' + authorization: Bearer *** + content-type: application/json + user-agent: python-httpx/0.28.1 + method: POST + path: /v1/responses + query_params: {} + response: + body: + access_programs: null + background: false + billing: + payer: developer + completed_at: 1792751857 + created_at: 1792751855 + error: null + frequency_penalty: 0.0 + id: resp_04129cd8130df26a006adb38ef67bc87d084d3bb0b37002d9b + incomplete_details: null + instructions: null + max_output_tokens: 2048 + max_tool_calls: null + metadata: {} + model: gpt-5.6-sol + moderation: null + object: response + output: + - content: + - annotations: [] + logprobs: [] + text: OK + type: output_text + id: msg_04129cd8130df26a006adb38f0f08487d0bbf61c454457358e + phase: final_answer + role: assistant + status: completed + type: message + parallel_tool_calls: true + presence_penalty: 0.0 + previous_response_id: resp_04129cd8130df26a006adb38eb6fac87d0bfafa9e5182f1a4f + prompt_cache_key: null + prompt_cache_retention: 24h + reasoning: + context: all_turns + effort: medium + mode: standard + summary: null + safety_identifier: null + service_tier: default + status: completed + store: true + temperature: 1.0 + text: + format: + type: text + verbosity: medium + tool_choice: none + tool_usage: + image_gen: + input_tokens: 0 + input_tokens_details: + image_tokens: 0 + text_tokens: 0 + output_tokens: 0 + output_tokens_details: + image_tokens: 0 + text_tokens: 0 + total_tokens: 0 + web_search: + num_requests: 0 + tools: + - description: Get the current weather for a given city. + name: get_weather + output_schema: null + parameters: + additionalProperties: false + properties: + city: + description: City name, e.g. Paris + type: string + required: + - city + type: object + strict: true + type: function + - description: Get the current stock price for a given ticker symbol. + name: get_stock_price + output_schema: null + parameters: + additionalProperties: false + properties: + ticker: + description: Stock ticker symbol, e.g. AAPL + type: string + required: + - ticker + type: object + strict: true + type: function + - description: Set the user's preferred temperature unit. This changes how temperatures + should be reported for the rest of this conversation. Call with the raw + unit as plain text input, e.g. fahrenheit -- not JSON. + format: + type: text + name: set_temperature_unit + type: custom + top_logprobs: 0 + top_p: 0.98 + truncation: disabled + usage: + input_tokens: 774 + input_tokens_details: + cache_write_tokens: 0 + cached_tokens: 0 + output_tokens: 5 + output_tokens_details: + reasoning_tokens: 0 + total_tokens: 779 + user: null + headers: + content-type: application/json + status_code: 200 +- filename: t19 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_04129cd8130df26a006adb38ef67bc87d084d3bb0b37002d9b/input_items + query_params: + limit: '100' + order: asc + response: + body: + data: + - content: + - text: 'Do all three of these right now, in parallel, in this single turn + -- do not wait for one before starting another: (1) call get_weather for + "Tokyo", (2) call get_stock_price for "AAPL", and (3) call set_temperature_unit + to set my preferred unit to "fahrenheit" for the rest of this conversation.' + type: input_text + id: msg_04129cd8130df26a006adb38d3c5ec87d0aa85e4a251c611e2 + role: user + status: completed + type: message + - content: [] + id: rs_04129cd8130df26a006adb38d4324c87d09716372ce68d8c5c + summary: [] + type: reasoning + - call_id: call_bThuNT6uHSEesGGGfFydRfHD + id: ctc_04129cd8130df26a006adb38d5638c87d09c6ce0569b880ef2 + input: 'fahrenheit + + ' + name: set_temperature_unit + status: completed + type: custom_tool_call + - call_id: call_bThuNT6uHSEesGGGfFydRfHD + id: ctco_04129cd8130df26a006adb38e274e087d0b728c283ec955761 + output: '{"status": "ok", "unit": "fahrenheit"}' + status: completed + type: custom_tool_call_output + - content: + - text: What did you find for the weather and the stock price, and what temperature + unit did you just set? + type: input_text + id: msg_04129cd8130df26a006adb38e2750c87d0a70dd0177d1f054f + role: user + status: completed + type: message + - content: [] + id: rs_04129cd8130df26a006adb38e37a3487d0b740e78a1882f194 + summary: [] + type: reasoning + - arguments: '{"city":"Tokyo"}' + call_id: call_1QGTsq7QjZvsBbqV7PI1laDZ + id: fc_04129cd8130df26a006adb38e4077887d091779ed5c296e758 + name: get_weather + status: completed + type: function_call + - arguments: '{"ticker":"AAPL"}' + call_id: call_h9C8lU46xPL4Q3ZV4G0Wk68a + id: fc_04129cd8130df26a006adb38e4079087d0872a5b5e6e151666 + name: get_stock_price + status: completed + type: function_call + - call_id: call_1QGTsq7QjZvsBbqV7PI1laDZ + id: fc_04129cd8130df26a006adb38e6362487d0a1e72650acb1c425 + output: '{"city": "Tokyo", "temperature_c": 22, "condition": "Clear"}' + status: completed + type: function_call_output + - call_id: call_h9C8lU46xPL4Q3ZV4G0Wk68a + id: fc_04129cd8130df26a006adb38e6364487d0ba35541709380bc4 + output: '{"ticker": "AAPL", "price": 231.45, "currency": "USD"}' + status: completed + type: function_call_output + - content: + - text: 'Do both of these right now, in parallel, in this single turn -- do + not wait for one before starting another: (1) call get_weather for "Tokyo", + and (2) call get_weather for "Paris".' + type: input_text + id: msg_04129cd8130df26a006adb38e6365c87d0b23e95f98b2b71c1 + role: user + status: completed + type: message + - content: [] + id: rs_04129cd8130df26a006adb38e6bf3087d0b211b13918eab15b + summary: [] + type: reasoning + - arguments: '{"city":"Tokyo"}' + call_id: call_SQDtr2NwQhbeXCPLktdfyDSX + id: fc_04129cd8130df26a006adb38e73f0c87d0b98cb10fc48fa31a + name: get_weather + status: completed + type: function_call + - arguments: '{"city":"Paris"}' + call_id: call_yyXC5pmY7FCLCbWYJxi81IgT + id: fc_04129cd8130df26a006adb38e73f1c87d0aae66b51389c1a79 + name: get_weather + status: completed + type: function_call + - call_id: call_SQDtr2NwQhbeXCPLktdfyDSX + id: fc_04129cd8130df26a006adb38eb7b3887d0b90de6204c87905f + output: '{"city": "Tokyo", "temperature_c": 22, "condition": "Clear"}' + status: completed + type: function_call_output + - call_id: call_yyXC5pmY7FCLCbWYJxi81IgT + id: fc_04129cd8130df26a006adb38eb7b5887d09aa80da51ec701f5 + output: '{"city": "Paris", "temperature_c": 22, "condition": "Clear"}' + status: completed + type: function_call_output + - content: + - text: What's the weather in each of those two cities? + type: input_text + id: msg_04129cd8130df26a006adb38eb7b7487d093df0daf75619730 + role: user + status: completed + type: message + - content: [] + id: rs_04129cd8130df26a006adb38ec332887d0a18b5f9366fd8e0c + summary: [] + type: reasoning + - content: + - annotations: [] + logprobs: [] + text: '- **Tokyo:** Clear, **71.6°F** + + - **Paris:** Clear, **71.6°F**' + type: output_text + id: msg_04129cd8130df26a006adb38ec70fc87d0aef01d0bf66fab89 + phase: final_answer + role: assistant + status: completed + type: message + - content: + - text: Do not call tools again. Reply only OK. + type: input_text + id: msg_04129cd8130df26a006adb38ef6e9487d0affb74650bbcc07d + role: user + status: completed + type: message + first_id: msg_04129cd8130df26a006adb38d3c5ec87d0aa85e4a251c611e2 + has_more: false + last_id: msg_04129cd8130df26a006adb38ef6e9487d0affb74650bbcc07d + object: list + headers: + content-type: application/json + status_code: 200 +- filename: t20 + request: + body: + input: 'Do all three of these right now, in parallel, in this single turn -- + do not wait for one before starting another: (1) call get_weather for "Tokyo", + (2) call set_temperature_unit to set my preferred unit to "fahrenheit" for + the rest of this conversation, and (3) search the web for the exact query + "Tokyo weather today".' + max_output_tokens: 2048 + model: gpt-5.6 + parallel_tool_calls: true + store: true + stream: false + tool_choice: auto + tools: + - type: web_search_preview + - description: Get the current weather for a given city. + name: get_weather + parameters: + additionalProperties: false + properties: + city: + description: City name, e.g. Tokyo + type: string + required: + - city + type: object + strict: true + type: function + - description: Set the user's preferred temperature unit. This changes how temperatures + should be reported for the rest of this conversation. Call with the raw + unit as plain text input, e.g. fahrenheit -- not JSON. + name: set_temperature_unit + type: custom + headers: + accept: '*/*' + authorization: Bearer *** + content-type: application/json + user-agent: python-httpx/0.28.1 + method: POST + path: /v1/responses + query_params: {} + response: + body: + access_programs: null + background: false + billing: + payer: developer + completed_at: 1792751862 + created_at: 1792751859 + error: null + frequency_penalty: 0.0 + id: resp_06c0f7faf6143021006adb38f33a8087d0a446531ae5719e61 + incomplete_details: null + instructions: null + max_output_tokens: 2048 + max_tool_calls: null + metadata: {} + model: gpt-5.6-sol + moderation: null + object: response + output: + - content: [] + encrypted_content: gAAAAABq2zj2VFSwN0YDUuf2i2JfxORTHfHfiGFqJw9bwHBkNJ4lSEneimhUyiztHuei4-lXBBYT-5TzpQxMMWGGCp7TF4YRoKb_g1Bkpfs1HFdZiNUnYumZKecr3lBPfYSODcJz1JyB--T6g4YWvTvveLpqlHwVD2o7jSETKrmrLWi2bF-lOc-LccqxROLHEiw2PIL1GD30dtgzZt9NspBE8IZM0wuu6Hi8QCftGyS0BCNBcIbTNV60yB7kLrS0UUJK35qB8jYszNpuAME55HkWD7AaugPve7Rp6dAL_625WgSlreJLeGv28ZRt1OB7zEopnV-uDMbnI2_6ybfVA0jUIJHql55T3Yn39xVST5nGGvw0ndshY6O4XsAsI3yEK4sLqaBKLR41_YDT070eaylb-KUBd7AIya9seKVFeAMWSo7lhsVPgg-L1YKc7CcYRDz4azLKaUSLLGPit7NOsq1MF9_JsB_x_F4bhffT_oOJK2chMV8KTVYS50NtLf9seiTstSu2QJJEy_tA-xL5ClkFNtzWAmY9PDQ7I4z9pKub5wd5h0feUimvMlikm4PeR_025ZLPchrrPPZ9Nqz2PLvTm6acgdE9wt0C8AqRU080uyQn4tkThiKS-kQtwif7haCmOlGcrIkZRFL78np9ghNmKLN21WRrzlp1pI5n32l_WkY3ZIkaC29x7bCBc8c0CxPn9WietbNqKuYiOpGqME0TCGGfHbpy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xtEoB2mQ_r-N-yrT-TnSuoir7HXdVlzaTpptbTyR8McVlk7VTVsQvVBjpXPT-y9ifzTtVE9dPX_AJgSn6hcJq01bReERpt48pt4B8oWeok242bmZhhFcFkEsCDONQVS7m7QFv0d24iD2aGTXLUOXbtHRlZx7He-vzSkQOWBonokKrHXZq3EGpUdd8VcAemOiZ0S4hcyC7_TVVWsWWyE9-mYPIln7DzM3FkcyANFe7ChWbK1nWglenZPTMiStn71FNILvhaprQ0Bvj83uH3hx4U1qeNHFDSRMr_LhjAjuBkLsuvxI3O4b6weeuSSQXxC-yf3_DOVkE7GtTmgb2Z6M-9pFBcr-2AmJADJiXosyxVdlFg_BCMxs5ST160TTnQcCi7DF8vdHaDYomTTvd76bXYMgbQz7qqYTSVw0xIAWLv6J3-ezyQC5eeSVw03ZhGxdV_hJy1EzCkUwy8TE5CXJQdW5-5AWTHUmP8SaQgTFjvtj6OAX96bhC-suV6cG_j-3uK-oXQ30E8tFMsfms5uPc1GYXsSabiMtMIU3-M47xKul9QPSLSMfvZdQT5lIDDnBDYKzT6kFDpeyxIYeHAWQWwTcJEnqquxLIexLEuDgexw578ORjOgIDqznucDsLKSf6iBOkb9B54CdZGC_ZBJcw4vYIGu_eOaJ338hTTlM7qncYKE6sgOccbALc-zAHtMquIAHj0uobxAF9rlf3LXYHl_MSbgqK2VV-dihI3n1qZfkVGtyciYO7wbwy6qQGD7yCDEEAtIFts3XiKHNGXkBJuAPPfb15gLC_giap1-EALXyNonfzyCfmLn9daNxaEs7UH6MxaY9dcG7ieldgH6bkt2vnrwCcWO_xs73Q6oGErIeBVeDhukd97PYAqaiB2PNhTriIg899Js_P6u4diqfjn6ZdCLs7mKSyqzONSRMJRC0uBtrQJR + id: rs_06c0f7faf6143021006adb38f4ab7c87d084de79cfd460b698 + summary: [] + type: reasoning + - call_id: call_sl8IRw8WVurN49oScf2ZmIqj + id: ctc_06c0f7faf6143021006adb38f5e44887d0980d5c58c96707d5 + input: 'fahrenheit + + ' + name: set_temperature_unit + status: completed + type: custom_tool_call + parallel_tool_calls: true + presence_penalty: 0.0 + previous_response_id: null + prompt_cache_key: null + prompt_cache_retention: 24h + reasoning: + context: all_turns + effort: medium + mode: standard + summary: null + safety_identifier: null + service_tier: default + status: completed + store: true + temperature: 1.0 + text: + format: + type: text + verbosity: medium + tool_choice: auto + tool_usage: + image_gen: + input_tokens: 0 + input_tokens_details: + image_tokens: 0 + text_tokens: 0 + output_tokens: 0 + output_tokens_details: + image_tokens: 0 + text_tokens: 0 + total_tokens: 0 + web_search: + num_requests: 0 + tools: + - description: Get the current weather for a given city. + name: get_weather + output_schema: null + parameters: + additionalProperties: false + properties: + city: + description: City name, e.g. Tokyo + type: string + required: + - city + type: object + strict: true + type: function + - search_content_types: + - text + search_context_size: medium + type: web_search_preview + user_location: + city: null + country: US + region: null + timezone: null + type: approximate + - description: Set the user's preferred temperature unit. This changes how temperatures + should be reported for the rest of this conversation. Call with the raw + unit as plain text input, e.g. fahrenheit -- not JSON. + format: + type: text + name: set_temperature_unit + type: custom + top_logprobs: 0 + top_p: 0.98 + truncation: disabled + usage: + input_tokens: 4630 + input_tokens_details: + cache_write_tokens: 0 + cached_tokens: 4627 + output_tokens: 118 + output_tokens_details: + reasoning_tokens: 101 + total_tokens: 4748 + user: null + headers: + content-type: application/json + status_code: 200 +- filename: t21 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_06c0f7faf6143021006adb38f33a8087d0a446531ae5719e61/input_items + query_params: + limit: '100' + order: asc + response: + body: + data: + - content: + - text: 'Do all three of these right now, in parallel, in this single turn + -- do not wait for one before starting another: (1) call get_weather for + "Tokyo", (2) call set_temperature_unit to set my preferred unit to "fahrenheit" + for the rest of this conversation, and (3) search the web for the exact + query "Tokyo weather today".' + type: input_text + id: msg_06c0f7faf6143021006adb38f34ab487d095a19a1d4d76045d + role: user + status: completed + type: message + first_id: msg_06c0f7faf6143021006adb38f34ab487d095a19a1d4d76045d + has_more: false + last_id: msg_06c0f7faf6143021006adb38f34ab487d095a19a1d4d76045d + object: list + headers: + content-type: application/json + status_code: 200 +- filename: t22 + request: + body: + input: + - call_id: call_sl8IRw8WVurN49oScf2ZmIqj + output: '{"status": "ok", "unit": "fahrenheit"}' + type: custom_tool_call_output + - content: Now report Tokyo's current temperature using the unit I just told + you to prefer. + role: user + type: message + max_output_tokens: 2048 + model: gpt-5.6 + parallel_tool_calls: true + previous_response_id: resp_06c0f7faf6143021006adb38f33a8087d0a446531ae5719e61 + store: true + stream: false + tool_choice: auto + tools: + - type: web_search_preview + - description: Get the current weather for a given city. + name: get_weather + parameters: + additionalProperties: false + properties: + city: + description: City name, e.g. Tokyo + type: string + required: + - city + type: object + strict: true + type: function + - description: Set the user's preferred temperature unit. This changes how temperatures + should be reported for the rest of this conversation. Call with the raw + unit as plain text input, e.g. fahrenheit -- not JSON. + name: set_temperature_unit + type: custom + headers: + accept: '*/*' + authorization: Bearer *** + content-type: application/json + user-agent: python-httpx/0.28.1 + method: POST + path: /v1/responses + query_params: {} + response: + body: + access_programs: null + background: false + billing: + payer: developer + completed_at: 1792751865 + created_at: 1792751864 + error: null + frequency_penalty: 0.0 + id: resp_06c0f7faf6143021006adb38f84d6c87d0be263c3949425023 + incomplete_details: null + instructions: null + max_output_tokens: 2048 + max_tool_calls: null + metadata: {} + model: gpt-5.6-sol + moderation: null + object: response + output: + - content: [] + encrypted_content: gAAAAABq2zj6lCtq4w6wLm67juuQJLtebvzh9UVzZtsWF-8lkNhqIXoR17r8IycQbOsG_sCRzT7jL2Q3Ro5iWjF4E4kldGDP2JtRmwmQs1bfrRXecWQ4BBNtdj5RrUahl1Fotyg1lffm0N-BKIpO707grTTuHI6YFiuU6dqs6WRg2lWG8Aev32WTLFvLGrVgCp3ttfCs7VbrgNruteTRqyJmYFjPs7XCw1rjmn4gFeUcLfNIQIczVidIIDU8Qz0cC5pdF5REbMD6NVFZKh6k86jG4oForJEmQ2nLONv24NDKw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Z7csbdhQ8TaD0OVytp7-kZNhXJmpL0aSvXeXCCKiGAwTwloY4FhupYRVL2AakbUuwDGdYYh6KhcMUqJlkEMMCm_EABGxDpADFQRmX9ujBS5wqYIsQp_l7SZhcwMMl58f0VaXU8vT8vOVbW8P0qOk7MKMuHWatmsdzK9_F6zDOoLY_5ldUNgLtbgyvzun8-0dOgfP4oWbVBRLcUqwCYB3oWOFSZsHMyBhSr2UjsAUniktaqCKLNQNCAA== + id: rs_06c0f7faf6143021006adb38f8d09887d092eb442374b8a638 + summary: [] + type: reasoning + - arguments: '{"city":"Tokyo"}' + call_id: call_XypZu8IaaAq5MfS2TooJCbyA + id: fc_06c0f7faf6143021006adb38f8f86887d0a33540e90ce42375 + name: get_weather + status: completed + type: function_call + parallel_tool_calls: true + presence_penalty: 0.0 + previous_response_id: resp_06c0f7faf6143021006adb38f33a8087d0a446531ae5719e61 + prompt_cache_key: null + prompt_cache_retention: 24h + reasoning: + context: all_turns + effort: medium + mode: standard + summary: null + safety_identifier: null + service_tier: default + status: completed + store: true + temperature: 1.0 + text: + format: + type: text + verbosity: medium + tool_choice: auto + tool_usage: + image_gen: + input_tokens: 0 + input_tokens_details: + image_tokens: 0 + text_tokens: 0 + output_tokens: 0 + output_tokens_details: + image_tokens: 0 + text_tokens: 0 + total_tokens: 0 + web_search: + num_requests: 0 + tools: + - description: Get the current weather for a given city. + name: get_weather + output_schema: null + parameters: + additionalProperties: false + properties: + city: + description: City name, e.g. Tokyo + type: string + required: + - city + type: object + strict: true + type: function + - search_content_types: + - text + search_context_size: medium + type: web_search_preview + user_location: + city: null + country: US + region: null + timezone: null + type: approximate + - description: Set the user's preferred temperature unit. This changes how temperatures + should be reported for the rest of this conversation. Call with the raw + unit as plain text input, e.g. fahrenheit -- not JSON. + format: + type: text + name: set_temperature_unit + type: custom + top_logprobs: 0 + top_p: 0.98 + truncation: disabled + usage: + input_tokens: 4793 + input_tokens_details: + cache_write_tokens: 163 + cached_tokens: 4627 + output_tokens: 36 + output_tokens_details: + reasoning_tokens: 16 + total_tokens: 4829 + user: null + headers: + content-type: application/json + status_code: 200 +- filename: t23 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_06c0f7faf6143021006adb38f84d6c87d0be263c3949425023/input_items + query_params: + limit: '100' + order: asc + response: + body: + data: + - content: + - text: 'Do all three of these right now, in parallel, in this single turn + -- do not wait for one before starting another: (1) call get_weather for + "Tokyo", (2) call set_temperature_unit to set my preferred unit to "fahrenheit" + for the rest of this conversation, and (3) search the web for the exact + query "Tokyo weather today".' + type: input_text + id: msg_06c0f7faf6143021006adb38f34ab487d095a19a1d4d76045d + role: user + status: completed + type: message + - content: [] + id: rs_06c0f7faf6143021006adb38f4ab7c87d084de79cfd460b698 + summary: [] + type: reasoning + - call_id: call_sl8IRw8WVurN49oScf2ZmIqj + id: ctc_06c0f7faf6143021006adb38f5e44887d0980d5c58c96707d5 + input: 'fahrenheit + + ' + name: set_temperature_unit + status: completed + type: custom_tool_call + - call_id: call_sl8IRw8WVurN49oScf2ZmIqj + id: ctco_06c0f7faf6143021006adb38f85dfc87d08fd39f9a08a01f58 + output: '{"status": "ok", "unit": "fahrenheit"}' + status: completed + type: custom_tool_call_output + - content: + - text: Now report Tokyo's current temperature using the unit I just told + you to prefer. + type: input_text + id: msg_06c0f7faf6143021006adb38f85e1c87d0bc882285027eb956 + role: user + status: completed + type: message + first_id: msg_06c0f7faf6143021006adb38f34ab487d095a19a1d4d76045d + has_more: false + last_id: msg_06c0f7faf6143021006adb38f85e1c87d0bc882285027eb956 + object: list + headers: + content-type: application/json + status_code: 200 +- filename: t24 + request: + body: + input: + - call_id: call_XypZu8IaaAq5MfS2TooJCbyA + output: '{"city": "Tokyo", "temperature_c": 22, "condition": "Clear"}' + type: function_call_output + - content: Do not call tools again. Reply only OK. + role: user + type: message + max_output_tokens: 2048 + model: gpt-5.6 + parallel_tool_calls: true + previous_response_id: resp_06c0f7faf6143021006adb38f84d6c87d0be263c3949425023 + store: true + stream: false + tool_choice: none + tools: + - type: web_search_preview + - description: Get the current weather for a given city. + name: get_weather + parameters: + additionalProperties: false + properties: + city: + description: City name, e.g. Tokyo + type: string + required: + - city + type: object + strict: true + type: function + - description: Set the user's preferred temperature unit. This changes how temperatures + should be reported for the rest of this conversation. Call with the raw + unit as plain text input, e.g. fahrenheit -- not JSON. + name: set_temperature_unit + type: custom + headers: + accept: '*/*' + authorization: Bearer *** + content-type: application/json + user-agent: python-httpx/0.28.1 + method: POST + path: /v1/responses + query_params: {} + response: + body: + access_programs: null + background: false + billing: + payer: developer + completed_at: 1792751869 + created_at: 1792751868 + error: null + frequency_penalty: 0.0 + id: resp_06c0f7faf6143021006adb38fbdfc087d084ce36f575dbf197 + incomplete_details: null + instructions: null + max_output_tokens: 2048 + max_tool_calls: null + metadata: {} + model: gpt-5.6-sol + moderation: null + object: response + output: + - content: + - annotations: [] + logprobs: [] + text: OK + type: output_text + id: msg_06c0f7faf6143021006adb38fd0bf887d0a5d15f31e55a129f + phase: final_answer + role: assistant + status: completed + type: message + parallel_tool_calls: true + presence_penalty: 0.0 + previous_response_id: resp_06c0f7faf6143021006adb38f84d6c87d0be263c3949425023 + prompt_cache_key: null + prompt_cache_retention: 24h + reasoning: + context: all_turns + effort: medium + mode: standard + summary: null + safety_identifier: null + service_tier: default + status: completed + store: true + temperature: 1.0 + text: + format: + type: text + verbosity: medium + tool_choice: none + tool_usage: + image_gen: + input_tokens: 0 + input_tokens_details: + image_tokens: 0 + text_tokens: 0 + output_tokens: 0 + output_tokens_details: + image_tokens: 0 + text_tokens: 0 + total_tokens: 0 + web_search: + num_requests: 0 + tools: + - description: Get the current weather for a given city. + name: get_weather + output_schema: null + parameters: + additionalProperties: false + properties: + city: + description: City name, e.g. Tokyo + type: string + required: + - city + type: object + strict: true + type: function + - search_content_types: + - text + search_context_size: medium + type: web_search_preview + user_location: + city: null + country: US + region: null + timezone: null + type: approximate + - description: Set the user's preferred temperature unit. This changes how temperatures + should be reported for the rest of this conversation. Call with the raw + unit as plain text input, e.g. fahrenheit -- not JSON. + format: + type: text + name: set_temperature_unit + type: custom + top_logprobs: 0 + top_p: 0.98 + truncation: disabled + usage: + input_tokens: 4873 + input_tokens_details: + cache_write_tokens: 80 + cached_tokens: 4718 + output_tokens: 5 + output_tokens_details: + reasoning_tokens: 0 + total_tokens: 4878 + user: null + headers: + content-type: application/json + status_code: 200 +- filename: t25 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_06c0f7faf6143021006adb38fbdfc087d084ce36f575dbf197/input_items + query_params: + limit: '100' + order: asc + response: + body: + data: + - content: + - text: 'Do all three of these right now, in parallel, in this single turn + -- do not wait for one before starting another: (1) call get_weather for + "Tokyo", (2) call set_temperature_unit to set my preferred unit to "fahrenheit" + for the rest of this conversation, and (3) search the web for the exact + query "Tokyo weather today".' + type: input_text + id: msg_06c0f7faf6143021006adb38f34ab487d095a19a1d4d76045d + role: user + status: completed + type: message + - content: [] + id: rs_06c0f7faf6143021006adb38f4ab7c87d084de79cfd460b698 + summary: [] + type: reasoning + - call_id: call_sl8IRw8WVurN49oScf2ZmIqj + id: ctc_06c0f7faf6143021006adb38f5e44887d0980d5c58c96707d5 + input: 'fahrenheit + + ' + name: set_temperature_unit + status: completed + type: custom_tool_call + - call_id: call_sl8IRw8WVurN49oScf2ZmIqj + id: ctco_06c0f7faf6143021006adb38f85dfc87d08fd39f9a08a01f58 + output: '{"status": "ok", "unit": "fahrenheit"}' + status: completed + type: custom_tool_call_output + - content: + - text: Now report Tokyo's current temperature using the unit I just told + you to prefer. + type: input_text + id: msg_06c0f7faf6143021006adb38f85e1c87d0bc882285027eb956 + role: user + status: completed + type: message + - content: [] + id: rs_06c0f7faf6143021006adb38f8d09887d092eb442374b8a638 + summary: [] + type: reasoning + - arguments: '{"city":"Tokyo"}' + call_id: call_XypZu8IaaAq5MfS2TooJCbyA + id: fc_06c0f7faf6143021006adb38f8f86887d0a33540e90ce42375 + name: get_weather + status: completed + type: function_call + - call_id: call_XypZu8IaaAq5MfS2TooJCbyA + id: fc_06c0f7faf6143021006adb38fbfdec87d0acd87250be328ce1 + output: '{"city": "Tokyo", "temperature_c": 22, "condition": "Clear"}' + status: completed + type: function_call_output + - content: + - text: Do not call tools again. Reply only OK. + type: input_text + id: msg_06c0f7faf6143021006adb38fbfe1487d0ae7a4f68d0542044 + role: user + status: completed + type: message + first_id: msg_06c0f7faf6143021006adb38f34ab487d095a19a1d4d76045d + has_more: false + last_id: msg_06c0f7faf6143021006adb38fbfe1487d0ae7a4f68d0542044 + object: list + headers: + content-type: application/json + status_code: 200 +- filename: t26 + request: + body: + input: 'The local shell environment is Linux bash. Use the shell tool exactly + once with this exact action, preserving the commands array and its order: + {"commands": ["printf ''SHELL_OK\\n''"], "timeout_ms": 1000, "max_output_length": + 4096}. Wait for the client to return shell_call_output before interpreting + the results.' + max_output_tokens: 4096 + model: gpt-5.6 + store: true + stream: false + tool_choice: auto + tools: + - environment: + type: local + type: shell + headers: + accept: '*/*' + authorization: Bearer *** + content-type: application/json + user-agent: python-httpx/0.28.1 + method: POST + path: /v1/responses + query_params: {} + response: + body: + access_programs: null + background: false + billing: + payer: developer + completed_at: 1792751873 + created_at: 1792751871 + error: null + frequency_penalty: 0.0 + id: resp_00865c2538464a9c006adb38ff90a487d089a30999d7aaa52e + incomplete_details: null + instructions: null + max_output_tokens: 4096 + max_tool_calls: null + metadata: {} + model: gpt-5.6-sol + moderation: null + object: response + output: + - content: [] + encrypted_content: gAAAAABq2zkCMsNa30fEJfc8SbTBXVZK_kvPogjRHT4DVy4x6-p5EdbjXhyAIsNxvGKk__WFqZSdNQgWNqZyyIYezVTdjpwzjuJIup-Z-v95L_r841cavGiiDwbTdcsqdkSQN3fDQSgvYKWghKxy09K4mxhPSD69ihDk1RUo_jkwtffgCvv6gGRI2KNToIUjAPijbm13JMzzDh6oh_9xu8KMgT0GSv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Be8dDbSEiMEn0-lvTOc3U-4BhipHUfNFm-TD9OppmSiEPu3AHeNo7UkgYMXt39ag1W7IK0W98qsUY2jyVMt8a52q30sjX5MnDkHlqOydciBoCES9mxZLr5ovH-icpF8rEpQCtLhz_58wJCXQgqyA6gw2oVE0BCcsBIWBIwYWNOjLWEO0p + id: rs_00865c2538464a9c006adb39003df087d0a5c43cc4a399a190 + summary: [] + type: reasoning + - action: + commands: + - printf 'SHELL_OK\n' + max_output_length: 4096 + timeout_ms: 1000 + call_id: call_XLfMoSsfAoKWH1VGy8fcWglb + environment: null + id: sh_00865c2538464a9c006adb39017b7487d0a179d433561fe4da + status: completed + type: shell_call + parallel_tool_calls: true + presence_penalty: 0.0 + previous_response_id: null + prompt_cache_key: null + prompt_cache_retention: 24h + reasoning: + context: all_turns + effort: medium + mode: standard + summary: null + safety_identifier: null + service_tier: default + status: completed + store: true + temperature: 1.0 + text: + format: + type: text + verbosity: medium + tool_choice: auto + tool_usage: + image_gen: + input_tokens: 0 + input_tokens_details: + image_tokens: 0 + text_tokens: 0 + output_tokens: 0 + output_tokens_details: + image_tokens: 0 + text_tokens: 0 + total_tokens: 0 + web_search: + num_requests: 0 + tools: + - environment: + type: local + type: shell + top_logprobs: 0 + top_p: 0.98 + truncation: disabled + usage: + input_tokens: 314 + input_tokens_details: + cache_write_tokens: 0 + cached_tokens: 0 + output_tokens: 122 + output_tokens_details: + reasoning_tokens: 83 + total_tokens: 436 + user: null + headers: + content-type: application/json + status_code: 200 +- filename: t27 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_00865c2538464a9c006adb38ff90a487d089a30999d7aaa52e/input_items + query_params: + limit: '100' + order: asc + response: + body: + data: + - content: + - text: 'The local shell environment is Linux bash. Use the shell tool exactly + once with this exact action, preserving the commands array and its order: + {"commands": ["printf ''SHELL_OK\\n''"], "timeout_ms": 1000, "max_output_length": + 4096}. Wait for the client to return shell_call_output before interpreting + the results.' + type: input_text + id: msg_00865c2538464a9c006adb38ff998087d09fd49b89b3a6d7d5 + role: user + status: completed + type: message + first_id: msg_00865c2538464a9c006adb38ff998087d09fd49b89b3a6d7d5 + has_more: false + last_id: msg_00865c2538464a9c006adb38ff998087d09fd49b89b3a6d7d5 + object: list + headers: + content-type: application/json + status_code: 200 +- filename: t28 + request: + body: + input: + - call_id: call_XLfMoSsfAoKWH1VGy8fcWglb + max_output_length: 4096 + output: + - outcome: + exit_code: 0 + type: exit + stderr: '' + stdout: 'SHELL_OK + + ' + type: shell_call_output + - content: Use the shell output above without calling any more tools. For each + command, report its stdout, stderr, and exit code or timeout outcome in + order. + role: user + type: message + max_output_tokens: 4096 + model: gpt-5.6 + previous_response_id: resp_00865c2538464a9c006adb38ff90a487d089a30999d7aaa52e + store: true + stream: false + tool_choice: auto + tools: + - environment: + type: local + type: shell + headers: + accept: '*/*' + authorization: Bearer *** + content-type: application/json + user-agent: python-httpx/0.28.1 + method: POST + path: /v1/responses + query_params: {} + response: + body: + access_programs: null + background: false + billing: + payer: developer + completed_at: 1792751877 + created_at: 1792751875 + error: null + frequency_penalty: 0.0 + id: resp_00865c2538464a9c006adb3903dfd887d0aeef4dcccbf01327 + incomplete_details: null + instructions: null + max_output_tokens: 4096 + max_tool_calls: null + metadata: {} + model: gpt-5.6-sol + moderation: null + object: response + output: + - content: + - annotations: [] + logprobs: [] + text: "1. `printf 'SHELL_OK\\n'`\n - **stdout:** `SHELL_OK`\n - **stderr:**\ + \ *(empty)*\n - **exit code:** `0`" + type: output_text + id: msg_00865c2538464a9c006adb39047fb887d085b830d039821589 + phase: final_answer + role: assistant + status: completed + type: message + parallel_tool_calls: true + presence_penalty: 0.0 + previous_response_id: resp_00865c2538464a9c006adb38ff90a487d089a30999d7aaa52e + prompt_cache_key: null + prompt_cache_retention: 24h + reasoning: + context: all_turns + effort: medium + mode: standard + summary: null + safety_identifier: null + service_tier: default + status: completed + store: true + temperature: 1.0 + text: + format: + type: text + verbosity: medium + tool_choice: auto + tool_usage: + image_gen: + input_tokens: 0 + input_tokens_details: + image_tokens: 0 + text_tokens: 0 + output_tokens: 0 + output_tokens_details: + image_tokens: 0 + text_tokens: 0 + total_tokens: 0 + web_search: + num_requests: 0 + tools: + - environment: + type: local + type: shell + top_logprobs: 0 + top_p: 0.98 + truncation: disabled + usage: + input_tokens: 499 + input_tokens_details: + cache_write_tokens: 0 + cached_tokens: 0 + output_tokens: 43 + output_tokens_details: + reasoning_tokens: 0 + total_tokens: 542 + user: null + headers: + content-type: application/json + status_code: 200 +- filename: t29 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_00865c2538464a9c006adb3903dfd887d0aeef4dcccbf01327/input_items + query_params: + limit: '100' + order: asc + response: + body: + data: + - content: + - text: 'The local shell environment is Linux bash. Use the shell tool exactly + once with this exact action, preserving the commands array and its order: + {"commands": ["printf ''SHELL_OK\\n''"], "timeout_ms": 1000, "max_output_length": + 4096}. Wait for the client to return shell_call_output before interpreting + the results.' + type: input_text + id: msg_00865c2538464a9c006adb38ff998087d09fd49b89b3a6d7d5 + role: user + status: completed + type: message + - content: [] + id: rs_00865c2538464a9c006adb39003df087d0a5c43cc4a399a190 + summary: [] + type: reasoning + - action: + commands: + - printf 'SHELL_OK\n' + max_output_length: 4096 + timeout_ms: 1000 + call_id: call_XLfMoSsfAoKWH1VGy8fcWglb + environment: null + id: sh_00865c2538464a9c006adb39017b7487d0a179d433561fe4da + status: completed + type: shell_call + - call_id: call_XLfMoSsfAoKWH1VGy8fcWglb + id: sho_00865c2538464a9c006adb3903eba487d09772108166174d21 + max_output_length: null + output: + - outcome: + exit_code: 0 + type: exit + stderr: '' + stdout: 'SHELL_OK + + ' + status: completed + type: shell_call_output + - content: + - text: Use the shell output above without calling any more tools. For each + command, report its stdout, stderr, and exit code or timeout outcome in + order. + type: input_text + id: msg_00865c2538464a9c006adb3903ebc087d08ac20d6e11c6f3ff + role: user + status: completed + type: message + first_id: msg_00865c2538464a9c006adb38ff998087d09fd49b89b3a6d7d5 + has_more: false + last_id: msg_00865c2538464a9c006adb3903ebc087d08ac20d6e11c6f3ff + object: list + headers: + content-type: application/json + status_code: 200 +- filename: t30 + request: + body: + input: + - content: Do not call tools again. Reply only OK. + role: user + type: message + max_output_tokens: 4096 + model: gpt-5.6 + previous_response_id: resp_00865c2538464a9c006adb3903dfd887d0aeef4dcccbf01327 + store: true + stream: false + tool_choice: none + tools: + - environment: + type: local + type: shell + headers: + accept: '*/*' + authorization: Bearer *** + content-type: application/json + user-agent: python-httpx/0.28.1 + method: POST + path: /v1/responses + query_params: {} + response: + body: + access_programs: null + background: false + billing: + payer: developer + completed_at: 1792751879 + created_at: 1792751879 + error: null + frequency_penalty: 0.0 + id: resp_00865c2538464a9c006adb39070a5887d0adbde2475b2f754a + incomplete_details: null + instructions: null + max_output_tokens: 4096 + max_tool_calls: null + metadata: {} + model: gpt-5.6-sol + moderation: null + object: response + output: + - content: + - annotations: [] + logprobs: [] + text: OK + type: output_text + id: msg_00865c2538464a9c006adb3907b78487d0b2f14a2db9401c60 + phase: final_answer + role: assistant + status: completed + type: message + parallel_tool_calls: true + presence_penalty: 0.0 + previous_response_id: resp_00865c2538464a9c006adb3903dfd887d0aeef4dcccbf01327 + prompt_cache_key: null + prompt_cache_retention: 24h + reasoning: + context: all_turns + effort: medium + mode: standard + summary: null + safety_identifier: null + service_tier: default + status: completed + store: true + temperature: 1.0 + text: + format: + type: text + verbosity: medium + tool_choice: none + tool_usage: + image_gen: + input_tokens: 0 + input_tokens_details: + image_tokens: 0 + text_tokens: 0 + output_tokens: 0 + output_tokens_details: + image_tokens: 0 + text_tokens: 0 + total_tokens: 0 + web_search: + num_requests: 0 + tools: + - environment: + type: local + type: shell + top_logprobs: 0 + top_p: 0.98 + truncation: disabled + usage: + input_tokens: 558 + input_tokens_details: + cache_write_tokens: 0 + cached_tokens: 0 + output_tokens: 5 + output_tokens_details: + reasoning_tokens: 0 + total_tokens: 563 + user: null + headers: + content-type: application/json + status_code: 200 +- filename: t31 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_00865c2538464a9c006adb39070a5887d0adbde2475b2f754a/input_items + query_params: + limit: '100' + order: asc + response: + body: + data: + - content: + - text: 'The local shell environment is Linux bash. Use the shell tool exactly + once with this exact action, preserving the commands array and its order: + {"commands": ["printf ''SHELL_OK\\n''"], "timeout_ms": 1000, "max_output_length": + 4096}. Wait for the client to return shell_call_output before interpreting + the results.' + type: input_text + id: msg_00865c2538464a9c006adb38ff998087d09fd49b89b3a6d7d5 + role: user + status: completed + type: message + - content: [] + id: rs_00865c2538464a9c006adb39003df087d0a5c43cc4a399a190 + summary: [] + type: reasoning + - action: + commands: + - printf 'SHELL_OK\n' + max_output_length: 4096 + timeout_ms: 1000 + call_id: call_XLfMoSsfAoKWH1VGy8fcWglb + environment: null + id: sh_00865c2538464a9c006adb39017b7487d0a179d433561fe4da + status: completed + type: shell_call + - call_id: call_XLfMoSsfAoKWH1VGy8fcWglb + id: sho_00865c2538464a9c006adb3903eba487d09772108166174d21 + max_output_length: null + output: + - outcome: + exit_code: 0 + type: exit + stderr: '' + stdout: 'SHELL_OK + + ' + status: completed + type: shell_call_output + - content: + - text: Use the shell output above without calling any more tools. For each + command, report its stdout, stderr, and exit code or timeout outcome in + order. + type: input_text + id: msg_00865c2538464a9c006adb3903ebc087d08ac20d6e11c6f3ff + role: user + status: completed + type: message + - content: + - annotations: [] + logprobs: [] + text: "1. `printf 'SHELL_OK\\n'`\n - **stdout:** `SHELL_OK`\n - **stderr:**\ + \ *(empty)*\n - **exit code:** `0`" + type: output_text + id: msg_00865c2538464a9c006adb39047fb887d085b830d039821589 + phase: final_answer + role: assistant + status: completed + type: message + - content: + - text: Do not call tools again. Reply only OK. + type: input_text + id: msg_00865c2538464a9c006adb390714c087d0a9f29ace3ff1ab14 + role: user + status: completed + type: message + first_id: msg_00865c2538464a9c006adb38ff998087d09fd49b89b3a6d7d5 + has_more: false + last_id: msg_00865c2538464a9c006adb390714c087d0a9f29ace3ff1ab14 + object: list + headers: + content-type: application/json + status_code: 200 +- filename: t32 + request: + body: + input: Use the python tool to calculate the sum of the squares of the integers + from 1 through 10. The code must print exactly CODE_INTERPRETER_OK=385. After + it runs, answer exactly CODE_INTERPRETER_OK=385. + max_output_tokens: 2048 + model: gpt-5.6 + parallel_tool_calls: false + store: true + stream: false + tool_choice: required + tools: + - container: + type: auto + type: code_interpreter + headers: + accept: '*/*' + authorization: Bearer *** + content-type: application/json + user-agent: python-httpx/0.28.1 + method: POST + path: /v1/responses + query_params: {} + response: + body: + access_programs: null + background: false + billing: + payer: developer + completed_at: 1792751884 + created_at: 1792751882 + error: null + frequency_penalty: 0.0 + id: resp_01bcbaf6cfee0657006adb3909fbe487d08551f2737f8cacf7 + incomplete_details: null + instructions: null + max_output_tokens: 2048 + max_tool_calls: null + metadata: {} + model: gpt-5.6-sol + moderation: null + object: response + output: + - code: 'print(f"CODE_INTERPRETER_OK={sum(i*i for i in range(1, 11))}") + + ' + container_id: cntr_6adb390a65948198be981976260eb856091bae5c5de1f431 + id: ci_01bcbaf6cfee0657006adb390acdbc87d0b4f8864ca4572367 + outputs: null + status: completed + type: code_interpreter_call + - content: + - annotations: [] + logprobs: [] + text: CODE_INTERPRETER_OK=385 + type: output_text + id: msg_01bcbaf6cfee0657006adb390bee0087d089b9e1b5e50bb01a + phase: final_answer + role: assistant + status: completed + type: message + parallel_tool_calls: false + presence_penalty: 0.0 + previous_response_id: null + prompt_cache_key: null + prompt_cache_retention: 24h + reasoning: + context: all_turns + effort: medium + mode: standard + summary: null + safety_identifier: null + service_tier: default + status: completed + store: true + temperature: 1.0 + text: + format: + type: text + verbosity: medium + tool_choice: required + tool_usage: + image_gen: + input_tokens: 0 + input_tokens_details: + image_tokens: 0 + text_tokens: 0 + output_tokens: 0 + output_tokens_details: + image_tokens: 0 + text_tokens: 0 + total_tokens: 0 + web_search: + num_requests: 0 + tools: + - container: + type: auto + type: code_interpreter + top_logprobs: 0 + top_p: 0.98 + truncation: disabled + usage: + input_tokens: 1315 + input_tokens_details: + cache_write_tokens: 0 + cached_tokens: 1143 + output_tokens: 43 + output_tokens_details: + reasoning_tokens: 32 + total_tokens: 1358 + user: null + headers: + content-type: application/json + status_code: 200 +- filename: t33 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_01bcbaf6cfee0657006adb3909fbe487d08551f2737f8cacf7/input_items + query_params: + limit: '100' + order: asc + response: + body: + data: + - content: + - text: Use the python tool to calculate the sum of the squares of the integers + from 1 through 10. The code must print exactly CODE_INTERPRETER_OK=385. + After it runs, answer exactly CODE_INTERPRETER_OK=385. + type: input_text + id: msg_01bcbaf6cfee0657006adb390a12c487d08f8851d895ecc3ae + role: user + status: completed + type: message + first_id: msg_01bcbaf6cfee0657006adb390a12c487d08f8851d895ecc3ae + has_more: false + last_id: msg_01bcbaf6cfee0657006adb390a12c487d08f8851d895ecc3ae + object: list + headers: + content-type: application/json + status_code: 200 +- filename: t34 + request: + body: + input: + - content: Do not call tools again. Reply only OK. + role: user + type: message + max_output_tokens: 2048 + model: gpt-5.6 + parallel_tool_calls: false + previous_response_id: resp_01bcbaf6cfee0657006adb3909fbe487d08551f2737f8cacf7 + store: true + stream: false + tool_choice: none + tools: + - container: + type: auto + type: code_interpreter + headers: + accept: '*/*' + authorization: Bearer *** + content-type: application/json + user-agent: python-httpx/0.28.1 + method: POST + path: /v1/responses + query_params: {} + response: + body: + access_programs: null + background: false + billing: + payer: developer + completed_at: 1792751887 + created_at: 1792751886 + error: null + frequency_penalty: 0.0 + id: resp_01bcbaf6cfee0657006adb390ead4487d0a59983bebb064bcb + incomplete_details: null + instructions: null + max_output_tokens: 2048 + max_tool_calls: null + metadata: {} + model: gpt-5.6-sol + moderation: null + object: response + output: + - content: + - annotations: [] + logprobs: [] + text: OK + type: output_text + id: msg_01bcbaf6cfee0657006adb390f5e7087d081decc7e31c2fba8 + phase: final_answer + role: assistant + status: completed + type: message + parallel_tool_calls: false + presence_penalty: 0.0 + previous_response_id: resp_01bcbaf6cfee0657006adb3909fbe487d08551f2737f8cacf7 + prompt_cache_key: null + prompt_cache_retention: 24h + reasoning: + context: all_turns + effort: medium + mode: standard + summary: null + safety_identifier: null + service_tier: default + status: completed + store: true + temperature: 1.0 + text: + format: + type: text + verbosity: medium + tool_choice: none + tool_usage: + image_gen: + input_tokens: 0 + input_tokens_details: + image_tokens: 0 + text_tokens: 0 + output_tokens: 0 + output_tokens_details: + image_tokens: 0 + text_tokens: 0 + total_tokens: 0 + web_search: + num_requests: 0 + tools: + - container: + type: auto + type: code_interpreter + top_logprobs: 0 + top_p: 0.98 + truncation: disabled + usage: + input_tokens: 1331 + input_tokens_details: + cache_write_tokens: 66 + cached_tokens: 1190 + output_tokens: 5 + output_tokens_details: + reasoning_tokens: 0 + total_tokens: 1336 + user: null + headers: + content-type: application/json + status_code: 200 +- filename: t35 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_01bcbaf6cfee0657006adb390ead4487d0a59983bebb064bcb/input_items + query_params: + limit: '100' + order: asc + response: + body: + data: + - content: + - text: Use the python tool to calculate the sum of the squares of the integers + from 1 through 10. The code must print exactly CODE_INTERPRETER_OK=385. + After it runs, answer exactly CODE_INTERPRETER_OK=385. + type: input_text + id: msg_01bcbaf6cfee0657006adb390a12c487d08f8851d895ecc3ae + role: user + status: completed + type: message + - code: 'print(f"CODE_INTERPRETER_OK={sum(i*i for i in range(1, 11))}") + + ' + container_id: cntr_6adb390a65948198be981976260eb856091bae5c5de1f431 + id: ci_01bcbaf6cfee0657006adb390acdbc87d0b4f8864ca4572367 + outputs: null + status: completed + type: code_interpreter_call + - content: + - annotations: [] + logprobs: [] + text: CODE_INTERPRETER_OK=385 + type: output_text + id: msg_01bcbaf6cfee0657006adb390bee0087d089b9e1b5e50bb01a + phase: final_answer + role: assistant + status: completed + type: message + - content: + - text: Do not call tools again. Reply only OK. + type: input_text + id: msg_01bcbaf6cfee0657006adb390eb8ec87d097c592a090ed71f5 + role: user + status: completed + type: message + first_id: msg_01bcbaf6cfee0657006adb390a12c487d08f8851d895ecc3ae + has_more: false + last_id: msg_01bcbaf6cfee0657006adb390eb8ec87d097c592a090ed71f5 + object: list + headers: + content-type: application/json + status_code: 200 +- filename: t36 + request: + body: + input: First call tool_search exactly once to find both a current-weather function + and a travel time-zone function. Do not call any other tool yet. + max_output_tokens: 4096 + model: gpt-5.6 + parallel_tool_calls: false + store: true + stream: false + tool_choice: required + tools: + - description: Search the client tool catalog for tools that can satisfy the + request. + execution: client + parameters: + additionalProperties: false + properties: + query: + description: A concise description of the needed capabilities. + type: string + required: + - query + type: object + type: tool_search + - defer_loading: true + description: Get the current weather for a city + name: get_weather + parameters: + additionalProperties: false + properties: + city: + type: string + required: + - city + type: object + strict: true + type: function + - defer_loading: true + description: Get the exchange rate between two currencies + name: get_exchange_rate + parameters: + additionalProperties: false + properties: + base: + type: string + quote: + type: string + required: + - base + - quote + type: object + strict: true + type: function + - defer_loading: true + description: Search for hotels in a city + name: search_hotels + parameters: + additionalProperties: false + properties: + city: + type: string + required: + - city + type: object + strict: true + type: function + - description: Travel location tools + name: travel + tools: + - defer_loading: true + description: Get the IANA time zone for a city + name: get_timezone + parameters: + additionalProperties: false + properties: + city: + type: string + required: + - city + type: object + strict: true + type: function + - defer_loading: true + description: Get latitude and longitude for a city + name: get_coordinates + parameters: + additionalProperties: false + properties: + city: + type: string + required: + - city + type: object + strict: true + type: function + - defer_loading: true + description: Calculate the distance between two cities + name: calculate_distance + parameters: + additionalProperties: false + properties: + destination: + type: string + origin: + type: string + required: + - origin + - destination + type: object + strict: true + type: function + type: namespace + headers: + accept: '*/*' + authorization: Bearer *** + content-type: application/json + user-agent: python-httpx/0.28.1 + method: POST + path: /v1/responses + query_params: {} + response: + body: + access_programs: null + background: false + billing: + payer: developer + completed_at: 1792751891 + created_at: 1792751889 + error: null + frequency_penalty: 0.0 + id: resp_0e035120236cff10006adb3911a39887d0a306b7fcc32cb181 + incomplete_details: null + instructions: null + max_output_tokens: 4096 + max_tool_calls: null + metadata: {} + model: gpt-5.6-sol + moderation: null + object: response + output: + - arguments: + query: Find both (1) a current weather function for a specified location + and (2) a travel time-zone function that can determine time zone or time + difference for a destination. Return relevant tools for both needs. + call_id: call_DNaw1Lxs7wTkXj99MX2XhYLp + execution: client + id: tsc_0e035120236cff10006adb391236dc87d0b67d59fa50fd0390 + status: completed + type: tool_search_call + parallel_tool_calls: false + presence_penalty: 0.0 + previous_response_id: null + prompt_cache_key: null + prompt_cache_retention: 24h + reasoning: + context: all_turns + effort: medium + mode: standard + summary: null + safety_identifier: null + service_tier: default + status: completed + store: true + temperature: 1.0 + text: + format: + type: text + verbosity: medium + tool_choice: required + tool_usage: + image_gen: + input_tokens: 0 + input_tokens_details: + image_tokens: 0 + text_tokens: 0 + output_tokens: 0 + output_tokens_details: + image_tokens: 0 + text_tokens: 0 + total_tokens: 0 + web_search: + num_requests: 0 + tools: + - defer_loading: true + description: Get the current weather for a city + name: get_weather + output_schema: null + parameters: + additionalProperties: false + properties: + city: + type: string + required: + - city + type: object + strict: true + type: function + - defer_loading: true + description: Get the exchange rate between two currencies + name: get_exchange_rate + output_schema: null + parameters: + additionalProperties: false + properties: + base: + type: string + quote: + type: string + required: + - base + - quote + type: object + strict: true + type: function + - defer_loading: true + description: Search for hotels in a city + name: search_hotels + output_schema: null + parameters: + additionalProperties: false + properties: + city: + type: string + required: + - city + type: object + strict: true + type: function + - description: Search the client tool catalog for tools that can satisfy the + request. + execution: client + parameters: + additionalProperties: false + properties: + query: + description: A concise description of the needed capabilities. + type: string + required: + - query + type: object + type: tool_search + - description: Travel location tools + name: travel + tools: + - defer_loading: true + description: Get the IANA time zone for a city + name: get_timezone + output_schema: null + parameters: + additionalProperties: false + properties: + city: + type: string + required: + - city + type: object + strict: true + type: function + - defer_loading: true + description: Get latitude and longitude for a city + name: get_coordinates + output_schema: null + parameters: + additionalProperties: false + properties: + city: + type: string + required: + - city + type: object + strict: true + type: function + - defer_loading: true + description: Calculate the distance between two cities + name: calculate_distance + output_schema: null + parameters: + additionalProperties: false + properties: + destination: + type: string + origin: + type: string + required: + - origin + - destination + type: object + strict: true + type: function + type: namespace + top_logprobs: 0 + top_p: 0.98 + truncation: disabled + usage: + input_tokens: 166 + input_tokens_details: + cache_write_tokens: 0 + cached_tokens: 0 + output_tokens: 60 + output_tokens_details: + reasoning_tokens: 0 + total_tokens: 226 + user: null + headers: + content-type: application/json + status_code: 200 +- filename: t37 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_0e035120236cff10006adb3911a39887d0a306b7fcc32cb181/input_items + query_params: + limit: '100' + order: asc + response: + body: + data: + - content: + - text: First call tool_search exactly once to find both a current-weather + function and a travel time-zone function. Do not call any other tool yet. + type: input_text + id: msg_0e035120236cff10006adb3911b09887d0accb43c387c44988 + role: user + status: completed + type: message + first_id: msg_0e035120236cff10006adb3911b09887d0accb43c387c44988 + has_more: false + last_id: msg_0e035120236cff10006adb3911b09887d0accb43c387c44988 + object: list + headers: + content-type: application/json + status_code: 200 +- filename: t38 + request: + body: + input: + - call_id: call_DNaw1Lxs7wTkXj99MX2XhYLp + execution: client + status: completed + tools: + - defer_loading: true + description: Get the current weather for a city + name: get_weather + parameters: + additionalProperties: false + properties: + city: + type: string + required: + - city + type: object + strict: true + type: function + - description: Travel location tools + name: travel + tools: + - defer_loading: true + description: Get the IANA time zone for a city + name: get_timezone + parameters: + additionalProperties: false + properties: + city: + type: string + required: + - city + type: object + strict: true + type: function + type: namespace + type: tool_search_output + - content: Now call get_weather exactly once with {"city":"Paris"}. Do not call + any other tool. + role: user + type: message + max_output_tokens: 4096 + model: gpt-5.6 + parallel_tool_calls: false + previous_response_id: resp_0e035120236cff10006adb3911a39887d0a306b7fcc32cb181 + store: true + stream: false + tool_choice: + name: get_weather + type: function + headers: + accept: '*/*' + authorization: Bearer *** + content-type: application/json + user-agent: python-httpx/0.28.1 + method: POST + path: /v1/responses + query_params: {} + response: + body: + access_programs: null + background: false + billing: + payer: developer + completed_at: 1792751894 + created_at: 1792751893 + error: null + frequency_penalty: 0.0 + id: resp_0e035120236cff10006adb3915969487d0b245c858158c0259 + incomplete_details: null + instructions: null + max_output_tokens: 4096 + max_tool_calls: null + metadata: {} + model: gpt-5.6-sol + moderation: null + object: response + output: + - arguments: '{"city":"Paris"}' + call_id: call_5wX9unmBE5JnciJb2IxcROge + id: fc_0e035120236cff10006adb3916730c87d09559504da4475039 + name: get_weather + status: completed + type: function_call + parallel_tool_calls: false + presence_penalty: 0.0 + previous_response_id: resp_0e035120236cff10006adb3911a39887d0a306b7fcc32cb181 + prompt_cache_key: null + prompt_cache_retention: 24h + reasoning: + context: all_turns + effort: medium + mode: standard + summary: null + safety_identifier: null + service_tier: default + status: completed + store: true + temperature: 1.0 + text: + format: + type: text + verbosity: medium + tool_choice: + name: get_weather + type: function + tool_usage: + image_gen: + input_tokens: 0 + input_tokens_details: + image_tokens: 0 + text_tokens: 0 + output_tokens: 0 + output_tokens_details: + image_tokens: 0 + text_tokens: 0 + total_tokens: 0 + web_search: + num_requests: 0 + tools: + - description: Get the current weather for a city + name: get_weather + output_schema: null + parameters: + additionalProperties: false + properties: + city: + type: string + required: + - city + type: object + strict: true + type: function + - description: Travel location tools + name: travel + tools: + - description: Get the IANA time zone for a city + name: get_timezone + output_schema: null + parameters: + additionalProperties: false + properties: + city: + type: string + required: + - city + type: object + strict: true + type: function + type: namespace + top_logprobs: 0 + top_p: 0.98 + truncation: disabled + usage: + input_tokens: 309 + input_tokens_details: + cache_write_tokens: 0 + cached_tokens: 0 + output_tokens: 18 + output_tokens_details: + reasoning_tokens: 0 + total_tokens: 327 + user: null + headers: + content-type: application/json + status_code: 200 +- filename: t39 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_0e035120236cff10006adb3915969487d0b245c858158c0259/input_items + query_params: + limit: '100' + order: asc + response: + body: + data: + - content: + - text: First call tool_search exactly once to find both a current-weather + function and a travel time-zone function. Do not call any other tool yet. + type: input_text + id: msg_0e035120236cff10006adb3911b09887d0accb43c387c44988 + role: user + status: completed + type: message + - arguments: + query: Find both (1) a current weather function for a specified location + and (2) a travel time-zone function that can determine time zone or time + difference for a destination. Return relevant tools for both needs. + call_id: call_DNaw1Lxs7wTkXj99MX2XhYLp + execution: client + id: tsc_0e035120236cff10006adb391236dc87d0b67d59fa50fd0390 + status: completed + type: tool_search_call + - call_id: call_DNaw1Lxs7wTkXj99MX2XhYLp + execution: client + id: tso_0e035120236cff10006adb3915a05487d0a761af95676687af + status: completed + tools: + - defer_loading: true + description: Get the current weather for a city + name: get_weather + output_schema: null + parameters: + additionalProperties: false + properties: + city: + type: string + required: + - city + type: object + strict: true + type: function + - description: Travel location tools + name: travel + tools: + - defer_loading: true + description: Get the IANA time zone for a city + name: get_timezone + output_schema: null + parameters: + additionalProperties: false + properties: + city: + type: string + required: + - city + type: object + strict: true + type: function + type: namespace + type: tool_search_output + - content: + - text: Now call get_weather exactly once with {"city":"Paris"}. Do not call + any other tool. + type: input_text + id: msg_0e035120236cff10006adb3915a07887d0ac12823a297dc92e + role: user + status: completed + type: message + first_id: msg_0e035120236cff10006adb3911b09887d0accb43c387c44988 + has_more: false + last_id: msg_0e035120236cff10006adb3915a07887d0ac12823a297dc92e + object: list + headers: + content-type: application/json + status_code: 200 +- filename: t40 + request: + body: + input: + - call_id: call_5wX9unmBE5JnciJb2IxcROge + output: '{"city":"Paris","condition":"clear","temperature_c":21}' + type: function_call_output + - content: Now call the loaded travel namespace member get_timezone exactly + once with {"city":"Paris"}. Do not call any other tool. + role: user + type: message + max_output_tokens: 4096 + model: gpt-5.6 + parallel_tool_calls: false + previous_response_id: resp_0e035120236cff10006adb3915969487d0b245c858158c0259 + store: true + stream: false + tool_choice: auto + headers: + accept: '*/*' + authorization: Bearer *** + content-type: application/json + user-agent: python-httpx/0.28.1 + method: POST + path: /v1/responses + query_params: {} + response: + body: + access_programs: null + background: false + billing: + payer: developer + completed_at: 1792751898 + created_at: 1792751897 + error: null + frequency_penalty: 0.0 + id: resp_0e035120236cff10006adb39199d5487d0aab42c6312dac41c + incomplete_details: null + instructions: null + max_output_tokens: 4096 + max_tool_calls: null + metadata: {} + model: gpt-5.6-sol + moderation: null + object: response + output: + - arguments: '{"city":"Paris"}' + call_id: call_fPY4IUstfYwpfd9zYZCKoenA + id: fc_0e035120236cff10006adb391a9bcc87d09c79e144ade2e145 + name: get_timezone + namespace: travel + status: completed + type: function_call + parallel_tool_calls: false + presence_penalty: 0.0 + previous_response_id: resp_0e035120236cff10006adb3915969487d0b245c858158c0259 + prompt_cache_key: null + prompt_cache_retention: 24h + reasoning: + context: all_turns + effort: medium + mode: standard + summary: null + safety_identifier: null + service_tier: default + status: completed + store: true + temperature: 1.0 + text: + format: + type: text + verbosity: medium + tool_choice: auto + tool_usage: + image_gen: + input_tokens: 0 + input_tokens_details: + image_tokens: 0 + text_tokens: 0 + output_tokens: 0 + output_tokens_details: + image_tokens: 0 + text_tokens: 0 + total_tokens: 0 + web_search: + num_requests: 0 + tools: + - description: Get the current weather for a city + name: get_weather + output_schema: null + parameters: + additionalProperties: false + properties: + city: + type: string + required: + - city + type: object + strict: true + type: function + - description: Travel location tools + name: travel + tools: + - description: Get the IANA time zone for a city + name: get_timezone + output_schema: null + parameters: + additionalProperties: false + properties: + city: + type: string + required: + - city + type: object + strict: true + type: function + type: namespace + top_logprobs: 0 + top_p: 0.98 + truncation: disabled + usage: + input_tokens: 381 + input_tokens_details: + cache_write_tokens: 0 + cached_tokens: 0 + output_tokens: 18 + output_tokens_details: + reasoning_tokens: 0 + total_tokens: 399 + user: null + headers: + content-type: application/json + status_code: 200 +- filename: t41 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_0e035120236cff10006adb39199d5487d0aab42c6312dac41c/input_items + query_params: + limit: '100' + order: asc + response: + body: + data: + - content: + - text: First call tool_search exactly once to find both a current-weather + function and a travel time-zone function. Do not call any other tool yet. + type: input_text + id: msg_0e035120236cff10006adb3911b09887d0accb43c387c44988 + role: user + status: completed + type: message + - arguments: + query: Find both (1) a current weather function for a specified location + and (2) a travel time-zone function that can determine time zone or time + difference for a destination. Return relevant tools for both needs. + call_id: call_DNaw1Lxs7wTkXj99MX2XhYLp + execution: client + id: tsc_0e035120236cff10006adb391236dc87d0b67d59fa50fd0390 + status: completed + type: tool_search_call + - call_id: call_DNaw1Lxs7wTkXj99MX2XhYLp + execution: client + id: tso_0e035120236cff10006adb3915a05487d0a761af95676687af + status: completed + tools: + - defer_loading: true + description: Get the current weather for a city + name: get_weather + output_schema: null + parameters: + additionalProperties: false + properties: + city: + type: string + required: + - city + type: object + strict: true + type: function + - description: Travel location tools + name: travel + tools: + - defer_loading: true + description: Get the IANA time zone for a city + name: get_timezone + output_schema: null + parameters: + additionalProperties: false + properties: + city: + type: string + required: + - city + type: object + strict: true + type: function + type: namespace + type: tool_search_output + - content: + - text: Now call get_weather exactly once with {"city":"Paris"}. Do not call + any other tool. + type: input_text + id: msg_0e035120236cff10006adb3915a07887d0ac12823a297dc92e + role: user + status: completed + type: message + - arguments: '{"city":"Paris"}' + call_id: call_5wX9unmBE5JnciJb2IxcROge + id: fc_0e035120236cff10006adb3916730c87d09559504da4475039 + name: get_weather + status: completed + type: function_call + - call_id: call_5wX9unmBE5JnciJb2IxcROge + id: fc_0e035120236cff10006adb3919a68c87d09c86701c2b8f101c + output: '{"city":"Paris","condition":"clear","temperature_c":21}' + status: completed + type: function_call_output + - content: + - text: Now call the loaded travel namespace member get_timezone exactly once + with {"city":"Paris"}. Do not call any other tool. + type: input_text + id: msg_0e035120236cff10006adb3919a6a487d0bfbc62b38f51e51e + role: user + status: completed + type: message + first_id: msg_0e035120236cff10006adb3911b09887d0accb43c387c44988 + has_more: false + last_id: msg_0e035120236cff10006adb3919a6a487d0bfbc62b38f51e51e + object: list + headers: + content-type: application/json + status_code: 200 +- filename: t42 + request: + body: + input: + - call_id: call_fPY4IUstfYwpfd9zYZCKoenA + output: '{"city":"Paris","iana_timezone":"Europe/Paris"}' + type: function_call_output + - content: Use both function outputs and call no more tools. Reply with exactly + PARIS_MIXED_TOOLS_OK. + role: user + type: message + max_output_tokens: 4096 + model: gpt-5.6 + parallel_tool_calls: false + previous_response_id: resp_0e035120236cff10006adb39199d5487d0aab42c6312dac41c + store: true + stream: false + tool_choice: none + headers: + accept: '*/*' + authorization: Bearer *** + content-type: application/json + user-agent: python-httpx/0.28.1 + method: POST + path: /v1/responses + query_params: {} + response: + body: + access_programs: null + background: false + billing: + payer: developer + completed_at: 1792751903 + created_at: 1792751902 + error: null + frequency_penalty: 0.0 + id: resp_0e035120236cff10006adb391e29c087d0917e2756afc3bf1a + incomplete_details: null + instructions: null + max_output_tokens: 4096 + max_tool_calls: null + metadata: {} + model: gpt-5.6-sol + moderation: null + object: response + output: + - content: + - annotations: [] + logprobs: [] + text: PARIS_MIXED_TOOLS_OK + type: output_text + id: msg_0e035120236cff10006adb391ed0f087d0a82003ad1338ff29 + phase: final_answer + role: assistant + status: completed + type: message + parallel_tool_calls: false + presence_penalty: 0.0 + previous_response_id: resp_0e035120236cff10006adb39199d5487d0aab42c6312dac41c + prompt_cache_key: null + prompt_cache_retention: 24h + reasoning: + context: all_turns + effort: medium + mode: standard + summary: null + safety_identifier: null + service_tier: default + status: completed + store: true + temperature: 1.0 + text: + format: + type: text + verbosity: medium + tool_choice: none + tool_usage: + image_gen: + input_tokens: 0 + input_tokens_details: + image_tokens: 0 + text_tokens: 0 + output_tokens: 0 + output_tokens_details: + image_tokens: 0 + text_tokens: 0 + total_tokens: 0 + web_search: + num_requests: 0 + tools: + - description: Get the current weather for a city + name: get_weather + output_schema: null + parameters: + additionalProperties: false + properties: + city: + type: string + required: + - city + type: object + strict: true + type: function + - description: Travel location tools + name: travel + tools: + - description: Get the IANA time zone for a city + name: get_timezone + output_schema: null + parameters: + additionalProperties: false + properties: + city: + type: string + required: + - city + type: object + strict: true + type: function + type: namespace + top_logprobs: 0 + top_p: 0.98 + truncation: disabled + usage: + input_tokens: 448 + input_tokens_details: + cache_write_tokens: 0 + cached_tokens: 0 + output_tokens: 12 + output_tokens_details: + reasoning_tokens: 0 + total_tokens: 460 + user: null + headers: + content-type: application/json + status_code: 200 +- filename: t43 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_0e035120236cff10006adb391e29c087d0917e2756afc3bf1a/input_items + query_params: + limit: '100' + order: asc + response: + body: + data: + - content: + - text: First call tool_search exactly once to find both a current-weather + function and a travel time-zone function. Do not call any other tool yet. + type: input_text + id: msg_0e035120236cff10006adb3911b09887d0accb43c387c44988 + role: user + status: completed + type: message + - arguments: + query: Find both (1) a current weather function for a specified location + and (2) a travel time-zone function that can determine time zone or time + difference for a destination. Return relevant tools for both needs. + call_id: call_DNaw1Lxs7wTkXj99MX2XhYLp + execution: client + id: tsc_0e035120236cff10006adb391236dc87d0b67d59fa50fd0390 + status: completed + type: tool_search_call + - call_id: call_DNaw1Lxs7wTkXj99MX2XhYLp + execution: client + id: tso_0e035120236cff10006adb3915a05487d0a761af95676687af + status: completed + tools: + - defer_loading: true + description: Get the current weather for a city + name: get_weather + output_schema: null + parameters: + additionalProperties: false + properties: + city: + type: string + required: + - city + type: object + strict: true + type: function + - description: Travel location tools + name: travel + tools: + - defer_loading: true + description: Get the IANA time zone for a city + name: get_timezone + output_schema: null + parameters: + additionalProperties: false + properties: + city: + type: string + required: + - city + type: object + strict: true + type: function + type: namespace + type: tool_search_output + - content: + - text: Now call get_weather exactly once with {"city":"Paris"}. Do not call + any other tool. + type: input_text + id: msg_0e035120236cff10006adb3915a07887d0ac12823a297dc92e + role: user + status: completed + type: message + - arguments: '{"city":"Paris"}' + call_id: call_5wX9unmBE5JnciJb2IxcROge + id: fc_0e035120236cff10006adb3916730c87d09559504da4475039 + name: get_weather + status: completed + type: function_call + - call_id: call_5wX9unmBE5JnciJb2IxcROge + id: fc_0e035120236cff10006adb3919a68c87d09c86701c2b8f101c + output: '{"city":"Paris","condition":"clear","temperature_c":21}' + status: completed + type: function_call_output + - content: + - text: Now call the loaded travel namespace member get_timezone exactly once + with {"city":"Paris"}. Do not call any other tool. + type: input_text + id: msg_0e035120236cff10006adb3919a6a487d0bfbc62b38f51e51e + role: user + status: completed + type: message + - arguments: '{"city":"Paris"}' + call_id: call_fPY4IUstfYwpfd9zYZCKoenA + id: fc_0e035120236cff10006adb391a9bcc87d09c79e144ade2e145 + name: get_timezone + namespace: travel + status: completed + type: function_call + - call_id: call_fPY4IUstfYwpfd9zYZCKoenA + id: fc_0e035120236cff10006adb391e33e087d0a5a484cd7035ecda + output: '{"city":"Paris","iana_timezone":"Europe/Paris"}' + status: completed + type: function_call_output + - content: + - text: Use both function outputs and call no more tools. Reply with exactly + PARIS_MIXED_TOOLS_OK. + type: input_text + id: msg_0e035120236cff10006adb391e340087d09e5c68d3001f7aa4 + role: user + status: completed + type: message + first_id: msg_0e035120236cff10006adb3911b09887d0accb43c387c44988 + has_more: false + last_id: msg_0e035120236cff10006adb391e340087d09e5c68d3001f7aa4 + object: list + headers: + content-type: application/json + status_code: 200 +- filename: t44 + request: + body: + input: + - content: Do not call tools again. Reply only OK. + role: user + type: message + max_output_tokens: 4096 + model: gpt-5.6 + parallel_tool_calls: false + previous_response_id: resp_0e035120236cff10006adb391e29c087d0917e2756afc3bf1a + store: true + stream: false + tool_choice: none + headers: + accept: '*/*' + authorization: Bearer *** + content-type: application/json + user-agent: python-httpx/0.28.1 + method: POST + path: /v1/responses + query_params: {} + response: + body: + access_programs: null + background: false + billing: + payer: developer + completed_at: 1792751906 + created_at: 1792751905 + error: null + frequency_penalty: 0.0 + id: resp_0e035120236cff10006adb3921a9f887d099e4209cda635d38 + incomplete_details: null + instructions: null + max_output_tokens: 4096 + max_tool_calls: null + metadata: {} + model: gpt-5.6-sol + moderation: null + object: response + output: + - content: + - annotations: [] + logprobs: [] + text: OK + type: output_text + id: msg_0e035120236cff10006adb39229e9c87d0a57ff6f659a0bcb6 + phase: final_answer + role: assistant + status: completed + type: message + parallel_tool_calls: false + presence_penalty: 0.0 + previous_response_id: resp_0e035120236cff10006adb391e29c087d0917e2756afc3bf1a + prompt_cache_key: null + prompt_cache_retention: 24h + reasoning: + context: all_turns + effort: medium + mode: standard + summary: null + safety_identifier: null + service_tier: default + status: completed + store: true + temperature: 1.0 + text: + format: + type: text + verbosity: medium + tool_choice: none + tool_usage: + image_gen: + input_tokens: 0 + input_tokens_details: + image_tokens: 0 + text_tokens: 0 + output_tokens: 0 + output_tokens_details: + image_tokens: 0 + text_tokens: 0 + total_tokens: 0 + web_search: + num_requests: 0 + tools: + - description: Get the current weather for a city + name: get_weather + output_schema: null + parameters: + additionalProperties: false + properties: + city: + type: string + required: + - city + type: object + strict: true + type: function + - description: Travel location tools + name: travel + tools: + - description: Get the IANA time zone for a city + name: get_timezone + output_schema: null + parameters: + additionalProperties: false + properties: + city: + type: string + required: + - city + type: object + strict: true + type: function + type: namespace + top_logprobs: 0 + top_p: 0.98 + truncation: disabled + usage: + input_tokens: 476 + input_tokens_details: + cache_write_tokens: 0 + cached_tokens: 0 + output_tokens: 5 + output_tokens_details: + reasoning_tokens: 0 + total_tokens: 481 + user: null + headers: + content-type: application/json + status_code: 200 +- filename: t45 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_0e035120236cff10006adb3921a9f887d099e4209cda635d38/input_items + query_params: + limit: '100' + order: asc + response: + body: + data: + - content: + - text: First call tool_search exactly once to find both a current-weather + function and a travel time-zone function. Do not call any other tool yet. + type: input_text + id: msg_0e035120236cff10006adb3911b09887d0accb43c387c44988 + role: user + status: completed + type: message + - arguments: + query: Find both (1) a current weather function for a specified location + and (2) a travel time-zone function that can determine time zone or time + difference for a destination. Return relevant tools for both needs. + call_id: call_DNaw1Lxs7wTkXj99MX2XhYLp + execution: client + id: tsc_0e035120236cff10006adb391236dc87d0b67d59fa50fd0390 + status: completed + type: tool_search_call + - call_id: call_DNaw1Lxs7wTkXj99MX2XhYLp + execution: client + id: tso_0e035120236cff10006adb3915a05487d0a761af95676687af + status: completed + tools: + - defer_loading: true + description: Get the current weather for a city + name: get_weather + output_schema: null + parameters: + additionalProperties: false + properties: + city: + type: string + required: + - city + type: object + strict: true + type: function + - description: Travel location tools + name: travel + tools: + - defer_loading: true + description: Get the IANA time zone for a city + name: get_timezone + output_schema: null + parameters: + additionalProperties: false + properties: + city: + type: string + required: + - city + type: object + strict: true + type: function + type: namespace + type: tool_search_output + - content: + - text: Now call get_weather exactly once with {"city":"Paris"}. Do not call + any other tool. + type: input_text + id: msg_0e035120236cff10006adb3915a07887d0ac12823a297dc92e + role: user + status: completed + type: message + - arguments: '{"city":"Paris"}' + call_id: call_5wX9unmBE5JnciJb2IxcROge + id: fc_0e035120236cff10006adb3916730c87d09559504da4475039 + name: get_weather + status: completed + type: function_call + - call_id: call_5wX9unmBE5JnciJb2IxcROge + id: fc_0e035120236cff10006adb3919a68c87d09c86701c2b8f101c + output: '{"city":"Paris","condition":"clear","temperature_c":21}' + status: completed + type: function_call_output + - content: + - text: Now call the loaded travel namespace member get_timezone exactly once + with {"city":"Paris"}. Do not call any other tool. + type: input_text + id: msg_0e035120236cff10006adb3919a6a487d0bfbc62b38f51e51e + role: user + status: completed + type: message + - arguments: '{"city":"Paris"}' + call_id: call_fPY4IUstfYwpfd9zYZCKoenA + id: fc_0e035120236cff10006adb391a9bcc87d09c79e144ade2e145 + name: get_timezone + namespace: travel + status: completed + type: function_call + - call_id: call_fPY4IUstfYwpfd9zYZCKoenA + id: fc_0e035120236cff10006adb391e33e087d0a5a484cd7035ecda + output: '{"city":"Paris","iana_timezone":"Europe/Paris"}' + status: completed + type: function_call_output + - content: + - text: Use both function outputs and call no more tools. Reply with exactly + PARIS_MIXED_TOOLS_OK. + type: input_text + id: msg_0e035120236cff10006adb391e340087d09e5c68d3001f7aa4 + role: user + status: completed + type: message + - content: + - annotations: [] + logprobs: [] + text: PARIS_MIXED_TOOLS_OK + type: output_text + id: msg_0e035120236cff10006adb391ed0f087d0a82003ad1338ff29 + phase: final_answer + role: assistant + status: completed + type: message + - content: + - text: Do not call tools again. Reply only OK. + type: input_text + id: msg_0e035120236cff10006adb3921b8d887d0bcec1fe8c006df5f + role: user + status: completed + type: message + first_id: msg_0e035120236cff10006adb3911b09887d0accb43c387c44988 + has_more: false + last_id: msg_0e035120236cff10006adb3921b8d887d0bcec1fe8c006df5f + object: list + headers: + content-type: application/json + status_code: 200 +- filename: t46 + request: + body: + input: 'Use three subagents to review this Python change: one for correctness, + one for security, and one for missing tests. File cache.py now contains these + lines: 1: import pickle; 2: CACHE = {}; 3: def load_profile(user_id, payload):; + 4: if user_id not in CACHE:; 5: CACHE[user_id] = pickle.loads(payload); + 6: return CACHE[user_id]. The function accepts payload bytes from an unauthenticated + HTTP request, caches profiles without expiration, and returns the cached mutable + dictionary directly. The only existing test loads one valid payload for one + user.' + max_output_tokens: 16384 + model: gpt-5.6-sol + multi_agent: + enabled: true + max_concurrent_subagents: 3 + store: true + stream: false + headers: + accept: '*/*' + authorization: Bearer *** + content-type: application/json + openai-beta: responses_multi_agent=v1 + user-agent: python-httpx/0.28.1 + method: POST + path: /v1/responses + query_params: {} + response: + body: + access_programs: null + background: false + billing: + payer: developer + completed_at: 1792751947 + created_at: 1792751909 + error: null + frequency_penalty: 0.0 + id: resp_0728b898e06dffcb006adb39258f4c87d0ad23c42f61a95c20 + incomplete_details: null + instructions: null + max_output_tokens: 16384 + max_tool_calls: null + metadata: {} + model: gpt-5.6-sol + moderation: null + object: response + output: +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MOTvyp3D6mkWey4E_pFL5YJ4vspRiR9z5CvWJ1vSpiVJWiuUx9DH93WzjsZd9H5bSsgpxFhYU6lsBYqa_yyQZ4WouWm_hSd3BohuY25pQ9IZpeQoC_Nw23e3D5d_M5GPBYWpz4sUCqRWUu9WcAvDwfiiPSzmc9nzR4eCfqRVoVJZo5GpTnp3PUe539Oage1wfCCzbKMvx-q9QSc9MuekXEveoi_MilroXdgYs7R3utEWdY_uzh2EknjluhDWlsIaxnpWs9NLlW7CZVeDkdAcNumi7HcrhOQUapRkHAN05UkU1jvTRgRnRP9Uimh5JG9VuWXDEeO8FqB2SdO2uUHdQZ6syXzupK8y9JBUoUbnEL6GTna-kfXMrIFna3D-NtSYwnjP-EobFfCESGAhb31_I_eF3BpFIH8YhZe3TUtAoOt2ktvGM6bPMwuPvG4lS0Wap-2vAKuuSlSNbLPR3QBwDVryQM24Lcwcc-hvzsHVdDMZnM2QWslaDE5kpzZ7uyxX91_w7_paFuLmTq6gUdbWE7CNBr0EMpDAzhpApQOqie2s4Y1DVRDKfuZ3ppEPXEDSMqMXr9v4cPOtgNSYvb6Um8-htYBsc7_m5cIu6NsTxmSiHMcXEyfMzH05yWepua3yRHL_82VSFDpR5UwcAapk4CELMY5TvyB73DZu1xmSSKfvbJl9GvY_lUzH1SAds0Iko_JESrEWYKIjSgtw== + id: rs_0728b898e06dffcb006adb39269b8c87d0ac8a0d890240ef0d + summary: [] + type: reasoning + - action: spawn_agent + agent: + agent_name: /root + arguments: '{"task_name":"correctness_review","message":"gAAAAABq2zknHsxGichM95AQ5cTbugSDz7fRYR4L7MGXsAq4EHmFVajchfnHxYgRjMue7v_AHmHhurrxo1INngNkTcRjGQcTjqisK3V87FCWUkmo4Gyfdlxr5bx_t4J_Ek87mx-fG9ze0EP9NqUy3_eVAgXyaz6mZXxjt7z9XwBH19o-oLm-jXEnyJSipOBp_IPDzFz4AGyUjxy1ycqDwt_3Gh1kSQNgAmM54_gs04fSmqH6zSL4tH3nukUj62K8dBaahEQ9S66uGI75h5Kegf0JlyZTyXKmeHwpr-YTnVYrh7WSi0FA07Q20UkqVXhbfxe_BFyNbUx_sZvv7F9YNffOdLpWfBuoUsCadk1iIV7aWon9DepT6uU7DiX1k3WWMtkjPV7RDW4_eIhtMQy0aCNI2r3Lr2UfXg==","fork_turns":"all"}' + call_id: call_FuDavN3956eBtvCyLaIZmFBb + id: mac_0728b898e06dffcb006adb3926fa7087d0add620154a8e5964 + type: multi_agent_call + - agent: + agent_name: /root/correctness_review + content: + - text: 'Use three subagents to review this Python change: one for correctness, + one for security, and one for missing tests. File cache.py now contains + these lines: 1: import pickle; 2: CACHE = {}; 3: def load_profile(user_id, + payload):; 4: if user_id not in CACHE:; 5: CACHE[user_id] + = pickle.loads(payload); 6: return CACHE[user_id]. The function accepts + payload bytes from an unauthenticated HTTP request, caches profiles without + expiration, and returns the cached mutable dictionary directly. The only + existing test loads one valid payload for one user.' + type: input_text + id: msg_0728b898e06dffcb006adb39279a5887d0b6c976e1977acb69 + role: user + status: completed + type: message + - agent: + agent_name: /root/correctness_review + author: /root + content: + - encrypted_content: gAAAAABq2zknrtdcnjiGht4ds5zqh8N7_b1v3QcFvd0NzdEBzXyCMYY_oqDaLc_OfcYEDvYzCjfAyzs4v_3B40r60TOq-DxDHI5AC1rnR276fROFJECNykUcVFXeW7OW64r8H2vilVk00MwKAGyWAuF2uooTwX758nLa1i8-vdPnlR2AqC3b0h-ReHR-SlgWBQiNaj584lE8IOFMrR1DTOloo7Fk0rb9EAGaVYSM7Wb06iboeY9GPy4-SJkkfSC5DwXAtMgTnhlK-1LSt_uMf0QC8QZvPecsJmRYDpELrg6FT_Z1sFhJqqzI2-fcbpmI2O_gXslcfBpRt_Gew9wT4KA7d-VBUU37DMAYz7byaYbEBxxr8SJ-E82w7il4oW9jbHQWnhUSXSE6YeHj94ugp4VaIcQiLG4aBXlmdxIphHxgSKF5cei4jFjg5UAJLNwhLZ4Xyc-QH7NVrCvpaxWHlhhY84B_7jrioxxCjGuijRwJHU7WYezKQKDn5JAOtpQD_sTBPTPlI4LmeT1nBUrS8yF9xGjO-Db2Dg== + type: encrypted_content + id: amsg_0728b898e06dffcb006adb39279bc087d0978eaefccd007f17 + recipient: /root/correctness_review + type: agent_message + - action: spawn_agent + agent: + agent_name: /root + call_id: call_FuDavN3956eBtvCyLaIZmFBb + id: maco_0728b898e06dffcb006adb3927a6ec87d09a6fd459acccd732 + output: + - annotations: [] + logprobs: [] + text: '{"task_name": "/root/correctness_review"}' + type: output_text + type: multi_agent_call_output + - agent: + agent_name: /root/correctness_review + content: [] + encrypted_content: gAAAAABq2zlMZramnBjfcJ9qKjClB8yrS_thlQQ6EXwpcFcIJwXyl5QqK7g2FoycvJlCbOGMyvyOIea2JB6ul1eCvIOLL5R97F2O1bcYp4Jn_z_a2DowzYnUa9Ti0Xrjb3KbAxhEuOmcCoSUpOQa0B1sWj5vvn5-hZ-pSZ5uDDfgNdquq3XxDBdi2udifumgmAXE1pbVBnno7TT3g4MD_0Jxj7JrJvFJofJLmGTfs7RqotBToiMqRiXTQgVvDK2Zwr44L_80d1TvUHAy8iBBxDB6oeBf3eA8eGL0XTdYSxBWdx363F1wqC9DWeyhEdlvcjzJPVEnp4iRQoR1yE864oKX6vb2hEJxv8jMP7yhTz6gVDfZwe3LtYNnZEOd4v4IeGU5poYHdyN_5_vjJaW8tTjLrD1xdLiF2aHmnjr9Xe0_JQO4vXEe4VfDhJ3AXCWNbfxxD8XWCzmRnLYHaJ-WHnOcr7cKJNyxTkkEkSLkePuOFiia13ed2ZCx6OwTTuKp17XmTv83brI3SMjyAvzdKDx2qQBIutqlyNPDBo0bQy_T_X9CPf4edbVdWfoFAWNUI2U2N9-fV4o2sFsWKxS04RUbA_u8gXXgraC_tD7sUKn3kZgH7SCGSoS17KfFYRMuXuQFOmnwKyM3jSO24Cy9vdUOADWqroMQ7JFNnmVVP0l7oGlBRiZuMeFFVyeawd754luTyMzS2X5OQ9QQJ4os__9_vbV92sRSHCSFI0ZqX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R5W_6TimQBXZe30HXAREZ3YO3o4DnhqDp7nqBAHTql3TP1kXGRcapmnNQ3tSoll82po0_5aQ9gufBNnWdgu8jkcEmzx9qqA_n0q6_ByOHN6_r_ChQTgddMJP7Fj2o2LZ8Md0vIIOEGvmFCOt67sbPpyc961WdFj4aLyUY0z-y-QRg1oJnrPAYuW-bUjRTq3E5n-STtca1no2yLlpRIe754jHXM2BKCF10_2-FEBiCs8fo= + id: rs_0728b898e06dffcb006adb392838b087d09219230d65443951 + summary: [] + type: reasoning + - agent: + agent_name: /root/correctness_review + content: + - annotations: [] + logprobs: [] + text: '### Correctness/reliability findings + + + - **High — stale or incorrect profile returned (lines 4–6):** Cache identity + is only `user_id`; after the first load, every later `payload` for that + user is silently ignored. Profile updates, corrected payloads, or reused + identifiers return old data indefinitely. **Fix:** define invalidation/refresh + semantics, use a payload/version-aware key, or replace the entry when + authoritative data changes. + + + - **High — shared cache corruption through mutable return value (line + 6):** Returning the cached dictionary directly lets any caller mutate + the canonical cached object. Later requests then observe unintended changes, + and concurrent callers can interfere. **Fix:** return a defensive copy/deep + copy or expose an immutable profile representation. + + + - **High — check-then-set race (lines 4–5):** Concurrent requests for + the same uncached user can both deserialize different payloads and overwrite + each other. A request may cache one profile but return another depending + on timing. **Fix:** synchronize lookup/population per key or use an atomic + cache API; also specify how conflicting payloads are resolved. + + + - **Medium — unbounded, permanent process memory growth (lines 2, 5):** + Every distinct `user_id` remains in `CACHE` forever, causing stale data + and eventual memory exhaustion/restarts under sustained traffic. **Fix:** + use a bounded cache with TTL/LRU eviction and explicit invalidation. + + + - **Medium — no validation of decoded object (line 5):** `pickle.loads` + may produce a non-dictionary or a dictionary missing required profile + fields, violating the function’s apparent return contract and moving failures + downstream. **Fix:** validate type/schema before insertion and reject + invalid profiles. + + + - **Medium — malformed payload failures are unmanaged (line 5):** Invalid/truncated + bytes raise deserialization exceptions directly, likely becoming HTTP + 500 responses unless handled elsewhere. **Fix:** catch expected decode + errors, return a controlled client error, and never populate the cache + on failure. + + + - **Medium — global cache is process-local (line 2):** Multi-worker deployments + can return different profiles for the same user, and all entries disappear + on restart. **Fix:** if consistency/persistence is required, use a shared + cache or backing store; otherwise document these semantics.' + type: output_text + id: msg_0728b898e06dffcb006adb392b70c887d0b21da0f74784b1d1 + phase: final_answer + role: assistant + status: completed + type: message + - action: spawn_agent + agent: + agent_name: /root + arguments: '{"task_name":"security_review","message":"gAAAAABq2zku4hAewQpr9HOv9tYtg_YVd3W_W8mw54eDD_f60-BS--PTXS9baLVfgGp9BPTSjiMuQZAhqloCO5aYhNBjeHVGfNUjwFVaqgJ_QkOlVecmElCpWBiKx9KquU99WJbf9G7d6ZcJitS98mLzR8PdEqc97YWu4cTE5JNdQm_HFIGZvZrBcZbxi9N3o0awZTCd1_GFZPql5vLnanc28sAgVTKJtnukZdNB_mJfJPAgG1xwmX0Z0qAkmXaNyzTwp6Fc8bjRTG2VvCbNe9tuh3lcKzCHt5StSnRG1iKnWPS_cRIm4R1jqbrnsdh_B75ZkQd6tJDBiLxHGxjq67o-mpsEyu0CzftAiGMtvlQhFleiH5mkReFEYQuZqWodRM239H1hbICpa-hLoSFwe0XxD0OHPFzuvgcR3mbPYOTgAj3nrsZ0HuA=","fork_turns":"all"}' + call_id: call_UDRhRMC2GExMCPFQL1gBhS2x + id: mac_0728b898e06dffcb006adb392de8a887d0b4a0af170fa2f2e9 + type: multi_agent_call + - agent: + agent_name: /root/security_review + content: + - text: 'Use three subagents to review this Python change: one for correctness, + one for security, and one for missing tests. File cache.py now contains + these lines: 1: import pickle; 2: CACHE = {}; 3: def load_profile(user_id, + payload):; 4: if user_id not in CACHE:; 5: CACHE[user_id] + = pickle.loads(payload); 6: return CACHE[user_id]. The function accepts + payload bytes from an unauthenticated HTTP request, caches profiles without + expiration, and returns the cached mutable dictionary directly. The only + existing test loads one valid payload for one user.' + type: input_text + id: msg_0728b898e06dffcb006adb392e6b8887d0b5214e1b597773fd + role: user + status: completed + type: message + - agent: + agent_name: /root/security_review + author: /root + content: + - encrypted_content: gAAAAABq2zkuG821zDn2CEZ4xL4Zo0Buh_uxng7MM6zKpQPfDjcnvmwxdv_1XYLrimDUFonQHy7C19D04AByo1WpO3vnn6qylNDnMTvHerM7PNqE3ctej3rUWsO83ztVvwkwvOargMVYgfa0hnI7jSNIeFnWeT_8zEW2oNzCvh02WW5QBcDgV3h-_8j7MJRZm9fZfyLP4702cVywAV53pcZSx_7FZsPlzwnkQTJVAVhAItPwh46fq2AdfB7zwPsXQW9eXDMuZivGdLNtuw-nLSwmiYY4yIDfc5CbjhSHLFD4oZ5APKaRNAvDAOc82pH8QFr466D6QmwwHxeCHpz2ny-WB_JL-SIG2n12pt_QgwB-0QiuVI5-5vELb6RONK5SGsOKhhPtQZVbyDlubH8NA3F3s67EpkyXgipfDzYphKDQHWxvpGOGP0TT7BRpvO97eJeiOwxsdfQJHlYzkWcG-eR8dOinoZafj57i3FC0a8Ee82pnMRUFrZelI5FwagPPA16XPYL-usitdfhn-BYXUeobAIipPkp9Ng== + type: encrypted_content + id: amsg_0728b898e06dffcb006adb392e6e3c87d0a2cdd09f589e1b25 + recipient: /root/security_review + type: agent_message + - action: spawn_agent + agent: + agent_name: /root + call_id: call_UDRhRMC2GExMCPFQL1gBhS2x + id: maco_0728b898e06dffcb006adb392e786487d08220ef8a4e87669a + output: + - annotations: [] + logprobs: [] + text: '{"task_name": "/root/security_review"}' + type: output_text + type: multi_agent_call_output + - agent: + agent_name: /root/security_review + content: [] + encrypted_content: gAAAAABq2zlMQbfcjLD-NAyUUqrOjEIqAZcI6c8UzTQNs3f7poryjfOHZYeZ51UZAtpBq4TakUYnjyeQu_uT06XzCjISoypD4IlVZ1evgpez_BejbVa9I3fZs5cGUJQmsiFSsE87Iuw-ICS9V9rWOrti9h-4NxjwK2upo5aQMOUWPJ4wYc7SKXmaTe_QRr53Ab0dmNWmRAxt_7rVgWartLbhadENA6vwLHZGfVIuVHIpp2bGxG1E1cfnWOxK3-imFfS6w-sOROE0TfblPZ1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Q3TDUdb9fVJk9JjzayRZVxUMRUNe2BWeHFq6VKsXDUqCobpFzn9KQ5bQYLXGjSSjKZxfGCcJUFEuqp11DJK-ClPPBlY56bV-iGwlyH7RG7gZ_sMlMSnc1c32aPPFfnnGp08l7sXsHaXihzL_YprIHcrxbSsPO0Wl7Q25cEtgzCkSCp_o0dr_8h9BglsC2SwHSzVoejczOKunTHb9FY_JLyZqkhNONeu-PM7a7faCz7xNTWeqXx5B5ydHtVS5XFSbq0oFU16T_65bq5fzgN_y1VVWXXcHfaVsRU9PCdYbLP1VMsbIfTnqaUr7Z74yLBsy1Hq4ozCY-BLqplMf6R3g6ZRSRl1AimznDQdSSdrrONIo-BLVPN5l8bRRLNIzDtXh3ol5G-pr0Jtr_-LTE8uK-0ziV2sidqwHXQxJn3zC0dV8QVB_jB8eI03DKMi5odYulnhcDLl3Sf + id: rs_0728b898e06dffcb006adb392f034087d09be0c9ca27181d72 + summary: [] + type: reasoning + - action: spawn_agent + agent: + agent_name: /root + arguments: '{"task_name":"missing_tests_review","message":"gAAAAABq2zkw0jNDUF5j71HJvBZWk2kCzJJ5kYTFPd-GXYEdMvrYOcqYW3ng-4OLQBlfhzOZ_V6Zr1uGD9OZsQoS8aGIqvfDcsumPVK6P3omVDEc9FlewSfr5hqAeO7LJdFz_LVsI8lNEdrUwwSYzaqPDvVQFIDr3Ckg6L-B0HU9fJfCdy5BDBBQJByCK7cwCCynu7TWS6_DDqXLZfAr6tBDgzJzDkMcD0uHeNPmM_xGLkqJijDO8RBaCsoyfF3I9cD6tq9o8-7T3T7hxvs6PJgYDsDXvFKWhxlsPsznWVXD0RlktjTO2Y3ZCdnwF2RZP51CVp66Gopi8N_RSQLuJXqDZ0r0eG49oqFHuYq4dUjkhdZepXw-7mfS8wM95_Goqo7rtmyODDRzuJjxmW6bbv7g5LygegXhaLzYKha6wYjIi0nv4JSyoE4=","fork_turns":"all"}' + call_id: call_qZdIWvLPqnp98UcZqDcegXfv + id: mac_0728b898e06dffcb006adb392fc0f087d086ff3836e0edfdc1 + type: multi_agent_call + - agent: + agent_name: /root/missing_tests_review + content: + - text: 'Use three subagents to review this Python change: one for correctness, + one for security, and one for missing tests. File cache.py now contains + these lines: 1: import pickle; 2: CACHE = {}; 3: def load_profile(user_id, + payload):; 4: if user_id not in CACHE:; 5: CACHE[user_id] + = pickle.loads(payload); 6: return CACHE[user_id]. The function accepts + payload bytes from an unauthenticated HTTP request, caches profiles without + expiration, and returns the cached mutable dictionary directly. The only + existing test loads one valid payload for one user.' + type: input_text + id: msg_0728b898e06dffcb006adb393051d887d0bf7d07885e934141 + role: user + status: completed + type: message + - agent: + agent_name: /root/missing_tests_review + author: /root + content: + - encrypted_content: gAAAAABq2zkwT4RTJERqhHuiGhPXkCTLt66HuosEzOi6Zq4nhzebgxAxHIw9kxV31_YBHf3iSD9HX97p9shsKd3yT3lcl3Bqwuizfpdx-_89x29yUQsN9thJWxKk09RmQs_-diIs1XczPIev_EpStbScZdKbkkpso1pgtTjEcWIEeW8Dn878-u2B0upaSP03iv64pmrgWOAB_2YCaGQ629ZynHNa9oDI2NWbwUS4qN9wtdS-ktIFm3NitIgF1NT3l6FMmM8UqRUyocr0RkzYoBz6-k3uONNQxO2DShjZQHHN0zxMI6reY7IllMns44kqfNJ56KVP3tbqa-AatTMMfW_-GeDOIZDuT15RazagGpl1rFnR-nGbSZEi13fzKxDSC5ydjPewvNjlCrKzmmu4KD0SUV2PJDvpWKK4L-Vw9ma16Ru0lqVxRagAqjtES9oT6ZQgSNTTwRjxlWK2Zg4FFG_ipBhE5ts68eAHPus970Grsccd34f0iXxjIekhOUNz5y8jTmVJ4FZQvenPqFwmHp38qhNa1LLkYA== + type: encrypted_content + id: amsg_0728b898e06dffcb006adb3930528c87d09e49739e4b76c167 + recipient: /root/missing_tests_review + type: agent_message + - action: spawn_agent + agent: + agent_name: /root + call_id: call_qZdIWvLPqnp98UcZqDcegXfv + id: maco_0728b898e06dffcb006adb39305f8087d0b6c0f96d85eb8314 + output: + - annotations: [] + logprobs: [] + text: '{"task_name": "/root/missing_tests_review"}' + type: output_text + type: multi_agent_call_output + - agent: + agent_name: /root/missing_tests_review + content: [] + encrypted_content: gAAAAABq2zlM0d1mGCocXd1q4kCL7-WfDfmApW-rlKFYzFIuiSzpAOu4hvl3g6YcN2RuOXwT1QE6QEUtC1RYhYsfC-rfuzxd-P9ZU8jte5GAw5kYw87snJGrGUnbM84ZjILVkyBn5RzbrjgbGG6FSmbsIMrKeAlgW9v1FZXRQRiAppGzKDQaMyjkQVbUyLkKXf3-rfeadZK0iWSXRBUPhnoRwV0gFNbmDb67E3SLTs7iogsb9GsCFw8J50ARwggqWc1B84CFpqDqxcnswHfxy7q1HYl8dhvcHEHNFiH1kh9nD1FzLEB4Hed9tGg5kqnOzbRb3skbPv23DairMyu3o9EOKhl9x0UyihLbZ5JDiNLUrT1JJsq7x-MNyJbSirNgIY7R76I4hPZXv7FctyKsOheMynGzNK1bJGvqIV1t1gd_k50I4dNTQAHhnmyOwtna_vpB2srLAX9HcQnuXBHL9oOZ9x_ZsUyBJTNndugmEOCTBgBqwx3HDPUC_flijNEOYD6o7lo5jir7ga_j82Xwk8rNE8xDNCOvemZTD2d_LU-eW1chR8Fvnto2u9gxALKEpD5JNY0eSbegIdKWfJKNHVRmwIf9NmEBuit00ySJvijKjM6fniJo6fkIXkNVs6g0JymGtA39f8ZG42cVEJAELHjflhefG3XD8E54A9OUE0c1TF6Hjztp2WLa4URZ79db_h8JT_QQmgYUfc5cb_PF5R0Oje2FmjJfJMu78mNvmoLnYdnI738xl06uCezb5GafIUy-_g2580_acvf0xH7QpfGh8awWi2cGYDUU13jhoftPgeN9SnihH_018D2cDKZ5VmxTLSlFjh40TRPe3KS2NuziRFtI9CVn0nRTtRFdmNiGYeG40qyqmW_Cx5uqGfC_awamOXXXGyTwHBtM7AlTY6L1fIyc1or8L0UOjIsPf8yHBKoi6ugR1NOV2W7wb_q6O98-9Y52PDBWQQcNtJ5fXuERCVE0B_rEPwt8-v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hAQAwlteEp3I6H8d_Z09aRGHArLDnYrR6RNsVwPE7DNtMqEB4NGs__Bq0TBa1hz2j-vG60vwz7Y-OHVGga7h0npF_tTsuUnE4U352CvYvs-IbLb5DIcbIjZkfteA8L0D21nweLi4eqHa19c9KIGI7hm9Dy8YiYXx53TGLV1QYZYt0aek882kqySEk1Q3zTNlJedX-dUJE3hJpKi1ugUUeLkKmsDycitKCzGshDWmbZ4lxwnDd075U4AHztkFWYLF71pMO8vus05D_UlPLXIOcRGy1DAum9HB8RWYom0xYMrVluxOfoTUYalzPv4oj-lTGoFOQWOrhC4pFGTx9uSzjrv9DYBcPpa1udguRncs_Fba3ePcCHMhfTGM7pqTHsh-MLqYc33cqDrIWptW4-ORjRQrG6BcOT3BVkBI-vb3L7B17P6t5R1RXAWBBc1MIh8sm_23sC_vVxmHur0PjK7Zp_qHgohbltr9hxIXsg5OESqur8XRy-raLsanE0Z5WsycSpEyqc71DgDVCw7sZRmSWImTxHdxBxuPlTA6rfbAW_UNqoXdcs3MboT4n8ZOnQY0LLd1UoDm5AR1O1-aEdl4ysVzYXc-yJq67dhi2O1MmFharXdXSEA2wL59vxMdUwCMoIWjtB0myc5mKO_hxr4dhZ076w== + id: rs_0728b898e06dffcb006adb3931b3b087d0bb09e4a025a2b526 + summary: [] + type: reasoning + - agent: + agent_name: /root/security_review + content: + - annotations: [] + logprobs: [] + text: "### Security findings\n\n1. **Critical — Unauthenticated remote code\ + \ execution (line 5)** \n `pickle.loads(payload)` deserializes attacker-controlled\ + \ bytes. Malicious pickle opcodes can execute arbitrary Python code with\ + \ the server process’s privileges. \n **Impact:** full application/host\ + \ compromise, credential theft, data destruction, lateral movement. \n\ + \ **Remediation:** never unpickle untrusted input. Use a non-executable\ + \ format such as JSON plus strict schema/type validation. Authentication\ + \ or pickle “restricted unpicklers” are not sufficient general fixes.\n\ + \n2. **High — Unbounded cache enables memory exhaustion (lines 2, 4–5)**\ + \ \n An unauthenticated attacker can submit many unique `user_id` values\ + \ and large payloads. Entries never expire or evict. \n **Impact:**\ + \ sustained memory growth and process/container denial of service. \n\ + \ **Remediation:** authenticate requests; bind IDs to the authenticated\ + \ principal; enforce request/payload size limits, per-client rate limits/quotas,\ + \ bounded LRU capacity, TTLs, and eviction.\n\n3. **High — Cache poisoning\ + \ / profile integrity failure (lines 4–6)** \n The first request for\ + \ an uncached `user_id` permanently determines that profile. If IDs are\ + \ attacker-selectable, an attacker can prepopulate another user’s cache\ + \ entry; later legitimate payloads are ignored. \n **Impact:** forged\ + \ or corrupted profiles, possible cross-user authorization or data-integrity\ + \ failures depending on downstream use. \n **Remediation:** authorize\ + \ ownership of `user_id`, use trusted server-side profile data, define\ + \ safe refresh/invalidation semantics, and namespace keys by authenticated\ + \ tenant/user identity.\n\n4. **Medium — Mutable cached object is exposed\ + \ directly (line 6)** \n Returning the cached dictionary lets callers\ + \ mutate shared global state without validation. \n **Impact:** persistent\ + \ cross-request corruption, privilege-field tampering, and accidental\ + \ cross-user effects. Pickle may also return a non-dictionary object.\ + \ \n **Remediation:** validate the decoded schema, store immutable\ + \ representations, and return a defensive copy/read-only view; restrict\ + \ updates through validated APIs." + type: output_text + id: msg_0728b898e06dffcb006adb3932176487d08f2307c47afddab0 + phase: final_answer + role: assistant + status: completed + type: message + - agent: + agent_name: /root + author: /root/correctness_review + content: + - encrypted_content: gAAAAABq2zkyuT7PZXDdMN-Uhmu53z-5yhJO_jBql3wBHjLOpvKoRPX0k9ZUyxj-kDquwbNLpFhsh06oSOMvqTUX56xiuYYkpkPjIFoDtZuiXyEBJVlUxeHvF4CdAhMIvX2TLtYN-zb6EIifxOLTt_W7SJzWfcNxQ18BD5aIQV8u960B03Z5X1WEI_M9T3Dd8y_tDaIfcbaaL5e-OQWUZNy-FfKmk38ukl9GPdAeOUZfk84WsOKOPsXnfEDBLFAMJyBdXzUr-2oKmwD569AvSyFl_Zm04OQ79ioH_QSGbz8qc3QSThzaOMB0jaQRS8As3nCfBu1y7jS9YpiS3oGku7eKG24NtNmex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IZYI9moT6IRtJ60jc8ip5CLLSAspbxYB3Kt4RP8v3ErbJ0cQW5AFiLNJWIeXlj-wdIrx-3-K7aAohE0GvNdrSCcJFvrqqkImxFe6PH2cA-05IDJTZ6bgV9ELwBXCbpRZEv5QcCn9rOP5WwapMY44QecY8Yq19OWeNqPMeLNerLAWcy-l14flvsWSN4b9ke4wyzdHLEm5LFokmvAaZTZkTDDiuUoE0Kv87vcAXYP8LlIpswyN5TzxjJFDjK2OTT_3JFOzBHGPE1E5fQzbvOMO42woYoNNuorqOUTgjgpqYe2o25tHxrPsn9JdgZok1N4hQqUzVquimy8Zrp_2BodPKiyMl8uctTOtsnbZQVI9oh_pV1Vpzwss3oCY__c4trf9FuyQGH6jnzom8OTPWtbcvMtGz9tqQEiavcWp8gNO15YqasNU5MVfna6HeWAzSQGxtBNFGAWrrIKzairBWy-hudTpHVbOE6-3p3vGZWhy_jp2e5jftJDn6tnDvrGBnvWcXn8zriSeFvNKzIlri4HEuX3ln0ii94W56kkXfEE8FCmFiiqY-Mp_OsRrmgtP137k3qICKBTYlSk1Kdf7P6dGhBmNYHitnFM7kj84LStOmb4kMvXdvCqozRGmlzOfkoiHAb9t79NkicflqTXlmgiKsIKxS8MOAlR2geHDQSXP7RecycIQ2hvLYECZBTDd1VjA2eCXHyb08XCpJ4PnZfzEAo8vHw3NZzrvoextygDRaJJ_ay9e8NG6DOm_Y2DsMHh1IniHMF3usYKZ4LIZ1whYvEESzgTYB8J7AqZzWi8iE9w-Y_JX7H7NExIYtaDuPSwWdKVTDhQvTijkq1V5D4bBMB24zYwWpABQkVFAh8booB5e2MdDo9V + type: encrypted_content + id: amsg_0728b898e06dffcb006adb393242b087d0b37dd408126bdf1b + recipient: /root + type: agent_message + - agent: + agent_name: /root + content: [] + encrypted_content: gAAAAABq2zlM0d_8wzhwiurs3IL_8dKynu3_T__T-VfEnqzsQ7df8OiHniDp63iP1v2PD5-spkex6XTnzgkjX8OtZml1d7oKTa1scJGiFy2lkQFiLutXFq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qXnV_RmfXyqN8PgtsJNftCEhjd7utblfnz6SWXX4vfw79ekGHSnKZq6PmBv12YZGinjz6rcBx-Awaa181L_sUs4DRGjqhAXsJVhM5n32WHj8dPN-JU86ToiKorD4pZfyu6TrqiD8oXIdUzvIYLK2T7VznGVL87hN_UNYbv7f6wim4PLTDZ9JgrY9kbd6xQLEoxmx6vVZ_T0xJ1AnkwpU26hPVJHIi1He0qkibgzW_2UAHTXxGy8Jsz4F3tBj_MxeR2jx2cHsQOaioiegxw0nVMQlf7pfNPPfimKDE7LxVGrrJX1MawenEHkqiP5XNrp4YerlL2I9f7-paElCkrWL-ZZz339ZtezkqvaC9bjuituBUFGE69U_BTNJWXnRRWxDsirKieoJvhspT3aiz-1qXBuJifkJfz6KUFaAyWiHSl16tSXmrtuFA== + id: rs_0728b898e06dffcb006adb3932476c87d09ad0355ac91fbfae + summary: [] + type: reasoning + - action: send_message + agent: + agent_name: /root/missing_tests_review + arguments: '{"target":"/root","message":"gAAAAABq2zk6uUSQHuW1EbtVDt3JfuErn-4gtzTPrsQyMgJ_1HuigfAcEFt9f7qhHTtNtSJ_c4EvDu2ak-AMWzm4SHGAU6pQPmCZEDPVa4RSf4UXR_RTk0Q_HwAvUSjX3DhAt-A-avGsSYpYlUimBGjIniMP7u179OhjCvmDF73GSB_dtmMVPfbrQiuIXfu0B5KvRvPxMp3qtAOD1NbSULsO5mt4A1vRGsiNx4XFxWV07GKhhm7wtw0A6lzKnA7gPeZEiKkOzdBo5vly8TDmlJI-ibIoOx-oltAvXf2s6HipROd_HP7wY7Ovwb_A8U9oTeriQUHHZ0kZpE4nabtPBrQtycfEUjrN4ohqAhKgIjZPKJuSO-p4FKnQ23r8dhfx4g3CBJykjyjEAuw4mr7Mecev2yXkDWyig66QqFbgDvWcu01IuNY52CvnD1YQYx9LGzwpOVSBwJ8SpiLZK5Ng_YQOv-HzjKwsOoFvfq3T0Jk_fMUfVNP096Pwo9IcJdZnKlr05QGxG3_7DBqElLmWpDtVLNHAG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K5qvG5IIPCzJzE9Y-TpbwD7fwpqFbXg7spjsRxnlzCXB8agJGAkcpxJS1cwwZyA6iN454H0YDKiEcYYC4SkcryutrVMoWlVTNg62FBLyhdxuENpYYvEh4RH4Rqtu-EjZzrlXPgwFGWhGDfg6Vt1ibrXGcQvLDbDBF1U0TRzaWG4UQao6NM4NwIdKHMu7vrNrzAiXk4H18g50A5uP2V_vvJFMorHCgxr7RVykwIkJKeIKphA7ZsIvv87aXVd_1mTmNoJLO6CpzRUmmwMJvS9T1xo6mEqUtp6HC1VxBBR6xezwQkYuBnlbF2YImE0M-cPaSqiaM5RURX1if2QkCSfr7Vz3a0_nhzYRMv9GsRJgKI7cBpSbnTBFtt5rNAOoTs5pHAuW-AQYSYLtcTlxixqToyTwCGleA1IYSpsofF5rMFOeH3G-j7nXt1e8XAB0BodKcQJ-iEUe-WWT3TUPopMeSqHQEi-yBUTQyK-mHEgteW3J1GqczBTtWf0UTZTXMtJRTBdQkh2zCc2xXTOyF5NAMqtTF8pm6Mw7pRe-gaR2kyBlK8ihu5vjzYdQTzIz3SHI7N4rEM2JRGMFmupmGD9_2-pT8HkrFJz5Zw2peAALcE8t6Aq2lJaFWZIan0_5YfxlUP8EdpVj0VXlH-HcfprNYTWI89SQBWJTAmAtJz80qt10WB6K5vj0m9KG6cMH6VGrQkFU2HFvZ-S0Mp51toG73angzx38uo7lDPxx6DRD4KaUNAbdqzzHrXDmMXFsWYDkZkG8NLZ4H6AIdmfthlH2v-13Q__S2v-pPvr0_6JR3LYNuKNrzJfyf9184fVymHP8rd5HxtVNpsY2W-h-qXoGshZBjxlkTZnOEg5f20FExs5JtXJ8U1EL5A3dgk"}' + call_id: call_lJkkJiqgeFy0IKz2v91FNVKE + id: mac_0728b898e06dffcb006adb3934fa0c87d0a6ed4baa4ebc67d0 + type: multi_agent_call + - agent: + agent_name: /root + content: [] + encrypted_content: gAAAAABq2zlMjd8kmNOA2_Vvlnk7UrzX1geVU35P8bZ35SyVt5Cz01LLSPyV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ysMSD0y6d1_d9L3ybhS-XPyImJPSg6j2tty1CpusEsBfb-R02KyZgMC27ZPfhet6FPeM1RsNRmgJGmKmIyv40a52QPMPD4q92icV4f343bGsHU7cUUbJ1AxphNPDCTdf50dFiRbX3BFwkylyfm8xY_rcOE3SIPZcwO6g-qmmjIOJYjtyBfkYLgrYKF3YNqv2pLIUHfMbvPaI6tRnpuLU6zaGLwQOlT2x6j8EMRCEI1tdBO0_0LpQXT1wINl0tD0a8UDnUK1ZLJ8GE0Yi56rm3S3Lk4iti7qLUIAjLYsvfnAMNLNeY96bSPWXjmbpaQ7XLkO-emH5Jn + id: rs_0728b898e06dffcb006adb3938239487d0b156ce9ce5de7a7f + summary: [] + type: reasoning + - action: wait_agent + agent: + agent_name: /root + arguments: '{"timeout_ms":30000}' + call_id: call_hhJwnOjF2Z4PCF1AIbeb45VU + id: mac_0728b898e06dffcb006adb3938547887d0b64bd489f080d313 + type: multi_agent_call + - agent: + agent_name: /root + author: /root/security_review + content: + - encrypted_content: gAAAAABq2zk4704nz3LAqQ7VpTpNY8XvHAaMbHa3UmYsoEoptpdA7wGLClaZUmD6haEZHJfw_yHjhXADHfncSZ8rvcEe3cnvpH3RhULSvaTU_AX8n9kXscNidw-SdyBAHaE697RGC9wtyuxXDJLG3UErfKUrbCBi8DXmkmzqIdhGD7rDwXj_LNaABgZYf7DkHlYNVTUJ8CA9PBeOPkwfaLeS198-XOhvJVAXSWrBnfv7byGJmyR2fDzs5RNmtIq9zZPbrf0IDA-evv_nW_HxcenX9mpl4n6Yh2vQRkOWJSK0K_SqkeTKUMxyr30ZRuVjgcngMv6bUf0lp6hSNvRF4dhKPk-CUqIATTGbdSs3b1sQD5wjkJfzz4k0Izg8fulZm_Gqy4KwbArsXytalgk6kX5JGCBjqrWtoNMKLWE0OYIxeyXGEm1qKwRvK8mrr_xWWKysE7NJo0sWon5yv_mgt7EWEaukNrkKLmmCIaRA2WuOE-oJw0y6X0VWxTke29secPqx1Lv9itWMSKVhuU5qR97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kvHovkpGD6WV1-13e45ZIwE9Cil6n-bFwwIDBu6A2rcv_0ZbWHLkKGt3x-vSGo2Rr5XgJO0HqA2h_UwLnd89fJLnMHSxtfuWnXz_ShvXD0hq3WqCN6Kb_vyKXJi_PDYu8r9DQbUmPQ1w2lHTYKbod3d8oc76RHquNInSVQskFmCSHCbm__kYeCJ9gFoqDeU_ci_JQXZfVzCmlJy7Q88hyin9aTcyiEOeYrdli5OSa_Sex6a4fvpmaNEIyaBDyjg2gjH7IiBbMA0rMoPrwOwSAJmZUgUgbI7uks15og2nFKy7rDWKYE8uuFh_ecxdGPFgvsJuep44uHJcLuz79vbKdGO8x9HFgesdsbZ_LJY85p-vHuWKkmSnqJux7ZShVz1ZF0HQ2zUeSw-qL6MRm37_qilJlKvo6NDmr9COarFpNI3oTkfkqj_rj493o2KlYpJPMwuLY00qTaYkDgdlF1fRyiGN9gSw== + type: encrypted_content + id: amsg_0728b898e06dffcb006adb3938e0fc87d0b283fc85b25352d9 + recipient: /root + type: agent_message + - action: wait_agent + agent: + agent_name: /root + call_id: call_hhJwnOjF2Z4PCF1AIbeb45VU + id: maco_0728b898e06dffcb006adb3938ea2487d0abaae5013611ba8b + output: + - annotations: [] + logprobs: [] + text: '{"message": "Wait completed.", "timed_out": false}' + type: output_text + type: multi_agent_call_output + - action: wait_agent + agent: + agent_name: /root + arguments: '{"timeout_ms":30000}' + call_id: call_EehCbCF4FDjJXimRhhkpczod + id: mac_0728b898e06dffcb006adb393a569087d09d0127132a4b92d4 + type: multi_agent_call + - action: send_message + agent: + agent_name: /root/missing_tests_review + call_id: call_lJkkJiqgeFy0IKz2v91FNVKE + id: maco_0728b898e06dffcb006adb393aaec087d0a3131ac81e678268 + output: + - annotations: [] + logprobs: [] + text: '' + type: output_text + type: multi_agent_call_output + - action: wait_agent + agent: + agent_name: /root + call_id: call_EehCbCF4FDjJXimRhhkpczod + id: maco_0728b898e06dffcb006adb393ab8fc87d0ada17d482d52e083 + output: + - annotations: [] + logprobs: [] + text: '{"message": "Wait completed.", "timed_out": false}' + type: output_text + type: multi_agent_call_output + - agent: + agent_name: /root + author: /root/missing_tests_review + content: + - encrypted_content: gAAAAABq2zk82GERbxB2TMzJRbm7dWxysoYieFSOCWQZwvJtRDy9Fri_A7SqewXf-nFPTktjdlUb3-cNcMMudhqgWQ5e1uzYTxKfa2hm1xQ4dH7K0NyzauszHS8Kil-b_bYiQddTwpUmx5mBzrOALtICgQqSmME5E1JUhz-iADRxT6XHlGX1WCnm17PiwQz1hu7Sphy-4ETycre76N2tEndze5lR5ODB4eH-2u76_wvMsYfNZl2ORlzRcE1m7lkX9T5jqYy_Kq1440MPGp_ZUQW6Rt7F6SQMY_tbvzMmD1sqK_czEpHg-4CB2kl80nhYPdG4gOMqxTeV7dhBH5lWYmnT-qhgF0qAmkW86wc_bpURo5JstVDdzrP53W2nB6kcs4ZYSjOM8_Nxrpu9v3-q8EGba-hUgz6duk-Lwv587a_1O5OeuVtWLci0E4cWjfDzDS8-p-d-LGl5TcQ29O-LhxlKZBxrbC9FBOWm-82Ji8g3FZDMk7yn7ejFCXFJ5Dhbw1gLrLSin1iRnwig1nXVPsykM5FIle5XWUA0JClTiKnuPeqJMBaFboot9-VghM_LKxsN-g1i_J_4JW6t9bZMuRF4gJOtsRAr8h1LftS2cENcTjdKUlncnhkG8PuQQFNmp6R_SnBWhATYsqhjI-Vk3cEtEzo-a1KyfRMqCVn1ZiTQ4PtmJdckIdL2MttqWj5sWHkBDYiOE0CryNPB84Ll2trO0tx4XGhDbbzmwYRPLb7lTtMIwdTC-dNyAqoFcUuuvTBaw2-gRnAGFEsUjVgxnGyRtFd32tQDOsYDFTk7eIa2LK_U-EWizyt3brNZN1WfxLOYbatT80i5QFwXaZjPgkzoviAV7l-iIKmqQHRieOxNAEu9nkBGWCv2_vYa-09rX6BqjUNUSZYAQxWSBnmC1YtSmX4flDERHrcPYBhrKMNe0H0V7aakTyjuLo2k9Gv3syFGoaoBYwvMc1fJzWLr9vJBbjKvtaoh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IcfCLpzypeg9RA8tzvQx41UzcAS-YqN3IFJ-Yql9bGFsBJ-A0a_9wYW9LNAbkKntEZQtdnb8q2pgUnwVPrBq_vTIa8cTWfJjdjmek9ubVQH23dctuMG6u0ZqHuixVxLeP-z5FOVyYVGaN2YKKR52vL4cXity70BAO2D25H6DRItxFeoFu9tlAw_vIyjkNdSb4ZIQSg3GPDqd6X6VGzKvvovPXeU5TYTqMjzMHE7p_Lufne9piqhH5Yhvmuts0tjv1FQNjPkO3Vddikyeo-IVLGBGZQSfNMNlSQdLp-ftcpXCSvXXsHpNEUyR70AEaAmovsXQLbAhJhMHJXFYw7aTIMZSrFo93RUAJ3qcVOKLp1QthechnCewWDB9INjq3ZDNTYyJPLvFmJ6YMqq4IMcEYDCas2U_15rFt3i4q-8ww0Fxa6U9Wj2W9b3whc3e27U1D48KLOVRI20GjitqU0eUtBt_OeozlCYb69sV4lpqjU34rCUo2YJX7Jr_7XriRUIMTI68WzK2pdydvsIlX2sixnE4ASupxB4Qyjo= + type: encrypted_content + id: amsg_0728b898e06dffcb006adb393b357c87d09dca5b928ba01c53 + recipient: /root + type: agent_message + - agent: + agent_name: /root/missing_tests_review + content: + - annotations: [] + logprobs: [] + text: Missing-test findings sent to the parent, prioritized around unsafe + deserialization, cache poisoning, mutable aliasing, resource limits/expiration, + concurrency, validation, and multi-user isolation. + type: output_text + id: msg_0728b898e06dffcb006adb393c11b487d098917ff83c68a5f6 + phase: final_answer + role: assistant + status: completed + type: message + - agent: + agent_name: /root + content: [] + encrypted_content: gAAAAABq2zlMkX0WAO8MGHvbS9ysMSYNz6K6-HjgcwCK9aM_nIoIJrYXRqW1CWZdsP_ZN6Vno_1msd1h6ClYKNemrDt68eVUoD3pqDcdB7YvPWunLXFJLBHb934YH6Hu_soul_PSTBAjCCI8pHp-AKL-D5_31Hu5HC5BiHe_PSWDax7QJqJ6fCWW3qyNxWUBb8rITLBOKlodx9YAuQraiAQkNHFPnmrui5G0viTN2149eTuV3FJ_ldw5f2f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85dmDnb6cU73r8gMyCZJg-yA85ebhXbH0GoMS63Fze9hanNqDBct9WBlxrDuTbAl5bgfJ-f9J1LDz0Ad87lqES5D28yE1R-ycQYOREzWfMfUnD8dwEB6hCcTmxm0o6PeUWXuzB3oxhXlHtJjb2Yv9op9yS13h1cHY1tLHlx4hDeusi1ZBWN8mF5puV9VMS4Rj75hsxrOSubqeHPEkL9tgVvoovBZwGBuwb8MEZjjFSOZqbTMjTcxpmanvbUk9_kqIlxSxgKgVGuGcTXhNxF8359NGliPX7q-HR1It83LtCWnhr47c3dWXVjm3YqK8b4S1vhJSOJV8SIkXjDrTX_2ogWF9MmNu2CQsaeKKALzHAYjN_52QHPXsS77Do-EZTBTg5B1pFg0pAu-XMHfnIx71AYdYHGerCa3553dtUvM3_FdCcBIzFBFFB3mnfFUDNkM9idQTkWbBPw0XKMmrkUtD2mxrvOnMUfX0mQgSKFWO0ew28rPY-TtIm5cxoZJxOb70ITUrbZQWf7UtEu1Jwe0CSF4GlgC47rjx4UQdxy42PNs_sC7zxb1EurFknaWYOPobthXrIt67Nw4n7TBRkM_b_pZ48D2exX5KI8gSa_OIq95CyVtvKsAbuTH-Sy + id: rs_0728b898e06dffcb006adb393c3c3c87d0ae6a94107f916ae9 + summary: [] + type: reasoning + - agent: + agent_name: /root + author: /root/missing_tests_review + content: + - encrypted_content: gAAAAABq2zk89ydXgHp2WpRvXWu1Wvo4LU18Q9Wb0Gq8qiM7s2HslOUpktFFvkEkR6cMXAUzDAd-yplqTuEEH3FC3UrkDnkfnEoRBp11gz8H3xII0aCBYiM-fbx1XySMHoHCQX-VkIYADgv7XJOoB-Uwg3NekWPjulFhkTkhT17Cmd5hGaZsXw2wuYSItSrdTeOJ1nMwySftxEeRUbk90tdK_ASpSiSA-d60pf5bgdd8cH_AzncdXHjNuM8RFtzcZZdk8lOWBorWMJd7LvJeZ_xU4KgQaW3Mf9ADVZBX3hWh3GsCm74oknBM0Rrsy3vcslx7k4d1qH_hqwfLhVZoPuHknfAD2KnoS3dZ0Rr53X9GXNvyePti9ToNqSsrkt9x8UqmeGXhUgWykIc2Mc8248uQq3JWSAIdQldxgEhWsWedM3M3dPk8QkqW9fSzuq6yX1Gfg6z-BDIEZUdGj2LHwG41hNXt0x3KGm8MHEmyLYZePKzqhHRG7g8= + type: encrypted_content + id: amsg_0728b898e06dffcb006adb393cd0a487d0a64936a3faf3889c + recipient: /root + type: agent_message + - agent: + agent_name: /root + content: + - annotations: [] + logprobs: [] + text: "## Consolidated review from three subagents\n\n**Recommendation:\ + \ block/stop-ship.** The change introduces a critical remote-code-execution\ + \ vulnerability and several cache-integrity and availability problems.\n\ + \n### Security review\n\n- **Critical — attacker-controlled deserialization\ + \ (line 5):** \n `pickle.loads(payload)` can execute arbitrary code\ + \ embedded in a pickle. Because `payload` comes from an unauthenticated\ + \ HTTP request, this can lead to full server compromise. \n **Fix:**\ + \ never unpickle untrusted input. Prefer JSON or another non-executable\ + \ format with strict schema validation. Authentication alone does not\ + \ make untrusted pickle safe.\n\n- **High — cache poisoning (lines 4–6):**\ + \ \n The first request for a `user_id` permanently controls that cache\ + \ entry. An attacker can seed a victim’s ID before the legitimate request,\ + \ whose later payload will then be ignored. \n **Fix:** bind the key\ + \ to an authenticated identity and load authoritative profile data server-side.\ + \ Define explicit refresh and invalidation behavior.\n\n- **High — possible\ + \ unauthorized profile disclosure (line 6):** \n If callers can choose\ + \ `user_id`, requesting an already-cached victim ID returns that victim’s\ + \ profile without authentication. \n **Fix:** authenticate and authorize\ + \ access to the requested profile; do not trust a caller-provided identity.\n\ + \n- **High — denial of service (lines 2, 4–5):** \n Attackers can submit\ + \ many unique IDs or large profiles, growing the cache indefinitely. \ + \ \n **Fix:** enforce payload-size limits, rate limits, quotas, bounded\ + \ capacity, TTLs, and eviction.\n\n### Correctness review\n\n- **High\ + \ — stale data (lines 4–6):** subsequent payloads for a cached user are\ + \ silently ignored forever.\n- **High — mutable shared state (line 6):**\ + \ callers can modify the returned dictionary and thereby corrupt future\ + \ responses. Nested values also require protection, so a shallow copy\ + \ may be insufficient.\n- **High — race condition (lines 4–5):** concurrent\ + \ misses can deserialize conflicting payloads and overwrite one another\ + \ nondeterministically.\n- **Medium — missing validation (line 5):** a\ + \ pickle can produce any object, not necessarily a valid profile dictionary.\n\ + - **Medium — unmanaged errors (line 5):** malformed input will raise deserialization\ + \ exceptions, likely producing HTTP 500 responses.\n- **Medium — process-local\ + \ behavior (line 2):** different workers may hold inconsistent profiles,\ + \ and all state disappears on restart.\n\nUse an established bounded cache\ + \ with atomic population, expiration, and invalidation. Store validated\ + \ immutable values and return defensive deep copies or read-only representations.\n\ + \n### Missing tests\n\nThe existing single happy-path test is insufficient.\ + \ Add, in priority order:\n\n1. Untrusted input cannot cause code execution;\ + \ malformed/truncated input produces a controlled client error and does\ + \ not populate the cache.\n2. An unauthenticated caller cannot seed, overwrite,\ + \ read, or otherwise affect another user’s profile.\n3. Mutating a returned\ + \ profile—including nested structures—does not mutate cached state.\n\ + 4. Cache size is bounded; TTL, eviction, and refresh behavior work as\ + \ specified.\n5. Concurrent requests for the same uncached ID behave atomically\ + \ and deterministically.\n6. Non-dictionary values, invalid schemas, oversized\ + \ payloads, and invalid IDs are rejected without insertion.\n7. Multiple\ + \ users remain isolated, repeated hits behave correctly, and the global\ + \ cache is reset between tests.\n\nRather than testing that malicious\ + \ pickle gadgets are safely handled, the preferred redesign should eliminate\ + \ `pickle.loads` from this request path entirely." + type: output_text + id: msg_0728b898e06dffcb006adb3942a2a487d0ab2f97a66cc8bdfd + phase: final_answer + role: assistant + status: completed + type: message + parallel_tool_calls: true + presence_penalty: 0.0 + previous_response_id: null + prompt_cache_key: null + prompt_cache_retention: 24h + reasoning: + context: all_turns + effort: medium + mode: standard + summary: null + safety_identifier: null + service_tier: default + status: completed + store: true + temperature: 1.0 + text: + format: + type: text + verbosity: medium + tool_choice: auto + tool_usage: + image_gen: + input_tokens: 0 + input_tokens_details: + image_tokens: 0 + text_tokens: 0 + output_tokens: 0 + output_tokens_details: + image_tokens: 0 + text_tokens: 0 + total_tokens: 0 + web_search: + num_requests: 0 + tools: [] + top_logprobs: 0 + top_p: 0.98 + truncation: disabled + usage: + input_tokens: 7987 + input_tokens_details: + cache_write_tokens: 1223 + cached_tokens: 0 + output_tokens: 2922 + output_tokens_details: + reasoning_tokens: 379 + total_tokens: 10909 + user: null + headers: + content-type: application/json + status_code: 200 +- filename: t47 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_0728b898e06dffcb006adb39258f4c87d0ad23c42f61a95c20/input_items + query_params: + limit: '100' + order: asc + response: + body: + data: + - content: + - text: 'Use three subagents to review this Python change: one for correctness, + one for security, and one for missing tests. File cache.py now contains + these lines: 1: import pickle; 2: CACHE = {}; 3: def load_profile(user_id, + payload):; 4: if user_id not in CACHE:; 5: CACHE[user_id] + = pickle.loads(payload); 6: return CACHE[user_id]. The function accepts + payload bytes from an unauthenticated HTTP request, caches profiles without + expiration, and returns the cached mutable dictionary directly. The only + existing test loads one valid payload for one user.' + type: input_text + id: msg_0728b898e06dffcb006adb3925978487d0a45c51be5137805e + role: user + status: completed + type: message + first_id: msg_0728b898e06dffcb006adb3925978487d0a45c51be5137805e + has_more: false + last_id: msg_0728b898e06dffcb006adb3925978487d0a45c51be5137805e + object: list + headers: + content-type: application/json + status_code: 200 +- filename: t48 + request: + body: + input: + - content: Do not call tools again. Reply only OK. + role: user + type: message + max_output_tokens: 16384 + model: gpt-5.6-sol + multi_agent: + enabled: true + max_concurrent_subagents: 3 + previous_response_id: resp_0728b898e06dffcb006adb39258f4c87d0ad23c42f61a95c20 + store: true + stream: false + tool_choice: none + headers: + accept: '*/*' + authorization: Bearer *** + content-type: application/json + openai-beta: responses_multi_agent=v1 + user-agent: python-httpx/0.28.1 + method: POST + path: /v1/responses + query_params: {} + response: + body: + access_programs: null + background: false + billing: + payer: developer + completed_at: 1792751952 + created_at: 1792751951 + error: null + frequency_penalty: 0.0 + id: resp_0728b898e06dffcb006adb394f375c87d080ede33befebaebf + incomplete_details: null + instructions: null + max_output_tokens: 16384 + max_tool_calls: null + metadata: {} + model: gpt-5.6-sol + moderation: null + object: response + output: + - agent: + agent_name: /root + content: + - annotations: [] + logprobs: [] + text: OK + type: output_text + id: msg_0728b898e06dffcb006adb395058c087d0a4a161f28b8aa32b + phase: final_answer + role: assistant + status: completed + type: message + parallel_tool_calls: true + presence_penalty: 0.0 + previous_response_id: resp_0728b898e06dffcb006adb39258f4c87d0ad23c42f61a95c20 + prompt_cache_key: null + prompt_cache_retention: 24h + reasoning: + context: all_turns + effort: medium + mode: standard + summary: null + safety_identifier: null + service_tier: default + status: completed + store: true + temperature: 1.0 + text: + format: + type: text + verbosity: medium + tool_choice: none + tool_usage: + image_gen: + input_tokens: 0 + input_tokens_details: + image_tokens: 0 + text_tokens: 0 + output_tokens: 0 + output_tokens_details: + image_tokens: 0 + text_tokens: 0 + total_tokens: 0 + web_search: + num_requests: 0 + tools: [] + top_logprobs: 0 + top_p: 0.98 + truncation: disabled + usage: + input_tokens: 4279 + input_tokens_details: + cache_write_tokens: 3053 + cached_tokens: 1223 + output_tokens: 5 + output_tokens_details: + reasoning_tokens: 0 + total_tokens: 4284 + user: null + headers: + content-type: application/json + status_code: 200 +- filename: t49 + request: + body: {} + headers: + accept: '*/*' + authorization: Bearer *** + user-agent: python-httpx/0.28.1 + method: GET + path: /v1/responses/resp_0728b898e06dffcb006adb394f375c87d080ede33befebaebf/input_items + query_params: + limit: '100' + order: asc + response: + body: + data: + - content: + - text: 'Use three subagents to review this Python change: one for correctness, + one for security, and one for missing tests. File cache.py now contains + these lines: 1: import pickle; 2: CACHE = {}; 3: def load_profile(user_id, + payload):; 4: if user_id not in CACHE:; 5: CACHE[user_id] + = pickle.loads(payload); 6: return CACHE[user_id]. The function accepts + payload bytes from an unauthenticated HTTP request, caches profiles without + expiration, and returns the cached mutable dictionary directly. The only + existing test loads one valid payload for one user.' + type: input_text + id: msg_0728b898e06dffcb006adb3925978487d0a45c51be5137805e + role: user + status: completed + type: message + - agent: + agent_name: /root + content: [] + id: rs_0728b898e06dffcb006adb39269b8c87d0ac8a0d890240ef0d + summary: [] + type: reasoning + - action: spawn_agent + agent: + agent_name: /root + arguments: '{"task_name":"correctness_review","message":"gAAAAABq2zknHsxGichM95AQ5cTbugSDz7fRYR4L7MGXsAq4EHmFVajchfnHxYgRjMue7v_AHmHhurrxo1INngNkTcRjGQcTjqisK3V87FCWUkmo4Gyfdlxr5bx_t4J_Ek87mx-fG9ze0EP9NqUy3_eVAgXyaz6mZXxjt7z9XwBH19o-oLm-jXEnyJSipOBp_IPDzFz4AGyUjxy1ycqDwt_3Gh1kSQNgAmM54_gs04fSmqH6zSL4tH3nukUj62K8dBaahEQ9S66uGI75h5Kegf0JlyZTyXKmeHwpr-YTnVYrh7WSi0FA07Q20UkqVXhbfxe_BFyNbUx_sZvv7F9YNffOdLpWfBuoUsCadk1iIV7aWon9DepT6uU7DiX1k3WWMtkjPV7RDW4_eIhtMQy0aCNI2r3Lr2UfXg==","fork_turns":"all"}' + call_id: call_FuDavN3956eBtvCyLaIZmFBb + id: mac_0728b898e06dffcb006adb3926fa7087d0add620154a8e5964 + type: multi_agent_call + - agent: + agent_name: /root/correctness_review + content: + - text: 'Use three subagents to review this Python change: one for correctness, + one for security, and one for missing tests. File cache.py now contains + these lines: 1: import pickle; 2: CACHE = {}; 3: def load_profile(user_id, + payload):; 4: if user_id not in CACHE:; 5: CACHE[user_id] + = pickle.loads(payload); 6: return CACHE[user_id]. The function accepts + payload bytes from an unauthenticated HTTP request, caches profiles without + expiration, and returns the cached mutable dictionary directly. The only + existing test loads one valid payload for one user.' + type: input_text + id: msg_0728b898e06dffcb006adb39279a5887d0b6c976e1977acb69 + role: user + status: completed + type: message + - agent: + agent_name: /root/correctness_review + author: /root + content: + - encrypted_content: gAAAAABq2zknrtdcnjiGht4ds5zqh8N7_b1v3QcFvd0NzdEBzXyCMYY_oqDaLc_OfcYEDvYzCjfAyzs4v_3B40r60TOq-DxDHI5AC1rnR276fROFJECNykUcVFXeW7OW64r8H2vilVk00MwKAGyWAuF2uooTwX758nLa1i8-vdPnlR2AqC3b0h-ReHR-SlgWBQiNaj584lE8IOFMrR1DTOloo7Fk0rb9EAGaVYSM7Wb06iboeY9GPy4-SJkkfSC5DwXAtMgTnhlK-1LSt_uMf0QC8QZvPecsJmRYDpELrg6FT_Z1sFhJqqzI2-fcbpmI2O_gXslcfBpRt_Gew9wT4KA7d-VBUU37DMAYz7byaYbEBxxr8SJ-E82w7il4oW9jbHQWnhUSXSE6YeHj94ugp4VaIcQiLG4aBXlmdxIphHxgSKF5cei4jFjg5UAJLNwhLZ4Xyc-QH7NVrCvpaxWHlhhY84B_7jrioxxCjGuijRwJHU7WYezKQKDn5JAOtpQD_sTBPTPlI4LmeT1nBUrS8yF9xGjO-Db2Dg== + type: encrypted_content + id: amsg_0728b898e06dffcb006adb39279bc087d0978eaefccd007f17 + recipient: /root/correctness_review + type: agent_message + - action: spawn_agent + agent: + agent_name: /root + call_id: call_FuDavN3956eBtvCyLaIZmFBb + id: maco_0728b898e06dffcb006adb3927a6ec87d09a6fd459acccd732 + output: + - annotations: [] + logprobs: [] + text: '{"task_name": "/root/correctness_review"}' + type: output_text + type: multi_agent_call_output + - agent: + agent_name: /root/correctness_review + content: [] + id: rs_0728b898e06dffcb006adb392838b087d09219230d65443951 + summary: [] + type: reasoning + - agent: + agent_name: /root/correctness_review + content: + - annotations: [] + logprobs: [] + text: '### Correctness/reliability findings + + + - **High — stale or incorrect profile returned (lines 4–6):** Cache identity + is only `user_id`; after the first load, every later `payload` for that + user is silently ignored. Profile updates, corrected payloads, or reused + identifiers return old data indefinitely. **Fix:** define invalidation/refresh + semantics, use a payload/version-aware key, or replace the entry when + authoritative data changes. + + + - **High — shared cache corruption through mutable return value (line + 6):** Returning the cached dictionary directly lets any caller mutate + the canonical cached object. Later requests then observe unintended changes, + and concurrent callers can interfere. **Fix:** return a defensive copy/deep + copy or expose an immutable profile representation. + + + - **High — check-then-set race (lines 4–5):** Concurrent requests for + the same uncached user can both deserialize different payloads and overwrite + each other. A request may cache one profile but return another depending + on timing. **Fix:** synchronize lookup/population per key or use an atomic + cache API; also specify how conflicting payloads are resolved. + + + - **Medium — unbounded, permanent process memory growth (lines 2, 5):** + Every distinct `user_id` remains in `CACHE` forever, causing stale data + and eventual memory exhaustion/restarts under sustained traffic. **Fix:** + use a bounded cache with TTL/LRU eviction and explicit invalidation. + + + - **Medium — no validation of decoded object (line 5):** `pickle.loads` + may produce a non-dictionary or a dictionary missing required profile + fields, violating the function’s apparent return contract and moving failures + downstream. **Fix:** validate type/schema before insertion and reject + invalid profiles. + + + - **Medium — malformed payload failures are unmanaged (line 5):** Invalid/truncated + bytes raise deserialization exceptions directly, likely becoming HTTP + 500 responses unless handled elsewhere. **Fix:** catch expected decode + errors, return a controlled client error, and never populate the cache + on failure. + + + - **Medium — global cache is process-local (line 2):** Multi-worker deployments + can return different profiles for the same user, and all entries disappear + on restart. **Fix:** if consistency/persistence is required, use a shared + cache or backing store; otherwise document these semantics.' + type: output_text + id: msg_0728b898e06dffcb006adb392b70c887d0b21da0f74784b1d1 + phase: final_answer + role: assistant + status: completed + type: message + - action: spawn_agent + agent: + agent_name: /root + arguments: '{"task_name":"security_review","message":"gAAAAABq2zku4hAewQpr9HOv9tYtg_YVd3W_W8mw54eDD_f60-BS--PTXS9baLVfgGp9BPTSjiMuQZAhqloCO5aYhNBjeHVGfNUjwFVaqgJ_QkOlVecmElCpWBiKx9KquU99WJbf9G7d6ZcJitS98mLzR8PdEqc97YWu4cTE5JNdQm_HFIGZvZrBcZbxi9N3o0awZTCd1_GFZPql5vLnanc28sAgVTKJtnukZdNB_mJfJPAgG1xwmX0Z0qAkmXaNyzTwp6Fc8bjRTG2VvCbNe9tuh3lcKzCHt5StSnRG1iKnWPS_cRIm4R1jqbrnsdh_B75ZkQd6tJDBiLxHGxjq67o-mpsEyu0CzftAiGMtvlQhFleiH5mkReFEYQuZqWodRM239H1hbICpa-hLoSFwe0XxD0OHPFzuvgcR3mbPYOTgAj3nrsZ0HuA=","fork_turns":"all"}' + call_id: call_UDRhRMC2GExMCPFQL1gBhS2x + id: mac_0728b898e06dffcb006adb392de8a887d0b4a0af170fa2f2e9 + type: multi_agent_call + - agent: + agent_name: /root/security_review + content: + - text: 'Use three subagents to review this Python change: one for correctness, + one for security, and one for missing tests. File cache.py now contains + these lines: 1: import pickle; 2: CACHE = {}; 3: def load_profile(user_id, + payload):; 4: if user_id not in CACHE:; 5: CACHE[user_id] + = pickle.loads(payload); 6: return CACHE[user_id]. The function accepts + payload bytes from an unauthenticated HTTP request, caches profiles without + expiration, and returns the cached mutable dictionary directly. The only + existing test loads one valid payload for one user.' + type: input_text + id: msg_0728b898e06dffcb006adb392e6b8887d0b5214e1b597773fd + role: user + status: completed + type: message + - agent: + agent_name: /root/security_review + author: /root + content: + - encrypted_content: gAAAAABq2zkuG821zDn2CEZ4xL4Zo0Buh_uxng7MM6zKpQPfDjcnvmwxdv_1XYLrimDUFonQHy7C19D04AByo1WpO3vnn6qylNDnMTvHerM7PNqE3ctej3rUWsO83ztVvwkwvOargMVYgfa0hnI7jSNIeFnWeT_8zEW2oNzCvh02WW5QBcDgV3h-_8j7MJRZm9fZfyLP4702cVywAV53pcZSx_7FZsPlzwnkQTJVAVhAItPwh46fq2AdfB7zwPsXQW9eXDMuZivGdLNtuw-nLSwmiYY4yIDfc5CbjhSHLFD4oZ5APKaRNAvDAOc82pH8QFr466D6QmwwHxeCHpz2ny-WB_JL-SIG2n12pt_QgwB-0QiuVI5-5vELb6RONK5SGsOKhhPtQZVbyDlubH8NA3F3s67EpkyXgipfDzYphKDQHWxvpGOGP0TT7BRpvO97eJeiOwxsdfQJHlYzkWcG-eR8dOinoZafj57i3FC0a8Ee82pnMRUFrZelI5FwagPPA16XPYL-usitdfhn-BYXUeobAIipPkp9Ng== + type: encrypted_content + id: amsg_0728b898e06dffcb006adb392e6e3c87d0a2cdd09f589e1b25 + recipient: /root/security_review + type: agent_message + - action: spawn_agent + agent: + agent_name: /root + call_id: call_UDRhRMC2GExMCPFQL1gBhS2x + id: maco_0728b898e06dffcb006adb392e786487d08220ef8a4e87669a + output: + - annotations: [] + logprobs: [] + text: '{"task_name": "/root/security_review"}' + type: output_text + type: multi_agent_call_output + - agent: + agent_name: /root/security_review + content: [] + id: rs_0728b898e06dffcb006adb392f034087d09be0c9ca27181d72 + summary: [] + type: reasoning + - action: spawn_agent + agent: + agent_name: /root + arguments: '{"task_name":"missing_tests_review","message":"gAAAAABq2zkw0jNDUF5j71HJvBZWk2kCzJJ5kYTFPd-GXYEdMvrYOcqYW3ng-4OLQBlfhzOZ_V6Zr1uGD9OZsQoS8aGIqvfDcsumPVK6P3omVDEc9FlewSfr5hqAeO7LJdFz_LVsI8lNEdrUwwSYzaqPDvVQFIDr3Ckg6L-B0HU9fJfCdy5BDBBQJByCK7cwCCynu7TWS6_DDqXLZfAr6tBDgzJzDkMcD0uHeNPmM_xGLkqJijDO8RBaCsoyfF3I9cD6tq9o8-7T3T7hxvs6PJgYDsDXvFKWhxlsPsznWVXD0RlktjTO2Y3ZCdnwF2RZP51CVp66Gopi8N_RSQLuJXqDZ0r0eG49oqFHuYq4dUjkhdZepXw-7mfS8wM95_Goqo7rtmyODDRzuJjxmW6bbv7g5LygegXhaLzYKha6wYjIi0nv4JSyoE4=","fork_turns":"all"}' + call_id: call_qZdIWvLPqnp98UcZqDcegXfv + id: mac_0728b898e06dffcb006adb392fc0f087d086ff3836e0edfdc1 + type: multi_agent_call + - agent: + agent_name: /root/missing_tests_review + content: + - text: 'Use three subagents to review this Python change: one for correctness, + one for security, and one for missing tests. File cache.py now contains + these lines: 1: import pickle; 2: CACHE = {}; 3: def load_profile(user_id, + payload):; 4: if user_id not in CACHE:; 5: CACHE[user_id] + = pickle.loads(payload); 6: return CACHE[user_id]. The function accepts + payload bytes from an unauthenticated HTTP request, caches profiles without + expiration, and returns the cached mutable dictionary directly. The only + existing test loads one valid payload for one user.' + type: input_text + id: msg_0728b898e06dffcb006adb393051d887d0bf7d07885e934141 + role: user + status: completed + type: message + - agent: + agent_name: /root/missing_tests_review + author: /root + content: + - encrypted_content: gAAAAABq2zkwT4RTJERqhHuiGhPXkCTLt66HuosEzOi6Zq4nhzebgxAxHIw9kxV31_YBHf3iSD9HX97p9shsKd3yT3lcl3Bqwuizfpdx-_89x29yUQsN9thJWxKk09RmQs_-diIs1XczPIev_EpStbScZdKbkkpso1pgtTjEcWIEeW8Dn878-u2B0upaSP03iv64pmrgWOAB_2YCaGQ629ZynHNa9oDI2NWbwUS4qN9wtdS-ktIFm3NitIgF1NT3l6FMmM8UqRUyocr0RkzYoBz6-k3uONNQxO2DShjZQHHN0zxMI6reY7IllMns44kqfNJ56KVP3tbqa-AatTMMfW_-GeDOIZDuT15RazagGpl1rFnR-nGbSZEi13fzKxDSC5ydjPewvNjlCrKzmmu4KD0SUV2PJDvpWKK4L-Vw9ma16Ru0lqVxRagAqjtES9oT6ZQgSNTTwRjxlWK2Zg4FFG_ipBhE5ts68eAHPus970Grsccd34f0iXxjIekhOUNz5y8jTmVJ4FZQvenPqFwmHp38qhNa1LLkYA== + type: encrypted_content + id: amsg_0728b898e06dffcb006adb3930528c87d09e49739e4b76c167 + recipient: /root/missing_tests_review + type: agent_message + - action: spawn_agent + agent: + agent_name: /root + call_id: call_qZdIWvLPqnp98UcZqDcegXfv + id: maco_0728b898e06dffcb006adb39305f8087d0b6c0f96d85eb8314 + output: + - annotations: [] + logprobs: [] + text: '{"task_name": "/root/missing_tests_review"}' + type: output_text + type: multi_agent_call_output + - agent: + agent_name: /root/missing_tests_review + content: [] + id: rs_0728b898e06dffcb006adb3931b3b087d0bb09e4a025a2b526 + summary: [] + type: reasoning + - agent: + agent_name: /root/security_review + content: + - annotations: [] + logprobs: [] + text: "### Security findings\n\n1. **Critical — Unauthenticated remote code\ + \ execution (line 5)** \n `pickle.loads(payload)` deserializes attacker-controlled\ + \ bytes. Malicious pickle opcodes can execute arbitrary Python code with\ + \ the server process’s privileges. \n **Impact:** full application/host\ + \ compromise, credential theft, data destruction, lateral movement. \n\ + \ **Remediation:** never unpickle untrusted input. Use a non-executable\ + \ format such as JSON plus strict schema/type validation. Authentication\ + \ or pickle “restricted unpicklers” are not sufficient general fixes.\n\ + \n2. **High — Unbounded cache enables memory exhaustion (lines 2, 4–5)**\ + \ \n An unauthenticated attacker can submit many unique `user_id` values\ + \ and large payloads. Entries never expire or evict. \n **Impact:**\ + \ sustained memory growth and process/container denial of service. \n\ + \ **Remediation:** authenticate requests; bind IDs to the authenticated\ + \ principal; enforce request/payload size limits, per-client rate limits/quotas,\ + \ bounded LRU capacity, TTLs, and eviction.\n\n3. **High — Cache poisoning\ + \ / profile integrity failure (lines 4–6)** \n The first request for\ + \ an uncached `user_id` permanently determines that profile. If IDs are\ + \ attacker-selectable, an attacker can prepopulate another user’s cache\ + \ entry; later legitimate payloads are ignored. \n **Impact:** forged\ + \ or corrupted profiles, possible cross-user authorization or data-integrity\ + \ failures depending on downstream use. \n **Remediation:** authorize\ + \ ownership of `user_id`, use trusted server-side profile data, define\ + \ safe refresh/invalidation semantics, and namespace keys by authenticated\ + \ tenant/user identity.\n\n4. **Medium — Mutable cached object is exposed\ + \ directly (line 6)** \n Returning the cached dictionary lets callers\ + \ mutate shared global state without validation. \n **Impact:** persistent\ + \ cross-request corruption, privilege-field tampering, and accidental\ + \ cross-user effects. Pickle may also return a non-dictionary object.\ + \ \n **Remediation:** validate the decoded schema, store immutable\ + \ representations, and return a defensive copy/read-only view; restrict\ + \ updates through validated APIs." + type: output_text + id: msg_0728b898e06dffcb006adb3932176487d08f2307c47afddab0 + phase: final_answer + role: assistant + status: completed + type: message + - agent: + agent_name: /root + author: /root/correctness_review + content: + - encrypted_content: gAAAAABq2zkyuT7PZXDdMN-Uhmu53z-5yhJO_jBql3wBHjLOpvKoRPX0k9ZUyxj-kDquwbNLpFhsh06oSOMvqTUX56xiuYYkpk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uPSwWdKVTDhQvTijkq1V5D4bBMB24zYwWpABQkVFAh8booB5e2MdDo9V + type: encrypted_content + id: amsg_0728b898e06dffcb006adb393242b087d0b37dd408126bdf1b + recipient: /root + type: agent_message + - agent: + agent_name: /root + content: [] + id: rs_0728b898e06dffcb006adb3932476c87d09ad0355ac91fbfae + summary: [] + type: reasoning + - action: send_message + agent: + agent_name: /root/missing_tests_review + arguments: '{"target":"/root","message":"gAAAAABq2zk6uUSQHuW1EbtVDt3JfuErn-4gtzTPrsQyMgJ_1HuigfAcEFt9f7qhHTtNtSJ_c4EvDu2ak-AMWzm4SHGAU6pQPmCZEDPVa4RSf4UXR_RTk0Q_HwAvUSjX3DhAt-A-avGsSYpYlUimBGjIniMP7u179OhjCvmDF73GSB_dtmMVPfbrQiuIXfu0B5KvRvPxMp3qtAOD1NbSULsO5mt4A1vRGsiNx4XFxWV07GKhhm7wtw0A6lzKnA7gPeZEiKkOzdBo5vly8TDmlJI-ibIoOx-oltAvXf2s6HipROd_HP7wY7Ovwb_A8U9oTeriQUHHZ0kZpE4nabtPBrQtycfEUjrN4ohqAhKgIjZPKJuSO-p4FKnQ23r8dhfx4g3CBJykjyjEAuw4mr7Mecev2yXkDWyig66QqFbgDvWcu01IuNY52CvnD1YQYx9LGzwpOVSBwJ8SpiLZK5Ng_YQOv-HzjKwsOoFvfq3T0Jk_fMUfVNP096Pwo9IcJdZnKlr05QGxG3_7DBqElLmWpDtVLNHAGaJQtu-uZtygiYXna7c3qOTEq3dK7bCMlekQ44cYSslhjpoyka3WYf7WlZABUOhNifoIGlMgZRZB9FegCfyXNW-xxNUdKtmMmJ4KDLw6njyc_B9-b2y7B5zs7aAl_soJP5rFB55BMTqnJDxHzuqrRNFMsvszFi6NSInYOZT1HU5pAplMB6Hk8Fxdj-wWDJSlBCELnkB7NxLUIkv_p2R2jMR3g3ft9PgJImZr8wrfeJfB9p-KTQA0CW7TWCSfJYsvFf1-Jj-3DpFbuue8789JpQ8k8b16suNaOj7Rc4c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VxBBR6xezwQkYuBnlbF2YImE0M-cPaSqiaM5RURX1if2QkCSfr7Vz3a0_nhzYRMv9GsRJgKI7cBpSbnTBFtt5rNAOoTs5pHAuW-AQYSYLtcTlxixqToyTwCGleA1IYSpsofF5rMFOeH3G-j7nXt1e8XAB0BodKcQJ-iEUe-WWT3TUPopMeSqHQEi-yBUTQyK-mHEgteW3J1GqczBTtWf0UTZTXMtJRTBdQkh2zCc2xXTOyF5NAMqtTF8pm6Mw7pRe-gaR2kyBlK8ihu5vjzYdQTzIz3SHI7N4rEM2JRGMFmupmGD9_2-pT8HkrFJz5Zw2peAALcE8t6Aq2lJaFWZIan0_5YfxlUP8EdpVj0VXlH-HcfprNYTWI89SQBWJTAmAtJz80qt10WB6K5vj0m9KG6cMH6VGrQkFU2HFvZ-S0Mp51toG73angzx38uo7lDPxx6DRD4KaUNAbdqzzHrXDmMXFsWYDkZkG8NLZ4H6AIdmfthlH2v-13Q__S2v-pPvr0_6JR3LYNuKNrzJfyf9184fVymHP8rd5HxtVNpsY2W-h-qXoGshZBjxlkTZnOEg5f20FExs5JtXJ8U1EL5A3dgk"}' + call_id: call_lJkkJiqgeFy0IKz2v91FNVKE + id: mac_0728b898e06dffcb006adb3934fa0c87d0a6ed4baa4ebc67d0 + type: multi_agent_call + - agent: + agent_name: /root + content: [] + id: rs_0728b898e06dffcb006adb3938239487d0b156ce9ce5de7a7f + summary: [] + type: reasoning + - action: wait_agent + agent: + agent_name: /root + arguments: '{"timeout_ms":30000}' + call_id: call_hhJwnOjF2Z4PCF1AIbeb45VU + id: mac_0728b898e06dffcb006adb3938547887d0b64bd489f080d313 + type: multi_agent_call + - agent: + agent_name: /root + author: /root/security_review + content: + - encrypted_content: gAAAAABq2zk4704nz3LAqQ7VpTpNY8XvHAaMbHa3UmYsoEoptpdA7wGLClaZUmD6haEZHJfw_yHjhXADHfncSZ8rvcEe3cnvpH3RhULSvaTU_AX8n9kXscNidw-SdyBAHaE697RGC9wtyuxXDJLG3UErfKUr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jhpSrzMZFfrurlqGp6CE1JY9mSUmZHlNdxtHiIfDk3ujvzjjdYQAbNb9IyyejkW0BHNG4Ih1L7busQj6bnjk0aKLKh_0sTRdc51Fv9BCD-M5Z2EidPADuJpI7Vhyn8C-nK0A_Ykz8SaqEG0KISsPZiupgAtWahgHcgSA7P_YEjcHIihf5M3KLlVtbGgcjpEhPIM11fS2lKErbqz1zXnGxibkdXcKf4lZ2plRWdlTdKe9J0hcUrcwraWRIzMR-7CP_MxYvmDKRuv7smXgETmKZ7Gt4fE8i_1bsREt5SvORywihc1IgEmRjappeIKcbdKfPMtZHIl3H2V9gvgxXpVeaTtDIoEff3R8Rt1tSesyQvD5AOqFqUNGnarhAnkPkvHovkpGD6WV1-13e45ZIwE9Cil6n-bFwwIDBu6A2rcv_0ZbWHLkKGt3x-vSGo2Rr5XgJO0HqA2h_UwLnd89fJLnMHSxtfuWnXz_ShvXD0hq3WqCN6Kb_vyKXJi_PDYu8r9DQbUmPQ1w2lHTYKbod3d8oc76RHquNInSVQskFmCSHCbm__kYeCJ9gFoqDeU_ci_JQXZfVzCmlJy7Q88hyin9aTcyiEOeYrdli5OSa_Sex6a4fvpmaNEIyaBDyjg2gjH7IiBbMA0rMoPrwOwSAJmZUgUgbI7uks15og2nFKy7rDWKYE8uuFh_ecxdGPFgvsJuep44uHJcLuz79vbKdGO8x9HFgesdsbZ_LJY85p-vHuWKkmSnqJux7ZShVz1ZF0HQ2zUeSw-qL6MRm37_qilJlKvo6NDmr9COarFpNI3oTkfkqj_rj493o2KlYpJPMwuLY00qTaYkDgdlF1fRyiGN9gSw== + type: encrypted_content + id: amsg_0728b898e06dffcb006adb3938e0fc87d0b283fc85b25352d9 + recipient: /root + type: agent_message + - action: wait_agent + agent: + agent_name: /root + call_id: call_hhJwnOjF2Z4PCF1AIbeb45VU + id: maco_0728b898e06dffcb006adb3938ea2487d0abaae5013611ba8b + output: + - annotations: [] + logprobs: [] + text: '{"message": "Wait completed.", "timed_out": false}' + type: output_text + type: multi_agent_call_output + - action: wait_agent + agent: + agent_name: /root + arguments: '{"timeout_ms":30000}' + call_id: call_EehCbCF4FDjJXimRhhkpczod + id: mac_0728b898e06dffcb006adb393a569087d09d0127132a4b92d4 + type: multi_agent_call + - action: send_message + agent: + agent_name: /root/missing_tests_review + call_id: call_lJkkJiqgeFy0IKz2v91FNVKE + id: maco_0728b898e06dffcb006adb393aaec087d0a3131ac81e678268 + output: + - annotations: [] + logprobs: [] + text: '' + type: output_text + type: multi_agent_call_output + - action: wait_agent + agent: + agent_name: /root + call_id: call_EehCbCF4FDjJXimRhhkpczod + id: maco_0728b898e06dffcb006adb393ab8fc87d0ada17d482d52e083 + output: + - annotations: [] + logprobs: [] + text: '{"message": "Wait completed.", "timed_out": false}' + type: output_text + type: multi_agent_call_output + - agent: + agent_name: /root + author: /root/missing_tests_review + content: + - encrypted_content: gAAAAABq2zk82GERbxB2TMzJRbm7dWxysoYieFSOCWQZwvJtRDy9Fri_A7SqewXf-nFPTktjdlUb3-cNcMMudhqgWQ5e1uzYTxKfa2hm1xQ4dH7K0NyzauszHS8Kil-b_bYiQddTwpUmx5mBzrOALtICgQqSmME5E1JUhz-iADRxT6XHlGX1WCnm17PiwQz1hu7Sphy-4ETycre76N2tEndze5lR5ODB4eH-2u76_wvMsYfNZl2ORlzRcE1m7lkX9T5jqYy_Kq1440MPGp_ZUQW6Rt7F6SQMY_tbvzMmD1sqK_czEpHg-4CB2kl80nhYPdG4gOMqxTeV7dhBH5lWYmnT-qhgF0qAmkW86wc_bpURo5JstVDdzrP53W2nB6kcs4ZYSjOM8_Nxrpu9v3-q8EGba-hUgz6duk-Lwv587a_1O5OeuVtWLci0E4cWjfDzDS8-p-d-LGl5TcQ29O-LhxlKZBxrbC9FBOWm-82Ji8g3FZDMk7yn7ejFCXFJ5Dhbw1gLrLSin1iRnwig1nXVPsykM5FIle5XWUA0JClTiKnuPeqJMBaFboot9-VghM_LKxsN-g1i_J_4JW6t9bZMuRF4gJOtsRAr8h1Lft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bD0UCAU7nXnaVbsMozqIJlfiFOftEd6M-f27kW0rf_MqOPn3aX6oSi2PLXybPl1f9uuLeMo9X6GHdv0co4Sqo7StVjqbQx708VvxN5KM6nyqLb9vfhzmd9M3P7IZf1BqH-VggOEA5zrXcgmEvUreOq4ycY-c1fa7SHbAe8rxxq7XB453us2nTMKUkmwTX6gR6iKWM751QALUsVU9sUHvY2Cn8OYwWLEELCoXrb8Va5hlkXS4slJlwXb-tnSSpVmC2z9NAkO6xYECdO9AJ5ikrriYDL_RzEXJg63E3iNjnefeJIumvUsL2qZB17P8cdiNtO-LC5GwoDbU_8ikWbZh0ttmXJrvASKZ5wJxrmlNqX79cEjmZ4bnHt7xc5JmlJHIcfCLpzypeg9RA8tzvQx41UzcAS-YqN3IFJ-Yql9bGFsBJ-A0a_9wYW9LNAbkKntEZQtdnb8q2pgUnwVPrBq_vTIa8cTWfJjdjmek9ubVQH23dctuMG6u0ZqHuixVxLeP-z5FOVyYVGaN2YKKR52vL4cXity70BAO2D25H6DRItxFeoFu9tlAw_vIyjkNdSb4ZIQSg3GPDqd6X6VGzKvvovPXeU5TYTqMjzMHE7p_Lufne9piqhH5Yhvmuts0tjv1FQNjPkO3Vddikyeo-IVLGBGZQSfNMNlSQdLp-ftcpXCSvXXsHpNEUyR70AEaAmovsXQLbAhJhMHJXFYw7aTIMZSrFo93RUAJ3qcVOKLp1QthechnCewWDB9INjq3ZDNTYyJPLvFmJ6YMqq4IMcEYDCas2U_15rFt3i4q-8ww0Fxa6U9Wj2W9b3whc3e27U1D48KLOVRI20GjitqU0eUtBt_OeozlCYb69sV4lpqjU34rCUo2YJX7Jr_7XriRUIMTI68WzK2pdydvsIlX2sixnE4ASupxB4Qyjo= + type: encrypted_content + id: amsg_0728b898e06dffcb006adb393b357c87d09dca5b928ba01c53 + recipient: /root + type: agent_message + - agent: + agent_name: /root/missing_tests_review + content: + - annotations: [] + logprobs: [] + text: Missing-test findings sent to the parent, prioritized around unsafe + deserialization, cache poisoning, mutable aliasing, resource limits/expiration, + concurrency, validation, and multi-user isolation. + type: output_text + id: msg_0728b898e06dffcb006adb393c11b487d098917ff83c68a5f6 + phase: final_answer + role: assistant + status: completed + type: message + - agent: + agent_name: /root + content: [] + id: rs_0728b898e06dffcb006adb393c3c3c87d0ae6a94107f916ae9 + summary: [] + type: reasoning + - agent: + agent_name: /root + author: /root/missing_tests_review + content: + - encrypted_content: gAAAAABq2zk89ydXgHp2WpRvXWu1Wvo4LU18Q9Wb0Gq8qiM7s2HslOUpktFFvkEkR6cMXAUzDAd-yplqTuEEH3FC3UrkDnkfnEoRBp11gz8H3xII0aCBYiM-fbx1XySMHoHCQX-VkIYADgv7XJOoB-Uwg3NekWPjulFhkTkhT17Cmd5hGaZsXw2wuYSItSrdTeOJ1nMwySftxEeRUbk90tdK_ASpSiSA-d60pf5bgdd8cH_AzncdXHjNuM8RFtzcZZdk8lOWBorWMJd7LvJeZ_xU4KgQaW3Mf9ADVZBX3hWh3GsCm74oknBM0Rrsy3vcslx7k4d1qH_hqwfLhVZoPuHknfAD2KnoS3dZ0Rr53X9GXNvyePti9ToNqSsrkt9x8UqmeGXhUgWykIc2Mc8248uQq3JWSAIdQldxgEhWsWedM3M3dPk8QkqW9fSzuq6yX1Gfg6z-BDIEZUdGj2LHwG41hNXt0x3KGm8MHEmyLYZePKzqhHRG7g8= + type: encrypted_content + id: amsg_0728b898e06dffcb006adb393cd0a487d0a64936a3faf3889c + recipient: /root + type: agent_message + - agent: + agent_name: /root + content: + - annotations: [] + logprobs: [] + text: "## Consolidated review from three subagents\n\n**Recommendation:\ + \ block/stop-ship.** The change introduces a critical remote-code-execution\ + \ vulnerability and several cache-integrity and availability problems.\n\ + \n### Security review\n\n- **Critical — attacker-controlled deserialization\ + \ (line 5):** \n `pickle.loads(payload)` can execute arbitrary code\ + \ embedded in a pickle. Because `payload` comes from an unauthenticated\ + \ HTTP request, this can lead to full server compromise. \n **Fix:**\ + \ never unpickle untrusted input. Prefer JSON or another non-executable\ + \ format with strict schema validation. Authentication alone does not\ + \ make untrusted pickle safe.\n\n- **High — cache poisoning (lines 4–6):**\ + \ \n The first request for a `user_id` permanently controls that cache\ + \ entry. An attacker can seed a victim’s ID before the legitimate request,\ + \ whose later payload will then be ignored. \n **Fix:** bind the key\ + \ to an authenticated identity and load authoritative profile data server-side.\ + \ Define explicit refresh and invalidation behavior.\n\n- **High — possible\ + \ unauthorized profile disclosure (line 6):** \n If callers can choose\ + \ `user_id`, requesting an already-cached victim ID returns that victim’s\ + \ profile without authentication. \n **Fix:** authenticate and authorize\ + \ access to the requested profile; do not trust a caller-provided identity.\n\ + \n- **High — denial of service (lines 2, 4–5):** \n Attackers can submit\ + \ many unique IDs or large profiles, growing the cache indefinitely. \ + \ \n **Fix:** enforce payload-size limits, rate limits, quotas, bounded\ + \ capacity, TTLs, and eviction.\n\n### Correctness review\n\n- **High\ + \ — stale data (lines 4–6):** subsequent payloads for a cached user are\ + \ silently ignored forever.\n- **High — mutable shared state (line 6):**\ + \ callers can modify the returned dictionary and thereby corrupt future\ + \ responses. Nested values also require protection, so a shallow copy\ + \ may be insufficient.\n- **High — race condition (lines 4–5):** concurrent\ + \ misses can deserialize conflicting payloads and overwrite one another\ + \ nondeterministically.\n- **Medium — missing validation (line 5):** a\ + \ pickle can produce any object, not necessarily a valid profile dictionary.\n\ + - **Medium — unmanaged errors (line 5):** malformed input will raise deserialization\ + \ exceptions, likely producing HTTP 500 responses.\n- **Medium — process-local\ + \ behavior (line 2):** different workers may hold inconsistent profiles,\ + \ and all state disappears on restart.\n\nUse an established bounded cache\ + \ with atomic population, expiration, and invalidation. Store validated\ + \ immutable values and return defensive deep copies or read-only representations.\n\ + \n### Missing tests\n\nThe existing single happy-path test is insufficient.\ + \ Add, in priority order:\n\n1. Untrusted input cannot cause code execution;\ + \ malformed/truncated input produces a controlled client error and does\ + \ not populate the cache.\n2. An unauthenticated caller cannot seed, overwrite,\ + \ read, or otherwise affect another user’s profile.\n3. Mutating a returned\ + \ profile—including nested structures—does not mutate cached state.\n\ + 4. Cache size is bounded; TTL, eviction, and refresh behavior work as\ + \ specified.\n5. Concurrent requests for the same uncached ID behave atomically\ + \ and deterministically.\n6. Non-dictionary values, invalid schemas, oversized\ + \ payloads, and invalid IDs are rejected without insertion.\n7. Multiple\ + \ users remain isolated, repeated hits behave correctly, and the global\ + \ cache is reset between tests.\n\nRather than testing that malicious\ + \ pickle gadgets are safely handled, the preferred redesign should eliminate\ + \ `pickle.loads` from this request path entirely." + type: output_text + id: msg_0728b898e06dffcb006adb3942a2a487d0ab2f97a66cc8bdfd + phase: final_answer + role: assistant + status: completed + type: message + - content: + - text: Do not call tools again. Reply only OK. + type: input_text + id: msg_0728b898e06dffcb006adb394f427087d0bada52ee50b2be20 + role: user + status: completed + type: message + first_id: msg_0728b898e06dffcb006adb3925978487d0a45c51be5137805e + has_more: false + last_id: msg_0728b898e06dffcb006adb394f427087d0bada52ee50b2be20 + object: list + headers: + content-type: application/json + status_code: 200 diff --git a/crates/agentic-server-core/tests/compaction_cassette_test.rs b/crates/agentic-server-core/tests/compaction_cassette_test.rs index 1642f11c6..086a9c28d 100644 --- a/crates/agentic-server-core/tests/compaction_cassette_test.rs +++ b/crates/agentic-server-core/tests/compaction_cassette_test.rs @@ -227,7 +227,10 @@ async fn repeated_compaction_drops_tool_pair_and_replaces_prior_checkpoint() { ); let requests = fixture.request_bodies().await; - assert_eq!(requests[0]["input"], turn.request.body.input); + let mut expected = turn.request.body.input.clone(); + assert_eq!(expected[4]["type"], "function_call_output"); + expected[4]["status"] = json!("completed"); + assert_eq!(requests[0]["input"], expected); } #[tokio::test] diff --git a/crates/agentic-server-core/tests/conversation_branch_response_test.rs b/crates/agentic-server-core/tests/conversation_branch_response_test.rs index b4bf5f160..fa007750c 100644 --- a/crates/agentic-server-core/tests/conversation_branch_response_test.rs +++ b/crates/agentic-server-core/tests/conversation_branch_response_test.rs @@ -8,6 +8,7 @@ use std::sync::Arc; use agentic_core::executor::ExecuteRequest; use agentic_core::executor::session::ResponseSession; use agentic_core::types::RequestPayload; +use agentic_core::types::io::{ItemOrder, ItemPage}; use either::Either; use futures::StreamExt; use serde_json::Value; @@ -59,6 +60,11 @@ async fn assert_branch_is_detached(streaming: bool) { env!("CARGO_MANIFEST_DIR") )); let turns = responses_turns(&cassette); + let page = ItemPage { + limit: 100.try_into().unwrap(), + after: None, + order: ItemOrder::Asc, + }; // Exercise durable lookup directly and through a transient session. for use_session in [false, true] { for store in [false, true] { @@ -95,7 +101,7 @@ async fn assert_branch_is_detached(streaming: bool) { let before = fixture .exec_ctx .conv_handler - .list_items("default_tenant", &conversation_id, 100, None, "asc") + .list_items("default_tenant", &conversation_id, page) .await .unwrap(); let parent_id = parent["id"].as_str().unwrap(); @@ -118,7 +124,7 @@ async fn assert_branch_is_detached(streaming: bool) { let after = fixture .exec_ctx .conv_handler - .list_items("default_tenant", &conversation_id, 100, None, "asc") + .list_items("default_tenant", &conversation_id, page) .await .unwrap(); assert_eq!( diff --git a/crates/agentic-server-core/tests/conversation_storage_regressions.rs b/crates/agentic-server-core/tests/conversation_storage_regressions.rs index 9d6034b73..c4ea220de 100644 --- a/crates/agentic-server-core/tests/conversation_storage_regressions.rs +++ b/crates/agentic-server-core/tests/conversation_storage_regressions.rs @@ -5,8 +5,8 @@ use std::sync::atomic::{AtomicU64, Ordering}; use agentic_core::storage::models::item as item_model; use agentic_core::storage::{ConversationStore, ResponseMetadata, ResponseStore, create_pool_with_schema}; -use agentic_core::types::conversations::ItemOrder; use agentic_core::types::io::InOutItem; +use agentic_core::types::io::ItemOrder; use serde_json::json; static COUNTER: AtomicU64 = AtomicU64::new(0); diff --git a/crates/agentic-server-core/tests/conversations/edge_replay.rs b/crates/agentic-server-core/tests/conversations/edge_replay.rs index 72411afd7..9d5b24bd3 100644 --- a/crates/agentic-server-core/tests/conversations/edge_replay.rs +++ b/crates/agentic-server-core/tests/conversations/edge_replay.rs @@ -3,9 +3,8 @@ use super::{IdPairs, Turn, Value, cassette, compare_value, remap_error_message}; use agentic_core::executor::{ConversationHandler, ExecutorError}; use agentic_core::storage::{ConversationData, ConversationStore, create_pool_with_schema}; -use agentic_core::types::conversations::{ - ConversationResponse, CreateConversationRequest, CreateItemRequest, ListItemsResponse, -}; +use agentic_core::types::conversations::{ConversationResponse, CreateConversationRequest, CreateItemRequest}; +use agentic_core::types::io::{ItemLimit, ItemOrder, ItemPage, ListItemsResponse}; pub(super) fn remap_ids(value: &Value, ids: &IdPairs) -> Value { match value { @@ -57,15 +56,17 @@ pub(super) async fn execute_step( Ok(serde_json::to_value(ListItemsResponse::new(items, false)).unwrap()) } ("GET", 4) => { - let limit = query["limit"].as_str().map_or(20, |limit| limit.parse().unwrap()); + let page = ItemPage { + limit: query["limit"].as_str().map_or_else(ItemLimit::default, |limit| { + ItemLimit::try_from(limit.parse::().unwrap()).unwrap() + }), + after: query["after"].as_str(), + order: query["order"].as_str().map_or_else(ItemOrder::default, |order| { + serde_json::from_value(Value::from(order)).unwrap() + }), + }; let items = handler - .list_items( - "default_tenant", - conversation.unwrap(), - limit, - query["after"].as_str(), - query["order"].as_str().unwrap_or("desc"), - ) + .list_items("default_tenant", conversation.unwrap(), page) .await?; Ok(serde_json::to_value(items).unwrap()) } diff --git a/crates/agentic-server-core/tests/conversations/item_references.rs b/crates/agentic-server-core/tests/conversations/item_references.rs index 3d1c5d15b..9cff83b15 100644 --- a/crates/agentic-server-core/tests/conversations/item_references.rs +++ b/crates/agentic-server-core/tests/conversations/item_references.rs @@ -2,7 +2,7 @@ use super::{message_with_id, test_store}; use agentic_core::storage::{ResponseMetadata, ResponseStore, StorageError}; -use agentic_core::types::conversations::ItemOrder; +use agentic_core::types::io::ItemOrder; use std::sync::Arc; /// A response history row stores its content under a `item_…` row ID and keeps the public ID in diff --git a/crates/agentic-server-core/tests/conversations_api_cassette_test.rs b/crates/agentic-server-core/tests/conversations_api_cassette_test.rs index 0b21d1c47..6574530c6 100644 --- a/crates/agentic-server-core/tests/conversations_api_cassette_test.rs +++ b/crates/agentic-server-core/tests/conversations_api_cassette_test.rs @@ -927,8 +927,8 @@ async fn existing_conversation_item_error_matches_openai_recording() { async fn deleted_cursor_error_body_matches_openai_recording() { use agentic_core::executor::ExecutorError; use agentic_core::storage::{ConversationStore, create_pool_with_schema}; - use agentic_core::types::conversations::ItemOrder; use agentic_core::types::io::InOutItem; + use agentic_core::types::io::ItemOrder; let reference = cassette("edge-cases", "openai").expect("OpenAI edge-case recording"); let pool = create_pool_with_schema(Some("sqlite::memory:")).await.unwrap(); diff --git a/crates/agentic-server-core/tests/execution_trace_test.rs b/crates/agentic-server-core/tests/execution_trace_test.rs index 992552216..481d860b9 100644 --- a/crates/agentic-server-core/tests/execution_trace_test.rs +++ b/crates/agentic-server-core/tests/execution_trace_test.rs @@ -426,7 +426,7 @@ async fn failure_before_execution_starts_is_not_delivered() { let Err(error) = run(&traces, Arc::clone(&fixture.exec_ctx), payload).await else { panic!("unknown previous_response_id fails rehydration"); }; - assert_eq!(error.http_status(), 404, "{error}"); + assert_eq!(error.http_status(), 400, "{error}"); let span = traces.execute_span().await; assert_execute_attributes(&span, false, "failed", "not_started"); diff --git a/crates/agentic-server-core/tests/mcp_tool_test.rs b/crates/agentic-server-core/tests/mcp_tool_test.rs index e17241d5e..4f8d1a947 100644 --- a/crates/agentic-server-core/tests/mcp_tool_test.rs +++ b/crates/agentic-server-core/tests/mcp_tool_test.rs @@ -3,7 +3,7 @@ use agentic_core::executor::accumulator::ResponseAccumulator; use agentic_core::tool::ToolDeclaration; use agentic_core::tool::{GatewayExecutors, ToolOwnership, ToolRegistry, ToolType}; use agentic_core::types::io::output::McpListTools; -use agentic_core::types::io::{McpCall, OutputItem, ToolChoice}; +use agentic_core::types::io::{ItemPage, McpCall, OutputItem, ToolChoice}; use agentic_core::types::request_response::RequestPayload; use agentic_core::types::tools::ResponsesTool; use axum::Router; @@ -897,3 +897,37 @@ fn successful_blocking_mcp_call_matches_openai() { assert_calls_match_openai(&openai_output, &gateway_output, false); assert_eq!(output_text(&gateway_output), output_text(&openai_output)); } + +#[tokio::test] +async fn mcp_input_items_return_stored_call_and_result() { + let mcp_url = spawn_forecast_mcp().await; + let fixture = support::TestFixture::new_with_responses(forecast_inference_responses(false, "Paris")).await; + let Either::Left(response) = ExecuteRequest::new(forecast_request(false, &mcp_url), Arc::clone(&fixture.exec_ctx)) + .run() + .await + .unwrap() + else { + panic!("expected JSON response") + }; + let page = fixture + .exec_ctx + .resp_handler + .list_input_items(&response.id, ItemPage::default()) + .await + .unwrap(); + let page = serde_json::to_value(page).unwrap(); + assert_eq!(page["data"].as_array().unwrap().len(), 3); + assert_eq!(page["data"][0]["type"], "function_call_output"); + assert_eq!(page["data"][1]["type"], "function_call"); + assert_eq!(page["data"][2]["type"], "message"); + let bodies = fixture.request_bodies().await; + for kind in ["function_call", "function_call_output"] { + assert!( + bodies[1]["input"] + .as_array() + .unwrap() + .iter() + .any(|item| item["type"] == kind && item["call_id"] == "call_forecast") + ); + } +} diff --git a/crates/agentic-server-core/tests/postgres_tenant_isolation_test.rs b/crates/agentic-server-core/tests/postgres_tenant_isolation_test.rs index 5a3947e30..e1fd3fbbc 100644 --- a/crates/agentic-server-core/tests/postgres_tenant_isolation_test.rs +++ b/crates/agentic-server-core/tests/postgres_tenant_isolation_test.rs @@ -218,7 +218,7 @@ async fn postgres_concurrent_tenant_isolation() { #[ignore = "requires TEST_POSTGRES_URL pointing to an isolated PostgreSQL database"] async fn postgres_item_crud_uses_turn_locking_and_preserves_history() { use agentic_core::storage::{ResponseMetadata, ResponseStore, StorageError}; - use agentic_core::types::conversations::ItemOrder; + use agentic_core::types::io::ItemOrder; let pool = setup_postgres_pool().await; let store = Arc::new(ConversationStore::new(Arc::clone(&pool))); diff --git a/crates/agentic-server-core/tests/relayed_stream_validation_test.rs b/crates/agentic-server-core/tests/relayed_stream_validation_test.rs index 06d280f37..eada15996 100644 --- a/crates/agentic-server-core/tests/relayed_stream_validation_test.rs +++ b/crates/agentic-server-core/tests/relayed_stream_validation_test.rs @@ -327,13 +327,22 @@ async fn strict_relay_decoder_accepts_compatible_recorded_responses_streams() { } } + // This stateless gateway capture is raw upstream pass-through. vLLM emits + // message content-part events for a reasoning item; strict ingestion must + // reject it. Keep this exact observed failure distinct from valid streams. + let invalid_passthrough = concat!( + "responses/response-edge-cases-stream-gateway.yaml turn 1: ", + "invalid request: upstream stream event does not match its active output item: ", + "inconsistent item ID, output_index, or kind" + ); + assert!(rejected.iter().any(|failure| failure == invalid_passthrough)); let unexpected: Vec<_> = rejected .iter() - .filter(|failure| !failure.contains("changes 'call_id'")) + .filter(|failure| !failure.contains("changes 'call_id'") && failure.as_str() != invalid_passthrough) .collect(); assert!( unexpected.is_empty(), - "recorded streams failed for reasons other than the call-ID stability rule:\n{}", + "recorded streams failed beyond the characterized upstream incompatibilities:\n{}", unexpected .iter() .map(|failure| failure.as_str()) @@ -342,8 +351,8 @@ async fn strict_relay_decoder_accepts_compatible_recorded_responses_streams() { ); assert_eq!( rejected.len(), - 10, - "the recorded call-ID incompatibility baseline changed:\n{}", + 11, + "the recorded upstream incompatibility baseline changed:\n{}", rejected.join("\n") ); assert!(decoded >= 50, "decoded only {decoded} recorded Responses SSE streams"); diff --git a/crates/agentic-server-core/tests/response_deletion_storage_test.rs b/crates/agentic-server-core/tests/response_deletion_storage_test.rs new file mode 100644 index 000000000..4689370a9 --- /dev/null +++ b/crates/agentic-server-core/tests/response_deletion_storage_test.rs @@ -0,0 +1,205 @@ +//! Response CRUD uses existing history rows and foreign-key behavior. + +use std::sync::Arc; +use std::sync::atomic::{AtomicU64, Ordering}; + +use agentic_core::storage::models::{conversation as conversation_model, response as response_model}; +use agentic_core::storage::{ + ConversationStore, DbPool, ResponseMetadata, ResponseStore, StorageError, create_pool_with_schema, +}; +use agentic_core::types::io::InOutItem; +use serde_json::json; + +static COUNTER: AtomicU64 = AtomicU64::new(0); + +async fn pool() -> Arc { + let id = COUNTER.fetch_add(1, Ordering::Relaxed); + let url = format!("sqlite:file:response_deletion_{id}?mode=memory&cache=shared"); + create_pool_with_schema(Some(&url)).await.unwrap() +} + +fn message(text: &str) -> InOutItem { + InOutItem::Input(serde_json::from_value(json!({"type": "message", "role": "user", "content": text})).unwrap()) +} + +fn answer(id: &str) -> InOutItem { + InOutItem::Output( + serde_json::from_value( + json!({"type": "message", "id": id, "role": "assistant", "status": "completed", + "content": [{"type": "output_text", "text": "answer", "annotations": []}]}), + ) + .unwrap(), + ) +} + +async fn item_count(pool: &DbPool) -> i64 { + sqlx::query_scalar("SELECT COUNT(*) FROM items") + .fetch_one(pool) + .await + .unwrap() +} + +async fn turn(store: &ResponseStore, id: &str, previous: Option<&str>) { + store + .persist( + id, + previous, + vec![message(id), answer(&format!("msg_{id}"))], + &ResponseMetadata::default(), + ) + .await + .unwrap(); +} + +#[tokio::test] +async fn deleting_a_response_removes_the_resource_and_keeps_history_rows() { + let pool = pool().await; + let store = ResponseStore::new(Arc::clone(&pool)); + turn(&store, "resp_only", None).await; + assert_eq!(item_count(&pool).await, 2); + + store.delete("resp_only").await.unwrap(); + assert_eq!(item_count(&pool).await, 2); + assert!(store.get("resp_only").await.unwrap_err().is_not_found()); + assert!(store.get_items("resp_only").await.unwrap_err().is_not_found()); + assert!(store.delete("resp_only").await.unwrap_err().is_not_found()); +} + +#[tokio::test] +async fn response_deletion_uses_the_callers_transaction() { + let pool = pool().await; + let store = ResponseStore::new(Arc::clone(&pool)); + turn(&store, "resp_parent", None).await; + turn(&store, "resp_child", Some("resp_parent")).await; + let original = store.get("resp_child").await.unwrap(); + + let mut tx = pool.begin().await.unwrap(); + assert!(response_model::delete_in_tx(&mut tx, "resp_parent").await.unwrap()); + assert!( + response_model::get_in_tx(&mut tx, "resp_parent") + .await + .unwrap() + .is_none() + ); + let child = response_model::get_in_tx(&mut tx, "resp_child").await.unwrap().unwrap(); + assert!(child.previous_response_id.is_none()); + tx.rollback().await.unwrap(); + + assert!(store.get("resp_parent").await.is_ok()); + let restored = store.get("resp_child").await.unwrap(); + assert_eq!(restored.previous_response_id, original.previous_response_id); + assert_eq!(restored.history_item_ids, original.history_item_ids); + assert_eq!(item_count(&pool).await, 4); +} + +#[tokio::test] +async fn deleting_a_parent_removes_its_context_and_preserves_child_history_order() { + let pool = pool().await; + let store = ResponseStore::new(Arc::clone(&pool)); + // `resp_a` and `resp_b` are siblings: both inherit the parent's two rows. + turn(&store, "resp_parent", None).await; + turn(&store, "resp_a", Some("resp_parent")).await; + turn(&store, "resp_b", Some("resp_parent")).await; + assert_eq!(item_count(&pool).await, 6); + + // OpenAI removes the deleted parent's context from descendant listings and continuations. + store.delete("resp_parent").await.unwrap(); + assert_eq!(item_count(&pool).await, 6); + // Deletion only removes response records, preserving all shared item rows. + store.delete("resp_a").await.unwrap(); + assert_eq!(item_count(&pool).await, 6); + let rows = store.get_items("resp_b").await.unwrap(); + let ids = store.get("resp_b").await.unwrap().history_item_ids; + assert_eq!( + rows.iter().map(|row| &row.id).collect::>(), + ids.iter().collect::>() + ); + let history = store.rehydrate("resp_b").await.unwrap(); + assert_eq!(history, vec![message("resp_b"), answer("msg_resp_b")]); + store.delete("resp_b").await.unwrap(); + assert_eq!(item_count(&pool).await, 6); +} + +#[tokio::test] +async fn deleting_a_conversation_latest_response_clears_its_pointer_and_keeps_items() { + let pool = pool().await; + let conversations = ConversationStore::new(Arc::clone(&pool)); + let responses = ResponseStore::new(Arc::clone(&pool)); + let conversation = conversations + .create_with_metadata_and_items(Some("default_tenant"), None, vec![]) + .await + .unwrap(); + let id = conversation.conversation_id.as_str(); + for (response, text) in [("resp_first", "first"), ("resp_second", "second")] { + conversations + .persist( + id, + response, + None, + vec![message(text), answer(&format!("msg_{response}"))], + &ResponseMetadata::default(), + ) + .await + .unwrap(); + } + let latest = |pool: Arc| async move { + conversation_model::get(&pool, id) + .await + .unwrap() + .unwrap() + .latest_response_id + }; + assert_eq!(latest(Arc::clone(&pool)).await.as_deref(), Some("resp_second")); + + responses.delete("resp_second").await.unwrap(); + assert_eq!( + latest(Arc::clone(&pool)).await.as_deref(), + None, + "the existing foreign key clears the deleted pointer" + ); + assert_eq!( + item_count(&pool).await, + 4, + "conversation items stay with the conversation" + ); + + responses.delete("resp_first").await.unwrap(); + assert_eq!(latest(Arc::clone(&pool)).await, None); + assert_eq!(item_count(&pool).await, 4); +} + +#[tokio::test] +async fn item_lookup_distinguishes_missing_empty_and_invalid_history() { + let pool = pool().await; + let store = ResponseStore::new(Arc::clone(&pool)); + assert!(store.get_items("resp_missing").await.unwrap_err().is_not_found()); + store + .persist("resp_empty", None, vec![], &ResponseMetadata::default()) + .await + .unwrap(); + assert!(store.get_items("resp_empty").await.unwrap().is_empty()); + sqlx::query("UPDATE responses SET history_item_ids = NULL WHERE id = 'resp_empty'") + .execute(pool.as_ref()) + .await + .unwrap(); + assert!(store.get_items("resp_empty").await.unwrap().is_empty()); + for invalid in ["not-json", "null", "{}"] { + sqlx::query("UPDATE responses SET history_item_ids = $1 WHERE id = 'resp_empty'") + .bind(invalid) + .execute(pool.as_ref()) + .await + .unwrap(); + assert!(matches!( + store.get_items("resp_empty").await, + Err(StorageError::InvalidResponseHistory { .. }) + )); + } + sqlx::query("UPDATE responses SET history_item_ids = '[\"item_missing\"]' WHERE id = 'resp_empty'") + .execute(pool.as_ref()) + .await + .unwrap(); + assert!(matches!( + store.get_items("resp_empty").await, + Err(StorageError::InvalidHistoryItem { .. }) + )); +} diff --git a/crates/agentic-server-core/tests/responses_api/recordings.rs b/crates/agentic-server-core/tests/responses_api/recordings.rs new file mode 100644 index 000000000..72857863a --- /dev/null +++ b/crates/agentic-server-core/tests/responses_api/recordings.rs @@ -0,0 +1,382 @@ +//! Assertions over the unchanged recordings, independent of live replay. + +use std::collections::HashSet; + +use super::{cassette, error_metadata, item_signature, terminal}; +use serde_json::{Value, json}; + +const SCENARIOS: [&str; 5] = [ + "lifecycle", + "pagination", + "edge-cases", + "conversation", + "replayed-items", +]; + +fn items(turns: &[Value], turn: usize) -> Vec { + terminal(&turns[turn - 1]["response"])["data"] + .as_array() + .unwrap() + .clone() +} + +fn comparable_items(items: &[Value]) -> Vec { + items + .iter() + .map(|item| { + let mut value = item_signature(item); + value["id"] = item["id"].clone(); + value + }) + .collect() +} + +fn assert_pages(turns: &[Value], full_turn: usize, page_turns: &[usize], label: &str) { + let full = items(turns, full_turn); + for &turn in page_turns { + let query = &turns[turn - 1]["request"]["query_params"]; + let body = terminal(&turns[turn - 1]["response"]); + let mut ordered = full.clone(); + if query["order"].as_str().unwrap_or("desc") == "desc" { + ordered.reverse(); + } + let start = query["after"].as_str().filter(|id| !id.is_empty()).map_or(0, |id| { + ordered + .iter() + .rposition(|item| item["id"] == id) + .expect("cursor in full history") + + 1 + }); + let limit = query["limit"] + .as_str() + .map_or(20, |value| value.parse::().unwrap()); + let expected: Vec<_> = ordered.iter().skip(start).take(limit).cloned().collect(); + assert_eq!( + comparable_items(&items(turns, turn)), + comparable_items(&expected), + "{label} t{turn}: page content/order" + ); + assert_eq!( + body["has_more"], + ordered.len() - start > limit, + "{label} t{turn}: has_more" + ); + } +} + +fn assert_recording(scenario: &str, turns: &[Value], label: &str) { + for (index, turn) in turns.iter().enumerate() { + let body = terminal(&turn["response"]); + if let Some(data) = body["data"].as_array() { + for (field, expected) in [("first_id", data.first()), ("last_id", data.last())] { + assert_eq!( + body[field], + expected.map_or(Value::Null, |item| item["id"].clone()), + "{label} t{}: {field}", + index + 1 + ); + } + } + } + match scenario { + "pagination" => assert_pages(turns, 3, &[4, 5, 6, 7, 8, 9, 10, 11, 12, 13], label), + "lifecycle" => { + assert_pages(turns, 4, &[5, 6], label); + let before = items(turns, 4); + assert_eq!( + comparable_items(&items(turns, 11)), + comparable_items(&before[before.len() - 1..]), + "{label}: descendant input after deletion" + ); + assert_eq!( + terminal(&turns[6]["response"]), + terminal(&turns[11]["response"]), + "{label}: stored response changed after deleting parent" + ); + let child = terminal(&turns[6]["response"]); + let mut retained = items(turns, 11); + retained.extend(child["output"].as_array().unwrap().iter().cloned()); + let continued = items(turns, 15); + assert_eq!(continued.len(), retained.len() + 1, "{label}: continuation length"); + assert_eq!( + comparable_items(&continued[..retained.len()]), + comparable_items(&retained), + "{label}: continued history must contain only the surviving child" + ); + assert_eq!( + continued.last().unwrap()["content"][0]["text"], + turns[13]["request"]["body"]["input"][0]["content"], + "{label}: continuation must retain the new user message" + ); + } + "conversation" => { + for turn in [6, 12] { + assert_eq!( + comparable_items(&items(turns, 4)), + comparable_items(&items(turns, turn)), + "{label}: first response input snapshot changed" + ); + } + for turn in [11, 14] { + assert_eq!( + comparable_items(&items(turns, 8)), + comparable_items(&items(turns, turn)), + "{label}: child input snapshot changed" + ); + } + assert_pages(turns, 8, &[18], label); + let deleted_id = items(turns, 5)[0]["id"].clone(); + let expected: Vec<_> = items(turns, 9) + .into_iter() + .filter(|item| item["id"] != deleted_id) + .collect(); + assert_eq!( + comparable_items(&items(turns, 15)), + comparable_items(&expected), + "{label}: conversation deletion removed the wrong items" + ); + } + "replayed-items" => { + for turn in [4, 5, 7, 8, 10, 11, 14] { + assert_eq!( + comparable_items(&items(turns, 2)), + comparable_items(&items(turns, turn)), + "{label}: reused ID or rejected request changed seed content" + ); + } + } + "edge-cases" => { + assert!(items(turns, 10).is_empty(), "{label}: limit=0 returns no items"); + assert_eq!(terminal(&turns[9]["response"])["has_more"], true); + } + _ => unreachable!(), + } +} + +#[test] +fn recorded_histories_and_pages_are_consistent() { + for scenario in SCENARIOS { + for suffix in ["", "-stream"] { + for provider in ["openai", "gateway"] { + let name = format!("{scenario}{suffix}"); + let turns = cassette(&name, provider).expect("required recording"); + assert_recording(scenario, &turns, &format!("{name}/{provider}")); + } + } + } +} + +fn generated_ids(turns: &[Value]) -> HashSet { + turns + .iter() + .filter(|turn| turn["request"]["method"] == "POST" && turn["request"]["path"] == "/v1/responses") + .flat_map(|turn| { + terminal(&turn["response"])["output"] + .as_array() + .cloned() + .unwrap_or_default() + }) + .filter_map(|item| item["id"].as_str().map(str::to_owned)) + .collect() +} + +#[test] +fn recorded_management_contract_matches_openai() { + let mut differences = Vec::new(); + for scenario in SCENARIOS { + for suffix in ["", "-stream"] { + let name = format!("{scenario}{suffix}"); + let a = cassette(&name, "openai").expect("OpenAI recording"); + let b = cassette(&name, "gateway").expect("gateway recording"); + assert_eq!(a.len(), b.len(), "{name}: turn count"); + let a_generated = generated_ids(&a); + let b_generated = generated_ids(&b); + for (index, (left, right)) in a.iter().zip(&b).enumerate() { + let location = format!("{name} t{}", index + 1); + assert_eq!( + left["request"]["method"], right["request"]["method"], + "{location}: method" + ); + assert_eq!( + left["response"]["status_code"], right["response"]["status_code"], + "{location}: HTTP status" + ); + if left["response"]["status_code"] != 200 { + continue; + } + let l = terminal(&left["response"]); + let r = terminal(&right["response"]); + for field in ["object", "status", "deleted", "has_more"] { + assert_eq!(l[field], r[field], "{location}: {field}"); + } + // Stateless creation is passed through on this branch; its upstream payload + // may omit `store`. Storage behavior is checked by the subsequent CRUD calls. + if left["request"]["body"]["store"] != false { + assert_eq!(l["store"], r["store"], "{location}: store"); + } + // Different models can emit different numbers of reasoning/output items. + // Each recording's complete pages (including those items) are checked above; + // client-supplied items must still match across providers exactly. + let client_items = |body: &Value, generated: &HashSet| -> Vec { + body["data"] + .as_array() + .into_iter() + .flatten() + .filter(|item| !item["id"].as_str().is_some_and(|id| generated.contains(id))) + .map(item_signature) + .collect() + }; + let lc = client_items(&l, &a_generated); + let rc = client_items(&r, &b_generated); + if lc != rc { + differences.push(format!("{location}: client items\nOpenAI: {lc:?}\ngateway: {rc:?}")); + } + } + } + } + assert!(differences.is_empty(), "{}", differences.join("\n")); +} + +#[test] +fn recorded_error_metadata_matches_openai() { + let mut differences = Vec::new(); + for scenario in SCENARIOS { + for suffix in ["", "-stream"] { + let name = format!("{scenario}{suffix}"); + let a = cassette(&name, "openai").expect("OpenAI recording"); + let b = cassette(&name, "gateway").expect("gateway recording"); + assert_eq!(a.len(), b.len()); + for (index, (left, right)) in a.iter().zip(&b).enumerate() { + if left["response"]["status_code"].as_u64().unwrap() < 400 { + continue; + } + let expected = error_metadata(&terminal(&left["response"])); + let actual = error_metadata(&terminal(&right["response"])); + if expected != actual { + differences.push(format!("{name} t{}: OpenAI {expected}; gateway {actual}", index + 1)); + } + } + } + } + assert!( + differences.is_empty(), + "recordings need to be refreshed after fixing these errors:\n{}", + differences.join("\n") + ); +} + +#[test] +fn deferred_tool_status_defaults_do_not_hide_other_statuses() { + for (kind, default) in [("function_call", "in_progress"), ("function_call_output", "completed")] { + let absent = json!({"type": kind, "call_id": "call_1"}); + let mut recorded = absent.clone(); + recorded["status"] = json!(default); + assert_eq!(item_signature(&absent), item_signature(&recorded)); + recorded["status"] = json!("incomplete"); + assert_ne!(item_signature(&absent), item_signature(&recorded)); + } +} + +#[test] +fn error_metadata_comparison_detects_each_field() { + let body = json!({"error":{"type":"invalid_request_error","code":"invalid_value","param":"limit"}}); + for field in ["type", "code", "param"] { + let mut changed = body.clone(); + changed["error"][field] = Value::Null; + assert_ne!(error_metadata(&body), error_metadata(&changed)); + } +} + +#[test] +fn recorded_tool_execution_ids_and_statuses() { + for provider in ["openai", "gateway"] { + assert_tool_execution_ids_and_statuses(provider); + } +} + +fn assert_tool_execution_ids_and_statuses(provider: &str) { + let turns = cassette("tool-items", provider).expect("tool-execution recording"); + assert_eq!( + turns.iter().filter(|turn| turn["request"]["method"] == "POST").count(), + 24 + ); + let expected = [ + ("web_search_call", "ws_"), + ("mcp_list_tools", "mcpl_"), + ("mcp_call", "mcp_"), + ("function_call", "fc_"), + ("function_call_output", "fc_"), + ("code_interpreter_call", "ci_"), + ("shell_call", "sh_"), + ("shell_call_output", "sho_"), + ("custom_tool_call", "ctc_"), + ("custom_tool_call_output", "ctco_"), + ("tool_search_call", "tsc_"), + ("tool_search_output", "tso_"), + ("multi_agent_call", "mac_"), + ("multi_agent_call_output", "maco_"), + ("agent_message", "amsg_"), + ]; + let mut seen = HashSet::new(); + let mut requests = turns.iter(); + while let Some(post) = requests.next() { + let request = &post["request"]["body"]; + let created = terminal(&post["response"]); + assert_eq!(post["request"]["method"], "POST"); + if request.get("previous_response_id").is_none() && request["multi_agent"]["enabled"] != true { + assert!(!request["tools"].as_array().unwrap().is_empty()); + } + assert_eq!(post["response"]["status_code"], 200, "{created}"); + assert_eq!(created["status"], "completed"); + let mut data = Vec::new(); + let mut after = Value::Null; + loop { + let listing = requests.next().expect("input-items page"); + let page = terminal(&listing["response"]); + assert_eq!(listing["response"]["status_code"], 200, "{page}"); + assert_eq!(listing["request"]["method"], "GET"); + assert_eq!(listing["request"]["query_params"]["after"], after); + assert_eq!( + listing["request"]["path"], + format!("/v1/responses/{}/input_items", created["id"].as_str().unwrap()) + ); + data.extend(page["data"].as_array().unwrap().iter().cloned()); + if page["has_more"] == false { + break; + } + assert_ne!(page["last_id"], after); + after = page["last_id"].clone(); + assert!(after.is_string()); + } + for item in &data { + let Some(&(kind, prefix)) = expected.iter().find(|(kind, _)| item["type"] == *kind) else { + continue; + }; + seen.insert(kind); + assert!(item["id"].as_str().unwrap().starts_with(prefix), "{item}"); + if matches!( + kind, + "mcp_list_tools" | "multi_agent_call" | "multi_agent_call_output" | "agent_message" + ) { + assert!(item.get("status").is_none()); + } else { + assert_eq!(item["status"], "completed", "{item}"); + } + } + if let Some(previous) = request["previous_response_id"].as_str() { + let parent = turns + .iter() + .find(|turn| turn["response"]["body"]["id"] == previous) + .unwrap(); + for output in parent["response"]["body"]["output"].as_array().unwrap() { + if expected.iter().any(|(kind, _)| output["type"] == *kind) { + let listed = data.iter().find(|item| item["id"] == output["id"]).unwrap(); + assert_eq!(listed["type"], output["type"]); + assert_eq!(listed["status"], output["status"]); + assert_eq!(listed["call_id"], output["call_id"]); + } + } + } + } + assert_eq!(seen, expected.iter().map(|(kind, _)| *kind).collect()); +} diff --git a/crates/agentic-server-core/tests/responses_api_test.rs b/crates/agentic-server-core/tests/responses_api_test.rs new file mode 100644 index 000000000..dd54992af --- /dev/null +++ b/crates/agentic-server-core/tests/responses_api_test.rs @@ -0,0 +1,477 @@ +//! Replay recorded Responses management calls through the gateway. +//! Only model inference is mocked; storage and management endpoints run locally. +#[path = "responses_api/recordings.rs"] +mod recordings; + +use std::collections::HashMap; +use std::path::{Path, PathBuf}; +use std::process::Stdio; +use std::time::Duration; + +use std::slice; +use std::sync::Arc; +use tokio::process::{Child, Command}; + +use agentic_core::events::normalize_sse_line; +use axum::{Json, Router, response::IntoResponse, routing::post}; +use serde_json::{Value, json}; +use tokio::net::TcpListener; +use tokio::sync::Mutex; + +fn cassette(scenario: &str, provider: &str) -> Option> { + let directory = std::env::var_os("RESPONSES_CASSETTES_DIR").map_or_else( + || PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("tests/cassettes/responses"), + PathBuf::from, + ); + let path = directory.join(format!("response-{scenario}-{provider}.yaml")); + if !path.exists() { + return None; + } + let document: Value = serde_yml::from_str(&std::fs::read_to_string(&path).expect("read cassette")) + .expect("parse recorder-generated cassette"); + assert_eq!( + document.as_object().unwrap().len(), + 1, + "only a flat turns list is allowed" + ); + let turns = document["turns"].as_array().unwrap().clone(); + assert!(!turns.is_empty(), "{}: empty cassette", path.display()); + for (index, turn) in turns.iter().enumerate() { + assert_eq!(turn["filename"], format!("t{}", index + 1)); + assert!(turn["request"]["method"].is_string()); + assert!(turn["request"]["query_params"].is_object()); + assert!(turn["response"]["status_code"].as_u64().is_some()); + } + Some(turns) +} + +fn terminal(response: &Value) -> Value { + if let Some(body) = response.get("body") { + return body.clone(); + } + let stream: String = response["sse"] + .as_array() + .unwrap() + .iter() + .map(|line| line.as_str().unwrap()) + .collect(); + stream + .lines() + .filter_map(normalize_sse_line) + .filter_map(|frame| frame.wire.rest.get("response").cloned()) + .find(|body| matches!(body["status"].as_str(), Some("completed" | "incomplete" | "failed"))) + .expect("stream must contain a terminal response") +} + +fn mapped(id: &str, ids: &HashMap) -> String { + ids.get(id).cloned().unwrap_or_else(|| id.to_owned()) +} + +fn map_request_ids(value: &mut Value, ids: &HashMap) { + match value { + Value::Array(items) => items.iter_mut().for_each(|item| map_request_ids(item, ids)), + Value::Object(object) => { + for (key, value) in object { + if matches!(key.as_str(), "id" | "previous_response_id" | "conversation" | "after") + && let Some(id) = value.as_str() + { + *value = mapped(id, ids).into(); + } else { + map_request_ids(value, ids); + } + } + } + _ => {} + } +} + +fn item_signature(item: &Value) -> Value { + let mut item = item.clone(); + item.as_object_mut().unwrap().remove("id"); + // Missing tool-history status defaults are deferred to the item-type refactor. + // Ignore only absence versus these recorded defaults; other statuses still differ. + if matches!( + (item["type"].as_str(), item["status"].as_str()), + (Some("function_call"), Some("in_progress")) | (Some("function_call_output"), Some("completed")) + ) { + item.as_object_mut().unwrap().remove("status"); + } + // Log probabilities are outside this API-management contract comparison. + if let Some(content) = item["content"].as_array_mut() { + for part in content { + if let Some(part) = part.as_object_mut() { + part.remove("logprobs"); + } + } + } + item +} + +fn bind_id(recorded: &str, live: &str, ids: &mut HashMap, location: &str) { + if let Some(previous) = ids.get(recorded) { + assert_eq!(previous, live, "{location}: an item changed identity"); + } else { + assert!( + !ids.values().any(|value| value == live), + "{location}: distinct IDs collapsed" + ); + ids.insert(recorded.to_owned(), live.to_owned()); + } +} + +fn error_metadata(body: &Value) -> Value { + json!({"type": body["error"]["type"], "code": body["error"]["code"], "param": body["error"]["param"]}) +} + +fn compare_items(expected: &[Value], actual: &[Value], ids: &mut HashMap, location: &str) { + assert_eq!(expected.len(), actual.len(), "{location}: item count"); + for (left, right) in expected.iter().zip(actual) { + let mut expected = item_signature(left); + let result_prefix = match left["type"].as_str() { + Some("function_call_output") => Some("fc_"), + Some("custom_tool_call_output") => Some("ctco_"), + Some("shell_call_output") => Some("sho_"), + _ => None, + }; + if let Some(prefix) = result_prefix { + // Older gateway captures lack these fields. The refreshed OpenAI + // tool-execution reference establishes their required public values. + assert!( + right["id"].as_str().is_some_and(|id| id.starts_with(prefix)), + "{location}: result ID" + ); + assert_eq!(right["status"], "completed", "{location}: result status"); + if left["type"] != "function_call_output" && expected["status"].is_null() { + expected["status"] = json!("completed"); + } + } + assert_eq!(expected, item_signature(right), "{location}: item content"); + let recorded = left["id"].as_str(); + let live = right["id"].as_str(); + // Function-result resource IDs are deferred; all other item identities remain required. + if recorded.is_some() || left["type"] != "function_call_output" { + assert_eq!(recorded.is_some(), live.is_some(), "{location}: item ID presence"); + } + if let (Some(recorded), Some(live)) = (recorded, live) { + bind_id(recorded, live, ids, location); + } + } +} + +fn assert_exchange(expected: &Value, actual: &Value, ids: &mut HashMap, location: &str) { + assert_eq!(actual["object"], expected["object"], "{location}: object"); + if let (Some(recorded), Some(live)) = (expected["id"].as_str(), actual["id"].as_str()) { + if let Some(mapped) = ids.get(recorded) { + assert_eq!(live, mapped, "{location}: identity"); + } else { + ids.insert(recorded.to_owned(), live.to_owned()); + } + } + if let Some(expected_items) = expected["data"].as_array() { + let actual_items = actual["data"].as_array().unwrap(); + assert_eq!(actual["has_more"], expected["has_more"], "{location}: has_more"); + compare_items(expected_items, actual_items, ids, location); + for field in ["first_id", "last_id"] { + if let Some(id) = expected[field].as_str() { + assert_eq!(actual[field], mapped(id, ids), "{location}: {field}"); + } else { + assert!(actual[field].is_null(), "{location}: {field}"); + } + } + } + if let Some(output) = expected["output"].as_array() { + compare_items(output, actual["output"].as_array().unwrap(), ids, location); + for field in ["status", "store"] { + assert_eq!(actual[field], expected[field], "{location}: {field}"); + } + } + if expected.get("deleted").is_some() { + assert_eq!(actual["deleted"], expected["deleted"], "{location}: deleted"); + } +} + +async fn replay_turn( + client: &reqwest::Client, + url: &str, + turn: &Value, + reference: &Value, + ids: &mut HashMap, + location: &str, +) { + let request = &turn["request"]; + let path = request["path"] + .as_str() + .unwrap() + .split('/') + .map(|part| mapped(part, ids)) + .collect::>() + .join("/"); + let mut body = request["body"].clone(); + map_request_ids(&mut body, ids); + let mut query = request["query_params"].clone(); + map_request_ids(&mut query, ids); + let query: Vec<(&str, &str)> = query + .as_object() + .unwrap() + .iter() + .flat_map(|(key, value)| { + value + .as_array() + .map_or_else(|| slice::from_ref(value), Vec::as_slice) + .iter() + .map(move |value| (key.as_str(), value.as_str().unwrap())) + }) + .collect(); + let method = request["method"].as_str().unwrap(); + let mut call = client + .request(method.parse().unwrap(), format!("{url}{path}")) + .bearer_auth("test-key") + .query(&query); + if method == "POST" { + call = call + .header("content-type", "application/json") + .body(serde_json::to_vec(&body).unwrap()); + } + let response = call.send().await.unwrap(); + let status = response.status().as_u16(); + let text = response.text().await.unwrap(); + let actual: Value = if status == 200 && body["stream"] == true && method == "POST" { + terminal(&json!({"sse":text.split_inclusive('\n').collect::>()})) + } else { + serde_json::from_str(&text).expect("JSON management response") + }; + assert_eq!( + u64::from(status), + reference["response"]["status_code"].as_u64().unwrap(), + "{location}: {actual}" + ); + if status != 200 { + assert_eq!( + error_metadata(&actual), + error_metadata(&terminal(&reference["response"])), + "{location}: OpenAI error metadata" + ); + return; + } + assert_exchange(&terminal(&turn["response"]), &actual, ids, location); +} + +async fn spawn_gateway(upstream_url: &str, home: &Path, client: &reqwest::Client) -> (String, Child) { + let port = std::net::TcpListener::bind("127.0.0.1:0") + .unwrap() + .local_addr() + .unwrap() + .port(); + let binary = std::env::var_os("RESPONSES_GATEWAY_BIN").map_or_else( + || { + std::env::current_exe() + .unwrap() + .parent() + .unwrap() + .parent() + .unwrap() + .join(format!("agentic-server{}", std::env::consts::EXE_SUFFIX)) + }, + PathBuf::from, + ); + let log_path = home.join("gateway.log"); + let log = std::fs::File::create(&log_path).unwrap(); + let mut gateway = Command::new(binary) + .env_clear() + .env("AGENTIC_API_HOME", home) + .env("OPENAI_API_KEY", "test-key") + .env("RUST_LOG", "warn") + .args([ + "--llm-api-base", + upstream_url, + "--skip-llm-ready-check", + "--gateway-host", + "127.0.0.1", + "--gateway-port", + &port.to_string(), + "--db-url", + "sqlite://?mode=memory", + ]) + .stdin(Stdio::null()) + .stdout(log.try_clone().unwrap()) + .stderr(log) + .kill_on_drop(true) + .spawn() + .expect("build the gateway first: cargo build -p agentic-server --bin agentic-server"); + let url = format!("http://127.0.0.1:{port}"); + let ready = tokio::time::timeout(Duration::from_secs(15), async { + loop { + assert!( + gateway.try_wait().unwrap().is_none(), + "gateway exited: {}", + std::fs::read_to_string(&log_path).unwrap() + ); + if client + .get(format!("{url}/health")) + .send() + .await + .is_ok_and(|response| response.status().is_success()) + { + break; + } + tokio::time::sleep(Duration::from_millis(25)).await; + } + }) + .await; + assert!( + ready.is_ok(), + "gateway did not start: {}", + std::fs::read_to_string(&log_path).unwrap() + ); + (url, gateway) +} + +async fn replay(scenario: &str, provider: &str, turns: &[Value]) { + let model_responses: Vec = turns + .iter() + .filter(|turn| { + turn["request"]["method"] == "POST" + && turn["request"]["path"] == "/v1/responses" + && turn["response"]["status_code"] == 200 + }) + .map(|turn| turn["response"].clone()) + .collect(); + let outputs = Arc::new(Mutex::new(model_responses.into_iter())); + let upstream_outputs = Arc::clone(&outputs); + let last_model_input = Arc::new(Mutex::new(Value::Null)); + let upstream_input = Arc::clone(&last_model_input); + let upstream_router = Router::new().route( + "/v1/responses", + post(move |Json(request): Json| { + let outputs = Arc::clone(&upstream_outputs); + let input = Arc::clone(&upstream_input); + async move { + *input.lock().await = request["input"].clone(); + let response = outputs.lock().await.next().expect("recorded model response exhausted"); + if let Some(chunks) = response["sse"].as_array() { + let stream: String = chunks.iter().map(|chunk| chunk.as_str().unwrap()).collect(); + ([("content-type", "text/event-stream")], stream).into_response() + } else { + Json(response["body"].clone()).into_response() + } + } + }), + ); + let listener = TcpListener::bind("127.0.0.1:0").await.unwrap(); + let upstream_url = format!("http://{}", listener.local_addr().unwrap()); + let upstream = tokio::spawn(async move { axum::serve(listener, upstream_router).await.unwrap() }); + let home = std::env::temp_dir().join(format!("responses-replay-{}", uuid::Uuid::now_v7())); + std::fs::create_dir(&home).unwrap(); + let client = reqwest::Client::builder() + .timeout(Duration::from_secs(10)) + .build() + .unwrap(); + let (url, mut gateway) = spawn_gateway(&upstream_url, &home, &client).await; + let reference = cassette(scenario, "openai").expect("OpenAI reference is required for error contracts"); + let mut ids = HashMap::::new(); + for (index, turn) in turns.iter().enumerate() { + replay_turn( + &client, + &url, + turn, + if provider == "openai" { turn } else { &reference[index] }, + &mut ids, + &format!("{scenario}/{provider} t{}", index + 1), + ) + .await; + } + assert!( + outputs.lock().await.next().is_none(), + "all recorded model calls must be consumed" + ); + if scenario == "lifecycle" || scenario == "lifecycle-stream" { + let input = last_model_input.lock().await; + let user_texts: Vec<&str> = input + .as_array() + .unwrap() + .iter() + .filter(|item| item["role"] == "user") + .flat_map(|item| { + let content = &item["content"]; + content + .as_array() + .map_or_else(|| slice::from_ref(content), Vec::as_slice) + }) + .map(|part| part.as_str().or_else(|| part["text"].as_str()).expect("user text")) + .collect(); + let expected: Vec<&str> = [2, 13] + .map(|index| turns[index]["request"]["body"]["input"][0]["content"].as_str().unwrap()) + .into(); + assert_eq!( + user_texts, expected, + "deleted parent must not reach continued inference" + ); + } + gateway.kill().await.unwrap(); + gateway.wait().await.unwrap(); + upstream.abort(); + let _ = upstream.await; + std::fs::remove_dir_all(&home).unwrap(); +} + +macro_rules! replay_tests { + ($(($name:ident, $scenario:literal, $provider:literal)),* $(,)?) => {$( + #[tokio::test] + async fn $name() { + let turns = cassette($scenario, $provider).expect("required Responses recording missing"); + replay($scenario, $provider, &turns).await; + } + )*}; +} + +replay_tests! { + (replay_lifecycle_openai, "lifecycle", "openai"), + (replay_lifecycle_gateway, "lifecycle", "gateway"), + (replay_lifecycle_stream_openai, "lifecycle-stream", "openai"), + (replay_lifecycle_stream_gateway, "lifecycle-stream", "gateway"), + (replay_pagination_openai, "pagination", "openai"), + (replay_pagination_gateway, "pagination", "gateway"), + (replay_pagination_stream_openai, "pagination-stream", "openai"), + (replay_pagination_stream_gateway, "pagination-stream", "gateway"), + (replay_edge_cases_openai, "edge-cases", "openai"), + (replay_edge_cases_gateway, "edge-cases", "gateway"), + (replay_edge_cases_stream_openai, "edge-cases-stream", "openai"), + (replay_edge_cases_stream_gateway, "edge-cases-stream", "gateway"), + (replay_conversation_openai, "conversation", "openai"), + (replay_conversation_gateway, "conversation", "gateway"), + (replay_conversation_stream_openai, "conversation-stream", "openai"), + (replay_conversation_stream_gateway, "conversation-stream", "gateway"), + (replay_replayed_items_openai, "replayed-items", "openai"), + (replay_replayed_items_gateway, "replayed-items", "gateway"), + (replay_replayed_items_stream_openai, "replayed-items-stream", "openai"), + (replay_replayed_items_stream_gateway, "replayed-items-stream", "gateway"), +} + +#[tokio::test] +async fn replay_client_tool_input_items_gateway() { + let turns = cassette("tool-items", "gateway").expect("gateway tool-execution recording"); + let mut selected = false; + let turns: Vec<_> = turns + .into_iter() + .filter(|turn| { + let body = &turn["request"]["body"]; + if turn["request"]["method"] == "POST" && body["previous_response_id"].is_null() { + selected = body["tools"].as_array().is_some_and(|tools| { + !tools.is_empty() + && tools.iter().all(|tool| { + matches!( + tool["type"].as_str(), + Some("function" | "custom" | "shell" | "tool_search" | "namespace") + ) + }) + }); + } + selected + }) + .collect(); + assert_eq!( + turns.iter().filter(|turn| turn["request"]["method"] == "POST").count(), + 13 + ); + replay("tool-items", "gateway", &turns).await; +} diff --git a/crates/agentic-server-core/tests/session_continuation_test.rs b/crates/agentic-server-core/tests/session_continuation_test.rs index 6c2c96c26..fca23cb93 100644 --- a/crates/agentic-server-core/tests/session_continuation_test.rs +++ b/crates/agentic-server-core/tests/session_continuation_test.rs @@ -395,10 +395,26 @@ async fn explicit_conversation_tool_history(use_session: bool, gateway_tool: boo assert_eq!(calls.load(Ordering::Relaxed), usize::from(gateway_tool)); let requests = model.requests.lock().await; assert_eq!(requests.len(), if gateway_tool { 3 } else { 2 }); - let model_history = requests.last().unwrap()["input"].clone(); + let mut model_history = requests.last().unwrap()["input"].clone(); drop(requests); let history = conversations.rehydrate(&conversation.conversation_id).await.unwrap(); - let stored_history = serde_json::to_value(InOutItem::into_input_items(history)).unwrap(); + let mut stored_history = serde_json::to_value(InOutItem::into_input_items(history)).unwrap(); + // Independently executed sessions generate different result item IDs. Check + // persistence within each execution before comparing their semantic history. + for item in model_history.as_array_mut().unwrap() { + if item["type"] == "function_call_output" && !item["id"].is_null() { + assert!(item["id"].as_str().unwrap().starts_with("fc_")); + let stored = stored_history + .as_array_mut() + .unwrap() + .iter_mut() + .find(|stored| stored["type"] == "function_call_output" && stored["call_id"] == item["call_id"]) + .unwrap(); + assert_eq!(stored["id"], item["id"]); + item.as_object_mut().unwrap().remove("id"); + stored.as_object_mut().unwrap().remove("id"); + } + } model.close().await; pool.close().await; (model_history, stored_history) diff --git a/crates/agentic-server-core/tests/shell_tool_test.rs b/crates/agentic-server-core/tests/shell_tool_test.rs index e2307b3fd..47b6d6da9 100644 --- a/crates/agentic-server-core/tests/shell_tool_test.rs +++ b/crates/agentic-server-core/tests/shell_tool_test.rs @@ -301,6 +301,7 @@ async fn submitted_shell_items_preserve_public_fields_in_storage() { InOutItem::Output(_) => None, }) .collect::>(); + output["status"] = json!("completed"); assert_eq!(inputs, vec![call, output]); let requests = fixture.request_bodies().await; assert_eq!(requests[0]["input"][0]["type"], "function_call"); diff --git a/crates/agentic-server-core/tests/stateful_responses_integration.rs b/crates/agentic-server-core/tests/stateful_responses_integration.rs index c560ddbed..8a7d19bd1 100644 --- a/crates/agentic-server-core/tests/stateful_responses_integration.rs +++ b/crates/agentic-server-core/tests/stateful_responses_integration.rs @@ -431,6 +431,8 @@ async fn test_previous_response_id_rehydrates_function_call_before_tool_output() let mut second = make_request("ignored", true, false, Some(p1.id), None); second.input = ResponsesInput::from(vec![InputItem::FunctionCallOutput(FunctionToolResultMessage { + id: None, + status: None, call_id: "call_1".to_string(), output: "{\"stdout\":\"/workspace\"}".into(), })]); @@ -493,6 +495,8 @@ async fn test_encrypted_only_persisted_reasoning_fails_before_upstream() { for stream in [false, true] { let mut continuation = make_request("continue", true, stream, Some(first.id.clone()), None); continuation.input = ResponsesInput::from(vec![InputItem::FunctionCallOutput(FunctionToolResultMessage { + id: None, + status: None, call_id: "call_prior".to_owned(), output: "tool output".into(), })]); @@ -646,7 +650,7 @@ async fn test_store_false_with_previous_response_id_hydrates_but_does_not_persis panic!("store=false response must not be persisted"); }; assert!( - matches!(&error, ExecutorError::Storage(source) if source.is_not_found()), + matches!(&error, ExecutorError::PreviousResponseNotFound { .. }), "expected a missing previous response, got {error}" ); assert_eq!( @@ -730,7 +734,7 @@ async fn test_public_persist_steps_honor_the_storage_policy() { async fn is_continuable(exec_ctx: &ExecutionContext, id: &str) -> bool { match rehydrate_conversation(make_request("next", true, false, Some(id.to_owned()), None), exec_ctx).await { Ok(_) => true, - Err(ExecutorError::Storage(source)) if source.is_not_found() => false, + Err(ExecutorError::PreviousResponseNotFound { .. }) => false, Err(error) => panic!("unexpected rehydration error for {id}: {error}"), } } @@ -1001,7 +1005,7 @@ async fn tool_search_store_false_manual_replay_completes_without_reusable_respon .get(&lookup_ctx) .await .expect_err("store:false response ID must not be reusable"); - assert!(matches!(error, agentic_core::executor::ExecutorError::Storage(source) if source.is_not_found())); + assert!(matches!(error, ExecutorError::PreviousResponseNotFound { .. })); } #[tokio::test] @@ -1222,6 +1226,8 @@ fn upstream_mcp_fixture_call(id: &str, call_id: &str, name: &str, arguments: &st fn tool_output(call_id: &str, output: &str) -> InputItem { InputItem::FunctionCallOutput(FunctionToolResultMessage { + id: None, + status: None, call_id: call_id.to_string(), output: output.into(), }) diff --git a/crates/agentic-server-core/tests/web_search_tool_test.rs b/crates/agentic-server-core/tests/web_search_tool_test.rs index 45726dce5..e0b0f613b 100644 --- a/crates/agentic-server-core/tests/web_search_tool_test.rs +++ b/crates/agentic-server-core/tests/web_search_tool_test.rs @@ -10,7 +10,7 @@ use agentic_core::tool::{GatewayExecutor, ToolOutput, WebSearchHandler, model_vi use agentic_core::types::event::MessageStatus; use agentic_core::types::io::output::{FunctionToolCall, GatewayCallStatus}; use agentic_core::types::io::{ - FunctionToolResultMessage, InputItem, OutputItem, ResponsesInput, ToolCallOutput, ToolChoice, + FunctionToolResultMessage, InputItem, ItemOrder, ItemPage, OutputItem, ResponsesInput, ToolCallOutput, ToolChoice, }; use agentic_core::types::request_response::{RequestPayload, ResponsePayload, ResponseTextConfig}; use agentic_core::types::tools::{ResponsesTool, WebSearchToolParam}; @@ -1901,6 +1901,8 @@ async fn execute_returns_mixed_client_tool_calls_without_followup_model_request( previous_response_id: Some(response.id), ..base_payload(ResponsesInput::from(vec![InputItem::FunctionCallOutput( FunctionToolResultMessage { + id: None, + status: None, call_id: "call_weather".to_owned(), output: ToolCallOutput::Text("{\"city\":\"San Francisco\",\"temperature_c\":18}".to_owned()), }, @@ -2925,3 +2927,83 @@ async fn cache_usage_accumulates_tool_rounds_without_inventing_writes() { } } } + +#[tokio::test] +async fn input_pages_return_stored_items_without_changing_model_history() { + let (you_url, _captured, _you) = spawn_mock_you().await; + let llm = support::MockServer::start_deque(vec![ + mixed_web_search_and_client_function_response(), + support::text_response("continued after mixed tools"), + ]) + .await; + let ctx = build_exec_ctx(llm.url(), you_url).await; + let payload: RequestPayload = serde_json::from_value(serde_json::json!({ + "model": "test-model", "input": "look up rust async and weather", "store": true, + "tools": [{"type": "web_search_preview"}, { + "type": "function", "name": "get_weather", "parameters": {"type": "object"} + }] + })) + .unwrap(); + let Either::Left(root) = ExecuteRequest::new(payload, Arc::clone(&ctx)).run().await.unwrap() else { + panic!("expected JSON response"); + }; + let page = ctx + .resp_handler + .list_input_items(&root.id, ItemPage::default()) + .await + .unwrap(); + assert_eq!( + page.data.len(), + 3, + "stored input items include the gateway call and result" + ); + let payload: RequestPayload = serde_json::from_value(serde_json::json!({ + "model": "test-model", "store": true, "previous_response_id": root.id, + "input": [{"type": "function_call_output", "call_id": "call_weather", "output": "sunny"}] + })) + .unwrap(); + let Either::Left(child) = ExecuteRequest::new(payload, Arc::clone(&ctx)).run().await.unwrap() else { + panic!("expected JSON continuation"); + }; + let page = ctx + .resp_handler + .list_input_items( + &child.id, + ItemPage { + order: ItemOrder::Asc, + ..ItemPage::default() + }, + ) + .await + .unwrap(); + let public = serde_json::to_value(&page.data).unwrap(); + let public = public.as_array().unwrap(); + assert_eq!( + public + .iter() + .map(|item| item["type"].as_str().unwrap()) + .collect::>(), + [ + "message", + "function_call", + "function_call_output", + "web_search_call", + "function_call", + "function_call_output" + ] + ); + assert_eq!(public[1]["call_id"], "call_search"); + assert_eq!(public[2]["call_id"], "call_search"); + assert_eq!(public[4]["name"], "get_weather"); + assert_eq!(public[5]["call_id"], "call_weather"); + let bodies = llm.request_bodies().await; + let model_input = bodies[1]["input"].as_array().unwrap(); + for kind in ["function_call", "function_call_output"] { + assert!( + model_input + .iter() + .any(|item| item["type"] == kind && item["call_id"] == "call_search"), + "canonical search {kind} must remain in inference history" + ); + } +} diff --git a/crates/agentic-server/src/app.rs b/crates/agentic-server/src/app.rs index 1b66f2633..8d7819d4e 100644 --- a/crates/agentic-server/src/app.rs +++ b/crates/agentic-server/src/app.rs @@ -21,9 +21,9 @@ use crate::auth::api_key::require_api_key; use crate::auth::{ANTHROPIC_COUNT_TOKENS_PATH, ANTHROPIC_MESSAGES_PATH, OidcAuthenticator, require_oidc}; use crate::handler::{ chat_completions, compact_response, completions, count_tokens, create_conversation, create_item, - delete_conversation, delete_item, embeddings, health, list_items, messages, models, ready, responses, - responses_ws_with_auth, retrieve_conversation, retrieve_item, retrieve_model, retrieve_response, transcriptions, - translations, update_conversation, + delete_conversation, delete_item, delete_response, embeddings, health, list_input_items, list_items, messages, + models, ready, responses, responses_ws_with_auth, retrieve_conversation, retrieve_item, retrieve_model, + retrieve_response, transcriptions, translations, update_conversation, }; use crate::model_capabilities::ModelCapabilities; use crate::rate_limit::{RateLimitConfig, RateLimiter, enforce_rate_limit}; @@ -349,12 +349,14 @@ pub fn build_router_with_auth( } else { public_routes }; - // Retrieval reads local storage, so it cannot rely on upstream credential validation. - let mut retrieval_route = get(retrieve_response); + // Retrieval and deletion act on local storage, so they cannot rely on upstream credential validation. + let mut retrieval_route = get(retrieve_response).delete(delete_response); + let mut input_items_route = get(list_input_items); if authenticator.is_none() && let Some(key) = state.openai_api_key.as_ref().filter(|key| !key.is_empty()) { retrieval_route = retrieval_route.route_layer(middleware::from_fn_with_state(key.clone(), require_api_key)); + input_items_route = input_items_route.route_layer(middleware::from_fn_with_state(key.clone(), require_api_key)); } let protected_routes = Router::new() .route("/v1/conversations", post(create_conversation)) @@ -384,7 +386,8 @@ pub fn build_router_with_auth( .route(ANTHROPIC_COUNT_TOKENS_PATH, post(count_tokens)) .route("/v1/responses", post(responses).get(responses_ws_with_auth)) .route("/v1/responses/compact", post(compact_response)) - .route("/v1/responses/{response_id}", retrieval_route); + .route("/v1/responses/{response_id}", retrieval_route) + .route("/v1/responses/{response_id}/input_items", input_items_route); // Layered before authentication, so it runs after it and sees the principal. let protected_routes = match server_config.rate_limit { Some(config) => protected_routes.route_layer(middleware::from_fn_with_state( diff --git a/crates/agentic-server/src/handler/http/conversation_items.rs b/crates/agentic-server/src/handler/http/conversation_items.rs index 676944603..0f8a0244f 100644 --- a/crates/agentic-server/src/handler/http/conversation_items.rs +++ b/crates/agentic-server/src/handler/http/conversation_items.rs @@ -1,46 +1,19 @@ //! HTTP transport for conversation item CRUD. -use axum::extract::{Path, Query, Request, State}; +use axum::extract::{Path, RawQuery, Request, State}; use axum::http::StatusCode; use axum::response::{IntoResponse, Response}; -use serde::Deserialize; +use agentic_core::types::io::ItemInclude; #[cfg(feature = "openapi")] -use agentic_core::types::ConversationResponse; -use agentic_core::types::{CreateItemRequest, ItemResponse, ListItemsResponse}; +use agentic_core::types::{ConversationResponse, InOutItem}; +use agentic_core::types::{CreateItemRequest, ListItemsResponse}; use super::super::common::{error_response, executor_error_response, extract_json, read_bytes}; use super::conversations::{DEFAULT_TENANT_ID, conversation_response}; +use super::items::ListItemsQuery; use crate::app::AppState; -/// Query parameters for listing conversation items. -#[derive(Debug, Deserialize)] -#[cfg_attr(feature = "openapi", derive(utoipa::IntoParams))] -pub struct ListItemsQuery { - /// Maximum number of items to return (default: 20, max: 100). - #[serde(default = "default_limit")] - pub limit: i64, - - /// Cursor for pagination (item ID to start after). - pub after: Option, - - /// Sort order for items (default: desc). Ascending order is oldest-first. - #[serde(default = "default_order")] - pub order: String, - - /// Optional output expansion, encoded as `include[]=value` by `OpenAI` clients. - #[serde(alias = "include[]")] - pub include: Option, -} - -fn default_limit() -> i64 { - 20 -} - -fn default_order() -> String { - "desc".to_string() -} - #[cfg_attr(feature = "openapi", utoipa::path( post, path = "/v1/conversations/{conversation_id}/items", @@ -100,32 +73,25 @@ pub async fn create_item(State(state): State, Path(conversation_id): P pub async fn list_items( State(state): State, Path(conversation_id): Path, - Query(query): Query, + RawQuery(raw): RawQuery, ) -> Response { - // Validate limit parameter - if query.limit < 1 || query.limit > 100 { + let query = match ListItemsQuery::parse(raw.as_deref()) { + Ok(query) => query, + Err(error) => return *error, + }; + // ItemLimit validates the upper bound; conversations also require a nonzero limit. + if query.limit.get() == 0 { return error_response( StatusCode::BAD_REQUEST, "invalid_request", "limit must be between 1 and 100", ); } - - // Validate order parameter - if query.order != "asc" && query.order != "desc" { - return error_response( - StatusCode::BAD_REQUEST, - "invalid_request", - "order must be 'asc' or 'desc'", - ); - } - // Text output logprobs are already present in stored message items. Other // include expansions need their own data sources before they can be served. if query .include - .as_deref() - .is_some_and(|value| value != "message.output_text.logprobs") + .is_some_and(|include| include != ItemInclude::MessageOutputTextLogprobs) { return error_response(StatusCode::BAD_REQUEST, "invalid_request", "unsupported include value"); } @@ -133,13 +99,7 @@ pub async fn list_items( match state .exec_ctx .conv_handler - .list_items( - DEFAULT_TENANT_ID, - &conversation_id, - query.limit, - query.after.as_deref(), - &query.order, - ) + .list_items(DEFAULT_TENANT_ID, &conversation_id, query.page()) .await { Ok(response) => axum::Json(response).into_response(), @@ -155,7 +115,7 @@ pub async fn list_items( ("item_id" = String, Path, description = "Item ID") ), responses( - (status = 200, description = "Item retrieved", body = ItemResponse), + (status = 200, description = "Item retrieved", body = InOutItem), (status = 404, description = "Item or conversation not found"), ), security(("bearer_auth" = [])), diff --git a/crates/agentic-server/src/handler/http/items.rs b/crates/agentic-server/src/handler/http/items.rs new file mode 100644 index 000000000..ac22f6a00 --- /dev/null +++ b/crates/agentic-server/src/handler/http/items.rs @@ -0,0 +1,106 @@ +//! Shared HTTP query handling for item listings. + +use agentic_core::types::io::{ItemInclude, ItemLimit, ItemOrder, ItemPage}; +use std::collections::HashSet; + +use agentic_core::executor::ExecutorError; +use axum::response::Response; +use serde::de::IntoDeserializer; +use serde::{Deserialize, Serialize}; + +use super::super::common::executor_error_response; + +/// Shared query parameters for conversation and response input item listings. +#[derive(Debug, Default, Serialize, Deserialize)] +#[cfg_attr(feature = "openapi", derive(utoipa::IntoParams))] +pub struct ListItemsQuery { + /// Maximum number of items to return (default: 20, max: 100). + #[serde(default)] + #[cfg_attr(feature = "openapi", param(value_type = Option, minimum = 0, maximum = 100))] + pub limit: ItemLimit, + + /// Cursor for pagination (item ID to start after). + pub after: Option, + + /// Sort order for items (default: desc). Ascending order is oldest-first. + #[serde(default)] + pub order: ItemOrder, + + /// Optional output expansion, encoded as `include[]=value` by `OpenAI` clients. + #[serde(alias = "include[]")] + pub include: Option, +} + +impl ListItemsQuery { + /// Decode item listing parameters while retaining parameter-specific errors. + /// + /// # Errors + /// Returns an OpenAI-compatible 400 for invalid or duplicate query parameters. + pub(super) fn parse(raw: Option<&str>) -> Result> { + let invalid = |param: &str, code: Option<&'static str>, message: String| { + Box::new(executor_error_response(ExecutorError::UnsupportedValue { + param: param.to_owned(), + code, + message, + })) + }; + let mut query = Self::default(); + let mut seen = HashSet::new(); + for (key, value) in url::form_urlencoded::parse(raw.unwrap_or_default().as_bytes()) { + let key = match key.as_ref() { + "include" | "include[]" => "include", + "limit" => "limit", + "order" => "order", + "after" => "after", + _ => continue, + }; + // Check each expansion, including repeated includes, before rejecting duplicates. + if key == "include" { + let include = value + .parse::() + .map_err(|error| invalid("include[0]", Some("invalid_value"), error.to_string()))?; + if include == ItemInclude::ReasoningEncryptedContent { + return Err(invalid( + "include", + None, + "Encrypted content cannot be requested for persisted responses.".into(), + )); + } + query.include = Some(include); + } + if !seen.insert(key) { + return Err(invalid( + key, + Some("duplicate_parameter"), + format!("'{key}' must be given at most once"), + )); + } + match key { + "limit" => { + let limit = value + .parse::() + .map_err(|_| invalid(key, Some("invalid_type"), "limit must be an integer".into()))?; + query.limit = ItemLimit::try_from(limit) + .map_err(|error| invalid(key, Some(error.code()), error.to_string()))?; + } + "order" => { + let order: Result = + ItemOrder::deserialize(value.as_ref().into_deserializer()); + query.order = order.map_err(|error| invalid(key, Some("invalid_value"), error.to_string()))?; + } + "after" => query.after = Some(value.into_owned()), + _ => {} + } + } + Ok(query) + } + + /// Borrow validated pagination arguments for the executor API. + pub(super) fn page(&self) -> ItemPage<'_> { + ItemPage { + limit: self.limit, + after: self.after.as_deref(), + order: self.order, + } + } +} diff --git a/crates/agentic-server/src/handler/http/mod.rs b/crates/agentic-server/src/handler/http/mod.rs index bb0c33216..8ad4fed4d 100644 --- a/crates/agentic-server/src/handler/http/mod.rs +++ b/crates/agentic-server/src/handler/http/mod.rs @@ -3,6 +3,7 @@ pub(crate) mod chat_completions; pub(crate) mod conversation_items; pub(crate) mod conversations; pub(crate) mod embeddings; +pub(crate) mod items; pub(crate) mod messages; pub(crate) mod models; pub(crate) mod responses; @@ -14,4 +15,4 @@ pub use conversations::{create_conversation, delete_conversation, retrieve_conve pub use embeddings::embeddings; pub use messages::{count_tokens, messages}; pub use models::{health, models, ready, retrieve_model}; -pub use responses::{compact_response, responses, retrieve_response}; +pub use responses::{compact_response, delete_response, list_input_items, responses, retrieve_response}; diff --git a/crates/agentic-server/src/handler/http/responses.rs b/crates/agentic-server/src/handler/http/responses.rs index d796447d4..98f227aaa 100644 --- a/crates/agentic-server/src/handler/http/responses.rs +++ b/crates/agentic-server/src/handler/http/responses.rs @@ -1,4 +1,4 @@ -use axum::extract::{Path, Request, State}; +use axum::extract::{Path, RawQuery, Request, State}; use axum::http::request::Parts; use axum::response::{IntoResponse, Response}; use bytes::Bytes; @@ -12,11 +12,13 @@ use agentic_core::executor::telemetry::Api; use agentic_core::executor::{ExecuteRequest, compact_response as execute_compaction}; use agentic_core::proxy::ProxyRequest; use agentic_core::tool::ToolSearchHandler; +use agentic_core::types::io::DeletedResponse; use agentic_core::types::request_response::{CompactRequest, PromptCacheOptions, RequestPayload, ResponseTextConfig}; use super::super::common::{ convert_response, executor_error_response, extract_bearer, read_bytes, read_json, sse_response, }; +use super::items::ListItemsQuery; use crate::app::AppState; // Only executor requests interpret text and prompt-cache options. Proxy requests retain their raw body. @@ -154,3 +156,68 @@ pub async fn retrieve_response(State(state): State, Path(response_id): Err(error) => executor_error_response(error), } } + +/// Delete a locally persisted response without invoking inference. +/// +/// Descendants created with `previous_response_id` stay retrievable; a new request +/// naming the deleted ID as `previous_response_id` is rejected as not found. +#[cfg_attr(feature = "openapi", utoipa::path( + delete, + path = "/v1/responses/{response_id}", + params(("response_id" = String, Path, description = "Stored response ID")), + responses( + (status = 200, description = "Response deleted", body = agentic_core::types::io::DeletedResponse), + (status = 401, description = "Missing or invalid bearer token", body = crate::openapi::ApiErrorResponse), + (status = 404, description = "Response not found", body = crate::openapi::ApiErrorResponse), + ), + security(("bearer_auth" = [])), + tag = "responses", +))] +pub async fn delete_response(State(state): State, Path(response_id): Path) -> Response { + match state.exec_ctx.resp_handler.delete(&response_id).await { + Ok(()) => axum::Json(DeletedResponse::response(response_id)).into_response(), + Err(error) => executor_error_response(error), + } +} + +/// List the input items of a locally persisted response. +/// +/// The list is the full context the response was generated from — items inherited +/// through `previous_response_id` or its conversation, then this turn's input — +/// without the response's own output. +#[cfg_attr(feature = "openapi", utoipa::path( + get, + path = "/v1/responses/{response_id}/input_items", + params( + ("response_id" = String, Path, description = "Stored response ID"), + ListItemsQuery + ), + responses( + (status = 200, description = "Input items", body = agentic_core::types::ListItemsResponse), + (status = 400, description = "Invalid pagination parameters", body = crate::openapi::ApiErrorResponse), + (status = 401, description = "Missing or invalid bearer token", body = crate::openapi::ApiErrorResponse), + (status = 404, description = "Response not found", body = crate::openapi::ApiErrorResponse), + (status = 409, description = "Legacy response has no retrievable payload", body = crate::openapi::ApiErrorResponse), + ), + security(("bearer_auth" = [])), + tag = "responses", +))] +pub async fn list_input_items( + State(state): State, + Path(response_id): Path, + RawQuery(query): RawQuery, +) -> Response { + let query = match ListItemsQuery::parse(query.as_deref()) { + Ok(query) => query, + Err(error) => return *error, + }; + match state + .exec_ctx + .resp_handler + .list_input_items(&response_id, query.page()) + .await + { + Ok(page) => axum::Json(page).into_response(), + Err(error) => executor_error_response(error), + } +} diff --git a/crates/agentic-server/src/handler/mod.rs b/crates/agentic-server/src/handler/mod.rs index 20a445520..41837c511 100644 --- a/crates/agentic-server/src/handler/mod.rs +++ b/crates/agentic-server/src/handler/mod.rs @@ -5,9 +5,9 @@ pub mod websocket; pub use common::{convert_response, executor_error_response}; pub use http::{ chat_completions, compact_response, completions, count_tokens, create_conversation, create_item, - delete_conversation, delete_item, embeddings, health, list_items, messages, models, ready, responses, - retrieve_conversation, retrieve_item, retrieve_model, retrieve_response, transcriptions, translations, - update_conversation, + delete_conversation, delete_item, delete_response, embeddings, health, list_input_items, list_items, messages, + models, ready, responses, retrieve_conversation, retrieve_item, retrieve_model, retrieve_response, transcriptions, + translations, update_conversation, }; pub use websocket::responses_ws; pub(crate) use websocket::responses_ws_with_auth; diff --git a/crates/agentic-server/src/openapi.rs b/crates/agentic-server/src/openapi.rs index 71c296856..0cf429d18 100644 --- a/crates/agentic-server/src/openapi.rs +++ b/crates/agentic-server/src/openapi.rs @@ -23,6 +23,8 @@ use utoipa::OpenApi; crate::handler::http::models::retrieve_model, crate::handler::http::responses::responses, crate::handler::http::responses::retrieve_response, + crate::handler::http::responses::delete_response, + crate::handler::http::responses::list_input_items, crate::handler::http::responses::compact_response, crate::handler::http::conversations::create_conversation, crate::handler::http::conversations::retrieve_conversation, @@ -170,12 +172,12 @@ use utoipa::OpenApi; agentic_core::types::conversations::CreateConversationRequest, agentic_core::types::conversations::ConversationResponse, agentic_core::types::conversations::UpdateConversationRequest, - agentic_core::types::conversations::DeletedResponse, + agentic_core::types::io::DeletedResponse, agentic_core::types::conversations::CreateItemRequest, - agentic_core::types::conversations::ItemResponse, - agentic_core::types::conversations::ListItemsResponse, + agentic_core::types::io::ListItemsResponse, InOutItem, - agentic_core::types::conversations::ItemOrder, + agentic_core::types::io::ItemOrder, + agentic_core::types::io::ItemInclude, )), modifiers(&SecurityAddon), tags( diff --git a/crates/agentic-server/tests/conversations/regressions.rs b/crates/agentic-server/tests/conversations/regressions.rs index e808fda8d..1119ef328 100644 --- a/crates/agentic-server/tests/conversations/regressions.rs +++ b/crates/agentic-server/tests/conversations/regressions.rs @@ -1,5 +1,6 @@ use super::*; use agentic_core::types::InOutItem; +use serde_json::Value; async fn create_conversation_with_items(url: &str, items: Vec) -> String { let response = reqwest::Client::new() @@ -139,13 +140,27 @@ async fn rejects_oversized_batches_and_invalid_limits() { .unwrap(); assert_eq!(response.status(), StatusCode::BAD_REQUEST); } - for query in ["limit=0", "limit=101", "order=invalid"] { + for (query, code, param) in [ + ("limit=0", None, None), + ("limit=101", Some("integer_above_max_value"), Some("limit")), + ("limit=-1", Some("integer_below_min_value"), Some("limit")), + ("order=invalid", Some("invalid_value"), Some("order")), + ("limit=ten", Some("invalid_type"), Some("limit")), + ("limit=1&limit=2", Some("duplicate_parameter"), Some("limit")), + ("include[]=unknown", Some("invalid_value"), Some("include[0]")), + ] { let response = client .get(format!("{url}/v1/conversations/{conv_id}/items?{query}")) .send() .await .unwrap(); assert_eq!(response.status(), StatusCode::BAD_REQUEST); + let body: Value = response.json().await.unwrap(); + if let Some(code) = code { + assert_eq!(body["error"]["type"], "invalid_request_error", "{query}: {body}"); + assert_eq!(body["error"]["code"], code, "{query}: {body}"); + } + assert_eq!(body["error"]["param"].as_str(), param, "{query}: {body}"); } handle.abort(); } diff --git a/crates/agentic-server/tests/response_input_items_test.rs b/crates/agentic-server/tests/response_input_items_test.rs new file mode 100644 index 000000000..d7899506d --- /dev/null +++ b/crates/agentic-server/tests/response_input_items_test.rs @@ -0,0 +1,466 @@ +//! `GET /v1/responses/{id}/input_items` lists the stored context a response was generated from. +#[allow(dead_code)] +mod common; + +use std::sync::Arc; +use std::sync::atomic::{AtomicUsize, Ordering}; + +use agentic_core::executor::ExecutionContext; +use agentic_core::storage::{ResponseMetadata, ResponseStore}; +use axum::{Json, Router, routing::post}; +use http::StatusCode; +use serde_json::{Value, json}; +use tokio::net::TcpListener; + +/// Mock inference upstream answering every turn with one uniquely identified message. +fn answering_upstream() -> Router { + answering_upstream_with(json!([])) +} + +/// Like [`answering_upstream`], but each turn's output starts with `extra_output`. +fn answering_upstream_with(extra_output: Value) -> Router { + let next_message_id = Arc::new(AtomicUsize::new(0)); + Router::new().route( + "/v1/responses", + post(move |Json(_): Json| { + let extra_output = extra_output.clone(); + let message_id = next_message_id.fetch_add(1, Ordering::Relaxed); + let mut output = extra_output.as_array().cloned().unwrap_or_default(); + output.push(json!({ + "type":"message", "id":format!("msg_answer_{message_id}"), "role":"assistant", + "status":"completed", "content":[{"type":"output_text", "text":format!("answer {message_id}")}]})); + async move { + Json(json!({"id":"resp_upstream", "object":"response", "created_at":123, + "model":"test-model", "status":"completed", "output":output, + "usage":{"input_tokens":3,"output_tokens":1,"total_tokens":4}})) + } + }), + ) +} + +struct Harness { + url: String, + client: reqwest::Client, + exec: Arc, + tasks: Vec>, +} + +impl Harness { + async fn start() -> Self { + Self::start_with(answering_upstream()).await + } + + async fn start_with(upstream: Router) -> Self { + let listener = TcpListener::bind("127.0.0.1:0").await.unwrap(); + let mut config = common::test_config(&format!("http://{}", listener.local_addr().unwrap())); + let upstream = tokio::spawn(async move { axum::serve(listener, upstream).await.unwrap() }); + config.db_url = Some("sqlite://?mode=memory".into()); + let exec = Arc::new(ExecutionContext::from_config(&config).await.unwrap()); + let mut state = common::test_state(&config); + state.exec_ctx = Arc::clone(&exec); + let (url, gateway) = common::spawn_gateway(state).await; + Self { + url, + client: reqwest::Client::new(), + exec, + tasks: vec![upstream, gateway], + } + } + + async fn create(&self, body: Value) -> Value { + let response = self + .client + .post(format!("{}/v1/responses", self.url)) + .json(&body) + .send() + .await + .unwrap(); + assert_eq!(response.status(), StatusCode::OK); + response.json().await.unwrap() + } + + async fn input_items(&self, id: &str, query: &str) -> reqwest::Response { + self.client + .get(format!("{}/v1/responses/{id}/input_items{query}", self.url)) + .bearer_auth("test-key") + .send() + .await + .unwrap() + } + + async fn page(&self, id: &str, query: &str) -> Value { + let response = self.input_items(id, query).await; + assert_eq!(response.status(), StatusCode::OK); + response.json().await.unwrap() + } + + async fn stop(self) { + for task in self.tasks { + task.abort(); + let _ = task.await; + } + self.exec.storage_pool().unwrap().close().await; + } +} + +/// The text of each item on a page: input text, or the first content part's text. +fn texts(page: &Value) -> Vec { + page["data"] + .as_array() + .unwrap() + .iter() + .map(|item| { + item["content"] + .as_str() + .or_else(|| item["content"][0]["text"].as_str()) + .expect("text item") + .to_owned() + }) + .collect() +} + +#[tokio::test] +async fn input_items_list_the_inherited_context_without_the_response_own_output() { + let harness = Harness::start().await; + let first = harness + .create(json!({"model":"test-model", "input":"first", "store":true})) + .await; + let first_id = first["id"].as_str().unwrap(); + let second = harness + .create(json!({"model":"test-model", "input":"second", "store":true, "previous_response_id":first_id})) + .await; + let second_id = second["id"].as_str().unwrap(); + + // The first turn's own answer is input to the second, but neither lists its own output. + assert_eq!(texts(&harness.page(first_id, "?order=asc").await), ["first"]); + let ascending = harness.page(second_id, "?order=asc").await; + assert_eq!(texts(&ascending), ["first", "answer 0", "second"]); + assert_eq!(ascending["object"], "list"); + assert_eq!(ascending["has_more"], false); + assert_eq!(ascending["data"][1]["id"], "msg_answer_0"); + assert!( + ascending["data"] + .as_array() + .unwrap() + .iter() + .all(|item| item["id"] != "msg_answer_1"), + "a response's own output is not one of its inputs" + ); + // Like conversation item listing, the default order is newest first. + assert_eq!( + texts(&harness.page(second_id, "").await), + ["second", "answer 0", "first"] + ); + + // Pagination walks the same sequence one item at a time. + let mut cursor = String::new(); + let mut walked = Vec::new(); + loop { + let page = harness.page(second_id, &format!("?order=asc&limit=1{cursor}")).await; + walked.extend(texts(&page)); + assert_eq!(page["first_id"], page["last_id"]); + if page["has_more"] == false { + break; + } + cursor = format!("&after={}", page["last_id"].as_str().unwrap()); + } + assert_eq!(walked, ["first", "answer 0", "second"]); + + // OpenAI removes the deleted parent's turn from the surviving child's input window. + let deleted = harness + .client + .delete(format!("{}/v1/responses/{first_id}", harness.url)) + .bearer_auth("test-key") + .send() + .await + .unwrap(); + assert_eq!(deleted.status(), StatusCode::OK); + assert_eq!(texts(&harness.page(second_id, "?order=asc").await), ["second"]); + + harness.stop().await; +} + +#[tokio::test] +async fn input_items_of_a_conversation_turn_reflect_the_conversation_at_that_turn() { + let harness = Harness::start().await; + let conversation: Value = harness + .client + .post(format!("{}/v1/conversations", harness.url)) + .bearer_auth("test-key") + .json(&json!({})) + .send() + .await + .unwrap() + .json() + .await + .unwrap(); + let conversation_id = conversation["id"].as_str().unwrap(); + let first = harness + .create(json!({"model":"test-model", "input":"first", "conversation":conversation_id})) + .await; + let second = harness + .create(json!({"model":"test-model", "input":"second", "conversation":conversation_id})) + .await; + // A later turn does not leak into an earlier response's inputs. + harness + .create(json!({"model":"test-model", "input":"third", "conversation":conversation_id})) + .await; + + assert_eq!( + texts(&harness.page(first["id"].as_str().unwrap(), "?order=asc").await), + ["first"] + ); + assert_eq!( + texts(&harness.page(second["id"].as_str().unwrap(), "?order=asc").await), + ["first", "answer 0", "second"] + ); + harness.stop().await; +} + +#[tokio::test] +async fn input_items_reject_what_retrieval_rejects() { + let harness = Harness::start().await; + let stored = harness + .create(json!({"model":"test-model", "input":"first", "store":true})) + .await; + let stored_id = stored["id"].as_str().unwrap(); + let transient = harness + .create(json!({"model":"test-model", "input":"transient", "store":false})) + .await; + + let unauthenticated = harness + .client + .get(format!("{}/v1/responses/{stored_id}/input_items", harness.url)) + .send() + .await + .unwrap(); + assert_eq!(unauthenticated.status(), StatusCode::UNAUTHORIZED); + for missing in [transient["id"].as_str().unwrap(), "resp_missing"] { + assert_eq!(harness.input_items(missing, "").await.status(), StatusCode::NOT_FOUND); + } + // Recorded OpenAI edge cases accept an empty page and known include fields. + let empty = harness.page(stored_id, "?limit=0").await; + assert_eq!(empty["data"], json!([])); + assert_eq!(empty["has_more"], true); + assert_eq!( + harness + .input_items(stored_id, "?include[]=web_search_call.results") + .await + .status(), + StatusCode::OK + ); + for (query, code, param) in [ + ("?limit=101", "integer_above_max_value", "limit"), + ("?limit=-1", "integer_below_min_value", "limit"), + ("?order=sideways", "invalid_value", "order"), + ("?include=no.such.field", "invalid_value", "include[0]"), + ("?limit=ten", "invalid_type", "limit"), + ("?limit=1&limit=2", "duplicate_parameter", "limit"), + ] { + let response = harness.input_items(stored_id, query).await; + assert_eq!(response.status(), StatusCode::BAD_REQUEST, "{query}"); + let body: Value = response.json().await.expect("a structured error body"); + assert_eq!(body["error"]["type"], "invalid_request_error", "{query}"); + assert_eq!(body["error"]["code"], code, "{query}"); + assert_eq!(body["error"]["param"], param, "{query}"); + } + // Same contract as conversation item listing: an unknown cursor is a not-found naming `after`. + let unknown_cursor = harness.input_items(stored_id, "?after=msg_unknown").await; + assert_eq!(unknown_cursor.status(), StatusCode::NOT_FOUND); + assert_eq!(unknown_cursor.json::().await.unwrap()["error"]["param"], "after"); + + // A record without a response snapshot cannot tell its output from its input. + let store = ResponseStore::new(Arc::new(harness.exec.storage_pool().unwrap().clone())); + store + .persist("resp_legacy", None, Vec::new(), &ResponseMetadata::default()) + .await + .unwrap(); + assert_eq!( + harness.input_items("resp_legacy", "").await.status(), + StatusCode::CONFLICT + ); + + // Deleting a response removes its input listing with it. + let deleted = harness + .client + .delete(format!("{}/v1/responses/{stored_id}", harness.url)) + .bearer_auth("test-key") + .send() + .await + .unwrap(); + assert_eq!(deleted.status(), StatusCode::OK); + assert_eq!(harness.input_items(stored_id, "").await.status(), StatusCode::NOT_FOUND); + harness.stop().await; +} + +#[tokio::test] +async fn input_items_exclude_own_output_items_that_carry_no_wire_id() { + // A compaction item's wire `id` is optional; storage generates one for the row. + let harness = Harness::start_with(answering_upstream_with( + json!([{"type":"compaction", "encrypted_content":"opaque"}]), + )) + .await; + let first = harness + .create(json!({"model":"test-model", "input":"first", "store":true})) + .await; + let first_id = first["id"].as_str().unwrap(); + assert!( + first["output"][0].get("id").is_none(), + "the upstream compaction item has no id" + ); + let second = harness + .create(json!({"model":"test-model", "input":"second", "store":true, "previous_response_id":first_id})) + .await; + + let own = harness.page(first_id, "?order=asc").await; + assert_eq!(own["data"].as_array().unwrap().len(), 1, "{own}"); + assert_eq!(texts(&own), ["first"]); + // The same item, under its generated ID, is input to the next turn. + let next = harness.page(second["id"].as_str().unwrap(), "?order=asc").await; + let types: Vec<&str> = next["data"] + .as_array() + .unwrap() + .iter() + .map(|item| item["type"].as_str().unwrap()) + .collect(); + assert_eq!(types, ["message", "compaction", "message", "message"], "{next}"); + assert!(next["data"][1]["id"].as_str().unwrap().starts_with("cmp_")); + + // Conversation turns exclude appended outputs without wire IDs too. + let conversation: Value = harness + .client + .post(format!("{}/v1/conversations", harness.url)) + .bearer_auth("test-key") + .json(&json!({})) + .send() + .await + .unwrap() + .json() + .await + .unwrap(); + let in_conversation = harness + .create(json!({"model":"test-model", "input":"conversation input", "store":true, + "conversation":conversation["id"]})) + .await; + let conversation_inputs = harness + .page(in_conversation["id"].as_str().unwrap(), "?order=asc") + .await; + assert_eq!(texts(&conversation_inputs), ["conversation input"]); + harness.stop().await; +} + +#[tokio::test] +async fn input_items_keep_an_earlier_turn_output_that_shares_this_turn_output_id() { + // An upstream may reuse a message ID across turns. Each occurrence is its own history + // row, so only this turn's row is excluded, not the earlier turn's answer. + let upstream = Router::new().route( + "/v1/responses", + post(|Json(_): Json| async { + Json(json!({"id":"resp_upstream", "object":"response", "created_at":123, + "model":"test-model", "status":"completed", "output":[{ + "type":"message", "id":"msg_reused", "role":"assistant", "status":"completed", + "content":[{"type":"output_text", "text":"same id"}]}], + "usage":{"input_tokens":3,"output_tokens":1,"total_tokens":4}})) + }), + ); + let harness = Harness::start_with(upstream).await; + let first = harness + .create(json!({"model":"test-model", "input":"first", "store":true})) + .await; + let second = harness + .create(json!({"model":"test-model", "input":"second", "store":true, + "previous_response_id":first["id"]})) + .await; + assert_eq!( + texts(&harness.page(second["id"].as_str().unwrap(), "?order=asc").await), + ["first", "same id", "second"] + ); + harness.stop().await; +} + +#[tokio::test] +async fn input_items_reuse_conversation_query_parameters() { + let harness = Harness::start().await; + let stored = harness + .create( + json!({"model":"test-model", "store":true, "input":[{"role":"user", "content":[ + {"type":"input_text", "text":"look"}, + {"type":"input_image", "image_url":"data:image/png;base64,AAAA"}]}]}), + ) + .await; + let page = harness + .page( + stored["id"].as_str().unwrap(), + "?include[]=message.output_text.logprobs", + ) + .await; + assert_eq!( + page["data"][0]["content"][1]["image_url"], "data:image/png;base64,AAAA", + "{page}" + ); + harness.stop().await; +} + +#[tokio::test] +async fn input_item_pages_make_progress_past_a_repeated_public_id() { + // The upstream reuses one message ID every turn, so the third turn's input holds + // that public ID twice. A cursor naming it resumes after its furthest occurrence, + // as conversation item listing does, instead of returning the same page forever. + let upstream = Router::new().route( + "/v1/responses", + post(|Json(_): Json| async { + Json(json!({"id":"resp_upstream", "object":"response", "created_at":123, + "model":"test-model", "status":"completed", "output":[{ + "type":"message", "id":"msg_reused", "role":"assistant", "status":"completed", + "content":[{"type":"output_text", "text":"same id"}]}], + "usage":{"input_tokens":3,"output_tokens":1,"total_tokens":4}})) + }), + ); + let harness = Harness::start_with(upstream).await; + let mut previous = Value::Null; + for input in ["first", "second", "third"] { + previous = harness + .create(json!({"model":"test-model", "input":input, "store":true, "previous_response_id":previous["id"]})) + .await; + } + let third = previous["id"].as_str().unwrap(); + assert_eq!( + texts(&harness.page(third, "?order=asc").await), + ["first", "same id", "second", "same id", "third"] + ); + + for (order, expected) in [ + ("asc", ["first", "same id", "third"]), + ("desc", ["third", "same id", "first"]), + ] { + let mut cursor = String::new(); + let mut walked = Vec::new(); + for _ in 0..10 { + let page = harness.page(third, &format!("?order={order}&limit=1{cursor}")).await; + walked.extend(texts(&page)); + if page["has_more"] == false { + break; + } + cursor = format!("&after={}", page["last_id"].as_str().unwrap()); + } + assert_eq!(walked, expected, "{order}"); + } + harness.stop().await; +} + +#[tokio::test] +async fn an_empty_input_turn_keeps_the_previous_answer_in_its_input_list() { + let harness = Harness::start().await; + let first = harness + .create(json!({"model":"test-model", "input":"first", "store":true})) + .await; + let second = harness + .create(json!({"model":"test-model", "input":[], "store":true, + "previous_response_id":first["id"]})) + .await; + assert_eq!( + texts(&harness.page(second["id"].as_str().unwrap(), "?order=asc").await), + ["first", "answer 0"] + ); + harness.stop().await; +} diff --git a/crates/agentic-server/tests/response_retrieval_test.rs b/crates/agentic-server/tests/response_retrieval_test.rs index 7e11d449d..620fa455c 100644 --- a/crates/agentic-server/tests/response_retrieval_test.rs +++ b/crates/agentic-server/tests/response_retrieval_test.rs @@ -209,7 +209,7 @@ async fn store_false_continuation_of_a_stored_response_is_not_retained() { let orphaned = create(json!({"model":"test-model", "input":"third", "store":true, "previous_response_id":child_id})) .await; - assert_eq!(orphaned.status(), StatusCode::NOT_FOUND); + assert_eq!(orphaned.status(), StatusCode::BAD_REQUEST); assert!(orphaned.json::().await.unwrap().get("error").is_some()); assert_eq!( requests.lock().unwrap().len(), @@ -265,3 +265,91 @@ async fn retrieval_allows_unauthenticated_access_without_configured_authenticati exec.storage_pool().unwrap().close().await; } } + +#[tokio::test] +async fn deleting_a_response_keeps_its_descendants_and_ends_its_own_continuations() { + let (upstream, requests) = response_retrieval_upstream(); + let listener = TcpListener::bind("127.0.0.1:0").await.unwrap(); + let mut config = common::test_config(&format!("http://{}", listener.local_addr().unwrap())); + let upstream = tokio::spawn(async move { axum::serve(listener, upstream).await.unwrap() }); + config.db_url = Some("sqlite://?mode=memory".into()); + let exec = Arc::new(ExecutionContext::from_config(&config).await.unwrap()); + let mut state = common::test_state(&config); + state.exec_ctx = Arc::clone(&exec); + let (url, gateway) = common::spawn_gateway(state).await; + let client = reqwest::Client::new(); + let create = |body: Value| { + let request = client.post(format!("{url}/v1/responses")).json(&body); + async move { request.send().await.unwrap() } + }; + let delete = |id: &str| { + let request = client + .delete(format!("{url}/v1/responses/{id}")) + .bearer_auth("test-key"); + async move { request.send().await.unwrap() } + }; + let retrieve = |id: &str| { + let request = client.get(format!("{url}/v1/responses/{id}")).bearer_auth("test-key"); + async move { request.send().await.unwrap() } + }; + + let parent: Value = create(json!({"model":"test-model", "input":"first", "store":true})) + .await + .json() + .await + .unwrap(); + let parent_id = parent["id"].as_str().unwrap(); + let child: Value = create(json!({"model":"test-model", "input":"second", "store":true, + "previous_response_id":parent_id})) + .await + .json() + .await + .unwrap(); + let child_id = child["id"].as_str().unwrap(); + + // Deletion reads local storage, so it carries the same credential check as retrieval. + let denied = client + .delete(format!("{url}/v1/responses/{parent_id}")) + .send() + .await + .unwrap(); + assert_eq!(denied.status(), StatusCode::UNAUTHORIZED); + assert_eq!(retrieve(parent_id).await.status(), StatusCode::OK); + + let deleted = delete(parent_id).await; + assert_eq!(deleted.status(), StatusCode::OK); + assert_eq!( + deleted.json::().await.unwrap(), + json!({"id":parent_id, "object":"response.deleted", "deleted":true}) + ); + assert_eq!(retrieve(parent_id).await.status(), StatusCode::NOT_FOUND); + assert_eq!(delete(parent_id).await.status(), StatusCode::NOT_FOUND); + assert_eq!(delete("resp_missing").await.status(), StatusCode::NOT_FOUND); + + // The deleted response can no longer be continued, and no inference runs for it. + let orphaned = create(json!({"model":"test-model", "input":"third", "store":true, + "previous_response_id":parent_id})) + .await; + // OpenAI reports a missing continuation as an invalid previous_response_id. + assert_eq!(orphaned.status(), StatusCode::BAD_REQUEST); + let body = orphaned.json::().await.unwrap(); + assert!(body["error"].is_object(), "{body}"); + assert_eq!(requests.lock().unwrap().len(), 2); + + // OpenAI keeps the child's snapshot but excludes the deleted parent's turn + // from subsequent inference (recorded in the Responses lifecycle suite). + let retrieved = retrieve(child_id).await; + assert_eq!(retrieved.status(), StatusCode::OK); + assert_eq!(retrieved.json::().await.unwrap(), child); + let grandchild = create(json!({"model":"test-model", "input":"third", "store":true, + "previous_response_id":child_id})) + .await; + assert_eq!(grandchild.status(), StatusCode::OK); + assert_eq!(input_texts(&requests.lock().unwrap()[2]), ["second", "answer", "third"]); + + upstream.abort(); + let _ = upstream.await; + gateway.abort(); + let _ = gateway.await; + exec.storage_pool().unwrap().close().await; +} diff --git a/docs/api/index.md b/docs/api/index.md index cfa7ae858..0b59ddc7d 100644 --- a/docs/api/index.md +++ b/docs/api/index.md @@ -436,6 +436,45 @@ history-only APIs, return `409`. Request-scoped MCP credentials are stripped before storage. When OIDC is disabled and `OPENAI_API_KEY` is nonempty, callers must send that key as a bearer token. +### `DELETE /v1/responses/{response_id}` + +Deletes a stored response and returns +`{"id": "", "object": "response.deleted", "deleted": true}`. +Unknown or already deleted IDs return `404`. The deleted response can no +longer be retrieved or used as a durable `previous_response_id`. + +History item rows are retained: descendant responses and conversations may +still reference them. Descendants remain retrievable and continuable, but +response-chain descendants exclude the deleted response's inherited context +from their input listings and subsequent inference. Conversation snapshots +retain their recorded context. These behaviors are covered by OpenAI and +gateway lifecycle recordings, including continuation after parent deletion. +Existing foreign keys clear pointers to the deleted response, including a +conversation's `latest_response_id`; deletion does not choose an older turn +as replacement state. Authentication matches response retrieval. + +Deletion does not invalidate a live WebSocket session's cached checkpoint. +Such a session may still continue without storage; persisting a child of the +deleted response fails. New connections resolve durable IDs through storage. + +### `GET /v1/responses/{response_id}/input_items` + +Lists the stored context for a response: inherited history, including earlier +outputs, followed by this turn's inputs. This response's appended outputs are +excluded. The endpoint uses the existing history IDs, item records, and saved +response snapshot; it does not add metadata or change persistence. + +Pagination uses the Conversation API query parameters: `limit` (1–100, +default 20), `order` (`asc` or `desc`, default `desc`), and `after` (a public +item ID; unknown cursors return `404`). A repeated public ID resumes after +its last occurrence in the requested order. `include` or `include[]` accepts +`message.output_text.logprobs`, which stored items already contain; other +expansions return `400`, as on conversation item listing. Malformed or repeated +scalar query parameters return `400`. + +Unknown or unstored responses return `404`. Legacy responses without a saved +payload return `409`, as on response retrieval. Authentication matches retrieval. + ### `POST /v1/responses/compact` Compacts direct input or a stored previous-response chain into a canonical