Skip to main content
@approval(type="required") creates a database-backed approval record in addition to pausing the run. The client finds that record with GET /approvals, resolves it with POST /approvals/{id}/resolve, and then continues the run without resending a tool decision.
with_approval_record.py

Run the Example

1

Set up your virtual environment

2

Install dependencies

3

Export your OpenAI API key

4

Run the example

Save the code above as with_approval_record.py, then run:
Full source: cookbook/05_agent_os/05_human_in_the_loop/with_approval_record.py