refactor: defer tool_selection and memory interception points

Pulls `tool_selection`, `memory_write`, and `memory_read` out of the
catalog. The tool seam needs a defined matching contract first (platform
and MCP tools expose different name shapes and attributes), and the
memory seams need real skip semantics instead of surfacing a policy
abort as an error log. Both are tracked as follow-up cards; the points
will return once those contracts are settled.
This commit is contained in:
Lucas Gomide
2026-07-14 04:05:11 -03:00
parent 04178f8f58
commit ef48447a25
7 changed files with 4 additions and 159 deletions

View File

@@ -6,8 +6,8 @@ mode: "wide"
Interception hooks give you a single, uniform way to observe and modify CrewAI's
runtime at well-defined points — from the moment an execution starts, through
every model call, tool call, and memory read, down to the final output. All
points share one contract and one registration API.
every model call, tool call, and knowledge lookup, down to the final output.
All points share one contract and one registration API.
The four LLM/tool hooks documented in [LLM Hooks](/learn/llm-hooks) and
[Tool Hooks](/learn/tool-hooks) are the same mechanism. Their existing
@@ -91,13 +91,12 @@ behavior.
| `PRE_TOOL_CALL` | Before a tool runs | `ToolCallHookContext` |
| `POST_TOOL_CALL` | After a tool runs | tool result |
### Step & agent points
### Step points
| Point | When | `payload` |
|-------|------|-----------|
| `PRE_STEP` | Before a task or flow-method step | step input |
| `POST_STEP` | After a task or flow-method step | step output |
| `TOOL_SELECTION` | Tools are offered to an agent | list of tools |
`PRE_STEP` / `POST_STEP` carry `ctx.kind` (`"task"` or `"flow_method"`) and
`ctx.step_name`.
@@ -106,8 +105,6 @@ behavior.
| Point | When | `payload` |
|-------|------|-----------|
| `MEMORY_WRITE` | A value is about to be stored in memory | value |
| `MEMORY_READ` | A memory query is issued | query |
| `KNOWLEDGE_RETRIEVAL` | A knowledge query is issued | query |
| `PRE_CODE_EXECUTION` | Code is about to run (flow `ScriptAction`) | code string |
| `MCP_CONNECT` | An MCP client is about to connect | connection params |