Execution hooks
Hooks are small functions that CrewAI calls at fixed points of a run. Watch a bank teller crew clean its inputs, block a large transfer before the tool runs, and mask account numbers in model output, all with the @on decorator.
12 minPro
Checking your access…
Inside this lesson
- An animation you play, pause and step through, with each part saying what it is doing.
- The real code beside it, with the lines for each step lit up.
- Practice mode, where you route each message yourself, and a short quiz.
- About 12 minutes.
Written from the official documentation
In this module: Streaming, events and hooks
- StreamingStreamFrame, channels and reading a run as it happens.Pro
- Event listenersSubscribing to the event bus for logging and monitoring.Pro
- Execution hooksThe @on decorator around runs, steps, LLM calls and tools.Pro
- Checkpointing and replaySaving run state, resuming after a failure, replaying a task.Pro