[FEATURE] Expose the native tool call id on tool usage events
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 84/100
- Issue type
- Feature
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- python
- Domain
- ai, backend-api-design
Research direction
Start in crewai/events/types/tool_usage_events.py to inspect ToolUsageEvent, then trace the emit sites in _execute_single_native_tool_call in agents/crew_agent_executor.py. Add the optional call_id field and ensure the existing native tool call id reaches both started and finished events; done means observability consumers can identify the originating model tool call.
Written by the indexing model from the issue text.
Description
Feature Area
Core functionality
Is your feature request related to a an existing bug? Please link it here.
N/A
Describe the solution you'd like
Add an optional call_id: str | None = None field to ToolUsageEvent (crewai/events/types/tool_usage_events.py), populated at the emit sites in _execute_single_native_tool_call.
CrewAI already has the value. _parse_native_tool_call sets call_id = getattr(tool_call, "id", f"call_{id(tool_call)}") (agents/crew_agent_executor.py:835), and it's threaded through _execute_single_native_tool_call(call_id=...) into the assistant/tool messages, so message history pairs correctly. It's a parameter of the very function that emits ToolUsageStartedEvent / ToolUsageFinishedEvent — already in scope, no plumbing needed.
Today those events carry tool_name, tool_args, agent and task ids, but no call id, so no observability consumer can attribute a tool execution to the model request that asked for it.
Describe alternatives you've considered
- Wrapping BaseTool.run (what OpenLIT and Arize OpenInference do): the id isn't in scope there, so it can't be recovered.
- Reconstructing from message history: the tool_call_id does survive into messages, but only post-hoc — an instrumentor needs it at span creation, not after the run.
- Pairing by ordering: ambiguous under max_usage_count retries and the parallel batch path in
_handle_native_tool_calls.
Adding the field is the smallest change that makes any of this work.
Additional context
Observability. The OTel GenAI semantic conventions list gen_ai.tool.call.id on the execute_tool span as Recommended "If available", described as "The tool call identifier." Because CrewAI doesn't surface it, no CrewAI instrumentor can populate it, and teams doing trace-based auditing lose the ability to attribute a tool execution to the specific model request that asked for it.
Verified against crewai 1.15.18.
Willingness to Contribute
Yes, I'd be happy to submit a pull request
- Dominant language
- Python
- Stars
- 58.8k
- Forks
- 8.5k
- Avg merge
- 1d 13h
- Merged PRs (30d)
- 103
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from crewAIInc/crewAI
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
-
[BUG] AttributeError: 'int' object has no attribute 'get' in crew_run_tui.py during plan rendering Openbug
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
All issues in crewAIInc/crewAI
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100