Lorenze/native inference sdks (#3619)

* ruff linted

* using native sdks with litellm fallback

* drop exa

* drop print on completion

* Refactor LLM and utility functions for type consistency

- Updated `max_tokens` parameter in `LLM` class to accept `float` in addition to `int`.
- Modified `create_llm` function to ensure consistent type hints and return types, now returning `LLM | BaseLLM | None`.
- Adjusted type hints for various parameters in `create_llm` and `_llm_via_environment_or_fallback` functions for improved clarity and type safety.
- Enhanced test cases to reflect changes in type handling and ensure proper instantiation of LLM instances.

* fix agent_tests

* fix litellm tests and usagemetrics fix

* drop print

* Refactor LLM event handling and improve test coverage

- Removed commented-out event emission for LLM call failures in `llm.py`.
- Added `from_agent` parameter to `CrewAgentExecutor` for better context in LLM responses.
- Enhanced test for LLM call failure to simulate OpenAI API failure and updated assertions for clarity.
- Updated agent and task ID assertions in tests to ensure they are consistently treated as strings.

* fix test_converter

* fixed tests/agents/test_agent.py

* Refactor LLM context length exception handling and improve provider integration

- Renamed `LLMContextLengthExceededException` to `LLMContextLengthExceededExceptionError` for clarity and consistency.
- Updated LLM class to pass the provider parameter correctly during initialization.
- Enhanced error handling in various LLM provider implementations to raise the new exception type.
- Adjusted tests to reflect the updated exception name and ensure proper error handling in context length scenarios.

* Enhance LLM context window handling across providers

- Introduced CONTEXT_WINDOW_USAGE_RATIO to adjust context window sizes dynamically for Anthropic, Azure, Gemini, and OpenAI LLMs.
- Added validation for context window sizes in Azure and Gemini providers to ensure they fall within acceptable limits.
- Updated context window size calculations to use the new ratio, improving consistency and adaptability across different models.
- Removed hardcoded context window sizes in favor of ratio-based calculations for better flexibility.

* fix test agent again

* fix test agent

* feat: add native LLM providers for Anthropic, Azure, and Gemini

- Introduced new completion implementations for Anthropic, Azure, and Gemini, integrating their respective SDKs.
- Added utility functions for tool validation and extraction to support function calling across LLM providers.
- Enhanced context window management and token usage extraction for each provider.
- Created a common utility module for shared functionality among LLM providers.

* chore: update dependencies and improve context management

- Removed direct dependency on `litellm` from the main dependencies and added it under extras for better modularity.
- Updated the `litellm` dependency specification to allow for greater flexibility in versioning.
- Refactored context length exception handling across various LLM providers to use a consistent error class.
- Enhanced platform-specific dependency markers for NVIDIA packages to ensure compatibility across different systems.

* refactor(tests): update LLM instantiation to include is_litellm flag in test cases

- Modified multiple test cases in test_llm.py to set the is_litellm parameter to True when instantiating the LLM class.
- This change ensures that the tests are aligned with the latest LLM configuration requirements and improves consistency across test scenarios.
- Adjusted relevant assertions and comments to reflect the updated LLM behavior.

* linter

* linted

* revert constants

* fix(tests): correct type hint in expected model description

- Updated the expected description in the test_generate_model_description_dict_field function to use 'Dict' instead of 'dict' for consistency with type hinting conventions.
- This change ensures that the test accurately reflects the expected output format for model descriptions.

* refactor(llm): enhance LLM instantiation and error handling

- Updated the LLM class to include validation for the model parameter, ensuring it is a non-empty string.
- Improved error handling by logging warnings when the native SDK fails, allowing for a fallback to LiteLLM.
- Adjusted the instantiation of LLM in test cases to consistently include the is_litellm flag, aligning with recent changes in LLM configuration.
- Modified relevant tests to reflect these updates, ensuring better coverage and accuracy in testing scenarios.

* fixed test

* refactor(llm): enhance token usage tracking and add copy methods

- Updated the LLM class to track token usage and log callbacks in streaming mode, improving monitoring capabilities.
- Introduced shallow and deep copy methods for the LLM instance, allowing for better management of LLM configurations and parameters.
- Adjusted test cases to instantiate LLM with the is_litellm flag, ensuring alignment with recent changes in LLM configuration.

* refactor(tests): reorganize imports and enhance error messages in test cases

- Cleaned up import statements in test_crew.py for better organization and readability.
- Enhanced error messages in test cases to use `re.escape` for improved regex matching, ensuring more robust error handling.
- Adjusted comments for clarity and consistency across test scenarios.
- Ensured that all necessary modules are imported correctly to avoid potential runtime issues.
This commit is contained in:
Lorenze Jay
2025-10-03 14:32:35 -07:00
committed by GitHub
parent 428810bd6f
commit 126b91eab3
77 changed files with 25026 additions and 493 deletions

View File

@@ -654,4 +654,657 @@ interactions:
status:
code: 200
message: OK
- request:
body: '{"trace_id": "5a473660-de8d-4c03-a05b-3d0e38cfaf2b", "execution_type":
"crew", "user_identifier": null, "execution_context": {"crew_fingerprint": null,
"crew_name": "crew", "flow_name": null, "crewai_version": "0.193.2", "privacy_level":
"standard"}, "execution_metadata": {"expected_duration_estimate": 300, "agent_count":
0, "task_count": 0, "flow_method_count": 0, "execution_started_at": "2025-09-23T20:49:30.429662+00:00"},
"ephemeral_trace_id": "5a473660-de8d-4c03-a05b-3d0e38cfaf2b"}'
headers:
Accept:
- '*/*'
Accept-Encoding:
- gzip, deflate
Connection:
- keep-alive
Content-Length:
- '490'
Content-Type:
- application/json
User-Agent:
- CrewAI-CLI/0.193.2
X-Crewai-Version:
- 0.193.2
method: POST
uri: http://localhost:3000/crewai_plus/api/v1/tracing/ephemeral/batches
response:
body:
string: '{"id":"73b8ab8e-2462-45ea-bea6-8397197bfa95","ephemeral_trace_id":"5a473660-de8d-4c03-a05b-3d0e38cfaf2b","execution_type":"crew","crew_name":"crew","flow_name":null,"status":"running","duration_ms":null,"crewai_version":"0.193.2","total_events":0,"execution_context":{"crew_fingerprint":null,"crew_name":"crew","flow_name":null,"crewai_version":"0.193.2","privacy_level":"standard"},"created_at":"2025-09-23T20:49:30.477Z","updated_at":"2025-09-23T20:49:30.477Z","access_code":"TRACE-e7ac143cef","user_identifier":null}'
headers:
Content-Length:
- '519'
cache-control:
- max-age=0, private, must-revalidate
content-security-policy:
- 'default-src ''self'' *.crewai.com crewai.com; script-src ''self'' ''unsafe-inline''
*.crewai.com crewai.com https://cdn.jsdelivr.net/npm/apexcharts https://www.gstatic.com
https://run.pstmn.io https://share.descript.com/; style-src ''self'' ''unsafe-inline''
*.crewai.com crewai.com https://cdn.jsdelivr.net/npm/apexcharts; img-src ''self''
data: *.crewai.com crewai.com https://zeus.tools.crewai.com https://dashboard.tools.crewai.com
https://cdn.jsdelivr.net; font-src ''self'' data: *.crewai.com crewai.com;
connect-src ''self'' *.crewai.com crewai.com https://zeus.tools.crewai.com
https://connect.useparagon.com/ https://zeus.useparagon.com/* https://*.useparagon.com/*
https://run.pstmn.io https://connect.tools.crewai.com/ ws://localhost:3036
wss://localhost:3036; frame-src ''self'' *.crewai.com crewai.com https://connect.useparagon.com/
https://zeus.tools.crewai.com https://zeus.useparagon.com/* https://connect.tools.crewai.com/
https://www.youtube.com https://share.descript.com'
content-type:
- application/json; charset=utf-8
etag:
- W/"62cedfc7eafa77605b47b4c6ef2e0ba8"
permissions-policy:
- camera=(), microphone=(self), geolocation=()
referrer-policy:
- strict-origin-when-cross-origin
server-timing:
- cache_read.active_support;dur=0.08, sql.active_record;dur=13.45, cache_generate.active_support;dur=2.56,
cache_write.active_support;dur=0.15, cache_read_multi.active_support;dur=0.08,
start_processing.action_controller;dur=0.00, start_transaction.active_record;dur=0.00,
transaction.active_record;dur=10.22, process_action.action_controller;dur=14.44
vary:
- Accept
x-content-type-options:
- nosniff
x-frame-options:
- SAMEORIGIN
x-permitted-cross-domain-policies:
- none
x-request-id:
- a7c1304c-dee7-4be0-bcb2-df853c3f86f7
x-runtime:
- '0.051387'
x-xss-protection:
- 1; mode=block
status:
code: 201
message: Created
- request:
body: '{"events": [{"event_id": "d33b112d-9b68-470d-be50-ea8c10e8ca7e", "timestamp":
"2025-09-23T20:49:30.484390+00:00", "type": "crew_kickoff_started", "event_data":
{"timestamp": "2025-09-23T20:49:30.428470+00:00", "type": "crew_kickoff_started",
"source_fingerprint": null, "source_type": null, "fingerprint_metadata": null,
"task_id": null, "task_name": null, "agent_id": null, "agent_role": null, "crew_name":
"crew", "crew": null, "inputs": null}}, {"event_id": "cff1f459-bf86-485a-bc4b-b90f72f88622",
"timestamp": "2025-09-23T20:49:30.485842+00:00", "type": "task_started", "event_data":
{"task_description": "What is Brandon''s favorite color?", "expected_output":
"Brandon''s favorite color.", "task_name": "What is Brandon''s favorite color?",
"context": "", "agent_role": "Information Agent", "task_id": "0305e5ec-8f86-441a-b17e-ec03979c4f40"}},
{"event_id": "f5b196fd-bf4e-46cc-a3dd-a0abacf78461", "timestamp": "2025-09-23T20:49:30.485966+00:00",
"type": "llm_call_started", "event_data": {"timestamp": "2025-09-23T20:49:30.485945+00:00",
"type": "llm_call_started", "source_fingerprint": null, "source_type": null,
"fingerprint_metadata": null, "task_id": null, "task_name": null, "agent_id":
null, "agent_role": null, "from_task": null, "from_agent": null, "model": "gpt-4o-mini",
"messages": [{"role": "system", "content": "Your goal is to rewrite the user
query so that it is optimized for retrieval from a vector database. Consider
how the query will be used to find relevant documents, and aim to make it more
specific and context-aware. \n\n Do not include any other text than the rewritten
query, especially any preamble or postamble and only add expected output format
if its relevant to the rewritten query. \n\n Focus on the key words of the intended
task and to retrieve the most relevant information. \n\n There will be some
extra context provided that might need to be removed such as expected_output
formats structured_outputs and other instructions."}, {"role": "user", "content":
"The original query is: What is Brandon''s favorite color?\n\nThis is the expected
criteria for your final answer: Brandon''s favorite color.\nyou MUST return
the actual complete content as the final answer, not a summary.."}], "tools":
null, "callbacks": null, "available_functions": null}}, {"event_id": "97f3e7b4-2ff7-4826-bd93-ec4a285ac60a",
"timestamp": "2025-09-23T20:49:30.487319+00:00", "type": "llm_call_completed",
"event_data": {"timestamp": "2025-09-23T20:49:30.487295+00:00", "type": "llm_call_completed",
"source_fingerprint": null, "source_type": null, "fingerprint_metadata": null,
"task_id": null, "task_name": null, "agent_id": null, "agent_role": null, "from_task":
null, "from_agent": null, "messages": [{"role": "system", "content": "Your goal
is to rewrite the user query so that it is optimized for retrieval from a vector
database. Consider how the query will be used to find relevant documents, and
aim to make it more specific and context-aware. \n\n Do not include any other
text than the rewritten query, especially any preamble or postamble and only
add expected output format if its relevant to the rewritten query. \n\n Focus
on the key words of the intended task and to retrieve the most relevant information.
\n\n There will be some extra context provided that might need to be removed
such as expected_output formats structured_outputs and other instructions."},
{"role": "user", "content": "The original query is: What is Brandon''s favorite
color?\n\nThis is the expected criteria for your final answer: Brandon''s favorite
color.\nyou MUST return the actual complete content as the final answer, not
a summary.."}], "response": "Brandon favorite color", "call_type": "<LLMCallType.LLM_CALL:
''llm_call''>", "model": "gpt-4o-mini"}}, {"event_id": "ae65649b-87ad-4378-9ee1-2c5edf2e9573",
"timestamp": "2025-09-23T20:49:30.487828+00:00", "type": "agent_execution_started",
"event_data": {"agent_role": "Information Agent", "agent_goal": "Provide information
based on knowledge sources", "agent_backstory": "You have access to specific
knowledge sources."}}, {"event_id": "69fa8d11-63df-4118-8607-6f5328dad0c5",
"timestamp": "2025-09-23T20:49:30.487905+00:00", "type": "llm_call_started",
"event_data": {"timestamp": "2025-09-23T20:49:30.487889+00:00", "type": "llm_call_started",
"source_fingerprint": null, "source_type": null, "fingerprint_metadata": null,
"task_id": "0305e5ec-8f86-441a-b17e-ec03979c4f40", "task_name": "What is Brandon''s
favorite color?", "agent_id": null, "agent_role": null, "from_task": null, "from_agent":
null, "model": "gpt-4o-mini", "messages": [{"role": "system", "content": "You
are Information Agent. You have access to specific knowledge sources.\nYour
personal goal is: Provide information based on knowledge sources\nTo give my
best complete final answer to the task respond using the exact following format:\n\nThought:
I now can give a great answer\nFinal Answer: Your final answer must be the great
and the most complete as possible, it must be outcome described.\n\nI MUST use
these formats, my job depends on it!"}, {"role": "user", "content": "\nCurrent
Task: What is Brandon''s favorite color?\n\nThis is the expected criteria for
your final answer: Brandon''s favorite color.\nyou MUST return the actual complete
content as the final answer, not a summary.\n\nBegin! This is VERY important
to you, use the tools available and give your best Final Answer, your job depends
on it!\n\nThought:"}], "tools": null, "callbacks": ["<crewai.utilities.token_counter_callback.TokenCalcHandler
object at 0x13513f080>"], "available_functions": null}}, {"event_id": "559890e0-ceea-4812-96a9-df25b86210d0",
"timestamp": "2025-09-23T20:49:30.488945+00:00", "type": "llm_call_completed",
"event_data": {"timestamp": "2025-09-23T20:49:30.488926+00:00", "type": "llm_call_completed",
"source_fingerprint": null, "source_type": null, "fingerprint_metadata": null,
"task_id": "0305e5ec-8f86-441a-b17e-ec03979c4f40", "task_name": "What is Brandon''s
favorite color?", "agent_id": null, "agent_role": null, "from_task": null, "from_agent":
null, "messages": [{"role": "system", "content": "You are Information Agent.
You have access to specific knowledge sources.\nYour personal goal is: Provide
information based on knowledge sources\nTo give my best complete final answer
to the task respond using the exact following format:\n\nThought: I now can
give a great answer\nFinal Answer: Your final answer must be the great and the
most complete as possible, it must be outcome described.\n\nI MUST use these
formats, my job depends on it!"}, {"role": "user", "content": "\nCurrent Task:
What is Brandon''s favorite color?\n\nThis is the expected criteria for your
final answer: Brandon''s favorite color.\nyou MUST return the actual complete
content as the final answer, not a summary.\n\nBegin! This is VERY important
to you, use the tools available and give your best Final Answer, your job depends
on it!\n\nThought:"}], "response": "I now can give a great answer \nFinal Answer:
Brandon''s favorite color is red.", "call_type": "<LLMCallType.LLM_CALL: ''llm_call''>",
"model": "gpt-4o-mini"}}, {"event_id": "1fea1502-387c-4456-b057-528f589f3946",
"timestamp": "2025-09-23T20:49:30.489060+00:00", "type": "agent_execution_completed",
"event_data": {"agent_role": "Information Agent", "agent_goal": "Provide information
based on knowledge sources", "agent_backstory": "You have access to specific
knowledge sources."}}, {"event_id": "c0848a77-a641-4be8-8c0a-ef6c7bce2ce3",
"timestamp": "2025-09-23T20:49:30.489105+00:00", "type": "task_completed", "event_data":
{"task_description": "What is Brandon''s favorite color?", "task_name": "What
is Brandon''s favorite color?", "task_id": "0305e5ec-8f86-441a-b17e-ec03979c4f40",
"output_raw": "Brandon''s favorite color is red.", "output_format": "OutputFormat.RAW",
"agent_role": "Information Agent"}}, {"event_id": "278e4853-3297-46c2-ba0f-3456c93cd50d",
"timestamp": "2025-09-23T20:49:30.490117+00:00", "type": "crew_kickoff_completed",
"event_data": {"timestamp": "2025-09-23T20:49:30.490098+00:00", "type": "crew_kickoff_completed",
"source_fingerprint": null, "source_type": null, "fingerprint_metadata": null,
"task_id": null, "task_name": null, "agent_id": null, "agent_role": null, "crew_name":
"crew", "crew": null, "output": {"description": "What is Brandon''s favorite
color?", "name": "What is Brandon''s favorite color?", "expected_output": "Brandon''s
favorite color.", "summary": "What is Brandon''s favorite color?...", "raw":
"Brandon''s favorite color is red.", "pydantic": null, "json_dict": null, "agent":
"Information Agent", "output_format": "raw"}, "total_tokens": 380}}], "batch_metadata":
{"events_count": 10, "batch_sequence": 1, "is_final_batch": false}}'
headers:
Accept:
- '*/*'
Accept-Encoding:
- gzip, deflate
Connection:
- keep-alive
Content-Length:
- '8758'
Content-Type:
- application/json
User-Agent:
- CrewAI-CLI/0.193.2
X-Crewai-Version:
- 0.193.2
method: POST
uri: http://localhost:3000/crewai_plus/api/v1/tracing/ephemeral/batches/5a473660-de8d-4c03-a05b-3d0e38cfaf2b/events
response:
body:
string: '{"events_created":10,"ephemeral_trace_batch_id":"73b8ab8e-2462-45ea-bea6-8397197bfa95"}'
headers:
Content-Length:
- '87'
cache-control:
- max-age=0, private, must-revalidate
content-security-policy:
- 'default-src ''self'' *.crewai.com crewai.com; script-src ''self'' ''unsafe-inline''
*.crewai.com crewai.com https://cdn.jsdelivr.net/npm/apexcharts https://www.gstatic.com
https://run.pstmn.io https://share.descript.com/; style-src ''self'' ''unsafe-inline''
*.crewai.com crewai.com https://cdn.jsdelivr.net/npm/apexcharts; img-src ''self''
data: *.crewai.com crewai.com https://zeus.tools.crewai.com https://dashboard.tools.crewai.com
https://cdn.jsdelivr.net; font-src ''self'' data: *.crewai.com crewai.com;
connect-src ''self'' *.crewai.com crewai.com https://zeus.tools.crewai.com
https://connect.useparagon.com/ https://zeus.useparagon.com/* https://*.useparagon.com/*
https://run.pstmn.io https://connect.tools.crewai.com/ ws://localhost:3036
wss://localhost:3036; frame-src ''self'' *.crewai.com crewai.com https://connect.useparagon.com/
https://zeus.tools.crewai.com https://zeus.useparagon.com/* https://connect.tools.crewai.com/
https://www.youtube.com https://share.descript.com'
content-type:
- application/json; charset=utf-8
etag:
- W/"f467d241acdc3eb80717680fc1a8e139"
permissions-policy:
- camera=(), microphone=(self), geolocation=()
referrer-policy:
- strict-origin-when-cross-origin
server-timing:
- cache_read.active_support;dur=0.06, sql.active_record;dur=30.49, cache_generate.active_support;dur=2.38,
cache_write.active_support;dur=0.12, cache_read_multi.active_support;dur=0.09,
start_processing.action_controller;dur=0.00, instantiation.active_record;dur=0.04,
start_transaction.active_record;dur=0.00, transaction.active_record;dur=69.93,
process_action.action_controller;dur=75.35
vary:
- Accept
x-content-type-options:
- nosniff
x-frame-options:
- SAMEORIGIN
x-permitted-cross-domain-policies:
- none
x-request-id:
- 8d615fb0-08c9-4258-aabe-e551d01dc139
x-runtime:
- '0.101789'
x-xss-protection:
- 1; mode=block
status:
code: 200
message: OK
- request:
body: '{"status": "completed", "duration_ms": 170, "final_event_count": 10}'
headers:
Accept:
- '*/*'
Accept-Encoding:
- gzip, deflate
Connection:
- keep-alive
Content-Length:
- '68'
Content-Type:
- application/json
User-Agent:
- CrewAI-CLI/0.193.2
X-Crewai-Version:
- 0.193.2
method: PATCH
uri: http://localhost:3000/crewai_plus/api/v1/tracing/ephemeral/batches/5a473660-de8d-4c03-a05b-3d0e38cfaf2b/finalize
response:
body:
string: '{"id":"73b8ab8e-2462-45ea-bea6-8397197bfa95","ephemeral_trace_id":"5a473660-de8d-4c03-a05b-3d0e38cfaf2b","execution_type":"crew","crew_name":"crew","flow_name":null,"status":"completed","duration_ms":170,"crewai_version":"0.193.2","total_events":10,"execution_context":{"crew_name":"crew","flow_name":null,"privacy_level":"standard","crewai_version":"0.193.2","crew_fingerprint":null},"created_at":"2025-09-23T20:49:30.477Z","updated_at":"2025-09-23T20:49:30.631Z","access_code":"TRACE-e7ac143cef","user_identifier":null}'
headers:
Content-Length:
- '521'
cache-control:
- max-age=0, private, must-revalidate
content-security-policy:
- 'default-src ''self'' *.crewai.com crewai.com; script-src ''self'' ''unsafe-inline''
*.crewai.com crewai.com https://cdn.jsdelivr.net/npm/apexcharts https://www.gstatic.com
https://run.pstmn.io https://share.descript.com/; style-src ''self'' ''unsafe-inline''
*.crewai.com crewai.com https://cdn.jsdelivr.net/npm/apexcharts; img-src ''self''
data: *.crewai.com crewai.com https://zeus.tools.crewai.com https://dashboard.tools.crewai.com
https://cdn.jsdelivr.net; font-src ''self'' data: *.crewai.com crewai.com;
connect-src ''self'' *.crewai.com crewai.com https://zeus.tools.crewai.com
https://connect.useparagon.com/ https://zeus.useparagon.com/* https://*.useparagon.com/*
https://run.pstmn.io https://connect.tools.crewai.com/ ws://localhost:3036
wss://localhost:3036; frame-src ''self'' *.crewai.com crewai.com https://connect.useparagon.com/
https://zeus.tools.crewai.com https://zeus.useparagon.com/* https://connect.tools.crewai.com/
https://www.youtube.com https://share.descript.com'
content-type:
- application/json; charset=utf-8
etag:
- W/"71b47fd1cf30771f0605bb4c77577c2f"
permissions-policy:
- camera=(), microphone=(self), geolocation=()
referrer-policy:
- strict-origin-when-cross-origin
server-timing:
- cache_read.active_support;dur=0.10, cache_fetch_hit.active_support;dur=0.00,
cache_read_multi.active_support;dur=0.07, start_processing.action_controller;dur=0.00,
sql.active_record;dur=7.47, instantiation.active_record;dur=0.03, unpermitted_parameters.action_controller;dur=0.00,
start_transaction.active_record;dur=0.00, transaction.active_record;dur=4.44,
process_action.action_controller;dur=10.94
vary:
- Accept
x-content-type-options:
- nosniff
x-frame-options:
- SAMEORIGIN
x-permitted-cross-domain-policies:
- none
x-request-id:
- 0f5e3242-5478-4d7f-9d5d-84ac009cb38d
x-runtime:
- '0.028980'
x-xss-protection:
- 1; mode=block
status:
code: 200
message: OK
- request:
body: '{"trace_id": "54a8adea-c972-420f-a708-1a544eff9635", "execution_type":
"crew", "user_identifier": null, "execution_context": {"crew_fingerprint": null,
"crew_name": "crew", "flow_name": null, "crewai_version": "0.193.2", "privacy_level":
"standard"}, "execution_metadata": {"expected_duration_estimate": 300, "agent_count":
0, "task_count": 0, "flow_method_count": 0, "execution_started_at": "2025-09-24T05:24:12.861068+00:00"}}'
headers:
Accept:
- '*/*'
Accept-Encoding:
- gzip, deflate
Connection:
- keep-alive
Content-Length:
- '428'
Content-Type:
- application/json
User-Agent:
- CrewAI-CLI/0.193.2
X-Crewai-Organization-Id:
- d3a3d10c-35db-423f-a7a4-c026030ba64d
X-Crewai-Version:
- 0.193.2
method: POST
uri: http://localhost:3000/crewai_plus/api/v1/tracing/batches
response:
body:
string: '{"id":"61db142f-783b-4fd1-9aa3-6a3a004dcd01","trace_id":"54a8adea-c972-420f-a708-1a544eff9635","execution_type":"crew","crew_name":"crew","flow_name":null,"status":"running","duration_ms":null,"crewai_version":"0.193.2","privacy_level":"standard","total_events":0,"execution_context":{"crew_fingerprint":null,"crew_name":"crew","flow_name":null,"crewai_version":"0.193.2","privacy_level":"standard"},"created_at":"2025-09-24T05:24:13.678Z","updated_at":"2025-09-24T05:24:13.678Z"}'
headers:
Content-Length:
- '480'
cache-control:
- max-age=0, private, must-revalidate
content-security-policy:
- 'default-src ''self'' *.crewai.com crewai.com; script-src ''self'' ''unsafe-inline''
*.crewai.com crewai.com https://cdn.jsdelivr.net/npm/apexcharts https://www.gstatic.com
https://run.pstmn.io https://share.descript.com/; style-src ''self'' ''unsafe-inline''
*.crewai.com crewai.com https://cdn.jsdelivr.net/npm/apexcharts; img-src ''self''
data: *.crewai.com crewai.com https://zeus.tools.crewai.com https://dashboard.tools.crewai.com
https://cdn.jsdelivr.net; font-src ''self'' data: *.crewai.com crewai.com;
connect-src ''self'' *.crewai.com crewai.com https://zeus.tools.crewai.com
https://connect.useparagon.com/ https://zeus.useparagon.com/* https://*.useparagon.com/*
https://run.pstmn.io https://connect.tools.crewai.com/ ws://localhost:3036
wss://localhost:3036; frame-src ''self'' *.crewai.com crewai.com https://connect.useparagon.com/
https://zeus.tools.crewai.com https://zeus.useparagon.com/* https://connect.tools.crewai.com/
https://www.youtube.com https://share.descript.com'
content-type:
- application/json; charset=utf-8
etag:
- W/"bef69fc49b08b5ac7bb3eac00e96085a"
permissions-policy:
- camera=(), microphone=(self), geolocation=()
referrer-policy:
- strict-origin-when-cross-origin
server-timing:
- cache_read.active_support;dur=0.05, sql.active_record;dur=24.34, cache_generate.active_support;dur=1.98,
cache_write.active_support;dur=0.12, cache_read_multi.active_support;dur=0.09,
start_processing.action_controller;dur=0.00, instantiation.active_record;dur=0.56,
feature_operation.flipper;dur=0.11, start_transaction.active_record;dur=0.01,
transaction.active_record;dur=6.41, process_action.action_controller;dur=793.70
vary:
- Accept
x-content-type-options:
- nosniff
x-frame-options:
- SAMEORIGIN
x-permitted-cross-domain-policies:
- none
x-request-id:
- 1fc54a38-7fa9-4fbd-9adc-5a67f11c6fc2
x-runtime:
- '0.820447'
x-xss-protection:
- 1; mode=block
status:
code: 201
message: Created
- request:
body: '{"events": [{"event_id": "71c92873-7e03-4150-bc17-c6840ee49538", "timestamp":
"2025-09-24T05:24:13.685702+00:00", "type": "crew_kickoff_started", "event_data":
{"timestamp": "2025-09-24T05:24:12.858951+00:00", "type": "crew_kickoff_started",
"source_fingerprint": null, "source_type": null, "fingerprint_metadata": null,
"task_id": null, "task_name": null, "agent_id": null, "agent_role": null, "crew_name":
"crew", "crew": null, "inputs": null}}, {"event_id": "e619fc6f-2dd4-4520-abbd-ac4e52f992ca",
"timestamp": "2025-09-24T05:24:13.691993+00:00", "type": "task_started", "event_data":
{"task_description": "What is Brandon''s favorite color?", "expected_output":
"Brandon''s favorite color.", "task_name": "What is Brandon''s favorite color?",
"context": "", "agent_role": "Information Agent", "task_id": "a89d3b30-df0d-4107-a477-ef54077c6833"}},
{"event_id": "8fae8f69-b0a5-426e-802c-a3b2e5b018db", "timestamp": "2025-09-24T05:24:13.692473+00:00",
"type": "llm_call_started", "event_data": {"timestamp": "2025-09-24T05:24:13.692433+00:00",
"type": "llm_call_started", "source_fingerprint": null, "source_type": null,
"fingerprint_metadata": null, "task_id": null, "task_name": null, "agent_id":
null, "agent_role": null, "from_task": null, "from_agent": null, "model": "gpt-4o-mini",
"messages": [{"role": "system", "content": "Your goal is to rewrite the user
query so that it is optimized for retrieval from a vector database. Consider
how the query will be used to find relevant documents, and aim to make it more
specific and context-aware. \n\n Do not include any other text than the rewritten
query, especially any preamble or postamble and only add expected output format
if its relevant to the rewritten query. \n\n Focus on the key words of the intended
task and to retrieve the most relevant information. \n\n There will be some
extra context provided that might need to be removed such as expected_output
formats structured_outputs and other instructions."}, {"role": "user", "content":
"The original query is: What is Brandon''s favorite color?\n\nThis is the expected
criteria for your final answer: Brandon''s favorite color.\nyou MUST return
the actual complete content as the final answer, not a summary.."}], "tools":
null, "callbacks": null, "available_functions": null}}, {"event_id": "0fcc1faf-8534-48e9-9823-bfe04645a79b",
"timestamp": "2025-09-24T05:24:13.694713+00:00", "type": "llm_call_completed",
"event_data": {"timestamp": "2025-09-24T05:24:13.694669+00:00", "type": "llm_call_completed",
"source_fingerprint": null, "source_type": null, "fingerprint_metadata": null,
"task_id": null, "task_name": null, "agent_id": null, "agent_role": null, "from_task":
null, "from_agent": null, "messages": [{"role": "system", "content": "Your goal
is to rewrite the user query so that it is optimized for retrieval from a vector
database. Consider how the query will be used to find relevant documents, and
aim to make it more specific and context-aware. \n\n Do not include any other
text than the rewritten query, especially any preamble or postamble and only
add expected output format if its relevant to the rewritten query. \n\n Focus
on the key words of the intended task and to retrieve the most relevant information.
\n\n There will be some extra context provided that might need to be removed
such as expected_output formats structured_outputs and other instructions."},
{"role": "user", "content": "The original query is: What is Brandon''s favorite
color?\n\nThis is the expected criteria for your final answer: Brandon''s favorite
color.\nyou MUST return the actual complete content as the final answer, not
a summary.."}], "response": "Brandon favorite color", "call_type": "<LLMCallType.LLM_CALL:
''llm_call''>", "model": "gpt-4o-mini"}}, {"event_id": "b82cf317-57e0-448f-a028-e74ed3a4cdb6",
"timestamp": "2025-09-24T05:24:13.825341+00:00", "type": "agent_execution_started",
"event_data": {"agent_role": "Information Agent", "agent_goal": "Provide information
based on knowledge sources", "agent_backstory": "You have access to specific
knowledge sources."}}, {"event_id": "820353d4-e621-463e-a512-45ebe3cbcd99",
"timestamp": "2025-09-24T05:24:13.825393+00:00", "type": "llm_call_started",
"event_data": {"timestamp": "2025-09-24T05:24:13.825378+00:00", "type": "llm_call_started",
"source_fingerprint": null, "source_type": null, "fingerprint_metadata": null,
"task_id": "a89d3b30-df0d-4107-a477-ef54077c6833", "task_name": "What is Brandon''s
favorite color?", "agent_id": "36311e2d-ffd3-4d3b-a212-f12d63c1cb06", "agent_role":
"Information Agent", "from_task": null, "from_agent": null, "model": "gpt-4o-mini",
"messages": [{"role": "system", "content": "You are Information Agent. You have
access to specific knowledge sources.\nYour personal goal is: Provide information
based on knowledge sources\nTo give my best complete final answer to the task
respond using the exact following format:\n\nThought: I now can give a great
answer\nFinal Answer: Your final answer must be the great and the most complete
as possible, it must be outcome described.\n\nI MUST use these formats, my job
depends on it!"}, {"role": "user", "content": "\nCurrent Task: What is Brandon''s
favorite color?\n\nThis is the expected criteria for your final answer: Brandon''s
favorite color.\nyou MUST return the actual complete content as the final answer,
not a summary.Additional Information: Brandon''s favorite color is red and he
likes Mexican food.\n\nBegin! This is VERY important to you, use the tools available
and give your best Final Answer, your job depends on it!\n\nThought:"}], "tools":
null, "callbacks": ["<crewai.utilities.token_counter_callback.TokenCalcHandler
object at 0x13b1efbc0>"], "available_functions": null}}, {"event_id": "0c94bb30-872b-40e2-bea1-8898056c6989",
"timestamp": "2025-09-24T05:24:13.826292+00:00", "type": "llm_call_completed",
"event_data": {"timestamp": "2025-09-24T05:24:13.826275+00:00", "type": "llm_call_completed",
"source_fingerprint": null, "source_type": null, "fingerprint_metadata": null,
"task_id": "a89d3b30-df0d-4107-a477-ef54077c6833", "task_name": "What is Brandon''s
favorite color?", "agent_id": "36311e2d-ffd3-4d3b-a212-f12d63c1cb06", "agent_role":
"Information Agent", "from_task": null, "from_agent": null, "messages": [{"role":
"system", "content": "You are Information Agent. You have access to specific
knowledge sources.\nYour personal goal is: Provide information based on knowledge
sources\nTo give my best complete final answer to the task respond using the
exact following format:\n\nThought: I now can give a great answer\nFinal Answer:
Your final answer must be the great and the most complete as possible, it must
be outcome described.\n\nI MUST use these formats, my job depends on it!"},
{"role": "user", "content": "\nCurrent Task: What is Brandon''s favorite color?\n\nThis
is the expected criteria for your final answer: Brandon''s favorite color.\nyou
MUST return the actual complete content as the final answer, not a summary.Additional
Information: Brandon''s favorite color is red and he likes Mexican food.\n\nBegin!
This is VERY important to you, use the tools available and give your best Final
Answer, your job depends on it!\n\nThought:"}], "response": "I now can give
a great answer \nFinal Answer: Brandon''s favorite color is red.", "call_type":
"<LLMCallType.LLM_CALL: ''llm_call''>", "model": "gpt-4o-mini"}}, {"event_id":
"e8a00053-f0ef-4712-9ab8-1f17554390c5", "timestamp": "2025-09-24T05:24:13.826380+00:00",
"type": "agent_execution_completed", "event_data": {"agent_role": "Information
Agent", "agent_goal": "Provide information based on knowledge sources", "agent_backstory":
"You have access to specific knowledge sources."}}, {"event_id": "e8a26836-8bcb-4020-ae54-ef8fad2b5eaf",
"timestamp": "2025-09-24T05:24:13.826421+00:00", "type": "task_completed", "event_data":
{"task_description": "What is Brandon''s favorite color?", "task_name": "What
is Brandon''s favorite color?", "task_id": "a89d3b30-df0d-4107-a477-ef54077c6833",
"output_raw": "Brandon''s favorite color is red.", "output_format": "OutputFormat.RAW",
"agent_role": "Information Agent"}}, {"event_id": "6947f01a-4023-4f2a-a72d-6f058ea76498",
"timestamp": "2025-09-24T05:24:13.827029+00:00", "type": "crew_kickoff_completed",
"event_data": {"timestamp": "2025-09-24T05:24:13.827017+00:00", "type": "crew_kickoff_completed",
"source_fingerprint": null, "source_type": null, "fingerprint_metadata": null,
"task_id": null, "task_name": null, "agent_id": null, "agent_role": null, "crew_name":
"crew", "crew": null, "output": {"description": "What is Brandon''s favorite
color?", "name": "What is Brandon''s favorite color?", "expected_output": "Brandon''s
favorite color.", "summary": "What is Brandon''s favorite color?...", "raw":
"Brandon''s favorite color is red.", "pydantic": null, "json_dict": null, "agent":
"Information Agent", "output_format": "raw"}, "total_tokens": 380}}], "batch_metadata":
{"events_count": 10, "batch_sequence": 1, "is_final_batch": false}}'
headers:
Accept:
- '*/*'
Accept-Encoding:
- gzip, deflate
Connection:
- keep-alive
Content-Length:
- '9020'
Content-Type:
- application/json
User-Agent:
- CrewAI-CLI/0.193.2
X-Crewai-Organization-Id:
- d3a3d10c-35db-423f-a7a4-c026030ba64d
X-Crewai-Version:
- 0.193.2
method: POST
uri: http://localhost:3000/crewai_plus/api/v1/tracing/batches/54a8adea-c972-420f-a708-1a544eff9635/events
response:
body:
string: '{"events_created":10,"trace_batch_id":"61db142f-783b-4fd1-9aa3-6a3a004dcd01"}'
headers:
Content-Length:
- '77'
cache-control:
- max-age=0, private, must-revalidate
content-security-policy:
- 'default-src ''self'' *.crewai.com crewai.com; script-src ''self'' ''unsafe-inline''
*.crewai.com crewai.com https://cdn.jsdelivr.net/npm/apexcharts https://www.gstatic.com
https://run.pstmn.io https://share.descript.com/; style-src ''self'' ''unsafe-inline''
*.crewai.com crewai.com https://cdn.jsdelivr.net/npm/apexcharts; img-src ''self''
data: *.crewai.com crewai.com https://zeus.tools.crewai.com https://dashboard.tools.crewai.com
https://cdn.jsdelivr.net; font-src ''self'' data: *.crewai.com crewai.com;
connect-src ''self'' *.crewai.com crewai.com https://zeus.tools.crewai.com
https://connect.useparagon.com/ https://zeus.useparagon.com/* https://*.useparagon.com/*
https://run.pstmn.io https://connect.tools.crewai.com/ ws://localhost:3036
wss://localhost:3036; frame-src ''self'' *.crewai.com crewai.com https://connect.useparagon.com/
https://zeus.tools.crewai.com https://zeus.useparagon.com/* https://connect.tools.crewai.com/
https://www.youtube.com https://share.descript.com'
content-type:
- application/json; charset=utf-8
etag:
- W/"a52ad8652657c7785d695eec97440bdf"
permissions-policy:
- camera=(), microphone=(self), geolocation=()
referrer-policy:
- strict-origin-when-cross-origin
server-timing:
- cache_read.active_support;dur=0.05, sql.active_record;dur=33.94, cache_generate.active_support;dur=2.76,
cache_write.active_support;dur=0.14, cache_read_multi.active_support;dur=0.08,
start_processing.action_controller;dur=0.00, instantiation.active_record;dur=0.25,
start_transaction.active_record;dur=0.00, transaction.active_record;dur=44.09,
process_action.action_controller;dur=322.17
vary:
- Accept
x-content-type-options:
- nosniff
x-frame-options:
- SAMEORIGIN
x-permitted-cross-domain-policies:
- none
x-request-id:
- d977667c-2447-4373-aca9-6af8c50cc7e8
x-runtime:
- '0.378785'
x-xss-protection:
- 1; mode=block
status:
code: 200
message: OK
- request:
body: '{"status": "completed", "duration_ms": 1355, "final_event_count": 10}'
headers:
Accept:
- '*/*'
Accept-Encoding:
- gzip, deflate
Connection:
- keep-alive
Content-Length:
- '69'
Content-Type:
- application/json
User-Agent:
- CrewAI-CLI/0.193.2
X-Crewai-Organization-Id:
- d3a3d10c-35db-423f-a7a4-c026030ba64d
X-Crewai-Version:
- 0.193.2
method: PATCH
uri: http://localhost:3000/crewai_plus/api/v1/tracing/batches/54a8adea-c972-420f-a708-1a544eff9635/finalize
response:
body:
string: '{"id":"61db142f-783b-4fd1-9aa3-6a3a004dcd01","trace_id":"54a8adea-c972-420f-a708-1a544eff9635","execution_type":"crew","crew_name":"crew","flow_name":null,"status":"completed","duration_ms":1355,"crewai_version":"0.193.2","privacy_level":"standard","total_events":10,"execution_context":{"crew_name":"crew","flow_name":null,"privacy_level":"standard","crewai_version":"0.193.2","crew_fingerprint":null},"created_at":"2025-09-24T05:24:13.678Z","updated_at":"2025-09-24T05:24:14.660Z"}'
headers:
Content-Length:
- '483'
cache-control:
- max-age=0, private, must-revalidate
content-security-policy:
- 'default-src ''self'' *.crewai.com crewai.com; script-src ''self'' ''unsafe-inline''
*.crewai.com crewai.com https://cdn.jsdelivr.net/npm/apexcharts https://www.gstatic.com
https://run.pstmn.io https://share.descript.com/; style-src ''self'' ''unsafe-inline''
*.crewai.com crewai.com https://cdn.jsdelivr.net/npm/apexcharts; img-src ''self''
data: *.crewai.com crewai.com https://zeus.tools.crewai.com https://dashboard.tools.crewai.com
https://cdn.jsdelivr.net; font-src ''self'' data: *.crewai.com crewai.com;
connect-src ''self'' *.crewai.com crewai.com https://zeus.tools.crewai.com
https://connect.useparagon.com/ https://zeus.useparagon.com/* https://*.useparagon.com/*
https://run.pstmn.io https://connect.tools.crewai.com/ ws://localhost:3036
wss://localhost:3036; frame-src ''self'' *.crewai.com crewai.com https://connect.useparagon.com/
https://zeus.tools.crewai.com https://zeus.useparagon.com/* https://connect.tools.crewai.com/
https://www.youtube.com https://share.descript.com'
content-type:
- application/json; charset=utf-8
etag:
- W/"38e0f70fac59670de2df6d90478b7e43"
permissions-policy:
- camera=(), microphone=(self), geolocation=()
referrer-policy:
- strict-origin-when-cross-origin
server-timing:
- cache_read.active_support;dur=0.04, cache_fetch_hit.active_support;dur=0.00,
cache_read_multi.active_support;dur=0.05, start_processing.action_controller;dur=0.00,
sql.active_record;dur=14.79, instantiation.active_record;dur=0.59, unpermitted_parameters.action_controller;dur=0.02,
start_transaction.active_record;dur=0.00, transaction.active_record;dur=4.39,
process_action.action_controller;dur=430.19
vary:
- Accept
x-content-type-options:
- nosniff
x-frame-options:
- SAMEORIGIN
x-permitted-cross-domain-policies:
- none
x-request-id:
- 8faa01f5-3c5f-47c0-8aef-e0807a0e0dcf
x-runtime:
- '0.445912'
x-xss-protection:
- 1; mode=block
status:
code: 200
message: OK
version: 1