fix: wire ProvenaCrewListener to current CrewAI event bus API - #205
Open
Sharvari713 wants to merge 1 commit into
Open
Sharvari713 wants to merge 1 commit into
Sharvari713 wants to merge 1 commit into
Conversation
Switched imports from crewai.utilities.events.* to crewai.events. Implemented setup_listeners(), registering ToolUsageFinishedEvent and AgentExecutionCompletedEvent handlers via @crewai_event_bus.on(...) -- the old bare on_tool_usage_finished/ on_agent_execution_completed methods were never invoked by anything without this. Read agent identity via event.agent.role instead of the nonexistent event.agent_name. Verified end to end against a real installed crewai (1.15.22): constructed real event objects, fired them through the real crewai_event_bus, confirmed trail records appear with the correct source_name. Bumped the crewai extra's minimum from >=0.80 to >=1.0.0. Confirmed by direct install/inspection: crewai 0.80.0 through 0.98.0 have neither the old nor the new event API -- they use a third, unrelated Emitter/emit/on decorator system. The class-based event API this adapter depends on first appears at 1.0.0, with the same fields (agent, output, tool_name) present through 1.15.22. crewai's own metadata pins <3.14,>=3.10 at both versions, consistent with provena's own >=3.10 floor -- no change needed there. Rewrote tests/test_adapters.py's CrewAI fixture to fake the real API shape (crewai.events, setup_listeners()/bus .on() registration) instead of the old wrong module path, and rewrote all tests to fire through that registration path instead of calling the old unbound methods directly. Verified: all tests pass with crewai genuinely uninstalled, and all fail against the reverted buggy adapter code. Fixes rajfirke#193
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
ProvenaCrewListenernever received real events — three separate problemscompounded into a silent no-op: it imported from a module path CrewAI no
longer has, it never implemented
setup_listeners()(the method CrewAI'sBaseEventListenerrequires every subclass to define, so the bareon_tool_usage_finished/on_agent_execution_completedmethods were neverinvoked by anything), and it read a nonexistent
event.agent_name. A userfollowing the README's exact usage got zero trail records from a real
crew.kickoff()run, with no error anywhere.The fix:
crewai.utilities.events.*tocrewai.eventssetup_listeners(), registeringToolUsageFinishedEventandAgentExecutionCompletedEventhandlers via@crewai_event_bus.on(...)event.agent.roleinstead of the nonexistentevent.agent_nameVerified end to end against a real installed
crewai(1.15.22): constructedreal event objects, fired them through the real
crewai_event_bus, confirmedtrail records appear with the correct
source_name.Also bumped the
crewaiextra's minimum from>=0.80to>=1.0.0.Confirmed by direct install/inspection in a throwaway venv, not a guess:
crewai0.80.0through0.98.0have neither the old nor the new event APIat all — they use a third, unrelated
Emitter/emit/ondecorator system.The class-based event API this adapter depends on first appears at
1.0.0,with the same fields (
agent,output,tool_name) present through1.15.22.crewai's own metadata pins<3.14,>=3.10at both versions,consistent with provena's own
>=3.10floor — no change needed there.Rewrote
tests/test_adapters.py's CrewAI fixture to fake the real API shape(
crewai.events,setup_listeners()/bus.on()registration) instead ofthe old wrong module path, and rewrote all tests to fire through that
registration path instead of calling the old unbound methods directly.
Verified: all tests pass with
crewaigenuinely uninstalled, and all failagainst the reverted buggy adapter code (it can't even import successfully
under a correctly faked module layout — falls straight to the
ImportErrorplaceholder).
Checklist
ruff check src/ tests/passesruff format --check src/ tests/passesmypy src/provena/passes (1 pre-existing unrelated error onmain, untouched by this change)pytestpasses with no failures (575 passed, 35 skipped — unrelated optional integrations)Related Issues
Fixes #193