Repository navigation
Conversation
Preview approval requiredThis pull request comes from a fork, so Mintlify won't build a preview until someone with write access approves commit |
Strix Security ReviewWarning This pull request has 7 commits after the last Strix review ( ✅ No open security findings. PR summary: Corrects the `@CrewBase` import in the hooks documentation so examples use `from crewai.project import CrewBase` instead of the broken `from crewai import CrewBase`, applied across the current versioned docs snapshot and the Korean/Portuguese `edge` pages. Review summaryThe PR is documentation-only: every changed file under Review 1 on this PR · Reviewed by Strix |
Vidit-Ostwal
left a comment
There was a problem hiding this comment.
The CrewBase import claim is right: it is exported from crewai.project, not crewai, so from crewai import CrewBase raises ImportError. A few things need to change before this matches how these docs are maintained.
Drop the docs/v1.15.30/ edits. Trees under docs/v*/ are frozen release snapshots, and DOCS_TRANSLATIONS.md says not to edit them. Please revert those 12 files. The live pages are under docs/edge/.
The four docs/edge import swaps are not enough. docs/edge/ko and docs/edge/pt-BR llm-hooks.mdx / tool-hooks.mdx still import before_llm_call_crew, after_llm_call_crew, before_tool_call_crew, and after_tool_call_crew. Those names are no longer exported from crewai.hooks. The current English pages register crew-scoped hooks with @on(InterceptionPoint....). Please sync those sections from:
docs/edge/en/learn/llm-hooks.mdxdocs/edge/en/learn/tool-hooks.mdx
Translate the prose only, and keep the code blocks aligned with English.
English and Arabic edge pages still do not copy-paste. On docs/edge/en, the crew-scoped examples in llm-hooks.mdx and tool-hooks.mdx use @CrewBase and @crew without importing them (from crewai.project import CrewBase, crew, plus Crew and Process where the snippet uses those names). docs/edge/ar has the same blocks with no imports, and still uses the removed *_crew decorators. Update English first, then sync ar, ko, and pt-BR together.
Kickoff and execution hooks on edge for ko and pt-BR already use from crewai.project import CrewBase. This was not introduced in the v1.15.0 restructure: the learn hooks pages have used from crewai import CrewBase since at least v1.10, while the concepts pages already imported from crewai.project.
|
Thanks for the detailed review — all three points are addressed in 1. Reverted the
|
…mples Revert the 12 docs/v1.15.30 files: AGENTS.md and DOCS_TRANSLATIONS.md forbid editing docs/v*/ release snapshots, so the fix belongs on docs/edge only. Add the imports the crew-scoped snippets were missing on docs/edge/en (`CrewBase`/`crew` from crewai.project, `Crew`/`Process` from crewai, and `HookAborted` in the tool-hooks block that raises it), then sync the same block to ar, ko and pt-BR so the localized code matches English and no longer references the removed before/after_*_crew decorators.
3df8106 to
416f80e
Compare
|
@Vidit-Ostwal the requested changes are pushed — could you take another look when you have a moment?
Not touched, flagging rather than expanding scope: |
Fixes #8630
Problem
Every code example in the hooks guides that defines a
@CrewBaseclass imports it with:That import fails on current code.
CrewBaseis defined increwai.project.crew_baseand re-exported only fromcrewai.project(lib/crewai/src/crewai/project/__init__.py); it is not imported increwai/__init__.pyand is not in its__all__. Verified at runtime againstmain:Readers copying these examples get an
ImportErroron the very first line.How this regressed
The v1.14.x docs snapshots used the correct
from crewai.project import CrewBasein the concepts/guides pages (e.g.docs/v1.14.7/en/concepts/agents.mdx), but thelearn/hooks pages never did, and the v1.15.0 docs restructure dropped the corrected usages. The wrong import survives in all versioned snapshots and, for the translated pages, inedgeas well (edge/enwas already corrected;edge/koandedge/pt-BRwere not).What changed
One-line replacement of
from crewai import CrewBasewithfrom crewai.project import CrewBase(matching the style already used byedge/en/learn/execution-hooks.mdxand the rest of the docs, e.g.docs/edge/en/concepts/agents.mdx) in the pages that still serve the broken snippet:docs/v1.15.30/(current latest snapshot):en,ar,ko,pt-BR—learn/before-and-after-kickoff-hooks.mdx,learn/execution-hooks.mdx,learn/llm-hooks.mdx,learn/tool-hooks.mdx(12 files)docs/edge/:ko,pt-BR—learn/llm-hooks.mdx,learn/tool-hooks.mdx(4 files)Older versioned snapshot directories are intentionally left untouched.
Verification
grepconfirms zero remainingfrom crewai import CrewBaseunderdocs/v1.15.30anddocs/edge; all 20 changed lines now readfrom crewai.project import CrewBase.main(paths above) shows the old import raisesImportErrorand the new one succeeds.Note
Low Risk
Documentation-only updates to code examples; no runtime or library behavior is affected.
Overview
Updates crew-scoped hook snippets in
docs/edgeLLM and tool hook guides (ar,en,ko,pt-BR) so they match the current@on/InterceptionPointAPI instead of legacy@before_*_call_crew/@after_*_call_crewdecorators.Examples now import
CrewBaseandcrewfromcrewai.project, use@on(InterceptionPoint.PRE_MODEL_CALL)orPRE_TOOL_CALL, and show tool validation viaHookAbortedrather thanreturn False. Crew-scoped samples are shortened (single pre-hook, leanerCrew(...)construction). Docs-only; no library changes.Reviewed by Cursor Bugbot for commit 3df8106. Bugbot is set up for automated code reviews on this repo. Configure here.