Skip to content

armgit / laya

Public Imported from GitHub
0

Non-autoregressive System 1 decision engine. Typed choice, score and yes/no decisions over any text in a single forward pass, in 100+ languages, with a router that picks the right checkpoint per request.

docs(hooks): hooks_installed removes what it installed, it does not restore a snapshot

Adeshina Lasisi3f2a614d3d30
diff --git a/docs/hooks/api.md b/docs/hooks/api.md
index ef556bc8..c3c105b6 100644
--- a/docs/hooks/api.md
+++ b/docs/hooks/api.md
@@ -165,8 +165,10 @@ with agent.hooks_installed(debug): # installed for the block, removed on exit
```
`add_hook` accepts the same objects as `hooks=` (not plain callables). `hooks_installed` takes
-any number of hook objects or sequences and restores the previous list on exit, including when
-the block raises.
+any number of hook objects or sequences and, on exit -- including when the block raises -- removes
+exactly what it installed: one occurrence of each hook it added, the most recent. It does not
+restore a snapshot of the list, so a hook the application had already installed stays installed,
+and a hook added inside the block with `add_hook` is left in place.
## Process-wide defaults
diff --git a/docs/hooks/patterns.md b/docs/hooks/patterns.md
index 773003cc..2088a141 100644
--- a/docs/hooks/patterns.md
+++ b/docs/hooks/patterns.md
@@ -248,7 +248,8 @@ earlier one.
### Scoped instrumentation
Attach a tracer or debug hook only for the code that needs it, instead of reconstructing the
-agent. `hooks_installed` restores the previous list on exit, even if the block raises.
+agent. On exit -- even if the block raises -- `hooks_installed` removes one occurrence of each
+hook it installed, and nothing else: a hook added inside the block with `add_hook` outlives it.
```python
with agent.hooks_installed(DebugDump()):