diff --git a/lib/crewai/tests/cassettes/agents/TestAnthropicNativeToolCalling.test_anthropic_agent_with_native_tool_calling.yaml b/lib/crewai/tests/cassettes/agents/TestAnthropicNativeToolCalling.test_anthropic_agent_with_native_tool_calling.yaml index 4794ec4db..6783a8e27 100644 --- a/lib/crewai/tests/cassettes/agents/TestAnthropicNativeToolCalling.test_anthropic_agent_with_native_tool_calling.yaml +++ b/lib/crewai/tests/cassettes/agents/TestAnthropicNativeToolCalling.test_anthropic_agent_with_native_tool_calling.yaml @@ -6,7 +6,9 @@ interactions: the final answer, not a summary.\n\nThis is VERY important to you, your job depends on it!"}],"model":"claude-3-5-haiku-20241022","stop_sequences":["\nObservation:"],"stream":false,"system":"You are Math Assistant. You are a helpful math assistant.\nYour personal goal is: - Help users with mathematical calculations"}' + Help users with mathematical calculations","tools":[{"name":"calculator","description":"Perform + mathematical calculations. Use this for any math operations.","input_schema":{"properties":{"expression":{"description":"Mathematical + expression to evaluate","title":"Expression","type":"string"}},"required":["expression"],"type":"object"}}]}' headers: User-Agent: - X-USER-AGENT-XXX @@ -19,7 +21,7 @@ interactions: connection: - keep-alive content-length: - - '548' + - '843' content-type: - application/json host: @@ -48,7 +50,9 @@ interactions: uri: https://api.anthropic.com/v1/messages response: body: - string: '{"model":"claude-3-5-haiku-20241022","id":"msg_01RVZdv4eF4cFt5DEYngV3fG","type":"message","role":"assistant","content":[{"type":"text","text":"120"}],"stop_reason":"end_turn","stop_sequence":null,"usage":{"input_tokens":93,"cache_creation_input_tokens":0,"cache_read_input_tokens":0,"cache_creation":{"ephemeral_5m_input_tokens":0,"ephemeral_1h_input_tokens":0},"output_tokens":5,"service_tier":"standard"}}' + string: '{"model":"claude-3-5-haiku-20241022","id":"msg_01LSVvqetDPhsHTrx63GXNEF","type":"message","role":"assistant","content":[{"type":"text","text":"I''ll + help you calculate 15 * 8 using the calculator tool."},{"type":"tool_use","id":"toolu_012QnA8xTpf27BLo6rkdvpoe","name":"calculator","input":{"expression":"15 + * 8"}}],"stop_reason":"tool_use","stop_sequence":null,"usage":{"input_tokens":430,"cache_creation_input_tokens":0,"cache_read_input_tokens":0,"cache_creation":{"ephemeral_5m_input_tokens":0,"ephemeral_1h_input_tokens":0},"output_tokens":73,"service_tier":"standard"}}' headers: CF-RAY: - CF-RAY-XXX @@ -57,7 +61,7 @@ interactions: Content-Type: - application/json Date: - - Wed, 21 Jan 2026 22:14:30 GMT + - Thu, 22 Jan 2026 20:40:57 GMT Server: - cloudflare Transfer-Encoding: @@ -83,7 +87,7 @@ interactions: anthropic-ratelimit-requests-remaining: - '3999' anthropic-ratelimit-requests-reset: - - '2026-01-21T22:14:29Z' + - '2026-01-22T20:40:56Z' anthropic-ratelimit-tokens-limit: - ANTHROPIC-RATELIMIT-TOKENS-LIMIT-XXX anthropic-ratelimit-tokens-remaining: @@ -97,7 +101,115 @@ interactions: strict-transport-security: - STS-XXX x-envoy-upstream-service-time: - - '547' + - '1600' + status: + code: 200 + message: OK +- request: + body: '{"max_tokens":4096,"messages":[{"role":"user","content":"\nCurrent Task: + Calculate what is 15 * 8\n\nThis is the expected criteria for your final answer: + The result of the calculation\nyou MUST return the actual complete content as + the final answer, not a summary.\n\nThis is VERY important to you, your job + depends on it!"},{"role":"assistant","content":[{"type":"tool_use","id":"toolu_012QnA8xTpf27BLo6rkdvpoe","name":"calculator","input":{"expression":"15 + * 8"}}]},{"role":"user","content":[{"type":"tool_result","tool_use_id":"toolu_012QnA8xTpf27BLo6rkdvpoe","content":"The + result of 15 * 8 is 120"}]},{"role":"user","content":"Analyze the tool result. + If requirements are met, provide the Final Answer. Otherwise, call the next + tool. Deliver only the answer without meta-commentary."}],"model":"claude-3-5-haiku-20241022","stop_sequences":["\nObservation:"],"stream":false,"system":"You + are Math Assistant. You are a helpful math assistant.\nYour personal goal is: + Help users with mathematical calculations","tools":[{"name":"calculator","description":"Perform + mathematical calculations. Use this for any math operations.","input_schema":{"properties":{"expression":{"description":"Mathematical + expression to evaluate","title":"Expression","type":"string"}},"required":["expression"],"type":"object"}}]}' + headers: + User-Agent: + - X-USER-AGENT-XXX + accept: + - application/json + accept-encoding: + - ACCEPT-ENCODING-XXX + anthropic-version: + - '2023-06-01' + connection: + - keep-alive + content-length: + - '1308' + content-type: + - application/json + host: + - api.anthropic.com + x-api-key: + - X-API-KEY-XXX + x-stainless-arch: + - X-STAINLESS-ARCH-XXX + x-stainless-async: + - 'false' + x-stainless-lang: + - python + x-stainless-os: + - X-STAINLESS-OS-XXX + x-stainless-package-version: + - 0.71.1 + x-stainless-retry-count: + - '0' + x-stainless-runtime: + - CPython + x-stainless-runtime-version: + - 3.13.3 + x-stainless-timeout: + - NOT_GIVEN + method: POST + uri: https://api.anthropic.com/v1/messages + response: + body: + string: '{"model":"claude-3-5-haiku-20241022","id":"msg_013hgHovrkRNhPGHTzJXdT3c","type":"message","role":"assistant","content":[{"type":"text","text":"120"}],"stop_reason":"end_turn","stop_sequence":null,"usage":{"input_tokens":549,"cache_creation_input_tokens":0,"cache_read_input_tokens":0,"cache_creation":{"ephemeral_5m_input_tokens":0,"ephemeral_1h_input_tokens":0},"output_tokens":5,"service_tier":"standard"}}' + headers: + CF-RAY: + - CF-RAY-XXX + Connection: + - keep-alive + Content-Type: + - application/json + Date: + - Thu, 22 Jan 2026 20:40:58 GMT + Server: + - cloudflare + Transfer-Encoding: + - chunked + X-Robots-Tag: + - none + anthropic-organization-id: + - ANTHROPIC-ORGANIZATION-ID-XXX + anthropic-ratelimit-input-tokens-limit: + - ANTHROPIC-RATELIMIT-INPUT-TOKENS-LIMIT-XXX + anthropic-ratelimit-input-tokens-remaining: + - ANTHROPIC-RATELIMIT-INPUT-TOKENS-REMAINING-XXX + anthropic-ratelimit-input-tokens-reset: + - ANTHROPIC-RATELIMIT-INPUT-TOKENS-RESET-XXX + anthropic-ratelimit-output-tokens-limit: + - ANTHROPIC-RATELIMIT-OUTPUT-TOKENS-LIMIT-XXX + anthropic-ratelimit-output-tokens-remaining: + - ANTHROPIC-RATELIMIT-OUTPUT-TOKENS-REMAINING-XXX + anthropic-ratelimit-output-tokens-reset: + - ANTHROPIC-RATELIMIT-OUTPUT-TOKENS-RESET-XXX + anthropic-ratelimit-requests-limit: + - '4000' + anthropic-ratelimit-requests-remaining: + - '3999' + anthropic-ratelimit-requests-reset: + - '2026-01-22T20:40:57Z' + anthropic-ratelimit-tokens-limit: + - ANTHROPIC-RATELIMIT-TOKENS-LIMIT-XXX + anthropic-ratelimit-tokens-remaining: + - ANTHROPIC-RATELIMIT-TOKENS-REMAINING-XXX + anthropic-ratelimit-tokens-reset: + - ANTHROPIC-RATELIMIT-TOKENS-RESET-XXX + cf-cache-status: + - DYNAMIC + request-id: + - REQUEST-ID-XXX + strict-transport-security: + - STS-XXX + x-envoy-upstream-service-time: + - '643' status: code: 200 message: OK diff --git a/lib/crewai/tests/cassettes/agents/TestAzureNativeToolCalling.test_azure_agent_with_native_tool_calling.yaml b/lib/crewai/tests/cassettes/agents/TestAzureNativeToolCalling.test_azure_agent_with_native_tool_calling.yaml index a94b6d476..28317ae56 100644 --- a/lib/crewai/tests/cassettes/agents/TestAzureNativeToolCalling.test_azure_agent_with_native_tool_calling.yaml +++ b/lib/crewai/tests/cassettes/agents/TestAzureNativeToolCalling.test_azure_agent_with_native_tool_calling.yaml @@ -36,7 +36,7 @@ interactions: response: body: string: '{"choices":[{"content_filter_results":{},"finish_reason":"tool_calls","index":0,"logprobs":null,"message":{"annotations":[],"content":null,"refusal":null,"role":"assistant","tool_calls":[{"function":{"arguments":"{\"expression\":\"15 - * 8\"}","name":"calculator"},"id":"call_Yi1jLnBybYT0S0bUK5TpHCGu","type":"function"}]}}],"created":1769101647,"id":"chatcmpl-D0sRTcJ5t52ASXArRpWVmuO7Klc3p","model":"gpt-4o-mini-2024-07-18","object":"chat.completion","prompt_filter_results":[{"prompt_index":0,"content_filter_results":{"hate":{"filtered":false,"severity":"safe"},"jailbreak":{"filtered":false,"detected":false},"self_harm":{"filtered":false,"severity":"safe"},"sexual":{"filtered":false,"severity":"safe"},"violence":{"filtered":false,"severity":"safe"}}}],"system_fingerprint":"fp_f97eff32c5","usage":{"completion_tokens":18,"completion_tokens_details":{"accepted_prediction_tokens":0,"audio_tokens":0,"reasoning_tokens":0,"rejected_prediction_tokens":0},"prompt_tokens":137,"prompt_tokens_details":{"audio_tokens":0,"cached_tokens":0},"total_tokens":155}} + * 8\"}","name":"calculator"},"id":"call_2aHLt8GoA1JBXMNQ70FHRTU1","type":"function"}]}}],"created":1769114233,"id":"chatcmpl-D0viTWl5nID0B4l2I1XruKwmMxxPu","model":"gpt-4o-mini-2024-07-18","object":"chat.completion","prompt_filter_results":[{"prompt_index":0,"content_filter_results":{"hate":{"filtered":false,"severity":"safe"},"jailbreak":{"filtered":false,"detected":false},"self_harm":{"filtered":false,"severity":"safe"},"sexual":{"filtered":false,"severity":"safe"},"violence":{"filtered":false,"severity":"safe"}}}],"system_fingerprint":"fp_f97eff32c5","usage":{"completion_tokens":18,"completion_tokens_details":{"accepted_prediction_tokens":0,"audio_tokens":0,"reasoning_tokens":0,"rejected_prediction_tokens":0},"prompt_tokens":137,"prompt_tokens_details":{"audio_tokens":0,"cached_tokens":0},"total_tokens":155}} ' headers: @@ -45,7 +45,7 @@ interactions: Content-Type: - application/json Date: - - Thu, 22 Jan 2026 17:07:26 GMT + - Thu, 22 Jan 2026 20:37:12 GMT Strict-Transport-Security: - STS-XXX apim-request-id: @@ -84,9 +84,9 @@ interactions: is 15 * 8\n\nThis is the expected criteria for your final answer: The result of the calculation\nyou MUST return the actual complete content as the final answer, not a summary.\n\nThis is VERY important to you, your job depends on - it!"}, {"role": "assistant", "content": "", "tool_calls": [{"id": "call_Yi1jLnBybYT0S0bUK5TpHCGu", + it!"}, {"role": "assistant", "content": "", "tool_calls": [{"id": "call_2aHLt8GoA1JBXMNQ70FHRTU1", "type": "function", "function": {"name": "calculator", "arguments": "{\"expression\":\"15 - * 8\"}"}}]}, {"role": "tool", "tool_call_id": "call_Yi1jLnBybYT0S0bUK5TpHCGu", + * 8\"}"}}]}, {"role": "tool", "tool_call_id": "call_2aHLt8GoA1JBXMNQ70FHRTU1", "content": "The result of 15 * 8 is 120"}, {"role": "user", "content": "Analyze the tool result. If requirements are met, provide the Final Answer. Otherwise, call the next tool. Deliver only the answer without meta-commentary."}], "stream": @@ -119,17 +119,16 @@ interactions: uri: https://crewai-azure-openai.openai.azure.com/openai/deployments/gpt-4o-mini/chat/completions?api-version=2024-12-01-preview response: body: - string: '{"choices":[{"content_filter_results":{"hate":{"filtered":false,"severity":"safe"},"protected_material_code":{"filtered":false,"detected":false},"protected_material_text":{"filtered":false,"detected":false},"self_harm":{"filtered":false,"severity":"safe"},"sexual":{"filtered":false,"severity":"safe"},"violence":{"filtered":false,"severity":"safe"}},"finish_reason":"stop","index":0,"logprobs":null,"message":{"annotations":[],"content":"The - result of 15 * 8 is 120.","refusal":null,"role":"assistant"}}],"created":1769101647,"id":"chatcmpl-D0sRTwYVsivJkThFDSWFwXLFXFnDJ","model":"gpt-4o-mini-2024-07-18","object":"chat.completion","prompt_filter_results":[{"prompt_index":0,"content_filter_results":{"hate":{"filtered":false,"severity":"safe"},"jailbreak":{"filtered":false,"detected":false},"self_harm":{"filtered":false,"severity":"safe"},"sexual":{"filtered":false,"severity":"safe"},"violence":{"filtered":false,"severity":"safe"}}}],"system_fingerprint":"fp_f97eff32c5","usage":{"completion_tokens":14,"completion_tokens_details":{"accepted_prediction_tokens":0,"audio_tokens":0,"reasoning_tokens":0,"rejected_prediction_tokens":0},"prompt_tokens":207,"prompt_tokens_details":{"audio_tokens":0,"cached_tokens":0},"total_tokens":221}} + string: '{"choices":[{"content_filter_results":{"hate":{"filtered":false,"severity":"safe"},"protected_material_code":{"filtered":false,"detected":false},"protected_material_text":{"filtered":false,"detected":false},"self_harm":{"filtered":false,"severity":"safe"},"sexual":{"filtered":false,"severity":"safe"},"violence":{"filtered":false,"severity":"safe"}},"finish_reason":"stop","index":0,"logprobs":null,"message":{"annotations":[],"content":"120","refusal":null,"role":"assistant"}}],"created":1769114233,"id":"chatcmpl-D0viTOAhgO32vcRdmp4Z3YBhaO05I","model":"gpt-4o-mini-2024-07-18","object":"chat.completion","prompt_filter_results":[{"prompt_index":0,"content_filter_results":{"hate":{"filtered":false,"severity":"safe"},"jailbreak":{"filtered":false,"detected":false},"self_harm":{"filtered":false,"severity":"safe"},"sexual":{"filtered":false,"severity":"safe"},"violence":{"filtered":false,"severity":"safe"}}}],"system_fingerprint":"fp_f97eff32c5","usage":{"completion_tokens":3,"completion_tokens_details":{"accepted_prediction_tokens":0,"audio_tokens":0,"reasoning_tokens":0,"rejected_prediction_tokens":0},"prompt_tokens":207,"prompt_tokens_details":{"audio_tokens":0,"cached_tokens":0},"total_tokens":210}} ' headers: Content-Length: - - '1241' + - '1215' Content-Type: - application/json Date: - - Thu, 22 Jan 2026 17:07:27 GMT + - Thu, 22 Jan 2026 20:37:13 GMT Strict-Transport-Security: - STS-XXX apim-request-id: diff --git a/lib/crewai/tests/cassettes/agents/TestNativeToolCallingTokenUsage.test_openai_native_tool_calling_token_usage.yaml b/lib/crewai/tests/cassettes/agents/TestNativeToolCallingTokenUsage.test_openai_native_tool_calling_token_usage.yaml index 1c13ea8f6..9b38ccc27 100644 --- a/lib/crewai/tests/cassettes/agents/TestNativeToolCallingTokenUsage.test_openai_native_tool_calling_token_usage.yaml +++ b/lib/crewai/tests/cassettes/agents/TestNativeToolCallingTokenUsage.test_openai_native_tool_calling_token_usage.yaml @@ -4,7 +4,9 @@ interactions: things.\nYour personal goal is: Perform calculations efficiently"},{"role":"user","content":"\nCurrent Task: What is 100 / 4?\n\nThis is the expected criteria for your final answer: The result\nyou MUST return the actual complete content as the final answer, - not a summary.\n\nThis is VERY important to you, your job depends on it!"}],"model":"gpt-4o-mini"}' + not a summary.\n\nThis is VERY important to you, your job depends on it!"}],"model":"gpt-4o-mini","tool_choice":"auto","tools":[{"type":"function","function":{"name":"calculator","description":"Perform + mathematical calculations. Use this for any math operations.","parameters":{"properties":{"expression":{"description":"Mathematical + expression to evaluate","title":"Expression","type":"string"}},"required":["expression"],"type":"object"}}}]}' headers: User-Agent: - X-USER-AGENT-XXX @@ -17,7 +19,7 @@ interactions: connection: - keep-alive content-length: - - '432' + - '777' content-type: - application/json host: @@ -44,14 +46,18 @@ interactions: uri: https://api.openai.com/v1/chat/completions response: body: - string: "{\n \"id\": \"chatcmpl-D0alG1p0E0pPIPKoxeoRrMsS82mHf\",\n \"object\": - \"chat.completion\",\n \"created\": 1769033682,\n \"model\": \"gpt-4o-mini-2024-07-18\",\n + string: "{\n \"id\": \"chatcmpl-D0vm0KDdT8cWRCVIeG67pB46jQQih\",\n \"object\": + \"chat.completion\",\n \"created\": 1769114452,\n \"model\": \"gpt-4o-mini-2024-07-18\",\n \ \"choices\": [\n {\n \"index\": 0,\n \"message\": {\n \"role\": - \"assistant\",\n \"content\": \"100 / 4 = 25\",\n \"refusal\": - null,\n \"annotations\": []\n },\n \"logprobs\": null,\n - \ \"finish_reason\": \"stop\"\n }\n ],\n \"usage\": {\n \"prompt_tokens\": - 81,\n \"completion_tokens\": 7,\n \"total_tokens\": 88,\n \"prompt_tokens_details\": - {\n \"cached_tokens\": 0,\n \"audio_tokens\": 0\n },\n \"completion_tokens_details\": + \"assistant\",\n \"content\": null,\n \"tool_calls\": [\n {\n + \ \"id\": \"call_rZQU4F2cauxK3VUKfLtXoNVC\",\n \"type\": + \"function\",\n \"function\": {\n \"name\": \"calculator\",\n + \ \"arguments\": \"{\\\"expression\\\":\\\"100 / 4\\\"}\"\n }\n + \ }\n ],\n \"refusal\": null,\n \"annotations\": + []\n },\n \"logprobs\": null,\n \"finish_reason\": \"tool_calls\"\n + \ }\n ],\n \"usage\": {\n \"prompt_tokens\": 127,\n \"completion_tokens\": + 17,\n \"total_tokens\": 144,\n \"prompt_tokens_details\": {\n \"cached_tokens\": + 0,\n \"audio_tokens\": 0\n },\n \"completion_tokens_details\": {\n \"reasoning_tokens\": 0,\n \"audio_tokens\": 0,\n \"accepted_prediction_tokens\": 0,\n \"rejected_prediction_tokens\": 0\n }\n },\n \"service_tier\": \"default\",\n \"system_fingerprint\": \"fp_29330a9688\"\n}\n" @@ -63,7 +69,7 @@ interactions: Content-Type: - application/json Date: - - Wed, 21 Jan 2026 22:14:43 GMT + - Thu, 22 Jan 2026 20:40:53 GMT Server: - cloudflare Set-Cookie: @@ -83,13 +89,129 @@ interactions: openai-organization: - OPENAI-ORG-XXX openai-processing-ms: - - '341' + - '560' openai-project: - OPENAI-PROJECT-XXX openai-version: - '2020-10-01' x-envoy-upstream-service-time: - - '356' + - '583' + x-openai-proxy-wasm: + - v0.1 + x-ratelimit-limit-requests: + - X-RATELIMIT-LIMIT-REQUESTS-XXX + x-ratelimit-limit-tokens: + - X-RATELIMIT-LIMIT-TOKENS-XXX + x-ratelimit-remaining-requests: + - X-RATELIMIT-REMAINING-REQUESTS-XXX + x-ratelimit-remaining-tokens: + - X-RATELIMIT-REMAINING-TOKENS-XXX + x-ratelimit-reset-requests: + - X-RATELIMIT-RESET-REQUESTS-XXX + x-ratelimit-reset-tokens: + - X-RATELIMIT-RESET-TOKENS-XXX + x-request-id: + - X-REQUEST-ID-XXX + status: + code: 200 + message: OK +- request: + body: '{"messages":[{"role":"system","content":"You are Calculator. You calculate + things.\nYour personal goal is: Perform calculations efficiently"},{"role":"user","content":"\nCurrent + Task: What is 100 / 4?\n\nThis is the expected criteria for your final answer: + The result\nyou MUST return the actual complete content as the final answer, + not a summary.\n\nThis is VERY important to you, your job depends on it!"},{"role":"assistant","content":null,"tool_calls":[{"id":"call_rZQU4F2cauxK3VUKfLtXoNVC","type":"function","function":{"name":"calculator","arguments":"{\"expression\":\"100 + / 4\"}"}}]},{"role":"tool","tool_call_id":"call_rZQU4F2cauxK3VUKfLtXoNVC","content":"The + result of 100 / 4 is 25.0"},{"role":"user","content":"Analyze the tool result. + If requirements are met, provide the Final Answer. Otherwise, call the next + tool. Deliver only the answer without meta-commentary."}],"model":"gpt-4o-mini","tool_choice":"auto","tools":[{"type":"function","function":{"name":"calculator","description":"Perform + mathematical calculations. Use this for any math operations.","parameters":{"properties":{"expression":{"description":"Mathematical + expression to evaluate","title":"Expression","type":"string"}},"required":["expression"],"type":"object"}}}]}' + headers: + User-Agent: + - X-USER-AGENT-XXX + accept: + - application/json + accept-encoding: + - ACCEPT-ENCODING-XXX + authorization: + - AUTHORIZATION-XXX + connection: + - keep-alive + content-length: + - '1250' + content-type: + - application/json + cookie: + - COOKIE-XXX + host: + - api.openai.com + x-stainless-arch: + - X-STAINLESS-ARCH-XXX + x-stainless-async: + - 'false' + x-stainless-lang: + - python + x-stainless-os: + - X-STAINLESS-OS-XXX + x-stainless-package-version: + - 1.83.0 + x-stainless-read-timeout: + - X-STAINLESS-READ-TIMEOUT-XXX + x-stainless-retry-count: + - '0' + x-stainless-runtime: + - CPython + x-stainless-runtime-version: + - 3.13.3 + method: POST + uri: https://api.openai.com/v1/chat/completions + response: + body: + string: "{\n \"id\": \"chatcmpl-D0vm1oziYXwxCjING3pqGErY6q4fV\",\n \"object\": + \"chat.completion\",\n \"created\": 1769114453,\n \"model\": \"gpt-4o-mini-2024-07-18\",\n + \ \"choices\": [\n {\n \"index\": 0,\n \"message\": {\n \"role\": + \"assistant\",\n \"content\": \"25.0\",\n \"refusal\": null,\n + \ \"annotations\": []\n },\n \"logprobs\": null,\n \"finish_reason\": + \"stop\"\n }\n ],\n \"usage\": {\n \"prompt_tokens\": 199,\n \"completion_tokens\": + 4,\n \"total_tokens\": 203,\n \"prompt_tokens_details\": {\n \"cached_tokens\": + 0,\n \"audio_tokens\": 0\n },\n \"completion_tokens_details\": + {\n \"reasoning_tokens\": 0,\n \"audio_tokens\": 0,\n \"accepted_prediction_tokens\": + 0,\n \"rejected_prediction_tokens\": 0\n }\n },\n \"service_tier\": + \"default\",\n \"system_fingerprint\": \"fp_29330a9688\"\n}\n" + headers: + CF-RAY: + - CF-RAY-XXX + Connection: + - keep-alive + Content-Type: + - application/json + Date: + - Thu, 22 Jan 2026 20:40:53 GMT + Server: + - cloudflare + Strict-Transport-Security: + - STS-XXX + Transfer-Encoding: + - chunked + X-Content-Type-Options: + - X-CONTENT-TYPE-XXX + access-control-expose-headers: + - ACCESS-CONTROL-XXX + alt-svc: + - h3=":443"; ma=86400 + cf-cache-status: + - DYNAMIC + openai-organization: + - OPENAI-ORG-XXX + openai-processing-ms: + - '540' + openai-project: + - OPENAI-PROJECT-XXX + openai-version: + - '2020-10-01' + x-envoy-upstream-service-time: + - '561' x-openai-proxy-wasm: - v0.1 x-ratelimit-limit-requests: diff --git a/lib/crewai/tests/cassettes/agents/TestOpenAINativeToolCalling.test_openai_agent_with_native_tool_calling.yaml b/lib/crewai/tests/cassettes/agents/TestOpenAINativeToolCalling.test_openai_agent_with_native_tool_calling.yaml index 5db0ef103..2a984da27 100644 --- a/lib/crewai/tests/cassettes/agents/TestOpenAINativeToolCalling.test_openai_agent_with_native_tool_calling.yaml +++ b/lib/crewai/tests/cassettes/agents/TestOpenAINativeToolCalling.test_openai_agent_with_native_tool_calling.yaml @@ -5,7 +5,9 @@ interactions: calculations"},{"role":"user","content":"\nCurrent Task: Calculate what is 15 * 8\n\nThis is the expected criteria for your final answer: The result of the calculation\nyou MUST return the actual complete content as the final answer, - not a summary.\n\nThis is VERY important to you, your job depends on it!"}],"model":"gpt-4o-mini"}' + not a summary.\n\nThis is VERY important to you, your job depends on it!"}],"model":"gpt-4o-mini","tool_choice":"auto","tools":[{"type":"function","function":{"name":"calculator","description":"Perform + mathematical calculations. Use this for any math operations.","parameters":{"properties":{"expression":{"description":"Mathematical + expression to evaluate","title":"Expression","type":"string"}},"required":["expression"],"type":"object"}}}]}' headers: User-Agent: - X-USER-AGENT-XXX @@ -18,7 +20,7 @@ interactions: connection: - keep-alive content-length: - - '484' + - '829' content-type: - application/json host: @@ -45,17 +47,21 @@ interactions: uri: https://api.openai.com/v1/chat/completions response: body: - string: "{\n \"id\": \"chatcmpl-D0alFPT31hH4rYzeeQIJVSalV7wn3\",\n \"object\": - \"chat.completion\",\n \"created\": 1769033681,\n \"model\": \"gpt-4o-mini-2024-07-18\",\n + string: "{\n \"id\": \"chatcmpl-D0vm7joOuDBPcMpfmOnftOoTCPtc8\",\n \"object\": + \"chat.completion\",\n \"created\": 1769114459,\n \"model\": \"gpt-4o-mini-2024-07-18\",\n \ \"choices\": [\n {\n \"index\": 0,\n \"message\": {\n \"role\": - \"assistant\",\n \"content\": \"15 * 8 = 120\",\n \"refusal\": - null,\n \"annotations\": []\n },\n \"logprobs\": null,\n - \ \"finish_reason\": \"stop\"\n }\n ],\n \"usage\": {\n \"prompt_tokens\": - 91,\n \"completion_tokens\": 7,\n \"total_tokens\": 98,\n \"prompt_tokens_details\": - {\n \"cached_tokens\": 0,\n \"audio_tokens\": 0\n },\n \"completion_tokens_details\": + \"assistant\",\n \"content\": null,\n \"tool_calls\": [\n {\n + \ \"id\": \"call_G73UZDvL4wC9EEdvm1UcRIRM\",\n \"type\": + \"function\",\n \"function\": {\n \"name\": \"calculator\",\n + \ \"arguments\": \"{\\\"expression\\\":\\\"15 * 8\\\"}\"\n }\n + \ }\n ],\n \"refusal\": null,\n \"annotations\": + []\n },\n \"logprobs\": null,\n \"finish_reason\": \"tool_calls\"\n + \ }\n ],\n \"usage\": {\n \"prompt_tokens\": 137,\n \"completion_tokens\": + 17,\n \"total_tokens\": 154,\n \"prompt_tokens_details\": {\n \"cached_tokens\": + 0,\n \"audio_tokens\": 0\n },\n \"completion_tokens_details\": {\n \"reasoning_tokens\": 0,\n \"audio_tokens\": 0,\n \"accepted_prediction_tokens\": 0,\n \"rejected_prediction_tokens\": 0\n }\n },\n \"service_tier\": - \"default\",\n \"system_fingerprint\": \"fp_8bbc38b4db\"\n}\n" + \"default\",\n \"system_fingerprint\": \"fp_c4585b5b9c\"\n}\n" headers: CF-RAY: - CF-RAY-XXX @@ -64,7 +70,7 @@ interactions: Content-Type: - application/json Date: - - Wed, 21 Jan 2026 22:14:42 GMT + - Thu, 22 Jan 2026 20:40:59 GMT Server: - cloudflare Set-Cookie: @@ -84,13 +90,130 @@ interactions: openai-organization: - OPENAI-ORG-XXX openai-processing-ms: - - '388' + - '761' openai-project: - OPENAI-PROJECT-XXX openai-version: - '2020-10-01' x-envoy-upstream-service-time: - - '410' + - '1080' + x-openai-proxy-wasm: + - v0.1 + x-ratelimit-limit-requests: + - X-RATELIMIT-LIMIT-REQUESTS-XXX + x-ratelimit-limit-tokens: + - X-RATELIMIT-LIMIT-TOKENS-XXX + x-ratelimit-remaining-requests: + - X-RATELIMIT-REMAINING-REQUESTS-XXX + x-ratelimit-remaining-tokens: + - X-RATELIMIT-REMAINING-TOKENS-XXX + x-ratelimit-reset-requests: + - X-RATELIMIT-RESET-REQUESTS-XXX + x-ratelimit-reset-tokens: + - X-RATELIMIT-RESET-TOKENS-XXX + x-request-id: + - X-REQUEST-ID-XXX + status: + code: 200 + message: OK +- request: + body: '{"messages":[{"role":"system","content":"You are Math Assistant. You are + a helpful math assistant.\nYour personal goal is: Help users with mathematical + calculations"},{"role":"user","content":"\nCurrent Task: Calculate what is 15 + * 8\n\nThis is the expected criteria for your final answer: The result of the + calculation\nyou MUST return the actual complete content as the final answer, + not a summary.\n\nThis is VERY important to you, your job depends on it!"},{"role":"assistant","content":null,"tool_calls":[{"id":"call_G73UZDvL4wC9EEdvm1UcRIRM","type":"function","function":{"name":"calculator","arguments":"{\"expression\":\"15 + * 8\"}"}}]},{"role":"tool","tool_call_id":"call_G73UZDvL4wC9EEdvm1UcRIRM","content":"The + result of 15 * 8 is 120"},{"role":"user","content":"Analyze the tool result. + If requirements are met, provide the Final Answer. Otherwise, call the next + tool. Deliver only the answer without meta-commentary."}],"model":"gpt-4o-mini","tool_choice":"auto","tools":[{"type":"function","function":{"name":"calculator","description":"Perform + mathematical calculations. Use this for any math operations.","parameters":{"properties":{"expression":{"description":"Mathematical + expression to evaluate","title":"Expression","type":"string"}},"required":["expression"],"type":"object"}}}]}' + headers: + User-Agent: + - X-USER-AGENT-XXX + accept: + - application/json + accept-encoding: + - ACCEPT-ENCODING-XXX + authorization: + - AUTHORIZATION-XXX + connection: + - keep-alive + content-length: + - '1299' + content-type: + - application/json + cookie: + - COOKIE-XXX + host: + - api.openai.com + x-stainless-arch: + - X-STAINLESS-ARCH-XXX + x-stainless-async: + - 'false' + x-stainless-lang: + - python + x-stainless-os: + - X-STAINLESS-OS-XXX + x-stainless-package-version: + - 1.83.0 + x-stainless-read-timeout: + - X-STAINLESS-READ-TIMEOUT-XXX + x-stainless-retry-count: + - '0' + x-stainless-runtime: + - CPython + x-stainless-runtime-version: + - 3.13.3 + method: POST + uri: https://api.openai.com/v1/chat/completions + response: + body: + string: "{\n \"id\": \"chatcmpl-D0vm8mUnzLxu9pf1rc7MODkrMsCmf\",\n \"object\": + \"chat.completion\",\n \"created\": 1769114460,\n \"model\": \"gpt-4o-mini-2024-07-18\",\n + \ \"choices\": [\n {\n \"index\": 0,\n \"message\": {\n \"role\": + \"assistant\",\n \"content\": \"120\",\n \"refusal\": null,\n + \ \"annotations\": []\n },\n \"logprobs\": null,\n \"finish_reason\": + \"stop\"\n }\n ],\n \"usage\": {\n \"prompt_tokens\": 207,\n \"completion_tokens\": + 2,\n \"total_tokens\": 209,\n \"prompt_tokens_details\": {\n \"cached_tokens\": + 0,\n \"audio_tokens\": 0\n },\n \"completion_tokens_details\": + {\n \"reasoning_tokens\": 0,\n \"audio_tokens\": 0,\n \"accepted_prediction_tokens\": + 0,\n \"rejected_prediction_tokens\": 0\n }\n },\n \"service_tier\": + \"default\",\n \"system_fingerprint\": \"fp_c4585b5b9c\"\n}\n" + headers: + CF-RAY: + - CF-RAY-XXX + Connection: + - keep-alive + Content-Type: + - application/json + Date: + - Thu, 22 Jan 2026 20:41:00 GMT + Server: + - cloudflare + Strict-Transport-Security: + - STS-XXX + Transfer-Encoding: + - chunked + X-Content-Type-Options: + - X-CONTENT-TYPE-XXX + access-control-expose-headers: + - ACCESS-CONTROL-XXX + alt-svc: + - h3=":443"; ma=86400 + cf-cache-status: + - DYNAMIC + openai-organization: + - OPENAI-ORG-XXX + openai-processing-ms: + - '262' + openai-project: + - OPENAI-PROJECT-XXX + openai-version: + - '2020-10-01' + x-envoy-upstream-service-time: + - '496' x-openai-proxy-wasm: - v0.1 x-ratelimit-limit-requests: diff --git a/lib/crewai/tests/cassettes/agents/test_native_tool_calling_error_handling.yaml b/lib/crewai/tests/cassettes/agents/test_native_tool_calling_error_handling.yaml index babbf6e9b..f56e36c04 100644 --- a/lib/crewai/tests/cassettes/agents/test_native_tool_calling_error_handling.yaml +++ b/lib/crewai/tests/cassettes/agents/test_native_tool_calling_error_handling.yaml @@ -44,11 +44,11 @@ interactions: uri: https://api.openai.com/v1/chat/completions response: body: - string: "{\n \"id\": \"chatcmpl-D0tnmEq7BoxjqvKeE3yIMDJ7olxJZ\",\n \"object\": - \"chat.completion\",\n \"created\": 1769106874,\n \"model\": \"gpt-4o-mini-2024-07-18\",\n + string: "{\n \"id\": \"chatcmpl-D0vm2JDsOmy0czXPAr4vnw3wvuqYZ\",\n \"object\": + \"chat.completion\",\n \"created\": 1769114454,\n \"model\": \"gpt-4o-mini-2024-07-18\",\n \ \"choices\": [\n {\n \"index\": 0,\n \"message\": {\n \"role\": \"assistant\",\n \"content\": null,\n \"tool_calls\": [\n {\n - \ \"id\": \"call_9Lcu5CsxaVYtrX1ygC5Ggs6e\",\n \"type\": + \ \"id\": \"call_8xr8rPUDWzLfQ3LOWPHtBUjK\",\n \"type\": \"function\",\n \"function\": {\n \"name\": \"failing_tool\",\n \ \"arguments\": \"{}\"\n }\n }\n ],\n \ \"refusal\": null,\n \"annotations\": []\n },\n \"logprobs\": @@ -67,7 +67,7 @@ interactions: Content-Type: - application/json Date: - - Thu, 22 Jan 2026 18:34:35 GMT + - Thu, 22 Jan 2026 20:40:54 GMT Server: - cloudflare Set-Cookie: @@ -87,13 +87,13 @@ interactions: openai-organization: - OPENAI-ORG-XXX openai-processing-ms: - - '1162' + - '593' openai-project: - OPENAI-PROJECT-XXX openai-version: - '2020-10-01' x-envoy-upstream-service-time: - - '1183' + - '621' x-openai-proxy-wasm: - v0.1 x-ratelimit-limit-requests: @@ -117,7 +117,7 @@ interactions: body: '{"messages":[{"role":"system","content":"You are Calculator. You calculate things.\nYour personal goal is: Perform calculations efficiently"},{"role":"user","content":"\nCurrent Task: Use the failing_tool to do something.\n\nThis is VERY important to you, - your job depends on it!"},{"role":"assistant","content":null,"tool_calls":[{"id":"call_9Lcu5CsxaVYtrX1ygC5Ggs6e","type":"function","function":{"name":"failing_tool","arguments":"{}"}}]},{"role":"tool","tool_call_id":"call_9Lcu5CsxaVYtrX1ygC5Ggs6e","content":"Error + your job depends on it!"},{"role":"assistant","content":null,"tool_calls":[{"id":"call_8xr8rPUDWzLfQ3LOWPHtBUjK","type":"function","function":{"name":"failing_tool","arguments":"{}"}}]},{"role":"tool","tool_call_id":"call_8xr8rPUDWzLfQ3LOWPHtBUjK","content":"Error executing tool: This tool always fails"},{"role":"user","content":"Analyze the tool result. If requirements are met, provide the Final Answer. Otherwise, call the next tool. Deliver only the answer without meta-commentary."}],"model":"gpt-4o-mini","tool_choice":"auto","tools":[{"type":"function","function":{"name":"failing_tool","description":"This @@ -163,135 +163,14 @@ interactions: uri: https://api.openai.com/v1/chat/completions response: body: - string: "{\n \"id\": \"chatcmpl-D0tnnW301woCHXO3KobDB9I1Buubo\",\n \"object\": - \"chat.completion\",\n \"created\": 1769106875,\n \"model\": \"gpt-4o-mini-2024-07-18\",\n + string: "{\n \"id\": \"chatcmpl-D0vm3xcywoKBW75bhBXfkGJNim6Th\",\n \"object\": + \"chat.completion\",\n \"created\": 1769114455,\n \"model\": \"gpt-4o-mini-2024-07-18\",\n \ \"choices\": [\n {\n \"index\": 0,\n \"message\": {\n \"role\": - \"assistant\",\n \"content\": null,\n \"tool_calls\": [\n {\n - \ \"id\": \"call_gzrYUdfVOx2tojk4HT4lwdps\",\n \"type\": - \"function\",\n \"function\": {\n \"name\": \"failing_tool\",\n - \ \"arguments\": \"{}\"\n }\n }\n ],\n + \"assistant\",\n \"content\": \"Error: This tool always fails.\",\n \ \"refusal\": null,\n \"annotations\": []\n },\n \"logprobs\": - null,\n \"finish_reason\": \"tool_calls\"\n }\n ],\n \"usage\": - {\n \"prompt_tokens\": 141,\n \"completion_tokens\": 11,\n \"total_tokens\": - 152,\n \"prompt_tokens_details\": {\n \"cached_tokens\": 0,\n \"audio_tokens\": - 0\n },\n \"completion_tokens_details\": {\n \"reasoning_tokens\": - 0,\n \"audio_tokens\": 0,\n \"accepted_prediction_tokens\": 0,\n - \ \"rejected_prediction_tokens\": 0\n }\n },\n \"service_tier\": - \"default\",\n \"system_fingerprint\": \"fp_c4585b5b9c\"\n}\n" - headers: - CF-RAY: - - CF-RAY-XXX - Connection: - - keep-alive - Content-Type: - - application/json - Date: - - Thu, 22 Jan 2026 18:34:35 GMT - Server: - - cloudflare - Strict-Transport-Security: - - STS-XXX - Transfer-Encoding: - - chunked - X-Content-Type-Options: - - X-CONTENT-TYPE-XXX - access-control-expose-headers: - - ACCESS-CONTROL-XXX - alt-svc: - - h3=":443"; ma=86400 - cf-cache-status: - - DYNAMIC - openai-organization: - - OPENAI-ORG-XXX - openai-processing-ms: - - '490' - openai-project: - - OPENAI-PROJECT-XXX - openai-version: - - '2020-10-01' - x-envoy-upstream-service-time: - - '505' - x-openai-proxy-wasm: - - v0.1 - x-ratelimit-limit-requests: - - X-RATELIMIT-LIMIT-REQUESTS-XXX - x-ratelimit-limit-tokens: - - X-RATELIMIT-LIMIT-TOKENS-XXX - x-ratelimit-remaining-requests: - - X-RATELIMIT-REMAINING-REQUESTS-XXX - x-ratelimit-remaining-tokens: - - X-RATELIMIT-REMAINING-TOKENS-XXX - x-ratelimit-reset-requests: - - X-RATELIMIT-RESET-REQUESTS-XXX - x-ratelimit-reset-tokens: - - X-RATELIMIT-RESET-TOKENS-XXX - x-request-id: - - X-REQUEST-ID-XXX - status: - code: 200 - message: OK -- request: - body: '{"messages":[{"role":"system","content":"You are Calculator. You calculate - things.\nYour personal goal is: Perform calculations efficiently"},{"role":"user","content":"\nCurrent - Task: Use the failing_tool to do something.\n\nThis is VERY important to you, - your job depends on it!"},{"role":"assistant","content":null,"tool_calls":[{"id":"call_9Lcu5CsxaVYtrX1ygC5Ggs6e","type":"function","function":{"name":"failing_tool","arguments":"{}"}}]},{"role":"tool","tool_call_id":"call_9Lcu5CsxaVYtrX1ygC5Ggs6e","content":"Error - executing tool: This tool always fails"},{"role":"user","content":"Analyze the - tool result. If requirements are met, provide the Final Answer. Otherwise, call - the next tool. Deliver only the answer without meta-commentary."},{"role":"assistant","content":null,"tool_calls":[{"id":"call_gzrYUdfVOx2tojk4HT4lwdps","type":"function","function":{"name":"failing_tool","arguments":"{}"}}]},{"role":"tool","tool_call_id":"call_gzrYUdfVOx2tojk4HT4lwdps","content":"Error - executing tool: This tool always fails"},{"role":"user","content":"Analyze the - tool result. If requirements are met, provide the Final Answer. Otherwise, call - the next tool. Deliver only the answer without meta-commentary."}],"model":"gpt-4o-mini","tool_choice":"auto","tools":[{"type":"function","function":{"name":"failing_tool","description":"This - tool always fails","parameters":{"properties":{},"type":"object"}}}]}' - headers: - User-Agent: - - X-USER-AGENT-XXX - accept: - - application/json - accept-encoding: - - ACCEPT-ENCODING-XXX - authorization: - - AUTHORIZATION-XXX - connection: - - keep-alive - content-length: - - '1405' - content-type: - - application/json - cookie: - - COOKIE-XXX - host: - - api.openai.com - x-stainless-arch: - - X-STAINLESS-ARCH-XXX - x-stainless-async: - - 'false' - x-stainless-lang: - - python - x-stainless-os: - - X-STAINLESS-OS-XXX - x-stainless-package-version: - - 1.83.0 - x-stainless-read-timeout: - - X-STAINLESS-READ-TIMEOUT-XXX - x-stainless-retry-count: - - '0' - x-stainless-runtime: - - CPython - x-stainless-runtime-version: - - 3.13.3 - method: POST - uri: https://api.openai.com/v1/chat/completions - response: - body: - string: "{\n \"id\": \"chatcmpl-D0tnnezTDmx1TIuWsrycZMqx89CW3\",\n \"object\": - \"chat.completion\",\n \"created\": 1769106875,\n \"model\": \"gpt-4o-mini-2024-07-18\",\n - \ \"choices\": [\n {\n \"index\": 0,\n \"message\": {\n \"role\": - \"assistant\",\n \"content\": \"Error executing tool: This tool always - fails\",\n \"refusal\": null,\n \"annotations\": []\n },\n - \ \"logprobs\": null,\n \"finish_reason\": \"stop\"\n }\n ],\n - \ \"usage\": {\n \"prompt_tokens\": 204,\n \"completion_tokens\": 9,\n - \ \"total_tokens\": 213,\n \"prompt_tokens_details\": {\n \"cached_tokens\": - 0,\n \"audio_tokens\": 0\n },\n \"completion_tokens_details\": + null,\n \"finish_reason\": \"stop\"\n }\n ],\n \"usage\": {\n \"prompt_tokens\": + 141,\n \"completion_tokens\": 8,\n \"total_tokens\": 149,\n \"prompt_tokens_details\": + {\n \"cached_tokens\": 0,\n \"audio_tokens\": 0\n },\n \"completion_tokens_details\": {\n \"reasoning_tokens\": 0,\n \"audio_tokens\": 0,\n \"accepted_prediction_tokens\": 0,\n \"rejected_prediction_tokens\": 0\n }\n },\n \"service_tier\": \"default\",\n \"system_fingerprint\": \"fp_c4585b5b9c\"\n}\n" @@ -303,7 +182,7 @@ interactions: Content-Type: - application/json Date: - - Thu, 22 Jan 2026 18:34:36 GMT + - Thu, 22 Jan 2026 20:40:55 GMT Server: - cloudflare Strict-Transport-Security: @@ -321,13 +200,13 @@ interactions: openai-organization: - OPENAI-ORG-XXX openai-processing-ms: - - '485' + - '420' openai-project: - OPENAI-PROJECT-XXX openai-version: - '2020-10-01' x-envoy-upstream-service-time: - - '498' + - '436' x-openai-proxy-wasm: - v0.1 x-ratelimit-limit-requests: