You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: site/src/content/docs/user-guide/concepts/agents/hooks.mdx
+26-3Lines changed: 26 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -392,10 +392,33 @@ Most event properties are read-only to prevent unintended modifications. However
392
392
<Tabs>
393
393
<Tablabel="Python">
394
394
395
-
After event callbacks run in reverse registration order for cleanup symmetry:
395
+
By default, After event callbacks run in reverse registration order for cleanup symmetry. You can override this with explicit priority using the `order` option — lower values run first.
396
+
397
+
The SDK exports convenience presets that mark where the SDK's own hooks run, so you can position yours relative to them:
398
+
399
+
-`HookOrder.SDK_FIRST` (-100) — where the SDK's earliest hooks run
400
+
-`HookOrder.DEFAULT` (0) — implicit when no order is specified
401
+
-`HookOrder.SDK_LAST` (100) — where the SDK's latest hooks run
402
+
403
+
These are not enforced bounds — any numeric value works. Use values beyond them (e.g. `SDK_FIRST - 1`) to run before or after the SDK's hooks, or `float('-inf')`/`float('inf')` for guaranteed absolute ordering.
404
+
405
+
```python
406
+
from strands import Agent
407
+
from strands.hooks import BeforeModelCallEvent, HookOrder
0 commit comments