Skip to content

Conversation

@ialisaleh
Copy link
Collaborator

@ialisaleh ialisaleh commented Oct 28, 2025

This PR adds tracing support for CrewAI to capture & expose metrics associated with short & long-term memory operations.

Memory Events

CrewAI_Memory_Events

Memory Attributes

CrewAI_Memory_Attributes

The following screenshots are outdated.

LongTermMemorySave

LongTermMemorySave

LongTermMemorySearch

LongTermMemorySearch

ShortTermMemorySave

ShortTermMemorySave

ShortTermMemorySearch

ShortTermMemorySearch

Closes #2207


Note

Adds tracing for CrewAI short/long-term memory save/search with event attributes and timings, and updates the example to enable SQLite-backed long-term memory.

  • Instrumentation (crewai):
    • Memory events: Add wrappers for LongTermMemory.save/search and ShortTermMemory.save/search that log structured span events with flattened attributes and timing metrics.
    • Event utility: Introduce _log_span_event to add events and prefixed attributes to the active span.
    • Registration: Wire wrappers in CrewAIInstrumentor _instrument and cleanly restore in _uninstrument.
    • Attribute handling: Enhance _flatten to join List[str] values.
  • Example:
    • Enable Crew memory in examples/research_writer_crew.py with LongTermMemory using LTMSQLiteStorage at crewai_storage/memory.db; add project-local storage path setup.

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

@ialisaleh ialisaleh self-assigned this Oct 28, 2025
@ialisaleh ialisaleh requested a review from a team as a code owner October 28, 2025 18:15
@dosubot dosubot bot added the size:L This PR changes 100-499 lines, ignoring generated files. label Oct 28, 2025
cursor[bot]

This comment was marked as outdated.

cursor[bot]

This comment was marked as outdated.

cursor[bot]

This comment was marked as outdated.

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: No status

Development

Successfully merging this pull request may close these issues.

[feature request] crewai - capture and expose metrics associated with short and long term memory usage

1 participant