Overview
Two interception points cover steps:
What the payload holds depends on
ctx.kind:
For flow methods, positional arguments appear in the params dict under
_0,
_1, … keys and keyword arguments under their own names; edits and
replacements are mapped back onto the actual call.
Hook Signature
Context Schema
Both points receive aStepContext:
step_name is the task’s name (falling back to its
description). For flow-method steps, it is the method name.
Common Use Cases
Step Tracing
Rewriting Task Context
Transforming Task Output
POST_STEP runs before the task’s output is stored, so rewrites propagate
everywhere the output is used: downstream task context, callbacks, the final
crew output, and the task’s output_file on disk.Guarding Flow Methods
Filtering by Agent
Step hooks support the sameagents= filter as the other points (matched
against the executing agent’s role on task steps):
Aborting a Step
RaisingHookAborted in PRE_STEP stops the step before any agent or method
work happens, and the abort propagates out of the execution with its reason —
it is not swallowed. Any other exception raised by a step hook is swallowed
(fail-open), like at every other point.
