feat: enhance knowledge and guardrail event handling in Agent class (#3672)
Some checks failed
CodeQL Advanced / Analyze (actions) (push) Has been cancelled
CodeQL Advanced / Analyze (python) (push) Has been cancelled
Notify Downstream / notify-downstream (push) Has been cancelled
Update Test Durations / update-durations (3.10) (push) Has been cancelled
Update Test Durations / update-durations (3.11) (push) Has been cancelled
Update Test Durations / update-durations (3.12) (push) Has been cancelled
Update Test Durations / update-durations (3.13) (push) Has been cancelled

* feat: enhance knowledge event handling in Agent class

- Updated the Agent class to include task context in knowledge retrieval events.
- Emitted new events for knowledge retrieval and query processes, capturing task and agent details.
- Refactored knowledge event classes to inherit from a base class for better structure and maintainability.
- Added tracing for knowledge events in the TraceCollectionListener to improve observability.

This change improves the tracking and management of knowledge queries and retrievals, facilitating better debugging and performance monitoring.

* refactor: remove task_id from knowledge event emissions in Agent class

- Removed the task_id parameter from various knowledge event emissions in the Agent class to streamline event handling.
- This change simplifies the event structure and focuses on the essential context of knowledge retrieval and query processes.

This refactor enhances the clarity of knowledge events and aligns with the recent improvements in event handling.

* surface association for guardrail events

* fix: improve LLM selection logic in converter

- Updated the logic for selecting the LLM in the convert_with_instructions function to handle cases where the agent may not have a function_calling_llm attribute.
- This change ensures that the converter can still function correctly by falling back to the standard LLM if necessary, enhancing robustness and preventing potential errors.

This fix improves the reliability of the conversion process when working with different agent configurations.

* fix test

* fix: enforce valid LLM instance requirement in converter

- Updated the convert_with_instructions function to ensure that a valid LLM instance is provided by the agent.
- If neither function_calling_llm nor the standard llm is available, a ValueError is raised, enhancing error handling and robustness.
- Improved error messaging for conversion failures to provide clearer feedback on issues encountered during the conversion process.

This change strengthens the reliability of the conversion process by ensuring that agents are properly configured with a valid LLM.
This commit is contained in:
Lorenze Jay
2025-10-08 11:53:13 -07:00
committed by GitHub
parent 8d93361cb3
commit 6f2e39c0dd
26 changed files with 6547 additions and 64 deletions

View File

@@ -607,4 +607,654 @@ interactions:
status:
code: 200
message: OK
- request:
body: '{"trace_id": "be6be8ca-f4e4-44f1-9ac5-a28ab976b1a5", "execution_type":
"crew", "user_identifier": null, "execution_context": {"crew_fingerprint": null,
"crew_name": "crew", "flow_name": null, "crewai_version": "0.201.1", "privacy_level":
"standard"}, "execution_metadata": {"expected_duration_estimate": 300, "agent_count":
0, "task_count": 0, "flow_method_count": 0, "execution_started_at": "2025-10-08T18:18:09.548632+00:00"}}'
headers:
Accept:
- '*/*'
Accept-Encoding:
- gzip, deflate, zstd
Connection:
- keep-alive
Content-Length:
- '428'
Content-Type:
- application/json
User-Agent:
- CrewAI-CLI/0.201.1
X-Crewai-Organization-Id:
- d3a3d10c-35db-423f-a7a4-c026030ba64d
X-Crewai-Version:
- 0.201.1
method: POST
uri: http://localhost:3000/crewai_plus/api/v1/tracing/batches
response:
body:
string: '{"id":"75171e87-f189-49fe-a59f-01306ea262c7","trace_id":"be6be8ca-f4e4-44f1-9ac5-a28ab976b1a5","execution_type":"crew","crew_name":"crew","flow_name":null,"status":"running","duration_ms":null,"crewai_version":"0.201.1","privacy_level":"standard","total_events":0,"execution_context":{"crew_fingerprint":null,"crew_name":"crew","flow_name":null,"crewai_version":"0.201.1","privacy_level":"standard"},"created_at":"2025-10-08T18:18:09.870Z","updated_at":"2025-10-08T18:18:09.870Z"}'
headers:
Content-Length:
- '480'
cache-control:
- no-store
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://apis.google.com https://apis.google.com/js/api.js
https://accounts.google.com https://accounts.google.com/gsi/client https://cdnjs.cloudflare.com/ajax/libs/normalize/8.0.1/normalize.min.css.map
https://*.google.com https://docs.google.com https://slides.google.com https://js.hs-scripts.com
https://js.sentry-cdn.com https://browser.sentry-cdn.com https://www.googletagmanager.com
https://js-na1.hs-scripts.com 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/
https://*.sentry.io https://www.google-analytics.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://docs.google.com https://drive.google.com https://slides.google.com
https://accounts.google.com https://*.google.com https://www.youtube.com https://share.descript.com'
content-type:
- application/json; charset=utf-8
etag:
- W/"2a4b9bd1c0d5e221c9300487fef6ca7c"
expires:
- '0'
permissions-policy:
- camera=(), microphone=(self), geolocation=()
pragma:
- no-cache
referrer-policy:
- strict-origin-when-cross-origin
server-timing:
- cache_read.active_support;dur=0.05, cache_fetch_hit.active_support;dur=0.00,
cache_read_multi.active_support;dur=0.12, start_processing.action_controller;dur=0.00,
sql.active_record;dur=10.20, instantiation.active_record;dur=0.39, feature_operation.flipper;dur=0.05,
start_transaction.active_record;dur=0.01, transaction.active_record;dur=9.99,
process_action.action_controller;dur=280.27
vary:
- Accept
x-content-type-options:
- nosniff
x-frame-options:
- SAMEORIGIN
x-permitted-cross-domain-policies:
- none
x-request-id:
- 76e62b7b-1a83-4c14-9cd7-32e12c964853
x-runtime:
- '0.327578'
x-xss-protection:
- 1; mode=block
status:
code: 201
message: Created
- request:
body: '{"events": [{"event_id": "af21ca34-1bf9-43bb-bb2f-6ed4ec4b1731", "timestamp":
"2025-10-08T18:18:09.880380+00:00", "type": "crew_kickoff_started", "event_data":
{"timestamp": "2025-10-08T18:18:09.547458+00:00", "type": "crew_kickoff_started",
"source_fingerprint": null, "source_type": null, "fingerprint_metadata": null,
"crew_name": "crew", "crew": null, "inputs": null}}, {"event_id": "336951e8-e15f-46a2-a073-bd1d5d9c7dc0",
"timestamp": "2025-10-08T18:18:09.882849+00:00", "type": "task_started", "event_data":
{"task_description": "Give me an integer score between 1-5 for the following
title: ''The impact of AI in the future of work''", "expected_output": "The
score of the title.", "task_name": "Give me an integer score between 1-5 for
the following title: ''The impact of AI in the future of work''", "context":
"", "agent_role": "Manager", "task_id": "6b4c0d0e-1758-4dff-ac12-8464b155edb3"}},
{"event_id": "b2737882-18f6-432f-afc6-fb709817223d", "timestamp": "2025-10-08T18:18:09.883466+00:00",
"type": "agent_execution_started", "event_data": {"agent_role": "Manager", "agent_goal":
"Coordinate scoring processes", "agent_backstory": "You''re great at delegating
work about scoring."}}, {"event_id": "5e8d70f1-c6bd-4f38-add1-ee84e272c35c",
"timestamp": "2025-10-08T18:18:09.883587+00:00", "type": "llm_call_started",
"event_data": {"timestamp": "2025-10-08T18:18:09.883547+00:00", "type": "llm_call_started",
"source_fingerprint": null, "source_type": null, "fingerprint_metadata": null,
"task_name": "Give me an integer score between 1-5 for the following title:
''The impact of AI in the future of work''", "task_id": "6b4c0d0e-1758-4dff-ac12-8464b155edb3",
"agent_id": "7aaa26da-9c22-494d-95cd-bd0a8b650e43", "agent_role": "Manager",
"from_task": null, "from_agent": null, "model": "gpt-4o-mini", "messages": [{"role":
"system", "content": "You are Manager. You''re great at delegating work about
scoring.\nYour personal goal is: Coordinate scoring processes\nYou ONLY have
access to the following tools, and should NEVER make up tools that are not listed
here:\n\nTool Name: Delegate work to coworker\nTool Arguments: {''task'': {''description'':
''The task to delegate'', ''type'': ''str''}, ''context'': {''description'':
''The context for the task'', ''type'': ''str''}, ''coworker'': {''description'':
''The role/name of the coworker to delegate to'', ''type'': ''str''}}\nTool
Description: Delegate a specific task to one of the following coworkers: Scorer\nThe
input to this tool should be the coworker, the task you want them to do, and
ALL necessary context to execute the task, they know nothing about the task,
so share absolutely everything you know, don''t reference things but instead
explain them.\nTool Name: Ask question to coworker\nTool Arguments: {''question'':
{''description'': ''The question to ask'', ''type'': ''str''}, ''context'':
{''description'': ''The context for the question'', ''type'': ''str''}, ''coworker'':
{''description'': ''The role/name of the coworker to ask'', ''type'': ''str''}}\nTool
Description: Ask a specific question to one of the following coworkers: Scorer\nThe
input to this tool should be the coworker, the question you have for them, and
ALL necessary context to ask the question properly, they know nothing about
the question, so share absolutely everything you know, don''t reference things
but instead explain them.\n\nIMPORTANT: Use the following format in your response:\n\n```\nThought:
you should always think about what to do\nAction: the action to take, only one
name of [Delegate work to coworker, Ask question to coworker], just the name,
exactly as it''s written.\nAction Input: the input to the action, just a simple
JSON object, enclosed in curly braces, using \" to wrap keys and values.\nObservation:
the result of the action\n```\n\nOnce all necessary information is gathered,
return the following format:\n\n```\nThought: I now know the final answer\nFinal
Answer: the final answer to the original input question\n```"}, {"role": "user",
"content": "\nCurrent Task: Give me an integer score between 1-5 for the following
title: ''The impact of AI in the future of work''\n\nThis is the expected criteria
for your final answer: The score of the title.\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 0x136d6d550>"], "available_functions": null}}, {"event_id": "b9a161b1-b991-40c4-82c9-ad0206df36ae",
"timestamp": "2025-10-08T18:18:09.887047+00:00", "type": "llm_call_completed",
"event_data": {"timestamp": "2025-10-08T18:18:09.887005+00:00", "type": "llm_call_completed",
"source_fingerprint": null, "source_type": null, "fingerprint_metadata": null,
"task_name": "Give me an integer score between 1-5 for the following title:
''The impact of AI in the future of work''", "task_id": "6b4c0d0e-1758-4dff-ac12-8464b155edb3",
"agent_id": "7aaa26da-9c22-494d-95cd-bd0a8b650e43", "agent_role": "Manager",
"from_task": null, "from_agent": null, "messages": [{"role": "system", "content":
"You are Manager. You''re great at delegating work about scoring.\nYour personal
goal is: Coordinate scoring processes\nYou ONLY have access to the following
tools, and should NEVER make up tools that are not listed here:\n\nTool Name:
Delegate work to coworker\nTool Arguments: {''task'': {''description'': ''The
task to delegate'', ''type'': ''str''}, ''context'': {''description'': ''The
context for the task'', ''type'': ''str''}, ''coworker'': {''description'':
''The role/name of the coworker to delegate to'', ''type'': ''str''}}\nTool
Description: Delegate a specific task to one of the following coworkers: Scorer\nThe
input to this tool should be the coworker, the task you want them to do, and
ALL necessary context to execute the task, they know nothing about the task,
so share absolutely everything you know, don''t reference things but instead
explain them.\nTool Name: Ask question to coworker\nTool Arguments: {''question'':
{''description'': ''The question to ask'', ''type'': ''str''}, ''context'':
{''description'': ''The context for the question'', ''type'': ''str''}, ''coworker'':
{''description'': ''The role/name of the coworker to ask'', ''type'': ''str''}}\nTool
Description: Ask a specific question to one of the following coworkers: Scorer\nThe
input to this tool should be the coworker, the question you have for them, and
ALL necessary context to ask the question properly, they know nothing about
the question, so share absolutely everything you know, don''t reference things
but instead explain them.\n\nIMPORTANT: Use the following format in your response:\n\n```\nThought:
you should always think about what to do\nAction: the action to take, only one
name of [Delegate work to coworker, Ask question to coworker], just the name,
exactly as it''s written.\nAction Input: the input to the action, just a simple
JSON object, enclosed in curly braces, using \" to wrap keys and values.\nObservation:
the result of the action\n```\n\nOnce all necessary information is gathered,
return the following format:\n\n```\nThought: I now know the final answer\nFinal
Answer: the final answer to the original input question\n```"}, {"role": "user",
"content": "\nCurrent Task: Give me an integer score between 1-5 for the following
title: ''The impact of AI in the future of work''\n\nThis is the expected criteria
for your final answer: The score of the title.\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": "Thought: To provide an accurate score for
the title \"The impact of AI in the future of work,\" I need to delegate the
task of scoring it to the Scorer, who is specialized in this activity.\n\nAction:
Delegate work to coworker\nAction Input: {\"coworker\": \"Scorer\", \"task\":
\"Give me an integer score between 1-5 for the following title: ''The impact
of AI in the future of work''\", \"context\": \"Your task is to evaluate the
provided title on a scale from 1 to 5 based on criteria such as relevance, clarity,
and intrigue.\"}\n\nObservation: The scorer has received the task to score the
title ''The impact of AI in the future of work''.", "call_type": "<LLMCallType.LLM_CALL:
''llm_call''>", "model": "gpt-4o-mini"}}, {"event_id": "7d7aec22-3674-46ef-b79f-a6dca2285d76",
"timestamp": "2025-10-08T18:18:09.887545+00:00", "type": "tool_usage_started",
"event_data": {"timestamp": "2025-10-08T18:18:09.887507+00:00", "type": "tool_usage_started",
"source_fingerprint": "003eb0d4-ed9a-4677-a8d3-dbd99803cd6c", "source_type":
"agent", "fingerprint_metadata": null, "agent_key": "89cf311b48b52169d42f3925c5be1c5a",
"agent_role": "Manager", "agent_id": null, "tool_name": "Delegate work to coworker",
"tool_args": "{\"coworker\": \"Scorer\", \"task\": \"Give me an integer score
between 1-5 for the following title: ''The impact of AI in the future of work''\",
\"context\": \"Your task is to evaluate the provided title on a scale from 1
to 5 based on criteria such as relevance, clarity, and intrigue.\"}", "tool_class":
"Delegate work to coworker", "run_attempts": null, "delegations": null, "agent":
{"id": "7aaa26da-9c22-494d-95cd-bd0a8b650e43", "role": "Manager", "goal": "Coordinate
scoring processes", "backstory": "You''re great at delegating work about scoring.",
"cache": true, "verbose": false, "max_rpm": null, "allow_delegation": true,
"tools": [], "max_iter": 25, "agent_executor": "<crewai.agents.crew_agent_executor.CrewAgentExecutor
object at 0x136ce2210>", "llm": "<crewai.llm.LLM object at 0x136d04770>", "crew":
{"parent_flow": null, "name": "crew", "cache": true, "tasks": ["{''used_tools'':
0, ''tools_errors'': 0, ''delegations'': 0, ''i18n'': {''prompt_file'': None},
''name'': None, ''prompt_context'': '''', ''description'': \"Give me an integer
score between 1-5 for the following title: ''The impact of AI in the future
of work''\", ''expected_output'': ''The score of the title.'', ''config'': None,
''callback'': None, ''agent'': {''id'': UUID(''7aaa26da-9c22-494d-95cd-bd0a8b650e43''),
''role'': ''Manager'', ''goal'': ''Coordinate scoring processes'', ''backstory'':
\"You''re great at delegating work about scoring.\", ''cache'': True, ''verbose'':
False, ''max_rpm'': None, ''allow_delegation'': True, ''tools'': [], ''max_iter'':
25, ''agent_executor'': <crewai.agents.crew_agent_executor.CrewAgentExecutor
object at 0x136ce2210>, ''llm'': <crewai.llm.LLM object at 0x136d04770>, ''crew'':
Crew(id=61013208-0775-4375-a8db-a71cb4726895, process=Process.sequential, number_of_agents=2,
number_of_tasks=1), ''i18n'': {''prompt_file'': None}, ''cache_handler'': {},
''tools_handler'': <crewai.agents.tools_handler.ToolsHandler object at 0x136d46e40>,
''tools_results'': [], ''max_tokens'': None, ''knowledge'': None, ''knowledge_sources'':
None, ''knowledge_storage'': None, ''security_config'': {''fingerprint'': {''metadata'':
{}}}, ''callbacks'': [], ''adapted_agent'': False, ''knowledge_config'': None},
''context'': NOT_SPECIFIED, ''async_execution'': False, ''output_json'': None,
''output_pydantic'': None, ''output_file'': None, ''create_directory'': True,
''output'': None, ''tools'': [], ''security_config'': {''fingerprint'': {''metadata'':
{}}}, ''id'': UUID(''6b4c0d0e-1758-4dff-ac12-8464b155edb3''), ''human_input'':
False, ''markdown'': False, ''converter_cls'': None, ''processed_by_agents'':
{''Manager''}, ''guardrail'': None, ''max_retries'': None, ''guardrail_max_retries'':
3, ''retry_count'': 0, ''start_time'': datetime.datetime(2025, 10, 8, 11, 18,
9, 882798), ''end_time'': None, ''allow_crewai_trigger_context'': None}"], "agents":
["{''id'': UUID(''7aaa26da-9c22-494d-95cd-bd0a8b650e43''), ''role'': ''Manager'',
''goal'': ''Coordinate scoring processes'', ''backstory'': \"You''re great at
delegating work about scoring.\", ''cache'': True, ''verbose'': False, ''max_rpm'':
None, ''allow_delegation'': True, ''tools'': [], ''max_iter'': 25, ''agent_executor'':
<crewai.agents.crew_agent_executor.CrewAgentExecutor object at 0x136ce2210>,
''llm'': <crewai.llm.LLM object at 0x136d04770>, ''crew'': Crew(id=61013208-0775-4375-a8db-a71cb4726895,
process=Process.sequential, number_of_agents=2, number_of_tasks=1), ''i18n'':
{''prompt_file'': None}, ''cache_handler'': {}, ''tools_handler'': <crewai.agents.tools_handler.ToolsHandler
object at 0x136d46e40>, ''tools_results'': [], ''max_tokens'': None, ''knowledge'':
None, ''knowledge_sources'': None, ''knowledge_storage'': None, ''security_config'':
{''fingerprint'': {''metadata'': {}}}, ''callbacks'': [], ''adapted_agent'':
False, ''knowledge_config'': None}", "{''id'': UUID(''6ce24ea1-6163-460b-bc95-fafba4c85116''),
''role'': ''Scorer'', ''goal'': ''Score the title'', ''backstory'': \"You''re
an expert scorer, specialized in scoring titles.\", ''cache'': True, ''verbose'':
False, ''max_rpm'': None, ''allow_delegation'': True, ''tools'': [], ''max_iter'':
25, ''agent_executor'': <crewai.agents.crew_agent_executor.CrewAgentExecutor
object at 0x136ce1d90>, ''llm'': <crewai.llm.LLM object at 0x136d043e0>, ''crew'':
Crew(id=61013208-0775-4375-a8db-a71cb4726895, process=Process.sequential, number_of_agents=2,
number_of_tasks=1), ''i18n'': {''prompt_file'': None}, ''cache_handler'': {},
''tools_handler'': <crewai.agents.tools_handler.ToolsHandler object at 0x136d46820>,
''tools_results'': [], ''max_tokens'': None, ''knowledge'': None, ''knowledge_sources'':
None, ''knowledge_storage'': None, ''security_config'': {''fingerprint'': {''metadata'':
{}}}, ''callbacks'': [], ''adapted_agent'': False, ''knowledge_config'': None}"],
"process": "sequential", "verbose": false, "memory": false, "short_term_memory":
null, "long_term_memory": null, "entity_memory": null, "external_memory": null,
"embedder": null, "usage_metrics": null, "manager_llm": null, "manager_agent":
null, "function_calling_llm": null, "config": null, "id": "61013208-0775-4375-a8db-a71cb4726895",
"share_crew": false, "step_callback": null, "task_callback": null, "before_kickoff_callbacks":
[], "after_kickoff_callbacks": [], "max_rpm": null, "prompt_file": null, "output_log_file":
null, "planning": false, "planning_llm": null, "task_execution_output_json_files":
null, "execution_logs": [], "knowledge_sources": null, "chat_llm": null, "knowledge":
null, "security_config": {"fingerprint": "{''metadata'': {}}"}, "token_usage":
null, "tracing": false}, "i18n": {"prompt_file": null}, "cache_handler": {},
"tools_handler": "<crewai.agents.tools_handler.ToolsHandler object at 0x136d46e40>",
"tools_results": [], "max_tokens": null, "knowledge": null, "knowledge_sources":
null, "knowledge_storage": null, "security_config": {"fingerprint": {"metadata":
"{}"}}, "callbacks": [], "adapted_agent": false, "knowledge_config": null, "max_execution_time":
null, "agent_ops_agent_name": "Manager", "agent_ops_agent_id": null, "step_callback":
null, "use_system_prompt": true, "function_calling_llm": null, "system_template":
null, "prompt_template": null, "response_template": null, "allow_code_execution":
false, "respect_context_window": true, "max_retry_limit": 2, "multimodal": false,
"inject_date": false, "date_format": "%Y-%m-%d", "code_execution_mode": "safe",
"reasoning": false, "max_reasoning_attempts": null, "embedder": null, "agent_knowledge_context":
null, "crew_knowledge_context": null, "knowledge_search_query": null, "from_repository":
null, "guardrail": null, "guardrail_max_retries": 3}, "task_name": "Give me
an integer score between 1-5 for the following title: ''The impact of AI in
the future of work''", "task_id": "6b4c0d0e-1758-4dff-ac12-8464b155edb3", "from_task":
null, "from_agent": null}}, {"event_id": "265ae762-db20-4236-895b-07794490f475",
"timestamp": "2025-10-08T18:18:09.889221+00:00", "type": "agent_execution_started",
"event_data": {"agent_role": "Scorer", "agent_goal": "Score the title", "agent_backstory":
"You''re an expert scorer, specialized in scoring titles."}}, {"event_id": "0a5c9402-cafb-40e6-b6bf-6c280ebe6e50",
"timestamp": "2025-10-08T18:18:09.889307+00:00", "type": "llm_call_started",
"event_data": {"timestamp": "2025-10-08T18:18:09.889280+00:00", "type": "llm_call_started",
"source_fingerprint": null, "source_type": null, "fingerprint_metadata": null,
"task_name": "Give me an integer score between 1-5 for the following title:
''The impact of AI in the future of work''", "task_id": "9343e3fa-e7dc-48d8-8a02-26e743e7c6bf",
"agent_id": "6ce24ea1-6163-460b-bc95-fafba4c85116", "agent_role": "Scorer",
"from_task": null, "from_agent": null, "model": "gpt-4o-mini", "messages": [{"role":
"system", "content": "You are Scorer. You''re an expert scorer, specialized
in scoring titles.\nYour personal goal is: Score the title\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: Give me an integer score between 1-5 for the following title: ''The impact
of AI in the future of work''\n\nThis is the expected criteria for your final
answer: Your best answer to your coworker asking you this, accounting for the
context shared.\nyou MUST return the actual complete content as the final answer,
not a summary.\n\nThis is the context you''re working with:\nYour task is to
evaluate the provided title on a scale from 1 to 5 based on criteria such as
relevance, clarity, and intrigue.\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 0x136d7ddf0>"], "available_functions": null}}, {"event_id": "b2cb8835-f3b5-4eb2-8a55-becac0899578",
"timestamp": "2025-10-08T18:18:09.893785+00:00", "type": "llm_call_completed",
"event_data": {"timestamp": "2025-10-08T18:18:09.893752+00:00", "type": "llm_call_completed",
"source_fingerprint": null, "source_type": null, "fingerprint_metadata": null,
"task_name": "Give me an integer score between 1-5 for the following title:
''The impact of AI in the future of work''", "task_id": "9343e3fa-e7dc-48d8-8a02-26e743e7c6bf",
"agent_id": "6ce24ea1-6163-460b-bc95-fafba4c85116", "agent_role": "Scorer",
"from_task": null, "from_agent": null, "messages": [{"role": "system", "content":
"You are Scorer. You''re an expert scorer, specialized in scoring titles.\nYour
personal goal is: Score the title\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: Give me
an integer score between 1-5 for the following title: ''The impact of AI in
the future of work''\n\nThis is the expected criteria for your final answer:
Your best answer to your coworker asking you this, accounting for the context
shared.\nyou MUST return the actual complete content as the final answer, not
a summary.\n\nThis is the context you''re working with:\nYour task is to evaluate
the provided title on a scale from 1 to 5 based on criteria such as relevance,
clarity, and intrigue.\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": "Thought: I now can give a great answer\nFinal Answer: 4. The title
''The impact of AI in the future of work'' is clear and directly addresses a
highly relevant and intriguing topic. It captures the essence of how AI could
shape the job market, which is a subject of significant interest. However, it
could be more specific or detailed to achieve a perfect score.", "call_type":
"<LLMCallType.LLM_CALL: ''llm_call''>", "model": "gpt-4o-mini"}}, {"event_id":
"935cc6c4-edbb-42bd-82a5-b904c7b14e5e", "timestamp": "2025-10-08T18:18:09.893917+00:00",
"type": "agent_execution_completed", "event_data": {"agent_role": "Scorer",
"agent_goal": "Score the title", "agent_backstory": "You''re an expert scorer,
specialized in scoring titles."}}, {"event_id": "80aef20e-1284-41c7-814b-f1c1609eb0b9",
"timestamp": "2025-10-08T18:18:09.894037+00:00", "type": "tool_usage_finished",
"event_data": {"timestamp": "2025-10-08T18:18:09.894006+00:00", "type": "tool_usage_finished",
"source_fingerprint": null, "source_type": null, "fingerprint_metadata": null,
"agent_key": "89cf311b48b52169d42f3925c5be1c5a", "agent_role": "Manager", "agent_id":
null, "tool_name": "Delegate work to coworker", "tool_args": {"coworker": "Scorer",
"task": "Give me an integer score between 1-5 for the following title: ''The
impact of AI in the future of work''", "context": "Your task is to evaluate
the provided title on a scale from 1 to 5 based on criteria such as relevance,
clarity, and intrigue."}, "tool_class": "CrewStructuredTool", "run_attempts":
1, "delegations": 0, "agent": null, "task_name": "Give me an integer score between
1-5 for the following title: ''The impact of AI in the future of work''", "task_id":
"6b4c0d0e-1758-4dff-ac12-8464b155edb3", "from_task": null, "from_agent": null,
"started_at": "2025-10-08T11:18:09.887804", "finished_at": "2025-10-08T11:18:09.893985",
"from_cache": false, "output": "4. The title ''The impact of AI in the future
of work'' is clear and directly addresses a highly relevant and intriguing topic.
It captures the essence of how AI could shape the job market, which is a subject
of significant interest. However, it could be more specific or detailed to achieve
a perfect score."}}, {"event_id": "2920d8bc-28f9-46cf-87df-113da77a6c34", "timestamp":
"2025-10-08T18:18:09.894139+00:00", "type": "llm_call_started", "event_data":
{"timestamp": "2025-10-08T18:18:09.894115+00:00", "type": "llm_call_started",
"source_fingerprint": null, "source_type": null, "fingerprint_metadata": null,
"task_name": "Give me an integer score between 1-5 for the following title:
''The impact of AI in the future of work''", "task_id": "6b4c0d0e-1758-4dff-ac12-8464b155edb3",
"agent_id": "7aaa26da-9c22-494d-95cd-bd0a8b650e43", "agent_role": "Manager",
"from_task": null, "from_agent": null, "model": "gpt-4o-mini", "messages": [{"role":
"system", "content": "You are Manager. You''re great at delegating work about
scoring.\nYour personal goal is: Coordinate scoring processes\nYou ONLY have
access to the following tools, and should NEVER make up tools that are not listed
here:\n\nTool Name: Delegate work to coworker\nTool Arguments: {''task'': {''description'':
''The task to delegate'', ''type'': ''str''}, ''context'': {''description'':
''The context for the task'', ''type'': ''str''}, ''coworker'': {''description'':
''The role/name of the coworker to delegate to'', ''type'': ''str''}}\nTool
Description: Delegate a specific task to one of the following coworkers: Scorer\nThe
input to this tool should be the coworker, the task you want them to do, and
ALL necessary context to execute the task, they know nothing about the task,
so share absolutely everything you know, don''t reference things but instead
explain them.\nTool Name: Ask question to coworker\nTool Arguments: {''question'':
{''description'': ''The question to ask'', ''type'': ''str''}, ''context'':
{''description'': ''The context for the question'', ''type'': ''str''}, ''coworker'':
{''description'': ''The role/name of the coworker to ask'', ''type'': ''str''}}\nTool
Description: Ask a specific question to one of the following coworkers: Scorer\nThe
input to this tool should be the coworker, the question you have for them, and
ALL necessary context to ask the question properly, they know nothing about
the question, so share absolutely everything you know, don''t reference things
but instead explain them.\n\nIMPORTANT: Use the following format in your response:\n\n```\nThought:
you should always think about what to do\nAction: the action to take, only one
name of [Delegate work to coworker, Ask question to coworker], just the name,
exactly as it''s written.\nAction Input: the input to the action, just a simple
JSON object, enclosed in curly braces, using \" to wrap keys and values.\nObservation:
the result of the action\n```\n\nOnce all necessary information is gathered,
return the following format:\n\n```\nThought: I now know the final answer\nFinal
Answer: the final answer to the original input question\n```"}, {"role": "user",
"content": "\nCurrent Task: Give me an integer score between 1-5 for the following
title: ''The impact of AI in the future of work''\n\nThis is the expected criteria
for your final answer: The score of the title.\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:"}, {"role": "assistant", "content": "Thought: To provide
an accurate score for the title \"The impact of AI in the future of work,\"
I need to delegate the task of scoring it to the Scorer, who is specialized
in this activity.\n\nAction: Delegate work to coworker\nAction Input: {\"coworker\":
\"Scorer\", \"task\": \"Give me an integer score between 1-5 for the following
title: ''The impact of AI in the future of work''\", \"context\": \"Your task
is to evaluate the provided title on a scale from 1 to 5 based on criteria such
as relevance, clarity, and intrigue.\"}\n\nObservation: The scorer has received
the task to score the title ''The impact of AI in the future of work''.\nObservation:
4. The title ''The impact of AI in the future of work'' is clear and directly
addresses a highly relevant and intriguing topic. It captures the essence of
how AI could shape the job market, which is a subject of significant interest.
However, it could be more specific or detailed to achieve a perfect score."}],
"tools": null, "callbacks": ["<crewai.utilities.token_counter_callback.TokenCalcHandler
object at 0x136d6d550>"], "available_functions": null}}, {"event_id": "c1561925-8100-4045-bfde-56c42bf1edab",
"timestamp": "2025-10-08T18:18:09.896686+00:00", "type": "llm_call_completed",
"event_data": {"timestamp": "2025-10-08T18:18:09.896654+00:00", "type": "llm_call_completed",
"source_fingerprint": null, "source_type": null, "fingerprint_metadata": null,
"task_name": "Give me an integer score between 1-5 for the following title:
''The impact of AI in the future of work''", "task_id": "6b4c0d0e-1758-4dff-ac12-8464b155edb3",
"agent_id": "7aaa26da-9c22-494d-95cd-bd0a8b650e43", "agent_role": "Manager",
"from_task": null, "from_agent": null, "messages": [{"role": "system", "content":
"You are Manager. You''re great at delegating work about scoring.\nYour personal
goal is: Coordinate scoring processes\nYou ONLY have access to the following
tools, and should NEVER make up tools that are not listed here:\n\nTool Name:
Delegate work to coworker\nTool Arguments: {''task'': {''description'': ''The
task to delegate'', ''type'': ''str''}, ''context'': {''description'': ''The
context for the task'', ''type'': ''str''}, ''coworker'': {''description'':
''The role/name of the coworker to delegate to'', ''type'': ''str''}}\nTool
Description: Delegate a specific task to one of the following coworkers: Scorer\nThe
input to this tool should be the coworker, the task you want them to do, and
ALL necessary context to execute the task, they know nothing about the task,
so share absolutely everything you know, don''t reference things but instead
explain them.\nTool Name: Ask question to coworker\nTool Arguments: {''question'':
{''description'': ''The question to ask'', ''type'': ''str''}, ''context'':
{''description'': ''The context for the question'', ''type'': ''str''}, ''coworker'':
{''description'': ''The role/name of the coworker to ask'', ''type'': ''str''}}\nTool
Description: Ask a specific question to one of the following coworkers: Scorer\nThe
input to this tool should be the coworker, the question you have for them, and
ALL necessary context to ask the question properly, they know nothing about
the question, so share absolutely everything you know, don''t reference things
but instead explain them.\n\nIMPORTANT: Use the following format in your response:\n\n```\nThought:
you should always think about what to do\nAction: the action to take, only one
name of [Delegate work to coworker, Ask question to coworker], just the name,
exactly as it''s written.\nAction Input: the input to the action, just a simple
JSON object, enclosed in curly braces, using \" to wrap keys and values.\nObservation:
the result of the action\n```\n\nOnce all necessary information is gathered,
return the following format:\n\n```\nThought: I now know the final answer\nFinal
Answer: the final answer to the original input question\n```"}, {"role": "user",
"content": "\nCurrent Task: Give me an integer score between 1-5 for the following
title: ''The impact of AI in the future of work''\n\nThis is the expected criteria
for your final answer: The score of the title.\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:"}, {"role": "assistant", "content": "Thought: To provide
an accurate score for the title \"The impact of AI in the future of work,\"
I need to delegate the task of scoring it to the Scorer, who is specialized
in this activity.\n\nAction: Delegate work to coworker\nAction Input: {\"coworker\":
\"Scorer\", \"task\": \"Give me an integer score between 1-5 for the following
title: ''The impact of AI in the future of work''\", \"context\": \"Your task
is to evaluate the provided title on a scale from 1 to 5 based on criteria such
as relevance, clarity, and intrigue.\"}\n\nObservation: The scorer has received
the task to score the title ''The impact of AI in the future of work''.\nObservation:
4. The title ''The impact of AI in the future of work'' is clear and directly
addresses a highly relevant and intriguing topic. It captures the essence of
how AI could shape the job market, which is a subject of significant interest.
However, it could be more specific or detailed to achieve a perfect score."}],
"response": "Thought: I now know the final answer as the Scorer has provided
the score for the title based on the given criteria.\n\nFinal Answer: 4", "call_type":
"<LLMCallType.LLM_CALL: ''llm_call''>", "model": "gpt-4o-mini"}}, {"event_id":
"59b15482-befa-4430-8fd6-be9bd08cc5db", "timestamp": "2025-10-08T18:18:09.896803+00:00",
"type": "agent_execution_completed", "event_data": {"agent_role": "Manager",
"agent_goal": "Coordinate scoring processes", "agent_backstory": "You''re great
at delegating work about scoring."}}, {"event_id": "ee08a9e6-f8d1-4ec3-b8ce-8db5cae003d5",
"timestamp": "2025-10-08T18:18:09.896864+00:00", "type": "task_completed", "event_data":
{"task_description": "Give me an integer score between 1-5 for the following
title: ''The impact of AI in the future of work''", "task_name": "Give me an
integer score between 1-5 for the following title: ''The impact of AI in the
future of work''", "task_id": "6b4c0d0e-1758-4dff-ac12-8464b155edb3", "output_raw":
"4", "output_format": "OutputFormat.RAW", "agent_role": "Manager"}}, {"event_id":
"b42a5428-c309-48d3-9b4d-d2c677dfd00f", "timestamp": "2025-10-08T18:18:09.898429+00:00",
"type": "crew_kickoff_completed", "event_data": {"timestamp": "2025-10-08T18:18:09.898415+00:00",
"type": "crew_kickoff_completed", "source_fingerprint": null, "source_type":
null, "fingerprint_metadata": null, "crew_name": "crew", "crew": null, "output":
{"description": "Give me an integer score between 1-5 for the following title:
''The impact of AI in the future of work''", "name": "Give me an integer score
between 1-5 for the following title: ''The impact of AI in the future of work''",
"expected_output": "The score of the title.", "summary": "Give me an integer
score between 1-5 for the following...", "raw": "4", "pydantic": null, "json_dict":
null, "agent": "Manager", "output_format": "raw"}, "total_tokens": 1877}}],
"batch_metadata": {"events_count": 16, "batch_sequence": 1, "is_final_batch":
false}}'
headers:
Accept:
- '*/*'
Accept-Encoding:
- gzip, deflate, zstd
Connection:
- keep-alive
Content-Length:
- '32137'
Content-Type:
- application/json
User-Agent:
- CrewAI-CLI/0.201.1
X-Crewai-Organization-Id:
- d3a3d10c-35db-423f-a7a4-c026030ba64d
X-Crewai-Version:
- 0.201.1
method: POST
uri: http://localhost:3000/crewai_plus/api/v1/tracing/batches/be6be8ca-f4e4-44f1-9ac5-a28ab976b1a5/events
response:
body:
string: '{"events_created":16,"trace_batch_id":"75171e87-f189-49fe-a59f-01306ea262c7"}'
headers:
Content-Length:
- '77'
cache-control:
- no-store
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://apis.google.com https://apis.google.com/js/api.js
https://accounts.google.com https://accounts.google.com/gsi/client https://cdnjs.cloudflare.com/ajax/libs/normalize/8.0.1/normalize.min.css.map
https://*.google.com https://docs.google.com https://slides.google.com https://js.hs-scripts.com
https://js.sentry-cdn.com https://browser.sentry-cdn.com https://www.googletagmanager.com
https://js-na1.hs-scripts.com 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/
https://*.sentry.io https://www.google-analytics.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://docs.google.com https://drive.google.com https://slides.google.com
https://accounts.google.com https://*.google.com https://www.youtube.com https://share.descript.com'
content-type:
- application/json; charset=utf-8
etag:
- W/"b165f8dea88d11f83754c72f73b8efb6"
expires:
- '0'
permissions-policy:
- camera=(), microphone=(self), geolocation=()
pragma:
- no-cache
referrer-policy:
- strict-origin-when-cross-origin
server-timing:
- cache_read.active_support;dur=0.06, cache_fetch_hit.active_support;dur=0.00,
cache_read_multi.active_support;dur=0.12, start_processing.action_controller;dur=0.00,
sql.active_record;dur=82.18, instantiation.active_record;dur=0.74, start_transaction.active_record;dur=0.01,
transaction.active_record;dur=171.97, process_action.action_controller;dur=511.20
vary:
- Accept
x-content-type-options:
- nosniff
x-frame-options:
- SAMEORIGIN
x-permitted-cross-domain-policies:
- none
x-request-id:
- e21e9c74-f4df-4485-8d92-775ee5b972c6
x-runtime:
- '0.559510'
x-xss-protection:
- 1; mode=block
status:
code: 200
message: OK
- request:
body: '{"status": "completed", "duration_ms": 919, "final_event_count": 16}'
headers:
Accept:
- '*/*'
Accept-Encoding:
- gzip, deflate, zstd
Connection:
- keep-alive
Content-Length:
- '68'
Content-Type:
- application/json
User-Agent:
- CrewAI-CLI/0.201.1
X-Crewai-Organization-Id:
- d3a3d10c-35db-423f-a7a4-c026030ba64d
X-Crewai-Version:
- 0.201.1
method: PATCH
uri: http://localhost:3000/crewai_plus/api/v1/tracing/batches/be6be8ca-f4e4-44f1-9ac5-a28ab976b1a5/finalize
response:
body:
string: '{"id":"75171e87-f189-49fe-a59f-01306ea262c7","trace_id":"be6be8ca-f4e4-44f1-9ac5-a28ab976b1a5","execution_type":"crew","crew_name":"crew","flow_name":null,"status":"completed","duration_ms":919,"crewai_version":"0.201.1","privacy_level":"standard","total_events":16,"execution_context":{"crew_name":"crew","flow_name":null,"privacy_level":"standard","crewai_version":"0.201.1","crew_fingerprint":null},"created_at":"2025-10-08T18:18:09.870Z","updated_at":"2025-10-08T18:18:10.961Z"}'
headers:
Content-Length:
- '482'
cache-control:
- no-store
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://apis.google.com https://apis.google.com/js/api.js
https://accounts.google.com https://accounts.google.com/gsi/client https://cdnjs.cloudflare.com/ajax/libs/normalize/8.0.1/normalize.min.css.map
https://*.google.com https://docs.google.com https://slides.google.com https://js.hs-scripts.com
https://js.sentry-cdn.com https://browser.sentry-cdn.com https://www.googletagmanager.com
https://js-na1.hs-scripts.com 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/
https://*.sentry.io https://www.google-analytics.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://docs.google.com https://drive.google.com https://slides.google.com
https://accounts.google.com https://*.google.com https://www.youtube.com https://share.descript.com'
content-type:
- application/json; charset=utf-8
etag:
- W/"b67654c67df1179eac2a9a79bbdf737f"
expires:
- '0'
permissions-policy:
- camera=(), microphone=(self), geolocation=()
pragma:
- no-cache
referrer-policy:
- strict-origin-when-cross-origin
server-timing:
- cache_read.active_support;dur=0.05, cache_fetch_hit.active_support;dur=0.00,
cache_read_multi.active_support;dur=0.08, start_processing.action_controller;dur=0.00,
sql.active_record;dur=20.84, instantiation.active_record;dur=0.67, unpermitted_parameters.action_controller;dur=0.01,
start_transaction.active_record;dur=0.01, transaction.active_record;dur=5.48,
process_action.action_controller;dur=452.72
vary:
- Accept
x-content-type-options:
- nosniff
x-frame-options:
- SAMEORIGIN
x-permitted-cross-domain-policies:
- none
x-request-id:
- 6ad8ee19-55a0-467c-a2ff-c82f2dac7cd1
x-runtime:
- '0.493951'
x-xss-protection:
- 1; mode=block
status:
code: 200
message: OK
version: 1