diff --git a/crates/agentic-server-core/tests/cassettes/codex/codex-openai-multi-round-web-search-gpt-4o-streaming.yaml b/crates/agentic-server-core/tests/cassettes/codex/codex-openai-multi-round-web-search-gpt-4o-streaming.yaml new file mode 100644 index 0000000..40b18ba --- /dev/null +++ b/crates/agentic-server-core/tests/cassettes/codex/codex-openai-multi-round-web-search-gpt-4o-streaming.yaml @@ -0,0 +1,706 @@ +turns: +- filename: t1 + request: + body: + input: Search the web for the latest Rust async news using web_search. + max_output_tokens: 1024 + model: gpt-4o + store: true + stream: true + tools: + - description: Search the web for current information. + name: web_search + parameters: + properties: + query: + description: the search query + type: string + required: + - query + type: object + 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: + headers: + content-type: text/event-stream; charset=utf-8 + sse: + - 'event: response.created + + ' + - 'data: {"type":"response.created","response":{"id":"resp_081562c094e9dace006a5150883fec819b8134045566e61b1a","object":"response","created_at":1783713928,"status":"in_progress","background":false,"completed_at":null,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":1024,"max_tool_calls":null,"model":"gpt-4o-2024-08-06","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":[{"type":"function","description":"Search + the web for current information.","name":"web_search","parameters":{"type":"object","properties":{"query":{"type":"string","description":"the + search query"}},"required":["query"],"additionalProperties":false},"strict":true}],"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_081562c094e9dace006a5150883fec819b8134045566e61b1a","object":"response","created_at":1783713928,"status":"in_progress","background":false,"completed_at":null,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":1024,"max_tool_calls":null,"model":"gpt-4o-2024-08-06","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":[{"type":"function","description":"Search + the web for current information.","name":"web_search","parameters":{"type":"object","properties":{"query":{"type":"string","description":"the + search query"}},"required":["query"],"additionalProperties":false},"strict":true}],"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":"fc_081562c094e9dace006a515089f1ac819bb8f18969532f07aa","type":"function_call","status":"in_progress","arguments":"","call_id":"call_4eiWt8t7meNBjJqTTJZ26iYj","name":"web_search"},"output_index":0,"sequence_number":2} + + ' + - ' + + ' + - 'event: response.function_call_arguments.delta + + ' + - 'data: {"type":"response.function_call_arguments.delta","delta":"{\"","item_id":"fc_081562c094e9dace006a515089f1ac819bb8f18969532f07aa","obfuscation":"z5KL2xwFpMNAO9","output_index":0,"sequence_number":3} + + ' + - ' + + ' + - 'event: response.function_call_arguments.delta + + ' + - 'data: {"type":"response.function_call_arguments.delta","delta":"query","item_id":"fc_081562c094e9dace006a515089f1ac819bb8f18969532f07aa","obfuscation":"hNo6PWXPd8j","output_index":0,"sequence_number":4} + + ' + - ' + + ' + - 'event: response.function_call_arguments.delta + + ' + - 'data: {"type":"response.function_call_arguments.delta","delta":"\":\"","item_id":"fc_081562c094e9dace006a515089f1ac819bb8f18969532f07aa","obfuscation":"8In4AFyWELcwz","output_index":0,"sequence_number":5} + + ' + - ' + + ' + - 'event: response.function_call_arguments.delta + + ' + - 'data: {"type":"response.function_call_arguments.delta","delta":"latest","item_id":"fc_081562c094e9dace006a515089f1ac819bb8f18969532f07aa","obfuscation":"8tpygMHKX2","output_index":0,"sequence_number":6} + + ' + - ' + + ' + - 'event: response.function_call_arguments.delta + + ' + - 'data: {"type":"response.function_call_arguments.delta","delta":" Rust","item_id":"fc_081562c094e9dace006a515089f1ac819bb8f18969532f07aa","obfuscation":"jyZo1Prgpeg","output_index":0,"sequence_number":7} + + ' + - ' + + ' + - 'event: response.function_call_arguments.delta + + ' + - 'data: {"type":"response.function_call_arguments.delta","delta":" async","item_id":"fc_081562c094e9dace006a515089f1ac819bb8f18969532f07aa","obfuscation":"RwREvAwQfu","output_index":0,"sequence_number":8} + + ' + - ' + + ' + - 'event: response.function_call_arguments.delta + + ' + - 'data: {"type":"response.function_call_arguments.delta","delta":" news","item_id":"fc_081562c094e9dace006a515089f1ac819bb8f18969532f07aa","obfuscation":"mkg2BhByY6x","output_index":0,"sequence_number":9} + + ' + - ' + + ' + - 'event: response.function_call_arguments.delta + + ' + - 'data: {"type":"response.function_call_arguments.delta","delta":" ","item_id":"fc_081562c094e9dace006a515089f1ac819bb8f18969532f07aa","obfuscation":"HQ6qWzuxeMUysMV","output_index":0,"sequence_number":10} + + ' + - ' + + ' + - 'event: response.function_call_arguments.delta + + ' + - 'data: {"type":"response.function_call_arguments.delta","delta":"202","item_id":"fc_081562c094e9dace006a515089f1ac819bb8f18969532f07aa","obfuscation":"ciS13PGRwjFBx","output_index":0,"sequence_number":11} + + ' + - ' + + ' + - 'event: response.function_call_arguments.delta + + ' + - 'data: {"type":"response.function_call_arguments.delta","delta":"3","item_id":"fc_081562c094e9dace006a515089f1ac819bb8f18969532f07aa","obfuscation":"WnGr8KUgsbJr9pc","output_index":0,"sequence_number":12} + + ' + - ' + + ' + - 'event: response.function_call_arguments.delta + + ' + - 'data: {"type":"response.function_call_arguments.delta","delta":"\"}","item_id":"fc_081562c094e9dace006a515089f1ac819bb8f18969532f07aa","obfuscation":"VimfEtP5EcO5QR","output_index":0,"sequence_number":13} + + ' + - ' + + ' + - 'event: response.function_call_arguments.done + + ' + - 'data: {"type":"response.function_call_arguments.done","arguments":"{\"query\":\"latest + Rust async news 2023\"}","item_id":"fc_081562c094e9dace006a515089f1ac819bb8f18969532f07aa","output_index":0,"sequence_number":14} + + ' + - ' + + ' + - 'event: response.output_item.done + + ' + - 'data: {"type":"response.output_item.done","item":{"id":"fc_081562c094e9dace006a515089f1ac819bb8f18969532f07aa","type":"function_call","status":"completed","arguments":"{\"query\":\"latest + Rust async news 2023\"}","call_id":"call_4eiWt8t7meNBjJqTTJZ26iYj","name":"web_search"},"output_index":0,"sequence_number":15} + + ' + - ' + + ' + - 'event: response.completed + + ' + - 'data: {"type":"response.completed","response":{"id":"resp_081562c094e9dace006a5150883fec819b8134045566e61b1a","object":"response","created_at":1783713928,"status":"completed","background":false,"completed_at":1783713930,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":1024,"max_tool_calls":null,"model":"gpt-4o-2024-08-06","moderation":null,"output":[{"id":"fc_081562c094e9dace006a515089f1ac819bb8f18969532f07aa","type":"function_call","status":"completed","arguments":"{\"query\":\"latest + Rust async news 2023\"}","call_id":"call_4eiWt8t7meNBjJqTTJZ26iYj","name":"web_search"}],"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":[{"type":"function","description":"Search + the web for current information.","name":"web_search","parameters":{"type":"object","properties":{"query":{"type":"string","description":"the + search query"}},"required":["query"],"additionalProperties":false},"strict":true}],"top_logprobs":0,"top_p":1.0,"truncation":"disabled","usage":{"input_tokens":56,"input_tokens_details":{"cache_write_tokens":0,"cached_tokens":0},"output_tokens":21,"output_tokens_details":{"reasoning_tokens":0},"total_tokens":77},"user":null,"metadata":{}},"sequence_number":16} + + ' + - ' + + ' + status_code: 200 +- filename: t2 + request: + body: + input: + - call_id: call_4eiWt8t7meNBjJqTTJZ26iYj + output: '{"results":{"web":[{"url":"https://example.com/rust-async","title":"Rust + async guide","snippets":["partial result"]}]},"metadata":{"query":"rust + async"}}' + type: function_call_output + - content: That result was incomplete. Search again with a refined query using + web_search. + role: user + type: message + max_output_tokens: 1024 + model: gpt-4o + previous_response_id: resp_081562c094e9dace006a5150883fec819b8134045566e61b1a + store: true + stream: true + tools: + - description: Search the web for current information. + name: web_search + parameters: + properties: + query: + description: the search query + type: string + required: + - query + type: object + 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: + headers: + content-type: text/event-stream; charset=utf-8 + sse: + - 'event: response.created + + ' + - 'data: {"type":"response.created","response":{"id":"resp_081562c094e9dace006a51508a9b74819bb005fbbf3ccccf04","object":"response","created_at":1783713930,"status":"in_progress","background":false,"completed_at":null,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":1024,"max_tool_calls":null,"model":"gpt-4o-2024-08-06","moderation":null,"output":[],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":"resp_081562c094e9dace006a5150883fec819b8134045566e61b1a","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":[{"type":"function","description":"Search + the web for current information.","name":"web_search","parameters":{"type":"object","properties":{"query":{"type":"string","description":"the + search query"}},"required":["query"],"additionalProperties":false},"strict":true}],"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_081562c094e9dace006a51508a9b74819bb005fbbf3ccccf04","object":"response","created_at":1783713930,"status":"in_progress","background":false,"completed_at":null,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":1024,"max_tool_calls":null,"model":"gpt-4o-2024-08-06","moderation":null,"output":[],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":"resp_081562c094e9dace006a5150883fec819b8134045566e61b1a","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":[{"type":"function","description":"Search + the web for current information.","name":"web_search","parameters":{"type":"object","properties":{"query":{"type":"string","description":"the + search query"}},"required":["query"],"additionalProperties":false},"strict":true}],"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":"fc_081562c094e9dace006a51508b1794819b81591d2fc2ec6722","type":"function_call","status":"in_progress","arguments":"","call_id":"call_NknM2aKPHXcmzCzFxVqVk6FR","name":"web_search"},"output_index":0,"sequence_number":2} + + ' + - ' + + ' + - 'event: response.function_call_arguments.delta + + ' + - 'data: {"type":"response.function_call_arguments.delta","delta":"{\"","item_id":"fc_081562c094e9dace006a51508b1794819b81591d2fc2ec6722","obfuscation":"1381xeWbK32vGq","output_index":0,"sequence_number":3} + + ' + - ' + + ' + - 'event: response.function_call_arguments.delta + + ' + - 'data: {"type":"response.function_call_arguments.delta","delta":"query","item_id":"fc_081562c094e9dace006a51508b1794819b81591d2fc2ec6722","obfuscation":"37NAgoek9Ps","output_index":0,"sequence_number":4} + + ' + - ' + + ' + - 'event: response.function_call_arguments.delta + + ' + - 'data: {"type":"response.function_call_arguments.delta","delta":"\":\"","item_id":"fc_081562c094e9dace006a51508b1794819b81591d2fc2ec6722","obfuscation":"iPgb7c4Zx2RYM","output_index":0,"sequence_number":5} + + ' + - ' + + ' + - 'event: response.function_call_arguments.delta + + ' + - 'data: {"type":"response.function_call_arguments.delta","delta":"latest","item_id":"fc_081562c094e9dace006a51508b1794819b81591d2fc2ec6722","obfuscation":"qQNnGL16h1","output_index":0,"sequence_number":6} + + ' + - ' + + ' + - 'event: response.function_call_arguments.delta + + ' + - 'data: {"type":"response.function_call_arguments.delta","delta":" updates","item_id":"fc_081562c094e9dace006a51508b1794819b81591d2fc2ec6722","obfuscation":"Hq7xqBTD","output_index":0,"sequence_number":7} + + ' + - ' + + ' + - 'event: response.function_call_arguments.delta + + ' + - 'data: {"type":"response.function_call_arguments.delta","delta":" on","item_id":"fc_081562c094e9dace006a51508b1794819b81591d2fc2ec6722","obfuscation":"vftg07qik6CGV","output_index":0,"sequence_number":8} + + ' + - ' + + ' + - 'event: response.function_call_arguments.delta + + ' + - 'data: {"type":"response.function_call_arguments.delta","delta":" Rust","item_id":"fc_081562c094e9dace006a51508b1794819b81591d2fc2ec6722","obfuscation":"T1pXpWm27N3","output_index":0,"sequence_number":9} + + ' + - ' + + ' + - 'event: response.function_call_arguments.delta + + ' + - 'data: {"type":"response.function_call_arguments.delta","delta":" async","item_id":"fc_081562c094e9dace006a51508b1794819b81591d2fc2ec6722","obfuscation":"tALS7EUGvX","output_index":0,"sequence_number":10} + + ' + - ' + + ' + - 'event: response.function_call_arguments.delta + + ' + - 'data: {"type":"response.function_call_arguments.delta","delta":" ","item_id":"fc_081562c094e9dace006a51508b1794819b81591d2fc2ec6722","obfuscation":"thhN7tQX1YuRZUF","output_index":0,"sequence_number":11} + + ' + - ' + + ' + - 'event: response.function_call_arguments.delta + + ' + - 'data: {"type":"response.function_call_arguments.delta","delta":"202","item_id":"fc_081562c094e9dace006a51508b1794819b81591d2fc2ec6722","obfuscation":"6UMgXibqb85xF","output_index":0,"sequence_number":12} + + ' + - ' + + ' + - 'event: response.function_call_arguments.delta + + ' + - 'data: {"type":"response.function_call_arguments.delta","delta":"3","item_id":"fc_081562c094e9dace006a51508b1794819b81591d2fc2ec6722","obfuscation":"VnBl2OCb0GZhpcD","output_index":0,"sequence_number":13} + + ' + - ' + + ' + - 'event: response.function_call_arguments.delta + + ' + - 'data: {"type":"response.function_call_arguments.delta","delta":"\"}","item_id":"fc_081562c094e9dace006a51508b1794819b81591d2fc2ec6722","obfuscation":"6aacWOxwiregZG","output_index":0,"sequence_number":14} + + ' + - ' + + ' + - 'event: response.function_call_arguments.done + + ' + - 'data: {"type":"response.function_call_arguments.done","arguments":"{\"query\":\"latest + updates on Rust async 2023\"}","item_id":"fc_081562c094e9dace006a51508b1794819b81591d2fc2ec6722","output_index":0,"sequence_number":15} + + ' + - ' + + ' + - 'event: response.output_item.done + + ' + - 'data: {"type":"response.output_item.done","item":{"id":"fc_081562c094e9dace006a51508b1794819b81591d2fc2ec6722","type":"function_call","status":"completed","arguments":"{\"query\":\"latest + updates on Rust async 2023\"}","call_id":"call_NknM2aKPHXcmzCzFxVqVk6FR","name":"web_search"},"output_index":0,"sequence_number":16} + + ' + - ' + + ' + - 'event: response.completed + + ' + - 'data: {"type":"response.completed","response":{"id":"resp_081562c094e9dace006a51508a9b74819bb005fbbf3ccccf04","object":"response","created_at":1783713930,"status":"completed","background":false,"completed_at":1783713931,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":1024,"max_tool_calls":null,"model":"gpt-4o-2024-08-06","moderation":null,"output":[{"id":"fc_081562c094e9dace006a51508b1794819b81591d2fc2ec6722","type":"function_call","status":"completed","arguments":"{\"query\":\"latest + updates on Rust async 2023\"}","call_id":"call_NknM2aKPHXcmzCzFxVqVk6FR","name":"web_search"}],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":"resp_081562c094e9dace006a5150883fec819b8134045566e61b1a","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":[{"type":"function","description":"Search + the web for current information.","name":"web_search","parameters":{"type":"object","properties":{"query":{"type":"string","description":"the + search query"}},"required":["query"],"additionalProperties":false},"strict":true}],"top_logprobs":0,"top_p":1.0,"truncation":"disabled","usage":{"input_tokens":143,"input_tokens_details":{"cache_write_tokens":0,"cached_tokens":0},"output_tokens":22,"output_tokens_details":{"reasoning_tokens":0},"total_tokens":165},"user":null,"metadata":{}},"sequence_number":17} + + ' + - ' + + ' + status_code: 200 +- filename: t3 + request: + body: + input: + - call_id: call_NknM2aKPHXcmzCzFxVqVk6FR + output: '{"results":{"web":[{"url":"https://example.com/rust-async","title":"Rust + async guide","snippets":["partial result"]}]},"metadata":{"query":"rust + async"}}' + type: function_call_output + - content: Good. Now summarize the finding in one sentence. Do not call any + tools. + role: user + type: message + max_output_tokens: 1024 + model: gpt-4o + previous_response_id: resp_081562c094e9dace006a51508a9b74819bb005fbbf3ccccf04 + store: true + stream: true + tools: + - description: Search the web for current information. + name: web_search + parameters: + properties: + query: + description: the search query + type: string + required: + - query + type: object + 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: + headers: + content-type: text/event-stream; charset=utf-8 + sse: + - 'event: response.created + + ' + - 'data: {"type":"response.created","response":{"id":"resp_081562c094e9dace006a51508b9158819b94d1daa5bf5ec91c","object":"response","created_at":1783713931,"status":"in_progress","background":false,"completed_at":null,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":1024,"max_tool_calls":null,"model":"gpt-4o-2024-08-06","moderation":null,"output":[],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":"resp_081562c094e9dace006a51508a9b74819bb005fbbf3ccccf04","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":[{"type":"function","description":"Search + the web for current information.","name":"web_search","parameters":{"type":"object","properties":{"query":{"type":"string","description":"the + search query"}},"required":["query"],"additionalProperties":false},"strict":true}],"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_081562c094e9dace006a51508b9158819b94d1daa5bf5ec91c","object":"response","created_at":1783713931,"status":"in_progress","background":false,"completed_at":null,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":1024,"max_tool_calls":null,"model":"gpt-4o-2024-08-06","moderation":null,"output":[],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":"resp_081562c094e9dace006a51508a9b74819bb005fbbf3ccccf04","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":[{"type":"function","description":"Search + the web for current information.","name":"web_search","parameters":{"type":"object","properties":{"query":{"type":"string","description":"the + search query"}},"required":["query"],"additionalProperties":false},"strict":true}],"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_081562c094e9dace006a51508cc89c819bb1fa1e5dc111ef4b","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_081562c094e9dace006a51508cc89c819bb1fa1e5dc111ef4b","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":"The","item_id":"msg_081562c094e9dace006a51508cc89c819bb1fa1e5dc111ef4b","logprobs":[],"obfuscation":"YxdljqaawWUxU","output_index":0,"sequence_number":4} + + ' + - ' + + ' + - 'event: response.output_text.delta + + ' + - 'data: {"type":"response.output_text.delta","content_index":0,"delta":" search","item_id":"msg_081562c094e9dace006a51508cc89c819bb1fa1e5dc111ef4b","logprobs":[],"obfuscation":"dzBPTJCme","output_index":0,"sequence_number":5} + + ' + - ' + + ' + - 'event: response.output_text.delta + + ' + - 'data: {"type":"response.output_text.delta","content_index":0,"delta":" did","item_id":"msg_081562c094e9dace006a51508cc89c819bb1fa1e5dc111ef4b","logprobs":[],"obfuscation":"UM5sDxtgTI0D","output_index":0,"sequence_number":6} + + ' + - ' + + ' + - 'event: response.output_text.delta + + ' + - 'data: {"type":"response.output_text.delta","content_index":0,"delta":" not","item_id":"msg_081562c094e9dace006a51508cc89c819bb1fa1e5dc111ef4b","logprobs":[],"obfuscation":"JmfGiDONQr4v","output_index":0,"sequence_number":7} + + ' + - ' + + ' + - 'event: response.output_text.delta + + ' + - 'data: {"type":"response.output_text.delta","content_index":0,"delta":" provide","item_id":"msg_081562c094e9dace006a51508cc89c819bb1fa1e5dc111ef4b","logprobs":[],"obfuscation":"t4WMJHWJ","output_index":0,"sequence_number":8} + + ' + - ' + + ' + - 'event: response.output_text.delta + + ' + - 'data: {"type":"response.output_text.delta","content_index":0,"delta":" a","item_id":"msg_081562c094e9dace006a51508cc89c819bb1fa1e5dc111ef4b","logprobs":[],"obfuscation":"HQIB3MlGT45mtP","output_index":0,"sequence_number":9} + + ' + - ' + + ' + - 'event: response.output_text.delta + + ' + - 'data: {"type":"response.output_text.delta","content_index":0,"delta":" complete","item_id":"msg_081562c094e9dace006a51508cc89c819bb1fa1e5dc111ef4b","logprobs":[],"obfuscation":"5QLFOLa","output_index":0,"sequence_number":10} + + ' + - ' + + ' + - 'event: response.output_text.delta + + ' + - 'data: {"type":"response.output_text.delta","content_index":0,"delta":" update","item_id":"msg_081562c094e9dace006a51508cc89c819bb1fa1e5dc111ef4b","logprobs":[],"obfuscation":"IwAWA3pah","output_index":0,"sequence_number":11} + + ' + - ' + + ' + - 'event: response.output_text.delta + + ' + - 'data: {"type":"response.output_text.delta","content_index":0,"delta":" on","item_id":"msg_081562c094e9dace006a51508cc89c819bb1fa1e5dc111ef4b","logprobs":[],"obfuscation":"gqkVL6hSMPwJ7","output_index":0,"sequence_number":12} + + ' + - ' + + ' + - 'event: response.output_text.delta + + ' + - 'data: {"type":"response.output_text.delta","content_index":0,"delta":" the","item_id":"msg_081562c094e9dace006a51508cc89c819bb1fa1e5dc111ef4b","logprobs":[],"obfuscation":"BaoIKwwqQRHo","output_index":0,"sequence_number":13} + + ' + - ' + + ' + - 'event: response.output_text.delta + + ' + - 'data: {"type":"response.output_text.delta","content_index":0,"delta":" latest","item_id":"msg_081562c094e9dace006a51508cc89c819bb1fa1e5dc111ef4b","logprobs":[],"obfuscation":"69jUsRye5","output_index":0,"sequence_number":14} + + ' + - ' + + ' + - 'event: response.output_text.delta + + ' + - 'data: {"type":"response.output_text.delta","content_index":0,"delta":" Rust","item_id":"msg_081562c094e9dace006a51508cc89c819bb1fa1e5dc111ef4b","logprobs":[],"obfuscation":"0xbSqpiqi5t","output_index":0,"sequence_number":15} + + ' + - ' + + ' + - 'event: response.output_text.delta + + ' + - 'data: {"type":"response.output_text.delta","content_index":0,"delta":" async","item_id":"msg_081562c094e9dace006a51508cc89c819bb1fa1e5dc111ef4b","logprobs":[],"obfuscation":"iZJrovBEx2","output_index":0,"sequence_number":16} + + ' + - ' + + ' + - 'event: response.output_text.delta + + ' + - 'data: {"type":"response.output_text.delta","content_index":0,"delta":" news","item_id":"msg_081562c094e9dace006a51508cc89c819bb1fa1e5dc111ef4b","logprobs":[],"obfuscation":"3Ftg5HlfD5Q","output_index":0,"sequence_number":17} + + ' + - ' + + ' + - 'event: response.output_text.delta + + ' + - 'data: {"type":"response.output_text.delta","content_index":0,"delta":" for","item_id":"msg_081562c094e9dace006a51508cc89c819bb1fa1e5dc111ef4b","logprobs":[],"obfuscation":"CQeenicRs1nw","output_index":0,"sequence_number":18} + + ' + - ' + + ' + - 'event: response.output_text.delta + + ' + - 'data: {"type":"response.output_text.delta","content_index":0,"delta":" ","item_id":"msg_081562c094e9dace006a51508cc89c819bb1fa1e5dc111ef4b","logprobs":[],"obfuscation":"v7CHNxRuYAkD9a2","output_index":0,"sequence_number":19} + + ' + - ' + + ' + - 'event: response.output_text.delta + + ' + - 'data: {"type":"response.output_text.delta","content_index":0,"delta":"202","item_id":"msg_081562c094e9dace006a51508cc89c819bb1fa1e5dc111ef4b","logprobs":[],"obfuscation":"JhKsqDeTWnE2L","output_index":0,"sequence_number":20} + + ' + - ' + + ' + - 'event: response.output_text.delta + + ' + - 'data: {"type":"response.output_text.delta","content_index":0,"delta":"3","item_id":"msg_081562c094e9dace006a51508cc89c819bb1fa1e5dc111ef4b","logprobs":[],"obfuscation":"ZTPjCf4T3t2OaZ2","output_index":0,"sequence_number":21} + + ' + - ' + + ' + - 'event: response.output_text.delta + + ' + - 'data: {"type":"response.output_text.delta","content_index":0,"delta":".","item_id":"msg_081562c094e9dace006a51508cc89c819bb1fa1e5dc111ef4b","logprobs":[],"obfuscation":"w8SKuFB4gc6IFJG","output_index":0,"sequence_number":22} + + ' + - ' + + ' + - 'event: response.output_text.done + + ' + - 'data: {"type":"response.output_text.done","content_index":0,"item_id":"msg_081562c094e9dace006a51508cc89c819bb1fa1e5dc111ef4b","logprobs":[],"output_index":0,"sequence_number":23,"text":"The + search did not provide a complete update on the latest Rust async news for 2023."} + + ' + - ' + + ' + - 'event: response.content_part.done + + ' + - 'data: {"type":"response.content_part.done","content_index":0,"item_id":"msg_081562c094e9dace006a51508cc89c819bb1fa1e5dc111ef4b","output_index":0,"part":{"type":"output_text","annotations":[],"logprobs":[],"text":"The + search did not provide a complete update on the latest Rust async news for 2023."},"sequence_number":24} + + ' + - ' + + ' + - 'event: response.output_item.done + + ' + - 'data: {"type":"response.output_item.done","item":{"id":"msg_081562c094e9dace006a51508cc89c819bb1fa1e5dc111ef4b","type":"message","status":"completed","content":[{"type":"output_text","annotations":[],"logprobs":[],"text":"The + search did not provide a complete update on the latest Rust async news for 2023."}],"role":"assistant"},"output_index":0,"sequence_number":25} + + ' + - ' + + ' + - 'event: response.completed + + ' + - 'data: {"type":"response.completed","response":{"id":"resp_081562c094e9dace006a51508b9158819b94d1daa5bf5ec91c","object":"response","created_at":1783713931,"status":"completed","background":false,"completed_at":1783713933,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":1024,"max_tool_calls":null,"model":"gpt-4o-2024-08-06","moderation":null,"output":[{"id":"msg_081562c094e9dace006a51508cc89c819bb1fa1e5dc111ef4b","type":"message","status":"completed","content":[{"type":"output_text","annotations":[],"logprobs":[],"text":"The + search did not provide a complete update on the latest Rust async news for 2023."}],"role":"assistant"}],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":"resp_081562c094e9dace006a51508a9b74819bb005fbbf3ccccf04","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":[{"type":"function","description":"Search + the web for current information.","name":"web_search","parameters":{"type":"object","properties":{"query":{"type":"string","description":"the + search query"}},"required":["query"],"additionalProperties":false},"strict":true}],"top_logprobs":0,"top_p":1.0,"truncation":"disabled","usage":{"input_tokens":232,"input_tokens_details":{"cache_write_tokens":0,"cached_tokens":0},"output_tokens":21,"output_tokens_details":{"reasoning_tokens":0},"total_tokens":253},"user":null,"metadata":{}},"sequence_number":26} + + ' + - ' + + ' + status_code: 200 diff --git a/crates/agentic-server-core/tests/cassettes/codex/codex-openai-web-search-and-namespace-same-turn-gpt-4o-streaming.yaml b/crates/agentic-server-core/tests/cassettes/codex/codex-openai-web-search-and-namespace-same-turn-gpt-4o-streaming.yaml new file mode 100644 index 0000000..8aa77ac --- /dev/null +++ b/crates/agentic-server-core/tests/cassettes/codex/codex-openai-web-search-and-namespace-same-turn-gpt-4o-streaming.yaml @@ -0,0 +1,158 @@ +turns: +- filename: t1 + request: + body: + input: 'Do two things in parallel now: (1) call web_search for "rust async news", + and (2) call agentic_ns__mcp__shell__run to run pwd. Emit both tool calls + together.' + max_output_tokens: 1024 + model: gpt-4o + store: true + stream: true + tools: + - description: Search the web for current information. + name: web_search + parameters: + properties: + query: + description: the search query + type: string + required: + - query + type: object + type: function + - description: Run a shell command via the mcp__shell namespace tool. + name: agentic_ns__mcp__shell__run + parameters: + properties: + command: + type: string + required: + - command + type: object + 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: + headers: + content-type: text/event-stream; charset=utf-8 + sse: + - 'event: response.created + + ' + - 'data: {"type":"response.created","response":{"id":"resp_04fef06d149c9eff006a5150a4bb808199971ef24dd2e364cd","object":"response","created_at":1783713956,"status":"in_progress","background":false,"completed_at":null,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":1024,"max_tool_calls":null,"model":"gpt-4o-2024-08-06","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":[{"type":"function","description":"Search + the web for current information.","name":"web_search","parameters":{"type":"object","properties":{"query":{"type":"string","description":"the + search query"}},"required":["query"],"additionalProperties":false},"strict":true},{"type":"function","description":"Run + a shell command via the mcp__shell namespace tool.","name":"agentic_ns__mcp__shell__run","parameters":{"type":"object","properties":{"command":{"type":"string"}},"required":["command"],"additionalProperties":false},"strict":true}],"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_04fef06d149c9eff006a5150a4bb808199971ef24dd2e364cd","object":"response","created_at":1783713956,"status":"in_progress","background":false,"completed_at":null,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":1024,"max_tool_calls":null,"model":"gpt-4o-2024-08-06","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":[{"type":"function","description":"Search + the web for current information.","name":"web_search","parameters":{"type":"object","properties":{"query":{"type":"string","description":"the + search query"}},"required":["query"],"additionalProperties":false},"strict":true},{"type":"function","description":"Run + a shell command via the mcp__shell namespace tool.","name":"agentic_ns__mcp__shell__run","parameters":{"type":"object","properties":{"command":{"type":"string"}},"required":["command"],"additionalProperties":false},"strict":true}],"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":"fc_04fef06d149c9eff006a5150a584948199a8e8be184148c2e7","type":"function_call","status":"in_progress","arguments":"","call_id":"call_eEwwbAjBJ3j0FdVMY3tdN0fs","name":"web_search"},"output_index":0,"sequence_number":2} + + ' + - ' + + ' + - 'event: response.function_call_arguments.delta + + ' + - 'data: {"type":"response.function_call_arguments.delta","delta":"{\"query\":\"rust + async news\"}","item_id":"fc_04fef06d149c9eff006a5150a584948199a8e8be184148c2e7","obfuscation":"H7qcP","output_index":0,"sequence_number":3} + + ' + - ' + + ' + - 'event: response.function_call_arguments.done + + ' + - 'data: {"type":"response.function_call_arguments.done","arguments":"{\"query\":\"rust + async news\"}","item_id":"fc_04fef06d149c9eff006a5150a584948199a8e8be184148c2e7","output_index":0,"sequence_number":4} + + ' + - ' + + ' + - 'event: response.output_item.done + + ' + - 'data: {"type":"response.output_item.done","item":{"id":"fc_04fef06d149c9eff006a5150a584948199a8e8be184148c2e7","type":"function_call","status":"completed","arguments":"{\"query\":\"rust + async news\"}","call_id":"call_eEwwbAjBJ3j0FdVMY3tdN0fs","name":"web_search"},"output_index":0,"sequence_number":5} + + ' + - ' + + ' + - 'event: response.output_item.added + + ' + - 'data: {"type":"response.output_item.added","item":{"id":"fc_04fef06d149c9eff006a5150a584a48199980dec99b10034b6","type":"function_call","status":"in_progress","arguments":"","call_id":"call_jxtolIGTTT3l9IT3VkBhCh67","name":"agentic_ns__mcp__shell__run"},"output_index":1,"sequence_number":6} + + ' + - ' + + ' + - 'event: response.function_call_arguments.delta + + ' + - 'data: {"type":"response.function_call_arguments.delta","delta":"{\"command\":\"pwd\"}","item_id":"fc_04fef06d149c9eff006a5150a584a48199980dec99b10034b6","obfuscation":"ODK8N8cIMQT6Ntw","output_index":1,"sequence_number":7} + + ' + - ' + + ' + - 'event: response.function_call_arguments.done + + ' + - 'data: {"type":"response.function_call_arguments.done","arguments":"{\"command\":\"pwd\"}","item_id":"fc_04fef06d149c9eff006a5150a584a48199980dec99b10034b6","output_index":1,"sequence_number":8} + + ' + - ' + + ' + - 'event: response.output_item.done + + ' + - 'data: {"type":"response.output_item.done","item":{"id":"fc_04fef06d149c9eff006a5150a584a48199980dec99b10034b6","type":"function_call","status":"completed","arguments":"{\"command\":\"pwd\"}","call_id":"call_jxtolIGTTT3l9IT3VkBhCh67","name":"agentic_ns__mcp__shell__run"},"output_index":1,"sequence_number":9} + + ' + - ' + + ' + - 'event: response.completed + + ' + - 'data: {"type":"response.completed","response":{"id":"resp_04fef06d149c9eff006a5150a4bb808199971ef24dd2e364cd","object":"response","created_at":1783713956,"status":"completed","background":false,"completed_at":1783713957,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":1024,"max_tool_calls":null,"model":"gpt-4o-2024-08-06","moderation":null,"output":[{"id":"fc_04fef06d149c9eff006a5150a584948199a8e8be184148c2e7","type":"function_call","status":"completed","arguments":"{\"query\":\"rust + async news\"}","call_id":"call_eEwwbAjBJ3j0FdVMY3tdN0fs","name":"web_search"},{"id":"fc_04fef06d149c9eff006a5150a584a48199980dec99b10034b6","type":"function_call","status":"completed","arguments":"{\"command\":\"pwd\"}","call_id":"call_jxtolIGTTT3l9IT3VkBhCh67","name":"agentic_ns__mcp__shell__run"}],"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":[{"type":"function","description":"Search + the web for current information.","name":"web_search","parameters":{"type":"object","properties":{"query":{"type":"string","description":"the + search query"}},"required":["query"],"additionalProperties":false},"strict":true},{"type":"function","description":"Run + a shell command via the mcp__shell namespace tool.","name":"agentic_ns__mcp__shell__run","parameters":{"type":"object","properties":{"command":{"type":"string"}},"required":["command"],"additionalProperties":false},"strict":true}],"top_logprobs":0,"top_p":1.0,"truncation":"disabled","usage":{"input_tokens":122,"input_tokens_details":{"cache_write_tokens":0,"cached_tokens":0},"output_tokens":55,"output_tokens_details":{"reasoning_tokens":0},"total_tokens":177},"user":null,"metadata":{}},"sequence_number":10} + + ' + - ' + + ' + status_code: 200 diff --git a/crates/agentic-server-core/tests/cassettes/codex/codex-openai-web-search-then-namespace-gpt-4o-streaming.yaml b/crates/agentic-server-core/tests/cassettes/codex/codex-openai-web-search-then-namespace-gpt-4o-streaming.yaml new file mode 100644 index 0000000..3eb4fda --- /dev/null +++ b/crates/agentic-server-core/tests/cassettes/codex/codex-openai-web-search-then-namespace-gpt-4o-streaming.yaml @@ -0,0 +1,342 @@ +turns: +- filename: t1 + request: + body: + input: Search the web for the latest Rust async news. Use the web_search tool. + max_output_tokens: 1024 + model: gpt-4o + store: true + stream: true + tools: + - description: Search the web for current information. + name: web_search + parameters: + properties: + query: + description: the search query + type: string + required: + - query + type: object + type: function + - description: Run a shell command via the mcp__shell namespace tool. + name: agentic_ns__mcp__shell__run + parameters: + properties: + command: + type: string + required: + - command + type: object + 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: + headers: + content-type: text/event-stream; charset=utf-8 + sse: + - 'event: response.created + + ' + - 'data: {"type":"response.created","response":{"id":"resp_065eb111d59a10dd006a514c41c62c81998de5a364fc417df7","object":"response","created_at":1783712833,"status":"in_progress","background":false,"completed_at":null,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":1024,"max_tool_calls":null,"model":"gpt-4o-2024-08-06","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":[{"type":"function","description":"Search + the web for current information.","name":"web_search","output_schema":null,"parameters":{"type":"object","properties":{"query":{"type":"string","description":"the + search query"}},"required":["query"],"additionalProperties":false},"strict":true},{"type":"function","description":"Run + a shell command via the mcp__shell namespace tool.","name":"agentic_ns__mcp__shell__run","output_schema":null,"parameters":{"type":"object","properties":{"command":{"type":"string"}},"required":["command"],"additionalProperties":false},"strict":true}],"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_065eb111d59a10dd006a514c41c62c81998de5a364fc417df7","object":"response","created_at":1783712833,"status":"in_progress","background":false,"completed_at":null,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":1024,"max_tool_calls":null,"model":"gpt-4o-2024-08-06","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":[{"type":"function","description":"Search + the web for current information.","name":"web_search","output_schema":null,"parameters":{"type":"object","properties":{"query":{"type":"string","description":"the + search query"}},"required":["query"],"additionalProperties":false},"strict":true},{"type":"function","description":"Run + a shell command via the mcp__shell namespace tool.","name":"agentic_ns__mcp__shell__run","output_schema":null,"parameters":{"type":"object","properties":{"command":{"type":"string"}},"required":["command"],"additionalProperties":false},"strict":true}],"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":"fc_065eb111d59a10dd006a514c427e408199bda223027c1892c7","type":"function_call","status":"in_progress","arguments":"","call_id":"call_uXmi4TV4J4BHOh8Nt5HfFOL2","name":"web_search"},"output_index":0,"sequence_number":2} + + ' + - ' + + ' + - 'event: response.function_call_arguments.delta + + ' + - 'data: {"type":"response.function_call_arguments.delta","delta":"{\"","item_id":"fc_065eb111d59a10dd006a514c427e408199bda223027c1892c7","obfuscation":"5MIJerHG2wUdMb","output_index":0,"sequence_number":3} + + ' + - ' + + ' + - 'event: response.function_call_arguments.delta + + ' + - 'data: {"type":"response.function_call_arguments.delta","delta":"query","item_id":"fc_065eb111d59a10dd006a514c427e408199bda223027c1892c7","obfuscation":"xx2nHYRfvOZ","output_index":0,"sequence_number":4} + + ' + - ' + + ' + - 'event: response.function_call_arguments.delta + + ' + - 'data: {"type":"response.function_call_arguments.delta","delta":"\":\"","item_id":"fc_065eb111d59a10dd006a514c427e408199bda223027c1892c7","obfuscation":"eyD7mDFyp2b57","output_index":0,"sequence_number":5} + + ' + - ' + + ' + - 'event: response.function_call_arguments.delta + + ' + - 'data: {"type":"response.function_call_arguments.delta","delta":"latest","item_id":"fc_065eb111d59a10dd006a514c427e408199bda223027c1892c7","obfuscation":"FRGiU6fPNV","output_index":0,"sequence_number":6} + + ' + - ' + + ' + - 'event: response.function_call_arguments.delta + + ' + - 'data: {"type":"response.function_call_arguments.delta","delta":" Rust","item_id":"fc_065eb111d59a10dd006a514c427e408199bda223027c1892c7","obfuscation":"1andrRdcYyY","output_index":0,"sequence_number":7} + + ' + - ' + + ' + - 'event: response.function_call_arguments.delta + + ' + - 'data: {"type":"response.function_call_arguments.delta","delta":" async","item_id":"fc_065eb111d59a10dd006a514c427e408199bda223027c1892c7","obfuscation":"MMSOvwTila","output_index":0,"sequence_number":8} + + ' + - ' + + ' + - 'event: response.function_call_arguments.delta + + ' + - 'data: {"type":"response.function_call_arguments.delta","delta":" news","item_id":"fc_065eb111d59a10dd006a514c427e408199bda223027c1892c7","obfuscation":"ok6mb0yvBAu","output_index":0,"sequence_number":9} + + ' + - ' + + ' + - 'event: response.function_call_arguments.delta + + ' + - 'data: {"type":"response.function_call_arguments.delta","delta":"\"}","item_id":"fc_065eb111d59a10dd006a514c427e408199bda223027c1892c7","obfuscation":"8QyMgCbnXNKrRH","output_index":0,"sequence_number":10} + + ' + - ' + + ' + - 'event: response.function_call_arguments.done + + ' + - 'data: {"type":"response.function_call_arguments.done","arguments":"{\"query\":\"latest + Rust async news\"}","item_id":"fc_065eb111d59a10dd006a514c427e408199bda223027c1892c7","output_index":0,"sequence_number":11} + + ' + - ' + + ' + - 'event: response.output_item.done + + ' + - 'data: {"type":"response.output_item.done","item":{"id":"fc_065eb111d59a10dd006a514c427e408199bda223027c1892c7","type":"function_call","status":"completed","arguments":"{\"query\":\"latest + Rust async news\"}","call_id":"call_uXmi4TV4J4BHOh8Nt5HfFOL2","name":"web_search"},"output_index":0,"sequence_number":12} + + ' + - ' + + ' + - 'event: response.completed + + ' + - 'data: {"type":"response.completed","response":{"id":"resp_065eb111d59a10dd006a514c41c62c81998de5a364fc417df7","object":"response","created_at":1783712833,"status":"completed","background":false,"completed_at":1783712834,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":1024,"max_tool_calls":null,"model":"gpt-4o-2024-08-06","moderation":null,"output":[{"id":"fc_065eb111d59a10dd006a514c427e408199bda223027c1892c7","type":"function_call","status":"completed","arguments":"{\"query\":\"latest + Rust async news\"}","call_id":"call_uXmi4TV4J4BHOh8Nt5HfFOL2","name":"web_search"}],"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":[{"type":"function","description":"Search + the web for current information.","name":"web_search","output_schema":null,"parameters":{"type":"object","properties":{"query":{"type":"string","description":"the + search query"}},"required":["query"],"additionalProperties":false},"strict":true},{"type":"function","description":"Run + a shell command via the mcp__shell namespace tool.","name":"agentic_ns__mcp__shell__run","output_schema":null,"parameters":{"type":"object","properties":{"command":{"type":"string"}},"required":["command"],"additionalProperties":false},"strict":true}],"top_logprobs":0,"top_p":1.0,"truncation":"disabled","usage":{"input_tokens":94,"input_tokens_details":{"cache_write_tokens":0,"cached_tokens":0},"output_tokens":18,"output_tokens_details":{"reasoning_tokens":0},"total_tokens":112},"user":null,"metadata":{}},"sequence_number":13} + + ' + - ' + + ' + status_code: 200 +- filename: t2 + request: + body: + input: + - call_id: call_uXmi4TV4J4BHOh8Nt5HfFOL2 + output: '{"results":{"web":[{"url":"https://example.com/rust-async","title":"Rust + async guide","snippets":["Use async carefully."]}]},"metadata":{"query":"rust + async news"}}' + type: function_call_output + - content: Good. Now call agentic_ns__mcp__shell__run to run 'pwd'. + role: user + type: message + max_output_tokens: 1024 + model: gpt-4o + previous_response_id: resp_065eb111d59a10dd006a514c41c62c81998de5a364fc417df7 + store: true + stream: true + tools: + - description: Search the web for current information. + name: web_search + parameters: + properties: + query: + description: the search query + type: string + required: + - query + type: object + type: function + - description: Run a shell command via the mcp__shell namespace tool. + name: agentic_ns__mcp__shell__run + parameters: + properties: + command: + type: string + required: + - command + type: object + 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: + headers: + content-type: text/event-stream; charset=utf-8 + sse: + - 'event: response.created + + ' + - 'data: {"type":"response.created","response":{"id":"resp_065eb111d59a10dd006a514c42c7f08199a64647cdae1d7884","object":"response","created_at":1783712834,"status":"in_progress","background":false,"completed_at":null,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":1024,"max_tool_calls":null,"model":"gpt-4o-2024-08-06","moderation":null,"output":[],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":"resp_065eb111d59a10dd006a514c41c62c81998de5a364fc417df7","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":[{"type":"function","description":"Search + the web for current information.","name":"web_search","parameters":{"type":"object","properties":{"query":{"type":"string","description":"the + search query"}},"required":["query"],"additionalProperties":false},"strict":true},{"type":"function","description":"Run + a shell command via the mcp__shell namespace tool.","name":"agentic_ns__mcp__shell__run","parameters":{"type":"object","properties":{"command":{"type":"string"}},"required":["command"],"additionalProperties":false},"strict":true}],"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_065eb111d59a10dd006a514c42c7f08199a64647cdae1d7884","object":"response","created_at":1783712834,"status":"in_progress","background":false,"completed_at":null,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":1024,"max_tool_calls":null,"model":"gpt-4o-2024-08-06","moderation":null,"output":[],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":"resp_065eb111d59a10dd006a514c41c62c81998de5a364fc417df7","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":[{"type":"function","description":"Search + the web for current information.","name":"web_search","parameters":{"type":"object","properties":{"query":{"type":"string","description":"the + search query"}},"required":["query"],"additionalProperties":false},"strict":true},{"type":"function","description":"Run + a shell command via the mcp__shell namespace tool.","name":"agentic_ns__mcp__shell__run","parameters":{"type":"object","properties":{"command":{"type":"string"}},"required":["command"],"additionalProperties":false},"strict":true}],"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":"fc_065eb111d59a10dd006a514c435fb08199931eb31eac468001","type":"function_call","status":"in_progress","arguments":"","call_id":"call_mmG1tORJWhZJeNlvmSat2ip1","name":"agentic_ns__mcp__shell__run"},"output_index":0,"sequence_number":2} + + ' + - ' + + ' + - 'event: response.function_call_arguments.delta + + ' + - 'data: {"type":"response.function_call_arguments.delta","delta":"{\"","item_id":"fc_065eb111d59a10dd006a514c435fb08199931eb31eac468001","obfuscation":"pzMmKZNvn7kA7C","output_index":0,"sequence_number":3} + + ' + - ' + + ' + - 'event: response.function_call_arguments.delta + + ' + - 'data: {"type":"response.function_call_arguments.delta","delta":"command","item_id":"fc_065eb111d59a10dd006a514c435fb08199931eb31eac468001","obfuscation":"UpZprm5by","output_index":0,"sequence_number":4} + + ' + - ' + + ' + - 'event: response.function_call_arguments.delta + + ' + - 'data: {"type":"response.function_call_arguments.delta","delta":"\":\"","item_id":"fc_065eb111d59a10dd006a514c435fb08199931eb31eac468001","obfuscation":"QDCbYP7HCNMBf","output_index":0,"sequence_number":5} + + ' + - ' + + ' + - 'event: response.function_call_arguments.delta + + ' + - 'data: {"type":"response.function_call_arguments.delta","delta":"pwd","item_id":"fc_065eb111d59a10dd006a514c435fb08199931eb31eac468001","obfuscation":"HPJItmBbKyFhx","output_index":0,"sequence_number":6} + + ' + - ' + + ' + - 'event: response.function_call_arguments.delta + + ' + - 'data: {"type":"response.function_call_arguments.delta","delta":"\"}","item_id":"fc_065eb111d59a10dd006a514c435fb08199931eb31eac468001","obfuscation":"85vKlM92dQAmii","output_index":0,"sequence_number":7} + + ' + - ' + + ' + - 'event: response.function_call_arguments.done + + ' + - 'data: {"type":"response.function_call_arguments.done","arguments":"{\"command\":\"pwd\"}","item_id":"fc_065eb111d59a10dd006a514c435fb08199931eb31eac468001","output_index":0,"sequence_number":8} + + ' + - ' + + ' + - 'event: response.output_item.done + + ' + - 'data: {"type":"response.output_item.done","item":{"id":"fc_065eb111d59a10dd006a514c435fb08199931eb31eac468001","type":"function_call","status":"completed","arguments":"{\"command\":\"pwd\"}","call_id":"call_mmG1tORJWhZJeNlvmSat2ip1","name":"agentic_ns__mcp__shell__run"},"output_index":0,"sequence_number":9} + + ' + - ' + + ' + - 'event: response.completed + + ' + - 'data: {"type":"response.completed","response":{"id":"resp_065eb111d59a10dd006a514c42c7f08199a64647cdae1d7884","object":"response","created_at":1783712834,"status":"completed","background":false,"completed_at":1783712835,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":1024,"max_tool_calls":null,"model":"gpt-4o-2024-08-06","moderation":null,"output":[{"id":"fc_065eb111d59a10dd006a514c435fb08199931eb31eac468001","type":"function_call","status":"completed","arguments":"{\"command\":\"pwd\"}","call_id":"call_mmG1tORJWhZJeNlvmSat2ip1","name":"agentic_ns__mcp__shell__run"}],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":"resp_065eb111d59a10dd006a514c41c62c81998de5a364fc417df7","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":[{"type":"function","description":"Search + the web for current information.","name":"web_search","parameters":{"type":"object","properties":{"query":{"type":"string","description":"the + search query"}},"required":["query"],"additionalProperties":false},"strict":true},{"type":"function","description":"Run + a shell command via the mcp__shell namespace tool.","name":"agentic_ns__mcp__shell__run","parameters":{"type":"object","properties":{"command":{"type":"string"}},"required":["command"],"additionalProperties":false},"strict":true}],"top_logprobs":0,"top_p":1.0,"truncation":"disabled","usage":{"input_tokens":185,"input_tokens_details":{"cache_write_tokens":0,"cached_tokens":0},"output_tokens":23,"output_tokens_details":{"reasoning_tokens":0},"total_tokens":208},"user":null,"metadata":{}},"sequence_number":10} + + ' + - ' + + ' + status_code: 200 diff --git a/crates/agentic-server-core/tests/cassettes/codex/codex-vllm-multi-round-web-search-gpt-oss-20b-streaming.yaml b/crates/agentic-server-core/tests/cassettes/codex/codex-vllm-multi-round-web-search-gpt-oss-20b-streaming.yaml new file mode 100644 index 0000000..06012eb --- /dev/null +++ b/crates/agentic-server-core/tests/cassettes/codex/codex-vllm-multi-round-web-search-gpt-oss-20b-streaming.yaml @@ -0,0 +1,1093 @@ +turns: +- filename: t1 + request: + body: + input: Search the web for the latest Rust async news using web_search. + max_output_tokens: 1024 + model: openai/gpt-oss-20b + store: true + stream: true + tools: + - description: Search the web for current information. + name: web_search + parameters: + properties: + query: + description: the search query + type: string + required: + - query + type: object + type: function + headers: + accept: '*/*' + 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_854b8b6733ff921e","created_at":1783713943,"incomplete_details":null,"instructions":null,"metadata":null,"model":"openai/gpt-oss-20b","object":"response","output":[],"parallel_tool_calls":true,"temperature":1.0,"tool_choice":"auto","tools":[{"name":"web_search","parameters":{"type":"object","properties":{"query":{"type":"string","description":"the + search query"}},"required":["query"]},"strict":null,"type":"function","defer_loading":null,"description":"Search + the web for current information."}],"top_p":1.0,"background":false,"max_output_tokens":1024,"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,"input_messages":null,"output_messages":null},"sequence_number":0,"type":"response.created"} + + ' + - ' + + ' + - 'event: response.in_progress + + ' + - 'data: {"response":{"id":"resp_854b8b6733ff921e","created_at":1783713943,"incomplete_details":null,"instructions":null,"metadata":null,"model":"openai/gpt-oss-20b","object":"response","output":[],"parallel_tool_calls":true,"temperature":1.0,"tool_choice":"auto","tools":[{"name":"web_search","parameters":{"type":"object","properties":{"query":{"type":"string","description":"the + search query"}},"required":["query"]},"strict":null,"type":"function","defer_loading":null,"description":"Search + the web for current information."}],"top_p":1.0,"background":false,"max_output_tokens":1024,"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,"input_messages":null,"output_messages":null},"sequence_number":1,"type":"response.in_progress"} + + ' + - ' + + ' + - 'event: response.output_item.added + + ' + - 'data: {"item":{"id":"msg_b0ef3ea8804e2b55","summary":[],"type":"reasoning","content":null,"encrypted_content":null,"status":"in_progress"},"output_index":0,"sequence_number":2,"type":"response.output_item.added"} + + ' + - ' + + ' + - 'event: response.reasoning_part.added + + ' + - 'data: {"content_index":0,"item_id":"msg_b0ef3ea8804e2b55","output_index":0,"part":{"text":"","type":"reasoning_text"},"sequence_number":3,"type":"response.reasoning_part.added"} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"content_index":0,"delta":"We","item_id":"msg_b0ef3ea8804e2b55","output_index":0,"sequence_number":4,"type":"response.reasoning_text.delta"} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"content_index":0,"delta":" need","item_id":"msg_b0ef3ea8804e2b55","output_index":0,"sequence_number":5,"type":"response.reasoning_text.delta"} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"content_index":0,"delta":" to","item_id":"msg_b0ef3ea8804e2b55","output_index":0,"sequence_number":6,"type":"response.reasoning_text.delta"} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"content_index":0,"delta":" use","item_id":"msg_b0ef3ea8804e2b55","output_index":0,"sequence_number":7,"type":"response.reasoning_text.delta"} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"content_index":0,"delta":" web","item_id":"msg_b0ef3ea8804e2b55","output_index":0,"sequence_number":8,"type":"response.reasoning_text.delta"} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"content_index":0,"delta":"_search","item_id":"msg_b0ef3ea8804e2b55","output_index":0,"sequence_number":9,"type":"response.reasoning_text.delta"} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"content_index":0,"delta":".","item_id":"msg_b0ef3ea8804e2b55","output_index":0,"sequence_number":10,"type":"response.reasoning_text.delta"} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"content_index":0,"delta":" Thus","item_id":"msg_b0ef3ea8804e2b55","output_index":0,"sequence_number":11,"type":"response.reasoning_text.delta"} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"content_index":0,"delta":" call","item_id":"msg_b0ef3ea8804e2b55","output_index":0,"sequence_number":12,"type":"response.reasoning_text.delta"} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"content_index":0,"delta":" to","item_id":"msg_b0ef3ea8804e2b55","output_index":0,"sequence_number":13,"type":"response.reasoning_text.delta"} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"content_index":0,"delta":" the","item_id":"msg_b0ef3ea8804e2b55","output_index":0,"sequence_number":14,"type":"response.reasoning_text.delta"} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"content_index":0,"delta":" tool","item_id":"msg_b0ef3ea8804e2b55","output_index":0,"sequence_number":15,"type":"response.reasoning_text.delta"} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"content_index":0,"delta":".","item_id":"msg_b0ef3ea8804e2b55","output_index":0,"sequence_number":16,"type":"response.reasoning_text.delta"} + + ' + - ' + + ' + - 'event: response.reasoning_text.done + + ' + - 'data: {"content_index":0,"item_id":"msg_b0ef3ea8804e2b55","output_index":0,"sequence_number":17,"text":"We + need to use web_search. Thus call to the tool.","type":"response.reasoning_text.done"} + + ' + - ' + + ' + - 'event: response.reasoning_part.done + + ' + - 'data: {"content_index":0,"item_id":"msg_b0ef3ea8804e2b55","output_index":0,"part":{"text":"We + need to use web_search. Thus call to the tool.","type":"reasoning_text"},"sequence_number":18,"type":"response.reasoning_part.done"} + + ' + - ' + + ' + - 'event: response.output_item.done + + ' + - 'data: {"item":{"id":"msg_b0ef3ea8804e2b55","summary":[],"type":"reasoning","content":[{"text":"We + need to use web_search. Thus call to the tool.","type":"reasoning_text"}],"encrypted_content":null,"status":"completed"},"output_index":0,"sequence_number":19,"type":"response.output_item.done"} + + ' + - ' + + ' + - 'event: response.output_item.added + + ' + - 'data: {"item":{"arguments":"","call_id":"call_936a52a1d20f276b","name":"web_search","type":"function_call","id":"fc_89e1c56cf0b8530f","namespace":null,"status":"in_progress"},"output_index":1,"sequence_number":20,"type":"response.output_item.added"} + + ' + - ' + + ' + - 'event: response.function_call_arguments.delta + + ' + - 'data: {"delta":"{\"","item_id":"fc_89e1c56cf0b8530f","output_index":1,"sequence_number":21,"type":"response.function_call_arguments.delta"} + + ' + - ' + + ' + - 'event: response.function_call_arguments.delta + + ' + - 'data: {"delta":"query","item_id":"fc_89e1c56cf0b8530f","output_index":1,"sequence_number":22,"type":"response.function_call_arguments.delta"} + + ' + - ' + + ' + - 'event: response.function_call_arguments.delta + + ' + - 'data: {"delta":"\":\"","item_id":"fc_89e1c56cf0b8530f","output_index":1,"sequence_number":23,"type":"response.function_call_arguments.delta"} + + ' + - ' + + ' + - 'event: response.function_call_arguments.delta + + ' + - 'data: {"delta":"latest","item_id":"fc_89e1c56cf0b8530f","output_index":1,"sequence_number":24,"type":"response.function_call_arguments.delta"} + + ' + - ' + + ' + - 'event: response.function_call_arguments.delta + + ' + - 'data: {"delta":" Rust","item_id":"fc_89e1c56cf0b8530f","output_index":1,"sequence_number":25,"type":"response.function_call_arguments.delta"} + + ' + - ' + + ' + - 'event: response.function_call_arguments.delta + + ' + - 'data: {"delta":" async","item_id":"fc_89e1c56cf0b8530f","output_index":1,"sequence_number":26,"type":"response.function_call_arguments.delta"} + + ' + - ' + + ' + - 'event: response.function_call_arguments.delta + + ' + - 'data: {"delta":" news","item_id":"fc_89e1c56cf0b8530f","output_index":1,"sequence_number":27,"type":"response.function_call_arguments.delta"} + + ' + - ' + + ' + - 'event: response.function_call_arguments.delta + + ' + - 'data: {"delta":"\"}","item_id":"fc_89e1c56cf0b8530f","output_index":1,"sequence_number":28,"type":"response.function_call_arguments.delta"} + + ' + - ' + + ' + - 'event: response.function_call_arguments.done + + ' + - 'data: {"arguments":"{\"query\":\"latest Rust async news\"}","item_id":"fc_89e1c56cf0b8530f","name":"web_search","output_index":1,"sequence_number":29,"type":"response.function_call_arguments.done"} + + ' + - ' + + ' + - 'event: response.output_item.done + + ' + - 'data: {"item":{"arguments":"{\"query\":\"latest Rust async news\"}","call_id":"call_936a52a1d20f276b","name":"web_search","type":"function_call","id":null,"namespace":null,"status":"completed","item_id":"fc_89e1c56cf0b8530f","output_index":1,"sequence_number":-1},"output_index":1,"sequence_number":30,"type":"response.output_item.done"} + + ' + - ' + + ' + - 'event: response.completed + + ' + - 'data: {"response":{"id":"resp_854b8b6733ff921e","created_at":1783713943,"incomplete_details":null,"instructions":null,"metadata":null,"model":"openai/gpt-oss-20b","object":"response","output":[{"id":"rs_898d70f87e4233cf","summary":[],"type":"reasoning","content":[{"text":"We + need to use web_search. Thus call to the tool.","type":"reasoning_text"}],"encrypted_content":null,"status":null},{"arguments":"{\"query\":\"latest + Rust async news\"}","call_id":"call_a061d4718d147e07","name":"web_search","type":"function_call","id":"fc_a061d4718d147e07","namespace":null,"status":null}],"parallel_tool_calls":true,"temperature":1.0,"tool_choice":"auto","tools":[{"name":"web_search","parameters":{"type":"object","properties":{"query":{"type":"string","description":"the + search query"}},"required":["query"]},"strict":null,"type":"function","defer_loading":null,"description":"Search + the web for current information."}],"top_p":1.0,"background":false,"max_output_tokens":1024,"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":137,"input_tokens_details":{"cached_tokens":112,"input_tokens_per_turn":[137],"cached_tokens_per_turn":[112]},"output_tokens":40,"output_tokens_details":{"reasoning_tokens":23,"tool_output_tokens":0,"output_tokens_per_turn":[40],"tool_output_tokens_per_turn":[0]},"total_tokens":177},"user":null,"presence_penalty":0.0,"frequency_penalty":0.0,"kv_transfer_params":null,"input_messages":null,"output_messages":null},"sequence_number":31,"type":"response.completed"} + + ' + - ' + + ' + status_code: 200 +- filename: t2 + request: + body: + input: + - call_id: call_a061d4718d147e07 + output: '{"results":{"web":[{"url":"https://example.com/rust-async","title":"Rust + async guide","snippets":["partial result"]}]},"metadata":{"query":"rust + async"}}' + type: function_call_output + - content: That result was incomplete. Search again with a refined query using + web_search. + role: user + type: message + max_output_tokens: 1024 + model: openai/gpt-oss-20b + previous_response_id: resp_854b8b6733ff921e + store: true + stream: true + tools: + - description: Search the web for current information. + name: web_search + parameters: + properties: + query: + description: the search query + type: string + required: + - query + type: object + type: function + headers: + accept: '*/*' + 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_ac34025e70547564","created_at":1783713943,"incomplete_details":null,"instructions":null,"metadata":null,"model":"openai/gpt-oss-20b","object":"response","output":[],"parallel_tool_calls":true,"temperature":1.0,"tool_choice":"auto","tools":[{"name":"web_search","parameters":{"type":"object","properties":{"query":{"type":"string","description":"the + search query"}},"required":["query"]},"strict":null,"type":"function","defer_loading":null,"description":"Search + the web for current information."}],"top_p":1.0,"background":false,"max_output_tokens":1024,"max_tool_calls":null,"previous_response_id":"resp_854b8b6733ff921e","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,"input_messages":null,"output_messages":null},"sequence_number":0,"type":"response.created"} + + ' + - ' + + ' + - 'event: response.in_progress + + ' + - 'data: {"response":{"id":"resp_ac34025e70547564","created_at":1783713943,"incomplete_details":null,"instructions":null,"metadata":null,"model":"openai/gpt-oss-20b","object":"response","output":[],"parallel_tool_calls":true,"temperature":1.0,"tool_choice":"auto","tools":[{"name":"web_search","parameters":{"type":"object","properties":{"query":{"type":"string","description":"the + search query"}},"required":["query"]},"strict":null,"type":"function","defer_loading":null,"description":"Search + the web for current information."}],"top_p":1.0,"background":false,"max_output_tokens":1024,"max_tool_calls":null,"previous_response_id":"resp_854b8b6733ff921e","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,"input_messages":null,"output_messages":null},"sequence_number":1,"type":"response.in_progress"} + + ' + - ' + + ' + - 'event: response.output_item.added + + ' + - 'data: {"item":{"id":"msg_a18e4d42f797d772","summary":[],"type":"reasoning","content":null,"encrypted_content":null,"status":"in_progress"},"output_index":0,"sequence_number":2,"type":"response.output_item.added"} + + ' + - ' + + ' + - 'event: response.reasoning_part.added + + ' + - 'data: {"content_index":0,"item_id":"msg_a18e4d42f797d772","output_index":0,"part":{"text":"","type":"reasoning_text"},"sequence_number":3,"type":"response.reasoning_part.added"} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"content_index":0,"delta":"We","item_id":"msg_a18e4d42f797d772","output_index":0,"sequence_number":4,"type":"response.reasoning_text.delta"} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"content_index":0,"delta":" need","item_id":"msg_a18e4d42f797d772","output_index":0,"sequence_number":5,"type":"response.reasoning_text.delta"} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"content_index":0,"delta":" to","item_id":"msg_a18e4d42f797d772","output_index":0,"sequence_number":6,"type":"response.reasoning_text.delta"} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"content_index":0,"delta":" refine","item_id":"msg_a18e4d42f797d772","output_index":0,"sequence_number":7,"type":"response.reasoning_text.delta"} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"content_index":0,"delta":" query","item_id":"msg_a18e4d42f797d772","output_index":0,"sequence_number":8,"type":"response.reasoning_text.delta"} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"content_index":0,"delta":".","item_id":"msg_a18e4d42f797d772","output_index":0,"sequence_number":9,"type":"response.reasoning_text.delta"} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"content_index":0,"delta":" Maybe","item_id":"msg_a18e4d42f797d772","output_index":0,"sequence_number":10,"type":"response.reasoning_text.delta"} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"content_index":0,"delta":" specify","item_id":"msg_a18e4d42f797d772","output_index":0,"sequence_number":11,"type":"response.reasoning_text.delta"} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"content_index":0,"delta":" \"","item_id":"msg_a18e4d42f797d772","output_index":0,"sequence_number":12,"type":"response.reasoning_text.delta"} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"content_index":0,"delta":"202","item_id":"msg_a18e4d42f797d772","output_index":0,"sequence_number":13,"type":"response.reasoning_text.delta"} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"content_index":0,"delta":"4","item_id":"msg_a18e4d42f797d772","output_index":0,"sequence_number":14,"type":"response.reasoning_text.delta"} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"content_index":0,"delta":" Rust","item_id":"msg_a18e4d42f797d772","output_index":0,"sequence_number":15,"type":"response.reasoning_text.delta"} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"content_index":0,"delta":" async","item_id":"msg_a18e4d42f797d772","output_index":0,"sequence_number":16,"type":"response.reasoning_text.delta"} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"content_index":0,"delta":"\".","item_id":"msg_a18e4d42f797d772","output_index":0,"sequence_number":17,"type":"response.reasoning_text.delta"} + + ' + - ' + + ' + - 'event: response.reasoning_text.done + + ' + - 'data: {"content_index":0,"item_id":"msg_a18e4d42f797d772","output_index":0,"sequence_number":18,"text":"We + need to refine query. Maybe specify \"2024 Rust async\".","type":"response.reasoning_text.done"} + + ' + - ' + + ' + - 'event: response.reasoning_part.done + + ' + - 'data: {"content_index":0,"item_id":"msg_a18e4d42f797d772","output_index":0,"part":{"text":"We + need to refine query. Maybe specify \"2024 Rust async\".","type":"reasoning_text"},"sequence_number":19,"type":"response.reasoning_part.done"} + + ' + - ' + + ' + - 'event: response.output_item.done + + ' + - 'data: {"item":{"id":"msg_a18e4d42f797d772","summary":[],"type":"reasoning","content":[{"text":"We + need to refine query. Maybe specify \"2024 Rust async\".","type":"reasoning_text"}],"encrypted_content":null,"status":"completed"},"output_index":0,"sequence_number":20,"type":"response.output_item.done"} + + ' + - ' + + ' + - 'event: response.output_item.added + + ' + - 'data: {"item":{"arguments":"","call_id":"call_934bd92183b8cb59","name":"web_search","type":"function_call","id":"fc_804d926b8311120f","namespace":null,"status":"in_progress"},"output_index":1,"sequence_number":21,"type":"response.output_item.added"} + + ' + - ' + + ' + - 'event: response.function_call_arguments.delta + + ' + - 'data: {"delta":"{\"","item_id":"fc_804d926b8311120f","output_index":1,"sequence_number":22,"type":"response.function_call_arguments.delta"} + + ' + - ' + + ' + - 'event: response.function_call_arguments.delta + + ' + - 'data: {"delta":"query","item_id":"fc_804d926b8311120f","output_index":1,"sequence_number":23,"type":"response.function_call_arguments.delta"} + + ' + - ' + + ' + - 'event: response.function_call_arguments.delta + + ' + - 'data: {"delta":"\":\"","item_id":"fc_804d926b8311120f","output_index":1,"sequence_number":24,"type":"response.function_call_arguments.delta"} + + ' + - ' + + ' + - 'event: response.function_call_arguments.delta + + ' + - 'data: {"delta":"202","item_id":"fc_804d926b8311120f","output_index":1,"sequence_number":25,"type":"response.function_call_arguments.delta"} + + ' + - ' + + ' + - 'event: response.function_call_arguments.delta + + ' + - 'data: {"delta":"4","item_id":"fc_804d926b8311120f","output_index":1,"sequence_number":26,"type":"response.function_call_arguments.delta"} + + ' + - ' + + ' + - 'event: response.function_call_arguments.delta + + ' + - 'data: {"delta":" Rust","item_id":"fc_804d926b8311120f","output_index":1,"sequence_number":27,"type":"response.function_call_arguments.delta"} + + ' + - ' + + ' + - 'event: response.function_call_arguments.delta + + ' + - 'data: {"delta":" async","item_id":"fc_804d926b8311120f","output_index":1,"sequence_number":28,"type":"response.function_call_arguments.delta"} + + ' + - ' + + ' + - 'event: response.function_call_arguments.delta + + ' + - 'data: {"delta":" updates","item_id":"fc_804d926b8311120f","output_index":1,"sequence_number":29,"type":"response.function_call_arguments.delta"} + + ' + - ' + + ' + - 'event: response.function_call_arguments.delta + + ' + - 'data: {"delta":"\"}","item_id":"fc_804d926b8311120f","output_index":1,"sequence_number":30,"type":"response.function_call_arguments.delta"} + + ' + - ' + + ' + - 'event: response.function_call_arguments.done + + ' + - 'data: {"arguments":"{\"query\":\"2024 Rust async updates\"}","item_id":"fc_804d926b8311120f","name":"web_search","output_index":1,"sequence_number":31,"type":"response.function_call_arguments.done"} + + ' + - ' + + ' + - 'event: response.output_item.done + + ' + - 'data: {"item":{"arguments":"{\"query\":\"2024 Rust async updates\"}","call_id":"call_934bd92183b8cb59","name":"web_search","type":"function_call","id":null,"namespace":null,"status":"completed","item_id":"fc_804d926b8311120f","output_index":1,"sequence_number":-1},"output_index":1,"sequence_number":32,"type":"response.output_item.done"} + + ' + - ' + + ' + - 'event: response.completed + + ' + - 'data: {"response":{"id":"resp_ac34025e70547564","created_at":1783713943,"incomplete_details":null,"instructions":null,"metadata":null,"model":"openai/gpt-oss-20b","object":"response","output":[{"id":"rs_bd46ee7c5ec5496f","summary":[],"type":"reasoning","content":[{"text":"We + need to refine query. Maybe specify \"2024 Rust async\".","type":"reasoning_text"}],"encrypted_content":null,"status":null},{"arguments":"{\"query\":\"2024 + Rust async updates\"}","call_id":"call_93780fccabe551bb","name":"web_search","type":"function_call","id":"fc_93780fccabe551bb","namespace":null,"status":null}],"parallel_tool_calls":true,"temperature":1.0,"tool_choice":"auto","tools":[{"name":"web_search","parameters":{"type":"object","properties":{"query":{"type":"string","description":"the + search query"}},"required":["query"]},"strict":null,"type":"function","defer_loading":null,"description":"Search + the web for current information."}],"top_p":1.0,"background":false,"max_output_tokens":1024,"max_tool_calls":null,"previous_response_id":"resp_854b8b6733ff921e","prompt":null,"reasoning":null,"service_tier":"auto","status":"completed","text":null,"top_logprobs":null,"truncation":"disabled","usage":{"input_tokens":249,"input_tokens_details":{"cached_tokens":144,"input_tokens_per_turn":[249],"cached_tokens_per_turn":[144]},"output_tokens":42,"output_tokens_details":{"reasoning_tokens":25,"tool_output_tokens":0,"output_tokens_per_turn":[42],"tool_output_tokens_per_turn":[0]},"total_tokens":291},"user":null,"presence_penalty":0.0,"frequency_penalty":0.0,"kv_transfer_params":null,"input_messages":null,"output_messages":null},"sequence_number":33,"type":"response.completed"} + + ' + - ' + + ' + status_code: 200 +- filename: t3 + request: + body: + input: + - call_id: call_93780fccabe551bb + output: '{"results":{"web":[{"url":"https://example.com/rust-async","title":"Rust + async guide","snippets":["partial result"]}]},"metadata":{"query":"rust + async"}}' + type: function_call_output + - content: Good. Now summarize the finding in one sentence. Do not call any + tools. + role: user + type: message + max_output_tokens: 1024 + model: openai/gpt-oss-20b + previous_response_id: resp_ac34025e70547564 + store: true + stream: true + tools: + - description: Search the web for current information. + name: web_search + parameters: + properties: + query: + description: the search query + type: string + required: + - query + type: object + type: function + headers: + accept: '*/*' + 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_a6779a58b9dec40c","created_at":1783713944,"incomplete_details":null,"instructions":null,"metadata":null,"model":"openai/gpt-oss-20b","object":"response","output":[],"parallel_tool_calls":true,"temperature":1.0,"tool_choice":"auto","tools":[{"name":"web_search","parameters":{"type":"object","properties":{"query":{"type":"string","description":"the + search query"}},"required":["query"]},"strict":null,"type":"function","defer_loading":null,"description":"Search + the web for current information."}],"top_p":1.0,"background":false,"max_output_tokens":1024,"max_tool_calls":null,"previous_response_id":"resp_ac34025e70547564","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,"input_messages":null,"output_messages":null},"sequence_number":0,"type":"response.created"} + + ' + - ' + + ' + - 'event: response.in_progress + + ' + - 'data: {"response":{"id":"resp_a6779a58b9dec40c","created_at":1783713944,"incomplete_details":null,"instructions":null,"metadata":null,"model":"openai/gpt-oss-20b","object":"response","output":[],"parallel_tool_calls":true,"temperature":1.0,"tool_choice":"auto","tools":[{"name":"web_search","parameters":{"type":"object","properties":{"query":{"type":"string","description":"the + search query"}},"required":["query"]},"strict":null,"type":"function","defer_loading":null,"description":"Search + the web for current information."}],"top_p":1.0,"background":false,"max_output_tokens":1024,"max_tool_calls":null,"previous_response_id":"resp_ac34025e70547564","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,"input_messages":null,"output_messages":null},"sequence_number":1,"type":"response.in_progress"} + + ' + - ' + + ' + - 'event: response.output_item.added + + ' + - 'data: {"item":{"id":"msg_ad8ee6d642f1cd74","content":[],"role":"assistant","status":"in_progress","type":"message","phase":null},"output_index":0,"sequence_number":2,"type":"response.output_item.added"} + + ' + - ' + + ' + - 'event: response.content_part.added + + ' + - 'data: {"content_index":0,"item_id":"msg_ad8ee6d642f1cd74","output_index":0,"part":{"annotations":[],"text":"","type":"output_text","logprobs":[]},"sequence_number":3,"type":"response.content_part.added"} + + ' + - ' + + ' + - 'event: response.output_text.delta + + ' + - 'data: {"content_index":0,"delta":"Rust","item_id":"msg_ad8ee6d642f1cd74","logprobs":[],"output_index":0,"sequence_number":4,"type":"response.output_text.delta"} + + ' + - ' + + ' + - 'event: response.output_text.delta + + ' + - 'data: {"content_index":0,"delta":"’s","item_id":"msg_ad8ee6d642f1cd74","logprobs":[],"output_index":0,"sequence_number":5,"type":"response.output_text.delta"} + + ' + - ' + + ' + - 'event: response.output_text.delta + + ' + - 'data: {"content_index":0,"delta":" async","item_id":"msg_ad8ee6d642f1cd74","logprobs":[],"output_index":0,"sequence_number":6,"type":"response.output_text.delta"} + + ' + - ' + + ' + - 'event: response.output_text.delta + + ' + - 'data: {"content_index":0,"delta":" ecosystem","item_id":"msg_ad8ee6d642f1cd74","logprobs":[],"output_index":0,"sequence_number":7,"type":"response.output_text.delta"} + + ' + - ' + + ' + - 'event: response.output_text.delta + + ' + - 'data: {"content_index":0,"delta":" has","item_id":"msg_ad8ee6d642f1cd74","logprobs":[],"output_index":0,"sequence_number":8,"type":"response.output_text.delta"} + + ' + - ' + + ' + - 'event: response.output_text.delta + + ' + - 'data: {"content_index":0,"delta":" seen","item_id":"msg_ad8ee6d642f1cd74","logprobs":[],"output_index":0,"sequence_number":9,"type":"response.output_text.delta"} + + ' + - ' + + ' + - 'event: response.output_text.delta + + ' + - 'data: {"content_index":0,"delta":" significant","item_id":"msg_ad8ee6d642f1cd74","logprobs":[],"output_index":0,"sequence_number":10,"type":"response.output_text.delta"} + + ' + - ' + + ' + - 'event: response.output_text.delta + + ' + - 'data: {"content_index":0,"delta":" updates","item_id":"msg_ad8ee6d642f1cd74","logprobs":[],"output_index":0,"sequence_number":11,"type":"response.output_text.delta"} + + ' + - ' + + ' + - 'event: response.output_text.delta + + ' + - 'data: {"content_index":0,"delta":" in","item_id":"msg_ad8ee6d642f1cd74","logprobs":[],"output_index":0,"sequence_number":12,"type":"response.output_text.delta"} + + ' + - ' + + ' + - 'event: response.output_text.delta + + ' + - 'data: {"content_index":0,"delta":" ","item_id":"msg_ad8ee6d642f1cd74","logprobs":[],"output_index":0,"sequence_number":13,"type":"response.output_text.delta"} + + ' + - ' + + ' + - 'event: response.output_text.delta + + ' + - 'data: {"content_index":0,"delta":"202","item_id":"msg_ad8ee6d642f1cd74","logprobs":[],"output_index":0,"sequence_number":14,"type":"response.output_text.delta"} + + ' + - ' + + ' + - 'event: response.output_text.delta + + ' + - 'data: {"content_index":0,"delta":"4","item_id":"msg_ad8ee6d642f1cd74","logprobs":[],"output_index":0,"sequence_number":15,"type":"response.output_text.delta"} + + ' + - ' + + ' + - 'event: response.output_text.delta + + ' + - 'data: {"content_index":0,"delta":",","item_id":"msg_ad8ee6d642f1cd74","logprobs":[],"output_index":0,"sequence_number":16,"type":"response.output_text.delta"} + + ' + - ' + + ' + - 'event: response.output_text.delta + + ' + - 'data: {"content_index":0,"delta":" including","item_id":"msg_ad8ee6d642f1cd74","logprobs":[],"output_index":0,"sequence_number":17,"type":"response.output_text.delta"} + + ' + - ' + + ' + - 'event: response.output_text.delta + + ' + - 'data: {"content_index":0,"delta":" new","item_id":"msg_ad8ee6d642f1cd74","logprobs":[],"output_index":0,"sequence_number":18,"type":"response.output_text.delta"} + + ' + - ' + + ' + - 'event: response.output_text.delta + + ' + - 'data: {"content_index":0,"delta":" language","item_id":"msg_ad8ee6d642f1cd74","logprobs":[],"output_index":0,"sequence_number":19,"type":"response.output_text.delta"} + + ' + - ' + + ' + - 'event: response.output_text.delta + + ' + - 'data: {"content_index":0,"delta":" features","item_id":"msg_ad8ee6d642f1cd74","logprobs":[],"output_index":0,"sequence_number":20,"type":"response.output_text.delta"} + + ' + - ' + + ' + - 'event: response.output_text.delta + + ' + - 'data: {"content_index":0,"delta":",","item_id":"msg_ad8ee6d642f1cd74","logprobs":[],"output_index":0,"sequence_number":21,"type":"response.output_text.delta"} + + ' + - ' + + ' + - 'event: response.output_text.delta + + ' + - 'data: {"content_index":0,"delta":" stabilized","item_id":"msg_ad8ee6d642f1cd74","logprobs":[],"output_index":0,"sequence_number":22,"type":"response.output_text.delta"} + + ' + - ' + + ' + - 'event: response.output_text.delta + + ' + - 'data: {"content_index":0,"delta":" crates","item_id":"msg_ad8ee6d642f1cd74","logprobs":[],"output_index":0,"sequence_number":23,"type":"response.output_text.delta"} + + ' + - ' + + ' + - 'event: response.output_text.delta + + ' + - 'data: {"content_index":0,"delta":",","item_id":"msg_ad8ee6d642f1cd74","logprobs":[],"output_index":0,"sequence_number":24,"type":"response.output_text.delta"} + + ' + - ' + + ' + - 'event: response.output_text.delta + + ' + - 'data: {"content_index":0,"delta":" and","item_id":"msg_ad8ee6d642f1cd74","logprobs":[],"output_index":0,"sequence_number":25,"type":"response.output_text.delta"} + + ' + - ' + + ' + - 'event: response.output_text.delta + + ' + - 'data: {"content_index":0,"delta":" performance","item_id":"msg_ad8ee6d642f1cd74","logprobs":[],"output_index":0,"sequence_number":26,"type":"response.output_text.delta"} + + ' + - ' + + ' + - 'event: response.output_text.delta + + ' + - 'data: {"content_index":0,"delta":" improvements","item_id":"msg_ad8ee6d642f1cd74","logprobs":[],"output_index":0,"sequence_number":27,"type":"response.output_text.delta"} + + ' + - ' + + ' + - 'event: response.output_text.delta + + ' + - 'data: {"content_index":0,"delta":" that","item_id":"msg_ad8ee6d642f1cd74","logprobs":[],"output_index":0,"sequence_number":28,"type":"response.output_text.delta"} + + ' + - ' + + ' + - 'event: response.output_text.delta + + ' + - 'data: {"content_index":0,"delta":" further","item_id":"msg_ad8ee6d642f1cd74","logprobs":[],"output_index":0,"sequence_number":29,"type":"response.output_text.delta"} + + ' + - ' + + ' + - 'event: response.output_text.delta + + ' + - 'data: {"content_index":0,"delta":" simplify","item_id":"msg_ad8ee6d642f1cd74","logprobs":[],"output_index":0,"sequence_number":30,"type":"response.output_text.delta"} + + ' + - ' + + ' + - 'event: response.output_text.delta + + ' + - 'data: {"content_index":0,"delta":" concurrent","item_id":"msg_ad8ee6d642f1cd74","logprobs":[],"output_index":0,"sequence_number":31,"type":"response.output_text.delta"} + + ' + - ' + + ' + - 'event: response.output_text.delta + + ' + - 'data: {"content_index":0,"delta":" programming","item_id":"msg_ad8ee6d642f1cd74","logprobs":[],"output_index":0,"sequence_number":32,"type":"response.output_text.delta"} + + ' + - ' + + ' + - 'event: response.output_text.delta + + ' + - 'data: {"content_index":0,"delta":".","item_id":"msg_ad8ee6d642f1cd74","logprobs":[],"output_index":0,"sequence_number":33,"type":"response.output_text.delta"} + + ' + - ' + + ' + - 'event: response.output_text.done + + ' + - 'data: {"content_index":0,"item_id":"msg_ad8ee6d642f1cd74","logprobs":[],"output_index":0,"sequence_number":34,"text":"Rust’s + async ecosystem has seen significant updates in 2024, including new language + features, stabilized crates, and performance improvements that further simplify + concurrent programming.","type":"response.output_text.done"} + + ' + - ' + + ' + - 'event: response.content_part.done + + ' + - 'data: {"content_index":0,"item_id":"msg_ad8ee6d642f1cd74","output_index":0,"part":{"annotations":[],"text":"Rust’s + async ecosystem has seen significant updates in 2024, including new language + features, stabilized crates, and performance improvements that further simplify + concurrent programming.","type":"output_text","logprobs":null},"sequence_number":35,"type":"response.content_part.done"} + + ' + - ' + + ' + - 'event: response.output_item.done + + ' + - 'data: {"item":{"id":"msg_ad8ee6d642f1cd74","content":[{"annotations":[],"text":"Rust’s + async ecosystem has seen significant updates in 2024, including new language + features, stabilized crates, and performance improvements that further simplify + concurrent programming.","type":"output_text","logprobs":null}],"role":"assistant","status":"completed","type":"message","phase":null},"output_index":0,"sequence_number":36,"type":"response.output_item.done"} + + ' + - ' + + ' + - 'event: response.completed + + ' + - 'data: {"response":{"id":"resp_a6779a58b9dec40c","created_at":1783713944,"incomplete_details":null,"instructions":null,"metadata":null,"model":"openai/gpt-oss-20b","object":"response","output":[{"id":"msg_b13f719d20afaa02","content":[{"annotations":[],"text":"Rust’s + async ecosystem has seen significant updates in 2024, including new language + features, stabilized crates, and performance improvements that further simplify + concurrent programming.","type":"output_text","logprobs":null}],"role":"assistant","status":"completed","type":"message","phase":null}],"parallel_tool_calls":true,"temperature":1.0,"tool_choice":"auto","tools":[{"name":"web_search","parameters":{"type":"object","properties":{"query":{"type":"string","description":"the + search query"}},"required":["query"]},"strict":null,"type":"function","defer_loading":null,"description":"Search + the web for current information."}],"top_p":1.0,"background":false,"max_output_tokens":1024,"max_tool_calls":null,"previous_response_id":"resp_ac34025e70547564","prompt":null,"reasoning":null,"service_tier":"auto","status":"completed","text":null,"top_logprobs":null,"truncation":"disabled","usage":{"input_tokens":364,"input_tokens_details":{"cached_tokens":256,"input_tokens_per_turn":[364],"cached_tokens_per_turn":[256]},"output_tokens":34,"output_tokens_details":{"reasoning_tokens":0,"tool_output_tokens":0,"output_tokens_per_turn":[34],"tool_output_tokens_per_turn":[0]},"total_tokens":398},"user":null,"presence_penalty":0.0,"frequency_penalty":0.0,"kv_transfer_params":null,"input_messages":null,"output_messages":null},"sequence_number":37,"type":"response.completed"} + + ' + - ' + + ' + status_code: 200 diff --git a/crates/agentic-server-core/tests/cassettes/codex/codex-vllm-web-search-then-namespace-gpt-oss-20b-streaming.yaml b/crates/agentic-server-core/tests/cassettes/codex/codex-vllm-web-search-then-namespace-gpt-oss-20b-streaming.yaml new file mode 100644 index 0000000..13c4304 --- /dev/null +++ b/crates/agentic-server-core/tests/cassettes/codex/codex-vllm-web-search-then-namespace-gpt-oss-20b-streaming.yaml @@ -0,0 +1,553 @@ +turns: +- filename: t1 + request: + body: + input: Search the web for the latest Rust async news. Use the web_search tool. + max_output_tokens: 1024 + model: openai/gpt-oss-20b + store: true + stream: true + tools: + - description: Search the web for current information. + name: web_search + parameters: + properties: + query: + description: the search query + type: string + required: + - query + type: object + type: function + - description: Run a shell command via the mcp__shell namespace tool. + name: agentic_ns__mcp__shell__run + parameters: + properties: + command: + type: string + required: + - command + type: object + type: function + headers: + accept: '*/*' + 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_aca305fd1819d465","created_at":1783713376,"incomplete_details":null,"instructions":null,"metadata":null,"model":"openai/gpt-oss-20b","object":"response","output":[],"parallel_tool_calls":true,"temperature":1.0,"tool_choice":"auto","tools":[{"name":"web_search","parameters":{"type":"object","properties":{"query":{"type":"string","description":"the + search query"}},"required":["query"]},"strict":null,"type":"function","defer_loading":null,"description":"Search + the web for current information."},{"name":"agentic_ns__mcp__shell__run","parameters":{"type":"object","properties":{"command":{"type":"string"}},"required":["command"]},"strict":null,"type":"function","defer_loading":null,"description":"Run + a shell command via the mcp__shell namespace tool."}],"top_p":1.0,"background":false,"max_output_tokens":1024,"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,"input_messages":null,"output_messages":null},"sequence_number":0,"type":"response.created"} + + ' + - ' + + ' + - 'event: response.in_progress + + ' + - 'data: {"response":{"id":"resp_aca305fd1819d465","created_at":1783713376,"incomplete_details":null,"instructions":null,"metadata":null,"model":"openai/gpt-oss-20b","object":"response","output":[],"parallel_tool_calls":true,"temperature":1.0,"tool_choice":"auto","tools":[{"name":"web_search","parameters":{"type":"object","properties":{"query":{"type":"string","description":"the + search query"}},"required":["query"]},"strict":null,"type":"function","defer_loading":null,"description":"Search + the web for current information."},{"name":"agentic_ns__mcp__shell__run","parameters":{"type":"object","properties":{"command":{"type":"string"}},"required":["command"]},"strict":null,"type":"function","defer_loading":null,"description":"Run + a shell command via the mcp__shell namespace tool."}],"top_p":1.0,"background":false,"max_output_tokens":1024,"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,"input_messages":null,"output_messages":null},"sequence_number":1,"type":"response.in_progress"} + + ' + - ' + + ' + - 'event: response.output_item.added + + ' + - 'data: {"item":{"id":"msg_80d39229e6661001","summary":[],"type":"reasoning","content":null,"encrypted_content":null,"status":"in_progress"},"output_index":0,"sequence_number":2,"type":"response.output_item.added"} + + ' + - ' + + ' + - 'event: response.reasoning_part.added + + ' + - 'data: {"content_index":0,"item_id":"msg_80d39229e6661001","output_index":0,"part":{"text":"","type":"reasoning_text"},"sequence_number":3,"type":"response.reasoning_part.added"} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"content_index":0,"delta":"Need","item_id":"msg_80d39229e6661001","output_index":0,"sequence_number":4,"type":"response.reasoning_text.delta"} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"content_index":0,"delta":" to use web_search","item_id":"msg_80d39229e6661001","output_index":0,"sequence_number":5,"type":"response.reasoning_text.delta"} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"content_index":0,"delta":".","item_id":"msg_80d39229e6661001","output_index":0,"sequence_number":6,"type":"response.reasoning_text.delta"} + + ' + - ' + + ' + - 'event: response.reasoning_text.done + + ' + - 'data: {"content_index":0,"item_id":"msg_80d39229e6661001","output_index":0,"sequence_number":7,"text":"Need + to use web_search.","type":"response.reasoning_text.done"} + + ' + - ' + + ' + - 'event: response.reasoning_part.done + + ' + - 'data: {"content_index":0,"item_id":"msg_80d39229e6661001","output_index":0,"part":{"text":"Need + to use web_search.","type":"reasoning_text"},"sequence_number":8,"type":"response.reasoning_part.done"} + + ' + - ' + + ' + - 'event: response.output_item.done + + ' + - 'data: {"item":{"id":"msg_80d39229e6661001","summary":[],"type":"reasoning","content":[{"text":"Need + to use web_search.","type":"reasoning_text"}],"encrypted_content":null,"status":"completed"},"output_index":0,"sequence_number":9,"type":"response.output_item.done"} + + ' + - ' + + ' + - 'event: response.output_item.added + + ' + - 'data: {"item":{"arguments":"","call_id":"call_966ac832ff2c814e","name":"web_search","type":"function_call","id":"fc_9105bc40ba2a4559","namespace":null,"status":"in_progress"},"output_index":1,"sequence_number":10,"type":"response.output_item.added"} + + ' + - ' + + ' + - 'event: response.function_call_arguments.delta + + ' + - 'data: {"delta":"{\"","item_id":"fc_9105bc40ba2a4559","output_index":1,"sequence_number":11,"type":"response.function_call_arguments.delta"} + + ' + - ' + + ' + - 'event: response.function_call_arguments.delta + + ' + - 'data: {"delta":"query","item_id":"fc_9105bc40ba2a4559","output_index":1,"sequence_number":12,"type":"response.function_call_arguments.delta"} + + ' + - ' + + ' + - 'event: response.function_call_arguments.delta + + ' + - 'data: {"delta":"\":\"","item_id":"fc_9105bc40ba2a4559","output_index":1,"sequence_number":13,"type":"response.function_call_arguments.delta"} + + ' + - ' + + ' + - 'event: response.function_call_arguments.delta + + ' + - 'data: {"delta":"latest","item_id":"fc_9105bc40ba2a4559","output_index":1,"sequence_number":14,"type":"response.function_call_arguments.delta"} + + ' + - ' + + ' + - 'event: response.function_call_arguments.delta + + ' + - 'data: {"delta":" Rust","item_id":"fc_9105bc40ba2a4559","output_index":1,"sequence_number":15,"type":"response.function_call_arguments.delta"} + + ' + - ' + + ' + - 'event: response.function_call_arguments.delta + + ' + - 'data: {"delta":" async","item_id":"fc_9105bc40ba2a4559","output_index":1,"sequence_number":16,"type":"response.function_call_arguments.delta"} + + ' + - ' + + ' + - 'event: response.function_call_arguments.delta + + ' + - 'data: {"delta":" news","item_id":"fc_9105bc40ba2a4559","output_index":1,"sequence_number":17,"type":"response.function_call_arguments.delta"} + + ' + - ' + + ' + - 'event: response.function_call_arguments.delta + + ' + - 'data: {"delta":" ","item_id":"fc_9105bc40ba2a4559","output_index":1,"sequence_number":18,"type":"response.function_call_arguments.delta"} + + ' + - ' + + ' + - 'event: response.function_call_arguments.delta + + ' + - 'data: {"delta":"202","item_id":"fc_9105bc40ba2a4559","output_index":1,"sequence_number":19,"type":"response.function_call_arguments.delta"} + + ' + - ' + + ' + - 'event: response.function_call_arguments.delta + + ' + - 'data: {"delta":"6","item_id":"fc_9105bc40ba2a4559","output_index":1,"sequence_number":20,"type":"response.function_call_arguments.delta"} + + ' + - ' + + ' + - 'event: response.function_call_arguments.delta + + ' + - 'data: {"delta":"\"}","item_id":"fc_9105bc40ba2a4559","output_index":1,"sequence_number":21,"type":"response.function_call_arguments.delta"} + + ' + - ' + + ' + - 'event: response.function_call_arguments.done + + ' + - 'data: {"arguments":"{\"query\":\"latest Rust async news 2026\"}","item_id":"fc_9105bc40ba2a4559","name":"web_search","output_index":1,"sequence_number":22,"type":"response.function_call_arguments.done"} + + ' + - ' + + ' + - 'event: response.output_item.done + + ' + - 'data: {"item":{"arguments":"{\"query\":\"latest Rust async news 2026\"}","call_id":"call_966ac832ff2c814e","name":"web_search","type":"function_call","id":null,"namespace":null,"status":"completed","item_id":"fc_9105bc40ba2a4559","output_index":1,"sequence_number":-1},"output_index":1,"sequence_number":23,"type":"response.output_item.done"} + + ' + - ' + + ' + - 'event: response.completed + + ' + - 'data: {"response":{"id":"resp_aca305fd1819d465","created_at":1783713376,"incomplete_details":null,"instructions":null,"metadata":null,"model":"openai/gpt-oss-20b","object":"response","output":[{"id":"rs_a6b25e327dae8d0e","summary":[],"type":"reasoning","content":[{"text":"Need + to use web_search.","type":"reasoning_text"}],"encrypted_content":null,"status":null},{"arguments":"{\"query\":\"latest + Rust async news 2026\"}","call_id":"call_b327e643984ef757","name":"web_search","type":"function_call","id":"fc_b327e643984ef757","namespace":null,"status":null}],"parallel_tool_calls":true,"temperature":1.0,"tool_choice":"auto","tools":[{"name":"web_search","parameters":{"type":"object","properties":{"query":{"type":"string","description":"the + search query"}},"required":["query"]},"strict":null,"type":"function","defer_loading":null,"description":"Search + the web for current information."},{"name":"agentic_ns__mcp__shell__run","parameters":{"type":"object","properties":{"command":{"type":"string"}},"required":["command"]},"strict":null,"type":"function","defer_loading":null,"description":"Run + a shell command via the mcp__shell namespace tool."}],"top_p":1.0,"background":false,"max_output_tokens":1024,"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":176,"input_tokens_details":{"cached_tokens":80,"input_tokens_per_turn":[176],"cached_tokens_per_turn":[80]},"output_tokens":36,"output_tokens_details":{"reasoning_tokens":16,"tool_output_tokens":0,"output_tokens_per_turn":[36],"tool_output_tokens_per_turn":[0]},"total_tokens":212},"user":null,"presence_penalty":0.0,"frequency_penalty":0.0,"kv_transfer_params":null,"input_messages":null,"output_messages":null},"sequence_number":24,"type":"response.completed"} + + ' + - ' + + ' + status_code: 200 +- filename: t2 + request: + body: + input: + - call_id: call_b327e643984ef757 + output: '{"results":{"web":[{"url":"https://example.com/rust-async","title":"Rust + async guide","snippets":["Use async carefully."]}]},"metadata":{"query":"rust + async news"}}' + type: function_call_output + - content: Good. Now call agentic_ns__mcp__shell__run to run 'pwd'. + role: user + type: message + max_output_tokens: 1024 + model: openai/gpt-oss-20b + previous_response_id: resp_aca305fd1819d465 + store: true + stream: true + tools: + - description: Search the web for current information. + name: web_search + parameters: + properties: + query: + description: the search query + type: string + required: + - query + type: object + type: function + - description: Run a shell command via the mcp__shell namespace tool. + name: agentic_ns__mcp__shell__run + parameters: + properties: + command: + type: string + required: + - command + type: object + type: function + headers: + accept: '*/*' + 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_98d9ee595491b112","created_at":1783713377,"incomplete_details":null,"instructions":null,"metadata":null,"model":"openai/gpt-oss-20b","object":"response","output":[],"parallel_tool_calls":true,"temperature":1.0,"tool_choice":"auto","tools":[{"name":"web_search","parameters":{"type":"object","properties":{"query":{"type":"string","description":"the + search query"}},"required":["query"]},"strict":null,"type":"function","defer_loading":null,"description":"Search + the web for current information."},{"name":"agentic_ns__mcp__shell__run","parameters":{"type":"object","properties":{"command":{"type":"string"}},"required":["command"]},"strict":null,"type":"function","defer_loading":null,"description":"Run + a shell command via the mcp__shell namespace tool."}],"top_p":1.0,"background":false,"max_output_tokens":1024,"max_tool_calls":null,"previous_response_id":"resp_aca305fd1819d465","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,"input_messages":null,"output_messages":null},"sequence_number":0,"type":"response.created"} + + ' + - ' + + ' + - 'event: response.in_progress + + ' + - 'data: {"response":{"id":"resp_98d9ee595491b112","created_at":1783713377,"incomplete_details":null,"instructions":null,"metadata":null,"model":"openai/gpt-oss-20b","object":"response","output":[],"parallel_tool_calls":true,"temperature":1.0,"tool_choice":"auto","tools":[{"name":"web_search","parameters":{"type":"object","properties":{"query":{"type":"string","description":"the + search query"}},"required":["query"]},"strict":null,"type":"function","defer_loading":null,"description":"Search + the web for current information."},{"name":"agentic_ns__mcp__shell__run","parameters":{"type":"object","properties":{"command":{"type":"string"}},"required":["command"]},"strict":null,"type":"function","defer_loading":null,"description":"Run + a shell command via the mcp__shell namespace tool."}],"top_p":1.0,"background":false,"max_output_tokens":1024,"max_tool_calls":null,"previous_response_id":"resp_aca305fd1819d465","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,"input_messages":null,"output_messages":null},"sequence_number":1,"type":"response.in_progress"} + + ' + - ' + + ' + - 'event: response.output_item.added + + ' + - 'data: {"item":{"id":"msg_a1c8f00940c47a88","summary":[],"type":"reasoning","content":null,"encrypted_content":null,"status":"in_progress"},"output_index":0,"sequence_number":2,"type":"response.output_item.added"} + + ' + - ' + + ' + - 'event: response.reasoning_part.added + + ' + - 'data: {"content_index":0,"item_id":"msg_a1c8f00940c47a88","output_index":0,"part":{"text":"","type":"reasoning_text"},"sequence_number":3,"type":"response.reasoning_part.added"} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"content_index":0,"delta":"We","item_id":"msg_a1c8f00940c47a88","output_index":0,"sequence_number":4,"type":"response.reasoning_text.delta"} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"content_index":0,"delta":" need","item_id":"msg_a1c8f00940c47a88","output_index":0,"sequence_number":5,"type":"response.reasoning_text.delta"} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"content_index":0,"delta":" to","item_id":"msg_a1c8f00940c47a88","output_index":0,"sequence_number":6,"type":"response.reasoning_text.delta"} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"content_index":0,"delta":" invoke","item_id":"msg_a1c8f00940c47a88","output_index":0,"sequence_number":7,"type":"response.reasoning_text.delta"} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"content_index":0,"delta":" that","item_id":"msg_a1c8f00940c47a88","output_index":0,"sequence_number":8,"type":"response.reasoning_text.delta"} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"content_index":0,"delta":" tool","item_id":"msg_a1c8f00940c47a88","output_index":0,"sequence_number":9,"type":"response.reasoning_text.delta"} + + ' + - ' + + ' + - 'event: response.reasoning_text.delta + + ' + - 'data: {"content_index":0,"delta":".","item_id":"msg_a1c8f00940c47a88","output_index":0,"sequence_number":10,"type":"response.reasoning_text.delta"} + + ' + - ' + + ' + - 'event: response.reasoning_text.done + + ' + - 'data: {"content_index":0,"item_id":"msg_a1c8f00940c47a88","output_index":0,"sequence_number":11,"text":"We + need to invoke that tool.","type":"response.reasoning_text.done"} + + ' + - ' + + ' + - 'event: response.reasoning_part.done + + ' + - 'data: {"content_index":0,"item_id":"msg_a1c8f00940c47a88","output_index":0,"part":{"text":"We + need to invoke that tool.","type":"reasoning_text"},"sequence_number":12,"type":"response.reasoning_part.done"} + + ' + - ' + + ' + - 'event: response.output_item.done + + ' + - 'data: {"item":{"id":"msg_a1c8f00940c47a88","summary":[],"type":"reasoning","content":[{"text":"We + need to invoke that tool.","type":"reasoning_text"}],"encrypted_content":null,"status":"completed"},"output_index":0,"sequence_number":13,"type":"response.output_item.done"} + + ' + - ' + + ' + - 'event: response.output_item.added + + ' + - 'data: {"item":{"arguments":"","call_id":"call_9141adfc3ce26ab7","name":"agentic_ns__mcp__shell__run","type":"function_call","id":"fc_9a29506a05398e47","namespace":null,"status":"in_progress"},"output_index":1,"sequence_number":14,"type":"response.output_item.added"} + + ' + - ' + + ' + - 'event: response.function_call_arguments.delta + + ' + - 'data: {"delta":"{\"","item_id":"fc_9a29506a05398e47","output_index":1,"sequence_number":15,"type":"response.function_call_arguments.delta"} + + ' + - ' + + ' + - 'event: response.function_call_arguments.delta + + ' + - 'data: {"delta":"command","item_id":"fc_9a29506a05398e47","output_index":1,"sequence_number":16,"type":"response.function_call_arguments.delta"} + + ' + - ' + + ' + - 'event: response.function_call_arguments.delta + + ' + - 'data: {"delta":"\":\"","item_id":"fc_9a29506a05398e47","output_index":1,"sequence_number":17,"type":"response.function_call_arguments.delta"} + + ' + - ' + + ' + - 'event: response.function_call_arguments.delta + + ' + - 'data: {"delta":"pwd","item_id":"fc_9a29506a05398e47","output_index":1,"sequence_number":18,"type":"response.function_call_arguments.delta"} + + ' + - ' + + ' + - 'event: response.function_call_arguments.delta + + ' + - 'data: {"delta":"\"}","item_id":"fc_9a29506a05398e47","output_index":1,"sequence_number":19,"type":"response.function_call_arguments.delta"} + + ' + - ' + + ' + - 'event: response.function_call_arguments.done + + ' + - 'data: {"arguments":"{\"command\":\"pwd\"}","item_id":"fc_9a29506a05398e47","name":"agentic_ns__mcp__shell__run","output_index":1,"sequence_number":20,"type":"response.function_call_arguments.done"} + + ' + - ' + + ' + - 'event: response.output_item.done + + ' + - 'data: {"item":{"arguments":"{\"command\":\"pwd\"}","call_id":"call_9141adfc3ce26ab7","name":"agentic_ns__mcp__shell__run","type":"function_call","id":null,"namespace":null,"status":"completed","item_id":"fc_9a29506a05398e47","output_index":1,"sequence_number":-1},"output_index":1,"sequence_number":21,"type":"response.output_item.done"} + + ' + - ' + + ' + - 'event: response.completed + + ' + - 'data: {"response":{"id":"resp_98d9ee595491b112","created_at":1783713377,"incomplete_details":null,"instructions":null,"metadata":null,"model":"openai/gpt-oss-20b","object":"response","output":[{"id":"rs_933e2dac0ee5d976","summary":[],"type":"reasoning","content":[{"text":"We + need to invoke that tool.","type":"reasoning_text"}],"encrypted_content":null,"status":null},{"arguments":"{\"command\":\"pwd\"}","call_id":"call_adcaba79614326ee","name":"agentic_ns__mcp__shell__run","type":"function_call","id":"fc_adcaba79614326ee","namespace":null,"status":null}],"parallel_tool_calls":true,"temperature":1.0,"tool_choice":"auto","tools":[{"name":"web_search","parameters":{"type":"object","properties":{"query":{"type":"string","description":"the + search query"}},"required":["query"]},"strict":null,"type":"function","defer_loading":null,"description":"Search + the web for current information."},{"name":"agentic_ns__mcp__shell__run","parameters":{"type":"object","properties":{"command":{"type":"string"}},"required":["command"]},"strict":null,"type":"function","defer_loading":null,"description":"Run + a shell command via the mcp__shell namespace tool."}],"top_p":1.0,"background":false,"max_output_tokens":1024,"max_tool_calls":null,"previous_response_id":"resp_aca305fd1819d465","prompt":null,"reasoning":null,"service_tier":"auto","status":"completed","text":null,"top_logprobs":null,"truncation":"disabled","usage":{"input_tokens":291,"input_tokens_details":{"cached_tokens":176,"input_tokens_per_turn":[291],"cached_tokens_per_turn":[176]},"output_tokens":39,"output_tokens_details":{"reasoning_tokens":14,"tool_output_tokens":0,"output_tokens_per_turn":[39],"tool_output_tokens_per_turn":[0]},"total_tokens":330},"user":null,"presence_penalty":0.0,"frequency_penalty":0.0,"kv_transfer_params":null,"input_messages":null,"output_messages":null},"sequence_number":22,"type":"response.completed"} + + ' + - ' + + ' + status_code: 200 diff --git a/crates/agentic-server-core/tests/cassettes/tool_calls/multi_turn/gateway_web_search_then_codex_namespace.yaml b/crates/agentic-server-core/tests/cassettes/tool_calls/multi_turn/gateway_web_search_then_codex_namespace.yaml deleted file mode 100644 index e25820b..0000000 --- a/crates/agentic-server-core/tests/cassettes/tool_calls/multi_turn/gateway_web_search_then_codex_namespace.yaml +++ /dev/null @@ -1,65 +0,0 @@ -# Composed multi-turn cassette for the gateway tool loop integration test. -# -# Turn 0 body is a recorded-shape gateway `web_search` function call (the tool -# the gateway executes server-side). Turn 1 body is the flat, model-visible -# Codex namespace call `agentic_ns__mcp__agentic_fixture__add_numbers` (the same -# flattened form as cassettes/codex/tools/direct_vllm_flat_namespace_tool.json), -# which the loop restores to `{namespace, name}` and hands back to the client. -# -# Driven by dispatch_loop_cassette_test.rs:: -# openai_gateway_web_search_then_codex_namespace_across_turns -turns: - - filename: t0 - request: - body: - input: search then add - method: POST - path: /v1/responses - response: - status_code: 200 - body: - id: resp_ws_0 - object: response - created_at: 0 - model: test-model - status: completed - output: - - id: fc_ws - type: function_call - call_id: call_ws - name: web_search - arguments: '{"query":"rust async"}' - status: completed - usage: null - incomplete_details: null - error: null - previous_response_id: null - conversation_id: null - instructions: null - - filename: t1 - request: - body: - input: continue - method: POST - path: /v1/responses - response: - status_code: 200 - body: - id: resp_ns_1 - object: response - created_at: 0 - model: test-model - status: completed - output: - - id: fc_ns - type: function_call - call_id: call_ns - name: agentic_ns__mcp__agentic_fixture__add_numbers - arguments: '{"numbers":[8,0]}' - status: completed - usage: null - incomplete_details: null - error: null - previous_response_id: resp_ws_0 - conversation_id: null - instructions: null diff --git a/crates/agentic-server-core/tests/dispatch_loop_cassette_test.rs b/crates/agentic-server-core/tests/dispatch_loop_cassette_test.rs index 4a99ffb..a0a5a4e 100644 --- a/crates/agentic-server-core/tests/dispatch_loop_cassette_test.rs +++ b/crates/agentic-server-core/tests/dispatch_loop_cassette_test.rs @@ -21,19 +21,28 @@ use agentic_core::types::io::{OutputItem, ResponsesInput}; use agentic_core::types::request_response::RequestPayload; use agentic_core::types::tools::ResponsesTool; use either::Either; +use futures::StreamExt; mod support; -const MULTI_TURN_DIR: &str = concat!(env!("CARGO_MANIFEST_DIR"), "/tests/cassettes/tool_calls/multi_turn"); +const CASSETTE_DIR: &str = concat!(env!("CARGO_MANIFEST_DIR"), "/tests/cassettes"); -/// Load turn N (0-based) response body from a multi-turn cassette as a mock -/// JSON response for the LLM `MockServer`. +/// Load turn N (0-based) response from a multi-turn cassette under +/// `tests/cassettes/tool_calls/multi_turn` as a mock response for the LLM +/// `MockServer`. /// /// Uses a permissive local parser (input typed as `Value`) rather than the /// shared strict `Cassette` — these `OpenAI` cassettes carry array-valued `input` /// on later turns, which the shared string-typed loader rejects. We only need -/// the response body, so the request shape is irrelevant here. +/// the response, so the request shape is irrelevant here. fn cassette_turn(filename: &str, turn: usize) -> support::MockResponse { + cassette_turn_at(&format!("tool_calls/multi_turn/{filename}"), turn) +} + +/// Same as [`cassette_turn`] but takes a path relative to `tests/cassettes`, so +/// recordings outside `tool_calls/multi_turn` (e.g. `codex/…`) can be replayed +/// through the loop too. +fn cassette_turn_at(rel_path: &str, turn: usize) -> support::MockResponse { use serde::Deserialize; #[derive(Deserialize)] @@ -52,14 +61,14 @@ fn cassette_turn(filename: &str, turn: usize) -> support::MockResponse { sse: Option>, } - let path = format!("{MULTI_TURN_DIR}/{filename}"); + let path = format!("{CASSETTE_DIR}/{rel_path}"); let text = std::fs::read_to_string(&path).unwrap_or_else(|e| panic!("read {path}: {e}")); let doc: Doc = serde_yaml::from_str(&text).unwrap_or_else(|e| panic!("parse {path}: {e}")); let resp = doc .turns .into_iter() .nth(turn) - .unwrap_or_else(|| panic!("cassette {filename} missing turn {turn}")) + .unwrap_or_else(|| panic!("cassette {rel_path} missing turn {turn}")) .response; if let Some(body) = resp.body { @@ -67,7 +76,7 @@ fn cassette_turn(filename: &str, turn: usize) -> support::MockResponse { } else if let Some(sse) = resp.sse { support::MockResponse::Sse(sse.join("")) } else { - panic!("cassette {filename} turn {turn} has neither body nor sse"); + panic!("cassette {rel_path} turn {turn} has neither body nor sse"); } } @@ -223,22 +232,21 @@ async fn openai_mixed_gateway_and_client_owned_hands_back_after_gateway_exec() { ); } -/// A gateway `web_search` turn followed by a Codex `namespace` turn, driven -/// through the loop as one conversation (per @maralbahari's review ask on #83). +/// Drive a real recorded 2-turn cassette (gateway `web_search` turn then a Codex +/// `namespace` turn) through the streaming loop and assert the end-to-end +/// behavior — shared by the `OpenAI` and `vLLM` backend recordings. /// /// Round 0: the model emits a gateway-owned `web_search` call → the loop /// executes it against the You.com mock and continues. Round 1: the model emits -/// the flat, model-visible namespace call -/// `agentic_ns__mcp__agentic_fixture__add_numbers` → the loop restores it to -/// `{namespace: "mcp__agentic_fixture", name: "add_numbers"}`, classifies it as -/// client-owned, and hands the turn back (`RequiresClientAction`). Two model -/// calls total; the namespace call is returned restored, never flattened. -#[tokio::test] -async fn openai_gateway_web_search_then_codex_namespace_across_turns() { +/// the flat, model-visible `agentic_ns__mcp__shell__run` → the loop restores it +/// to `{namespace: "mcp__shell", name: "run"}`, classifies it client-owned, and +/// hands the turn back (`RequiresClientAction`). Two model calls total; the +/// namespace call is returned restored, never flattened. +async fn assert_web_search_then_namespace(cassette_rel_path: &str) { let (you_url, mut captured_you, _you_handle) = spawn_mock_you().await; let llm = support::MockServer::start_deque(vec![ - cassette_turn("gateway_web_search_then_codex_namespace.yaml", 0), - cassette_turn("gateway_web_search_then_codex_namespace.yaml", 1), + cassette_turn_at(cassette_rel_path, 0), + cassette_turn_at(cassette_rel_path, 1), ]) .await; let exec_ctx = build_exec_ctx_with_web_search(llm.url(), &you_url).await; @@ -246,21 +254,21 @@ async fn openai_gateway_web_search_then_codex_namespace_across_turns() { let web_search: ResponsesTool = serde_json::from_value(serde_json::json!({"type": "web_search_preview"})).unwrap(); let codex_namespace: ResponsesTool = serde_json::from_value(serde_json::json!({ "type": "namespace", - "name": "mcp__agentic_fixture", - "tools": [{"type": "function", "name": "add_numbers", "parameters": {"type": "object"}}] + "name": "mcp__shell", + "tools": [{"type": "function", "name": "run", "parameters": {"type": "object"}}] })) .unwrap(); - let result = ExecuteRequest::new( - request("search then add", Some(vec![web_search, codex_namespace])), - exec_ctx, - ) - .run() - .await - .expect("execute should succeed"); - let Either::Left(response) = result else { - panic!("non-streaming request should return a payload"); + let mut payload = request("search then run pwd", Some(vec![web_search, codex_namespace])); + payload.stream = true; + let result = ExecuteRequest::new(payload, exec_ctx) + .run() + .await + .expect("execute should succeed"); + let Either::Right(stream) = result else { + panic!("streaming request should return a stream"); }; + let chunks: Vec = stream.collect().await; // Round 0 executed the gateway web_search against the You.com mock, then // round 1 emitted the namespace call — two model calls in one conversation. @@ -272,26 +280,218 @@ async fn openai_gateway_web_search_then_codex_namespace_across_turns() { "gateway round + client-action round" ); - // The namespace call is handed back restored to {namespace, name}, never - // the flat model-visible name. - let output = serde_json::to_value(&response.output).unwrap(); - let items = output.as_array().unwrap(); + let events: Vec = chunks + .iter() + .filter_map(|chunk| { + let data = chunk.trim_end_matches('\n').strip_prefix("data: ")?; + (data != "[DONE]").then(|| serde_json::from_str(data).ok())? + }) + .collect(); + + // The gateway web_search surfaced as public web_search_call lifecycle events; + // its raw function call never leaked to the client. + let event_types: Vec<&str> = events.iter().filter_map(|e| e["type"].as_str()).collect(); + assert!( + event_types.contains(&"response.web_search_call.completed"), + "gateway web_search should emit its public lifecycle events; got {event_types:?}" + ); + assert!( + !events + .iter() + .any(|e| e["item"]["type"] == "function_call" && e["item"]["name"] == "web_search"), + "internal web_search function call must not be forwarded" + ); + + // The terminal response hands back the namespace call restored to + // {namespace, name}, never the flat model-visible name. + let terminal = events + .iter() + .rev() + .find_map(|e| e.get("response").filter(|r| r.get("output").is_some())) + .expect("stream should include a terminal response payload"); + let items = terminal["output"].as_array().unwrap(); let ns_call = items .iter() - .find(|it| it["type"] == "function_call" && it["call_id"] == "call_ns") + .find(|it| it["type"] == "function_call" && it["namespace"] == "mcp__shell") .expect("namespace call handed back to the client"); - assert_eq!(ns_call["name"], "add_numbers", "flat name restored to member name"); - assert_eq!(ns_call["namespace"], "mcp__agentic_fixture", "namespace restored"); + assert_eq!(ns_call["name"], "run", "flat name restored to member name"); + assert!( + !items.iter().any(|it| it["name"] == "agentic_ns__mcp__shell__run"), + "flat namespaced name must not leak to the client" + ); + assert!( + items.iter().any(|it| it["type"] == "web_search_call"), + "web_search resolved into a public web_search_call: {terminal:#}" + ); +} + +/// Real recorded **`OpenAI`** (`gpt-4o`) traffic through the mixed +/// gateway-plus-namespace flow. Both turns are typed incremental SSE. +#[tokio::test] +async fn openai_gateway_web_search_then_codex_namespace_across_turns() { + assert_web_search_then_namespace("codex/codex-openai-web-search-then-namespace-gpt-4o-streaming.yaml").await; +} + +/// Real recorded **vLLM** (`openai/gpt-oss-20b`) traffic through the same flow — +/// backend parity with the `OpenAI` recording (mirrors the dual-backend approach +/// in PR #77). +#[tokio::test] +async fn vllm_gateway_web_search_then_codex_namespace_across_turns() { + assert_web_search_then_namespace("codex/codex-vllm-web-search-then-namespace-gpt-oss-20b-streaming.yaml").await; +} + +/// Drive a real recorded 3-turn cassette where the model calls the gateway +/// `web_search` tool on two consecutive turns before answering. This is the only +/// coverage of the loop's `Continue` decision firing **more than once**: round 0 +/// and round 1 both dispatch a gateway call and loop, round 2 returns a message +/// so the loop terminates `Done`. Three model calls, two You.com executions. +async fn assert_multi_round_web_search(cassette_rel_path: &str) { + let (you_url, mut captured_you, _you_handle) = spawn_mock_you().await; + let llm = support::MockServer::start_deque(vec![ + cassette_turn_at(cassette_rel_path, 0), + cassette_turn_at(cassette_rel_path, 1), + cassette_turn_at(cassette_rel_path, 2), + ]) + .await; + let exec_ctx = build_exec_ctx_with_web_search(llm.url(), &you_url).await; + + let web_search: ResponsesTool = serde_json::from_value(serde_json::json!({"type": "web_search_preview"})).unwrap(); + let mut payload = request("research rust async", Some(vec![web_search])); + payload.stream = true; + let result = ExecuteRequest::new(payload, exec_ctx) + .run() + .await + .expect("execute should succeed"); + let Either::Right(stream) = result else { + panic!("streaming request should return a stream"); + }; + let chunks: Vec = stream.collect().await; + + // Two gateway web_search executions (rounds 0 and 1), three model calls total + // (the loop continued twice, then the model answered). + let first = captured_you.recv().await.expect("first web_search should hit You.com"); + assert!(first.body.get("query").is_some(), "round-0 web_search executed"); + let second = captured_you.recv().await.expect("second web_search should hit You.com"); + assert!(second.body.get("query").is_some(), "round-1 web_search executed"); + assert_eq!( + llm.request_bodies().await.len(), + 3, + "two Continue rounds + a final answering round" + ); + + let events: Vec = chunks + .iter() + .filter_map(|chunk| { + let data = chunk.trim_end_matches('\n').strip_prefix("data: ")?; + (data != "[DONE]").then(|| serde_json::from_str(data).ok())? + }) + .collect(); + // Both gateway calls surfaced as public web_search_call items in the terminal + // response; the final turn produced a message. + let terminal = events + .iter() + .rev() + .find_map(|e| e.get("response").filter(|r| r.get("output").is_some())) + .expect("stream should include a terminal response payload"); + let items = terminal["output"].as_array().unwrap(); + let searches = items.iter().filter(|it| it["type"] == "web_search_call").count(); + assert_eq!(searches, 2, "both gateway searches recorded on output: {terminal:#}"); + assert!( + items.iter().any(|it| it["type"] == "message"), + "final turn produced a message" + ); assert!( !items .iter() - .any(|it| it["name"] == "agentic_ns__mcp__agentic_fixture__add_numbers"), - "flat namespaced name must not leak to the client" + .any(|it| it["type"] == "function_call" && it["name"] == "web_search"), + "raw web_search function calls must stay internal" + ); +} + +/// Real recorded **`OpenAI`** (`gpt-4o`) multi-round gateway loop. +#[tokio::test] +async fn openai_multi_round_web_search_loops_then_answers() { + assert_multi_round_web_search("codex/codex-openai-multi-round-web-search-gpt-4o-streaming.yaml").await; +} + +/// Real recorded **vLLM** (`openai/gpt-oss-20b`) multi-round gateway loop — +/// backend parity. +#[tokio::test] +async fn vllm_multi_round_web_search_loops_then_answers() { + assert_multi_round_web_search("codex/codex-vllm-multi-round-web-search-gpt-oss-20b-streaming.yaml").await; +} + +/// Real recorded **OpenAI** (`gpt-4o`) turn that emits a gateway `web_search` +/// call **and** a Codex namespace call in a *single* model output. The loop +/// executes the gateway call and, because a client-owned call is also present, +/// hands the turn back (`RequiresClientAction`) in one round — the gateway +/// result is recorded alongside the restored namespace call. gpt-oss does not +/// emit both tools in one turn, so this path is `OpenAI`-only. +#[tokio::test] +async fn openai_web_search_and_namespace_same_turn_hands_back_in_one_round() { + let (you_url, mut captured_you, _you_handle) = spawn_mock_you().await; + let llm = support::MockServer::start_deque(vec![cassette_turn_at( + "codex/codex-openai-web-search-and-namespace-same-turn-gpt-4o-streaming.yaml", + 0, + )]) + .await; + let exec_ctx = build_exec_ctx_with_web_search(llm.url(), &you_url).await; + + let web_search: ResponsesTool = serde_json::from_value(serde_json::json!({"type": "web_search_preview"})).unwrap(); + let codex_namespace: ResponsesTool = serde_json::from_value(serde_json::json!({ + "type": "namespace", + "name": "mcp__shell", + "tools": [{"type": "function", "name": "run", "parameters": {"type": "object"}}] + })) + .unwrap(); + let mut payload = request("search and run pwd together", Some(vec![web_search, codex_namespace])); + payload.stream = true; + let result = ExecuteRequest::new(payload, exec_ctx) + .run() + .await + .expect("execute should succeed"); + let Either::Right(stream) = result else { + panic!("streaming request should return a stream"); + }; + let chunks: Vec = stream.collect().await; + + // The gateway web_search executed this turn, and the turn ended in ONE model + // call (no loop-back) because a client-owned namespace call was also present. + let search = captured_you.recv().await.expect("web_search should hit You.com"); + assert!(search.body.get("query").is_some(), "web_search executed with a query"); + assert_eq!( + llm.request_bodies().await.len(), + 1, + "mixed turn hands back immediately — no second model call" ); - // The gateway web_search surfaced as a public web_search_call, not a raw fn. + + let events: Vec = chunks + .iter() + .filter_map(|chunk| { + let data = chunk.trim_end_matches('\n').strip_prefix("data: ")?; + (data != "[DONE]").then(|| serde_json::from_str(data).ok())? + }) + .collect(); + let terminal = events + .iter() + .rev() + .find_map(|e| e.get("response").filter(|r| r.get("output").is_some())) + .expect("stream should include a terminal response payload"); + let items = terminal["output"].as_array().unwrap(); + // Gateway call resolved to a public web_search_call... assert!( items.iter().any(|it| it["type"] == "web_search_call"), - "web_search resolved into a public web_search_call: {output:#}" + "web_search resolved into a public web_search_call: {terminal:#}" + ); + // ...and the namespace call handed back restored to {namespace, name}. + let ns_call = items + .iter() + .find(|it| it["type"] == "function_call" && it["namespace"] == "mcp__shell") + .expect("namespace call handed back to the client"); + assert_eq!(ns_call["name"], "run", "flat name restored to member name"); + assert!( + !items.iter().any(|it| it["name"] == "agentic_ns__mcp__shell__run"), + "flat namespaced name must not leak to the client" ); }