Skip to content

Introduce MemoryEvents to monitor their usage #3098

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jul 2, 2025
Merged

Conversation

lucasgomide
Copy link
Contributor

Added comprehensive memory event emission across all memory classes and implemented tests to verify events are properly emitted during memory operations.

@lucasgomide lucasgomide changed the title Add Memory events usage Introduce MemoryEvents to monitor their usage Jul 1, 2025
@lucasgomide lucasgomide requested a review from lorenzejay July 1, 2025 17:53
Copy link
Collaborator

@lorenzejay lorenzejay left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice, but can you add some logs for it on event_listener.py, take a look at how we logged knowledge:

@crewai_event_bus.on(KnowledgeRetrievalCompletedEvent)
        def on_knowledge_retrieval_completed(
            source, event: KnowledgeRetrievalCompletedEvent
        ):
            if not self.knowledge_retrieval_in_progress:
                return

            self.knowledge_retrieval_in_progress = False
            self.formatter.handle_knowledge_retrieval_completed(
                self.formatter.current_agent_branch,
                self.formatter.current_crew_tree,
                event.retrieved_knowledge,
            )

@lorenzejay
Copy link
Collaborator

nice, but can you add some logs for it on event_listener.py, take a look at how we logged knowledge:

@crewai_event_bus.on(KnowledgeRetrievalCompletedEvent)
        def on_knowledge_retrieval_completed(
            source, event: KnowledgeRetrievalCompletedEvent
        ):
            if not self.knowledge_retrieval_in_progress:
                return

            self.knowledge_retrieval_in_progress = False
            self.formatter.handle_knowledge_retrieval_completed(
                self.formatter.current_agent_branch,
                self.formatter.current_crew_tree,
                event.retrieved_knowledge,
            )

what would be great is highlighting the retrieved memory instances over there

@lucasgomide
Copy link
Contributor Author

@lorenzejay that is exactly what I was planning to do. I decided to focus this PR solely on Memory Events.. I will open another PR logging the usage into the console very soon

Copy link
Collaborator

@lorenzejay lorenzejay left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work

@lucasgomide lucasgomide merged commit ab39753 into main Jul 2, 2025
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants