diff --git a/lib/crewai/tests/cassettes/hooks/TestNativeToolCallingHooksIntegration.test_agent_native_tool_hooks_before_and_after.yaml b/lib/crewai/tests/cassettes/hooks/TestNativeToolCallingHooksIntegration.test_agent_native_tool_hooks_before_and_after.yaml index 23719e5c3..d637a70ea 100644 --- a/lib/crewai/tests/cassettes/hooks/TestNativeToolCallingHooksIntegration.test_agent_native_tool_hooks_before_and_after.yaml +++ b/lib/crewai/tests/cassettes/hooks/TestNativeToolCallingHooksIntegration.test_agent_native_tool_hooks_before_and_after.yaml @@ -1,10 +1,83 @@ interactions: +- request: + body: '{"trace_id": "ecb9a078-e82d-47cf-9f14-87d70109b2bc", "execution_type": + "crew", "user_identifier": null, "execution_context": {"crew_fingerprint": null, + "crew_name": "Unknown Crew", "flow_name": null, "crewai_version": "1.9.3", "privacy_level": + "standard"}, "execution_metadata": {"expected_duration_estimate": 300, "agent_count": + 0, "task_count": 0, "flow_method_count": 0, "execution_started_at": "2026-02-11T01:37:34.522072+00:00"}}' + headers: + Accept: + - '*/*' + Connection: + - keep-alive + Content-Length: + - '434' + Content-Type: + - application/json + User-Agent: + - X-USER-AGENT-XXX + X-Crewai-Organization-Id: + - 3433f0ee-8a94-4aa4-822b-2ac71aa38b18 + X-Crewai-Version: + - 1.9.3 + accept-encoding: + - ACCEPT-ENCODING-XXX + authorization: + - AUTHORIZATION-XXX + method: POST + uri: https://app.crewai.com/crewai_plus/api/v1/tracing/batches + response: + body: + string: '{"id":"10c9dd30-aa69-4595-9c73-65acbb6c0b56","trace_id":"ecb9a078-e82d-47cf-9f14-87d70109b2bc","execution_type":"crew","crew_name":"Unknown + Crew","flow_name":null,"status":"running","duration_ms":null,"crewai_version":"1.9.3","privacy_level":"standard","total_events":0,"execution_context":{"crew_fingerprint":null,"crew_name":"Unknown + Crew","flow_name":null,"crewai_version":"1.9.3","privacy_level":"standard"},"created_at":"2026-02-11T01:37:35.293Z","updated_at":"2026-02-11T01:37:35.293Z"}' + headers: + Connection: + - keep-alive + Content-Length: + - '492' + Content-Type: + - application/json; charset=utf-8 + Date: + - Wed, 11 Feb 2026 01:37:35 GMT + cache-control: + - no-store + content-security-policy: + - CSP-FILTERED + etag: + - ETAG-XXX + expires: + - '0' + permissions-policy: + - PERMISSIONS-POLICY-XXX + pragma: + - no-cache + referrer-policy: + - REFERRER-POLICY-XXX + strict-transport-security: + - STS-XXX + vary: + - Accept + x-content-type-options: + - X-CONTENT-TYPE-XXX + x-frame-options: + - X-FRAME-OPTIONS-XXX + x-permitted-cross-domain-policies: + - X-PERMITTED-XXX + x-request-id: + - X-REQUEST-ID-XXX + x-runtime: + - X-RUNTIME-XXX + x-xss-protection: + - X-XSS-PROTECTION-XXX + status: + code: 201 + message: Created - request: body: '{"messages":[{"role":"system","content":"You are Calculator. You are a calculator assistant\nYour personal goal is: Perform calculations"},{"role":"user","content":"\nCurrent - Task: What is 7 times 6? Use the multiply_numbers tool.\n\nThis is VERY important - to you, your job depends on it!"}],"model":"gpt-4.1-mini","tool_choice":"auto","tools":[{"type":"function","function":{"name":"multiply_numbers","description":"Multiply - two numbers together.","parameters":{"properties":{"a":{"title":"A","type":"integer"},"b":{"title":"B","type":"integer"}},"required":["a","b"],"type":"object"}}}]}' + Task: What is 7 times 6? Use the multiply_numbers tool."}],"model":"gpt-4.1-mini","tool_choice":"auto","tools":[{"type":"function","function":{"name":"multiply_numbers","description":"Multiply + two numbers together.","strict":true,"parameters":{"properties":{"a":{"title":"A","type":"integer"},"b":{"title":"B","type":"integer"}},"required":["a","b"],"type":"object","additionalProperties":false}}}]}' headers: User-Agent: - X-USER-AGENT-XXX @@ -17,7 +90,7 @@ interactions: connection: - keep-alive content-length: - - '589' + - '574' content-type: - application/json host: @@ -44,21 +117,21 @@ interactions: uri: https://api.openai.com/v1/chat/completions response: body: - string: "{\n \"id\": \"chatcmpl-D2gblVDQeSH6tTrJiUtxgjoVoPuAR\",\n \"object\": - \"chat.completion\",\n \"created\": 1769532813,\n \"model\": \"gpt-4.1-mini-2025-04-14\",\n + string: "{\n \"id\": \"chatcmpl-D7tSYWrTqYtCsSPITkPippGUKq3Xd\",\n \"object\": + \"chat.completion\",\n \"created\": 1770773854,\n \"model\": \"gpt-4.1-mini-2025-04-14\",\n \ \"choices\": [\n {\n \"index\": 0,\n \"message\": {\n \"role\": \"assistant\",\n \"content\": null,\n \"tool_calls\": [\n {\n - \ \"id\": \"call_gO6PtjoOIDVeDWs7Wf680BHh\",\n \"type\": + \ \"id\": \"call_Yibpu7inV67QiBQ0LD6E5agB\",\n \"type\": \"function\",\n \"function\": {\n \"name\": \"multiply_numbers\",\n \ \"arguments\": \"{\\\"a\\\":7,\\\"b\\\":6}\"\n }\n \ }\n ],\n \"refusal\": null,\n \"annotations\": []\n },\n \"logprobs\": null,\n \"finish_reason\": \"tool_calls\"\n - \ }\n ],\n \"usage\": {\n \"prompt_tokens\": 100,\n \"completion_tokens\": - 18,\n \"total_tokens\": 118,\n \"prompt_tokens_details\": {\n \"cached_tokens\": + \ }\n ],\n \"usage\": {\n \"prompt_tokens\": 87,\n \"completion_tokens\": + 18,\n \"total_tokens\": 105,\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_376a7ccef1\"\n}\n" + \"default\",\n \"system_fingerprint\": \"fp_f4e2bc9c47\"\n}\n" headers: CF-RAY: - CF-RAY-XXX @@ -67,11 +140,9 @@ interactions: Content-Type: - application/json Date: - - Tue, 27 Jan 2026 16:53:34 GMT + - Wed, 11 Feb 2026 01:37:35 GMT Server: - cloudflare - Set-Cookie: - - SET-COOKIE-XXX Strict-Transport-Security: - STS-XXX Transfer-Encoding: @@ -87,11 +158,13 @@ interactions: openai-organization: - OPENAI-ORG-XXX openai-processing-ms: - - '593' + - '431' openai-project: - OPENAI-PROJECT-XXX openai-version: - '2020-10-01' + set-cookie: + - SET-COOKIE-XXX x-openai-proxy-wasm: - v0.1 x-ratelimit-limit-requests: @@ -114,11 +187,8 @@ interactions: - request: body: '{"messages":[{"role":"system","content":"You are Calculator. You are a calculator assistant\nYour personal goal is: Perform calculations"},{"role":"user","content":"\nCurrent - Task: What is 7 times 6? Use the multiply_numbers tool.\n\nThis is VERY important - to you, your job depends on it!"},{"role":"assistant","content":null,"tool_calls":[{"id":"call_gO6PtjoOIDVeDWs7Wf680BHh","type":"function","function":{"name":"multiply_numbers","arguments":"{\"a\":7,\"b\":6}"}}]},{"role":"tool","tool_call_id":"call_gO6PtjoOIDVeDWs7Wf680BHh","name":"multiply_numbers","content":"42"},{"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-4.1-mini","tool_choice":"auto","tools":[{"type":"function","function":{"name":"multiply_numbers","description":"Multiply - two numbers together.","parameters":{"properties":{"a":{"title":"A","type":"integer"},"b":{"title":"B","type":"integer"}},"required":["a","b"],"type":"object"}}}]}' + Task: What is 7 times 6? Use the multiply_numbers tool."},{"role":"assistant","content":null,"tool_calls":[{"id":"call_Yibpu7inV67QiBQ0LD6E5agB","type":"function","function":{"name":"multiply_numbers","arguments":"{\"a\":7,\"b\":6}"}}]},{"role":"tool","tool_call_id":"call_Yibpu7inV67QiBQ0LD6E5agB","name":"multiply_numbers","content":"42"}],"model":"gpt-4.1-mini","tool_choice":"auto","tools":[{"type":"function","function":{"name":"multiply_numbers","description":"Multiply + two numbers together.","strict":true,"parameters":{"properties":{"a":{"title":"A","type":"integer"},"b":{"title":"B","type":"integer"}},"required":["a","b"],"type":"object","additionalProperties":false}}}]}' headers: User-Agent: - X-USER-AGENT-XXX @@ -131,7 +201,7 @@ interactions: connection: - keep-alive content-length: - - '1056' + - '857' content-type: - application/json cookie: @@ -160,17 +230,17 @@ interactions: uri: https://api.openai.com/v1/chat/completions response: body: - string: "{\n \"id\": \"chatcmpl-D2gbm9NaGCXkI3QwW3eOTFSP4L4lh\",\n \"object\": - \"chat.completion\",\n \"created\": 1769532814,\n \"model\": \"gpt-4.1-mini-2025-04-14\",\n + string: "{\n \"id\": \"chatcmpl-D7tSZWUhZzzjRdKmJSY4h5FitpUG9\",\n \"object\": + \"chat.completion\",\n \"created\": 1770773855,\n \"model\": \"gpt-4.1-mini-2025-04-14\",\n \ \"choices\": [\n {\n \"index\": 0,\n \"message\": {\n \"role\": - \"assistant\",\n \"content\": \"42\",\n \"refusal\": null,\n - \ \"annotations\": []\n },\n \"logprobs\": null,\n \"finish_reason\": - \"stop\"\n }\n ],\n \"usage\": {\n \"prompt_tokens\": 162,\n \"completion_tokens\": - 2,\n \"total_tokens\": 164,\n \"prompt_tokens_details\": {\n \"cached_tokens\": - 0,\n \"audio_tokens\": 0\n },\n \"completion_tokens_details\": + \"assistant\",\n \"content\": \"7 times 6 is 42.\",\n \"refusal\": + null,\n \"annotations\": []\n },\n \"logprobs\": null,\n + \ \"finish_reason\": \"stop\"\n }\n ],\n \"usage\": {\n \"prompt_tokens\": + 114,\n \"completion_tokens\": 9,\n \"total_tokens\": 123,\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_376a7ccef1\"\n}\n" + \"default\",\n \"system_fingerprint\": \"fp_f4e2bc9c47\"\n}\n" headers: CF-RAY: - CF-RAY-XXX @@ -179,7 +249,7 @@ interactions: Content-Type: - application/json Date: - - Tue, 27 Jan 2026 16:53:34 GMT + - Wed, 11 Feb 2026 01:37:36 GMT Server: - cloudflare Strict-Transport-Security: @@ -197,11 +267,123 @@ interactions: openai-organization: - OPENAI-ORG-XXX openai-processing-ms: - - '259' + - '342' openai-project: - OPENAI-PROJECT-XXX openai-version: - '2020-10-01' + set-cookie: + - SET-COOKIE-XXX + 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 are a + calculator assistant\nYour personal goal is: Perform calculations"},{"role":"user","content":"\nCurrent + Task: What is 7 times 6? Use the multiply_numbers tool."},{"role":"assistant","content":null,"tool_calls":[{"id":"call_Yibpu7inV67QiBQ0LD6E5agB","type":"function","function":{"name":"multiply_numbers","arguments":"{\"a\":7,\"b\":6}"}}]},{"role":"tool","tool_call_id":"call_Yibpu7inV67QiBQ0LD6E5agB","name":"multiply_numbers","content":"42"},{"role":"assistant","content":"7 + times 6 is 42."}],"model":"gpt-4.1-mini","tool_choice":"auto","tools":[{"type":"function","function":{"name":"multiply_numbers","description":"Multiply + two numbers together.","strict":true,"parameters":{"properties":{"a":{"title":"A","type":"integer"},"b":{"title":"B","type":"integer"}},"required":["a","b"],"type":"object","additionalProperties":false}}}]}' + headers: + User-Agent: + - X-USER-AGENT-XXX + accept: + - application/json + accept-encoding: + - ACCEPT-ENCODING-XXX + authorization: + - AUTHORIZATION-XXX + connection: + - keep-alive + content-length: + - '907' + 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-D7tSaZn2xFoaEjE5quiTYRJPIkUb8\",\n \"object\": + \"chat.completion\",\n \"created\": 1770773856,\n \"model\": \"gpt-4.1-mini-2025-04-14\",\n + \ \"choices\": [\n {\n \"index\": 0,\n \"message\": {\n \"role\": + \"assistant\",\n \"content\": \"7 times 6 is 42.\",\n \"refusal\": + null,\n \"annotations\": []\n },\n \"logprobs\": null,\n + \ \"finish_reason\": \"stop\"\n }\n ],\n \"usage\": {\n \"prompt_tokens\": + 126,\n \"completion_tokens\": 9,\n \"total_tokens\": 135,\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_f4e2bc9c47\"\n}\n" + headers: + CF-RAY: + - CF-RAY-XXX + Connection: + - keep-alive + Content-Type: + - application/json + Date: + - Wed, 11 Feb 2026 01:37:36 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: + - '353' + openai-project: + - OPENAI-PROJECT-XXX + openai-version: + - '2020-10-01' + set-cookie: + - SET-COOKIE-XXX x-openai-proxy-wasm: - v0.1 x-ratelimit-limit-requests: