Skip to content

Commit c166961

Browse files
docs: add explicit shutdown to quickstart example
1 parent ef3e1d8 commit c166961

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)