Skip to content

Conversation

@ialisaleh
Copy link
Collaborator

@ialisaleh ialisaleh commented Oct 20, 2025

This PR adds tracing support for the CrewAI AgentAction.

Example Trace

CrewAI_Agent_Action

Closes #2037


Note

Adds tracing for CrewAI AgentAction with input/output serialization and updates tests to validate new spans.

  • Instrumentation:
    • Wraps crewai.agents.crew_agent_executor.CrewAgentExecutor._handle_agent_action with _AgentActionWrapper; tracks original and restores on uninstrument.
  • Wrappers:
    • New _AgentActionWrapper creates UNKNOWN spans for AgentAction handling; records serialized inputs (AgentAction) and outputs (AgentFinish) using OpenInferenceMimeTypeValues.JSON and flattens attributes.
    • Adds _serialize_agent_object (supports dataclass and legacy objects) and imports asdict/is_dataclass.
    • Extends semconv imports to include OpenInferenceMimeTypeValues.
  • Tests:
    • Update span expectations from 5 to 7 (add 2 AgentAction spans); assert counts for TOOL and UNKNOWN kinds and keep existing crew/agent/flow validations.

Written by Cursor Bugbot for commit 91caaee. This will update automatically on new commits. Configure here.

@ialisaleh ialisaleh self-assigned this Oct 20, 2025
@ialisaleh ialisaleh requested a review from a team as a code owner October 20, 2025 17:14
@dosubot dosubot bot added the size:M This PR changes 30-99 lines, ignoring generated files. label Oct 20, 2025
cursor[bot]

This comment was marked as outdated.

cursor[bot]

This comment was marked as outdated.

@dosubot dosubot bot added size:L This PR changes 100-499 lines, ignoring generated files. and removed size:M This PR changes 30-99 lines, ignoring generated files. labels Oct 20, 2025
cursor[bot]

This comment was marked as outdated.

@nate-mar nate-mar moved this to Todo in Instrumentation Oct 28, 2025
@caroger caroger moved this from Todo to In Review in Instrumentation Nov 6, 2025
@ialisaleh ialisaleh closed this Nov 13, 2025
@github-project-automation github-project-automation bot moved this from In Review to Done in Instrumentation Nov 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:L This PR changes 100-499 lines, ignoring generated files.

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

[feature request] CrewAI - add instrumentation for AgentAction to capture tool usage as separate attribute

1 participant