Skip to content

Commit b76014f

Browse files
fix(docs): add explicit shutdown to quickstart example (#149)
## Summary - update the README quickstart async example to call `agent_control.ashutdown()` in a `finally` block - wrap the snippet with an `if __name__ == "__main__":` guard - add a short note explaining that short-lived scripts should explicitly shut down so observability events flush before exit ## Testing - make check - git push -u origin abhi/quickstart-explicit-shutdown (pre-push hook: lint, typecheck, contrib evaluator checks)
1 parent ef3e1d8 commit b76014f

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

‎README.md‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,10 +139,15 @@ async def main():
139139
print(await chat("test")) # ❌ Blocked
140140
except ControlViolationError as e:
141141
print(f"❌ Blocked: {e.control_name}")
142+
finally:
143+
await agent_control.ashutdown()
142144

143-
asyncio.run(main())
145+
if __name__ == "__main__":
146+
asyncio.run(main())
144147
```
145148

149+
Use `agent_control.shutdown()` or `await agent_control.ashutdown()` before process exit so short-lived scripts flush pending observability events cleanly.
150+
146151
Next, create a control in Step 4, then run the setup and agent scripts in
147152
order to see blocking in action.
148153

0 commit comments

Comments
 (0)