Skip to content
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

Add tool usage events #1382

Merged
merged 3 commits into from
Oct 2, 2024
Merged

Add tool usage events #1382

merged 3 commits into from
Oct 2, 2024

Conversation

thiagomoretto
Copy link
Contributor

Add a small event structure to listen to tool usage events.
It uses decorators and can be expanded and used for pretty much anything.

import crewai.utilities.events as events

...
@events.on(ToolUsageFinished)
def on_tool_use_finished(source: "ToolUsage", event: ToolUsageFinished):
    # Handle the event
    pass

Currently, a generic emitter is initialized once, but we can scope and create emitters per module/use case.

Copy link
Collaborator

@gvieira gvieira left a comment

Choose a reason for hiding this comment

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

Amazing work! It looks beautiful!

@thiagomoretto thiagomoretto merged commit f46a12b into main Oct 2, 2024
2 of 4 checks passed
@thiagomoretto thiagomoretto deleted the tm-basic-event-structure branch October 2, 2024 15:54
bhancockio pushed a commit that referenced this pull request Jan 2, 2025
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