Conversation
…ree booking guard The four channel crews and the social crew each carried an execution agent in their agents=[] list, wired with live OpenDirect order-writing tools (CreateOrderTool, CreateLineTool, ReserveLineTool, BookLineTool) even though no task was ever assigned to it. In crewai's hierarchical process the manager LLM may delegate to any agent present in that list, so this was a live-tooled agent one delegation away from writing a real order outside the deterministic DealBookingFlow booking path. Remove the execution agent (and its tool wiring) from every channel crew and the social crew. All real booking continues to go through DealBookingFlow / MultiSellerOrchestrator. The create_execution_agent factory itself is left in place since it is still exercised directly by its own unit tests. Extend tests/unit/test_booking_path_llm_free.py with a guard that builds every production crew and asserts no agent, manager included, carries an order-writing tool class. A control test cross-checks the tool classes against the crew module's own execution-tool bundle so the guard cannot silently go stale.
Sirajmx
approved these changes
Sep 15, 2026
Sirajmx
left a comment
Contributor
There was a problem hiding this comment.
Verified: 3612 passed, 83 skipped, 0 failed (+2 from the new guard tests). Confirmed the real
risk this closes: every research crew carried a live, order-writing execution agent
(CreateOrderTool/CreateLineTool/ReserveLineTool/BookLineTool) with no task ever assigned
to it — one manager-LLM delegation away from a real booking outsideDealBookingFlow. The new
guard test (TestNoCrewAgentCarriesAnOrderWritingTool) is a real regression check, not just a
snapshot — it inspects actual crew tool inventories rather than asserting agent counts.
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.
Summary
Every channel crew (branding, mobile, CTV, performance) and the social crew placed an execution agent in the crew's
agents=[]list, wired with live OpenDirect order-writing tools (CreateOrderTool,CreateLineTool,ReserveLineTool,BookLineTool), even though no task was ever assigned to that agent. All real booking already goes through the deterministicDealBookingFlow/MultiSellerOrchestratorpath.In crewai's hierarchical process, the manager LLM may delegate a task to any agent present in
agents=[], whether or not it was ever assigned one. So an idle, live-tooled execution agent sitting in a research crew was one delegation away from writing a real order outside the deterministic booking path. The existing LLM-free CI guard (tests/unit/test_booking_path_llm_free.py) only proved the booking path can't reach an LLM; it said nothing about a crew's own manager LLM reaching booking, since it never inspected crew tool inventories.Changes
src/ad_buyer/crews/channel_crews.py: removedexecution_agent(and its_create_execution_toolswiring) from_build_channel_crewand fromcreate_social_crew. Research/recommendation crews now contain only agents that actually have a task assigned.create_execution_agentitself is untouched — it's still exercised directly by its own unit tests (test_agents.py,test_agent_hierarchy.py,test_llm_pricing_guardrails.py), so it wasn't left dangling and didn't need deletion.tests/unit/test_booking_path_llm_free.py: addedTestNoCrewAgentCarriesAnOrderWritingTool, which builds every production crew (branding, mobile, CTV, performance, social, portfolio) the way the app does and asserts no agent — manager included — carriesCreateOrderTool/CreateLineTool/ReserveLineTool/BookLineTool. A second control test cross-checks the tool classes against the crew module's own_create_execution_toolsbundle so the guard can't silently go stale if an execution tool is renamed or added. I verified locally that reverting the crew fix makes this test fail with a clear per-agent message.tests/unit/test_crew_factories.py: updated the branding/mobile/CTV/performance agent-count assertions from 2 to 1, reflecting the removed execution agent.Test plan
uv run ruff checkclean on all changed files (3 pre-existing, unrelated ruff findings indemo/andpatches/confirmed present onorigin/mainbefore this change)tests/unitsuite: 3502 passed, 1 skipped