Server-side resources and retake reap
Some requests create state on the provider that outlives the test: uploaded files and
message batches. While recording, Retake recognises the requests that create and delete
these, and adds a resource record to the take after each successful one:
{"type":"resource","exchange":0,"provider":"anthropic","kind":"file","id":"file_011CNha8iCJcU1wXNR6q4V8w","action":"created"}
{"type":"resource","exchange":1,"provider":"anthropic","kind":"file","id":"file_011CNha8iCJcU1wXNR6q4V8w","action":"deleted"}
| Kind | Created by | Deleted by |
|---|---|---|
file | POST /v1/files | DELETE /v1/files/{id} |
message_batch | POST /v1/messages/batches | DELETE /v1/messages/batches/{id} |
Not tracked yet: Skills (and their versions), Managed Agents objects (agents, sessions, environments, vaults and credentials, memory stores, deployments), and files created inside code execution or a Managed Agents session rather than uploaded. Recordings that create these leave them for you to delete.
The recording summary lists the resources the run created and did not delete. A recording is never refused for them: a test may keep state on purpose, or remove it in a teardown that runs outside Retake’s view.
retake: 1 resource(s) created by this recording and not deleted; `retake reap` deletes them:
retake: file file_011CNha8iCJcU1wXNR6q4V8w (tests/test_files.py/test_upload.take, exchange 0)
When a recording does not become a take (a failed test, a refused recording, a refused
end-of-run finalization, a final scan that found a secret), when a new recording replaces
or removes a take, and when retake clean removes a .partial, the resources it created
and did not delete are appended to _resource.take in the takes directory. That file
accumulates across runs as the worklist for retake reap. It describes the recording
account, not test behaviour, so retake init adds it to .gitignore.
retake reap lists every resource that the committed takes and _resource.take say was
created and never deleted, then deletes them with your own credentials
(ANTHROPIC_API_KEY, or else ANTHROPIC_AUTH_TOKEN as a bearer token, as the SDK takes
them), sent to
the same place retake record sends requests (--record-anthropic-url, else
ANTHROPIC_BASE_URL, else https://api.anthropic.com):
$ retake reap --dry-run
retake: 2 outstanding resource(s) in tests/takes:
retake: file file_011CNha8iCJcU1wXNR6q4V8w (from tests/test_files.py/test_upload.take, exchange 0)
retake: message_batch msgbatch_013Zva2CMHLNnXjNJJKqJ2EF (_resource.take, from tests/test_batch.py/test_submit.take, exchange 0)
retake: dry run; nothing deleted
- It asks before deleting; a run without a terminal is refused unless
--yes(orRETAKE_ASSUME_YES=1) is given.--dry-runonly lists. - It deletes only IDs found in
resourcerecords, never anything else in the account. - A resource the provider no longer has (404) counts as reaped.
- A message batch that is still processing cannot be deleted:
reapcancels it and tries again; if it is still cancelling, it stays on the list andreapexits 1, saying to runretake reapagain later. A failed deletion also exits 1. reapnever modifies committed takes. What it reaped is recorded only in_resource.take: entries it settles leave the file, and a reaped resource that a committed take still names gets a"action":"reaped"record there, so it is not listed again (until that take is re-recorded). Since_resource.takeis local, another checkout lists those resources again; deleting them then answers 404, which counts as reaped.
Replay never creates anything on the provider: resource records are informational, the
recorded IDs are served as recorded, and a replay run gives reap nothing to do. A test
take whose requests use an ID from a _session.take resource record counts as a
dependent of _session.take (see Session IDs).