docs: group execution hooks and document all hook contexts#6548
Conversation
The hooks pages sat flat in the learn nav and only documented the LLM and tool call contexts, with examples built on the legacy decorators. Groups them under a collapsible "Execution Hooks" section, adds `step-hooks` and `execution-boundary-hooks` pages covering every hook context from source, reworks the LLM and tool pages to lead with `@on` while keeping the decorators, and links the orphaned `before-and-after-kickoff-hooks` page into the group.
📝 WalkthroughWalkthroughThe documentation updates consolidate hook guidance around the ChangesHook Documentation
Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
docs/edge/en/learn/tool-hooks.mdx (1)
204-221: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick winAvoid storing timing state in
ctx.tool_input
_start_timeis forwarded to the tool call, so strictly validated tools can fail on the extra kwarg. Keep timing state in a separate call-scoped store keyed by the shared input dict, then clean it up inPOST_TOOL_CALL.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@docs/edge/en/learn/tool-hooks.mdx` around lines 204 - 221, Update the Tool Usage Analytics example so start_timer stores the timestamp in a separate call-scoped store keyed by the shared tool-input dictionary, rather than adding _start_time to ctx.tool_input. In track_tool_usage, retrieve and remove that stored timestamp during POST_TOOL_CALL while preserving the existing count and elapsed-time updates.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@docs/edge/en/learn/tool-hooks.mdx`:
- Line 320: Update the two occurrences of “pre hooks” in the tool-hooks
documentation to the hyphenated compound modifier “pre-hooks,” including the
instance near the earlier hook-blocking note and the additional occurrence
around the referenced later line.
- Around line 119-138: Update the Crew-Scoped Hooks example import to include
HookAborted alongside on and InterceptionPoint, so the validate_tool_inputs
method can raise it without causing a NameError when the snippet is copied
independently.
---
Outside diff comments:
In `@docs/edge/en/learn/tool-hooks.mdx`:
- Around line 204-221: Update the Tool Usage Analytics example so start_timer
stores the timestamp in a separate call-scoped store keyed by the shared
tool-input dictionary, rather than adding _start_time to ctx.tool_input. In
track_tool_usage, retrieve and remove that stored timestamp during
POST_TOOL_CALL while preserving the existing count and elapsed-time updates.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 0bdac633-f329-4bed-bb28-dba16454a9a0
📒 Files selected for processing (6)
docs/docs.jsondocs/edge/en/learn/execution-boundary-hooks.mdxdocs/edge/en/learn/execution-hooks.mdxdocs/edge/en/learn/llm-hooks.mdxdocs/edge/en/learn/step-hooks.mdxdocs/edge/en/learn/tool-hooks.mdx
|
Preview deployment for your docs. Learn more about Mintlify Previews.
💡 Tip: Enable Workflows to automatically generate PRs for you. |
|
Preview deployment for your docs. Learn more about Mintlify Previews.
💡 Tip: Enable Workflows to automatically generate PRs for you. |
The new edge-only hooks pages linked each other with versionless paths like `/learn/step-hooks`, which mintlify resolves against the frozen default version where those pages do not exist, breaking the CI link check. Uses the `/en/learn/...` form the other edge pages already use.
The `/en/learn/...` form still resolves against the default frozen version, where `step-hooks` and `execution-boundary-hooks` do not exist yet, so the link checker kept failing. Links now use the explicit `/edge/en/learn/...` form, matching how `consuming-streams.mdx` linked to edge-only streaming pages before they were frozen.
The hooks docs were flat pages in the learn nav, documented hook contexts only for LLM and tool calls, and every example used the legacy decorators. This groups them under a collapsible Execution Hooks nav section, adds step-hooks and execution-boundary-hooks pages documenting every hook context from source, reworks the LLM and tool pages to lead with
@onwhile keeping the legacy decorators visible, and brings the orphaned before-and-after-kickoff-hooks page into the group. Follows up #6518, which has since merged.Note
Low Risk
Documentation and navigation only; no runtime or API behavior changes in this diff.
Overview
Reorganizes Edge learn docs so Execution Hooks is a collapsible nav group and adds dedicated guides for execution boundaries (
EXECUTION_START/INPUT/OUTPUT/EXECUTION_END) and step hooks (PRE_STEP/POST_STEP), including context schemas and@onexamples. The overview page now links each interception family to those guides and fixes LLM/tool examples to use rich contexts (ctx.tool_name,ctx.response, etc.) instead of treating everything asctx.payload.LLM and tool hook pages are reworked to lead with
@onandHookAborted, document unified management (clear_all_hooks,unregister_hook), and keep legacy decorators/APIs as a compatibility section with trimmed duplicate content. Related links move to/edge/en/learn/..., and before-and-after-kickoff-hooks is included in the group.Reviewed by Cursor Bugbot for commit 191a173. Bugbot is set up for automated code reviews on this repo. Configure here.