feat(crewai): Enable Tracing Support For CrewAI Flow Nodes#2780
feat(crewai): Enable Tracing Support For CrewAI Flow Nodes#2780ialisaleh wants to merge 13 commits intoArize-ai:mainfrom
Conversation
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
|
hey @ialisaleh , thanks for working on this I opened PR #2848 which covers the same _FlowExecuteMethodWrapper addition and goes a bit further — wanted to flag a couple of differences before either moves forward. Response unpacking: Flow._execute_method in crewAI 1.10.x returns a (result, next_method_name | None) tuple internally. Passing that directly to get_output_attributes serializes the whole tuple instead of just the node's return value. PR #2848 extracts response[0] when the response is a tuple to get the actual node result. agent_kickoff_active guard: Agent.kickoff() internally spins up a Flow, which would cause _FlowExecuteMethodWrapper to emit node spans even for Broader scope: PR #2848 also addresses the root context-propagation bug (spans from Flow→Crew ending up in separate traces) via _FlowKickoffWrapper creating the CHAIN span before asyncio.run(), and the TOOL span nesting bug via _ExecuteWithTimeoutWrapper. |
|
#2848 merged, so closing this PR. |
Closes #2751
Example Trace
Note
Medium Risk
Wraps an internal CrewAI method (
Flow._execute_method) and changes span emission behavior, which may be sensitive to upstream CrewAI implementation changes and could affect tracing volume/structure.Overview
Adds OpenInference tracing for individual CrewAI Flow nodes by instrumenting
Flow._execute_method, creating per-step CHAIN spans named like<flow>.<method>withflow.node.name/flow.node.typeattributes and captured outputs.Updates tests to expect and validate these new node spans (including nested-flow scenarios), and refreshes example flows to provide explicit
Task.namevalues, tweak plotting/output formatting, and includecrewai-toolsin example requirements.Written by Cursor Bugbot for commit 721511b. This will update automatically on new commits. Configure here.