Before you start
- Wait for the Twin Run to reach
ready. - Stop agent and application traffic to its provider endpoints. Provider requests are blocked while the run is
resetting. - Check the run’s expiry and extend its TTL if needed. Reset does not extend the TTL; teardown and expiry can cancel the operation.
Start a reset
This example requirescurl and jq. Set ARGA_API_KEY in your environment, then choose your run ID and an idempotency key for this reset:
202, an operation_id, and a relative status_url. The Location header contains the same status URL. Retry-After: 2 suggests polling every two seconds.
Save the run ID, idempotency key, and operation ID so you can resume after a process restart. If the POST times out before you receive a response, repeat it with the same key. Arga returns the existing operation if it was already accepted.
Reusing a key also returns the same operation after it finishes. Use a new key for each intentional reset, such as the next evaluation attempt. A different key while a reset is active returns 409; it does not start a second reset.
Poll until completion
Poll the returned URL with the same Arga API key:status is succeeded.
The operation response includes timestamps and
timeout_seconds. The server’s default reset budget is 900 seconds, including queue time; use the returned value for the operation. A GET can return HTTP 200 with status: "failed" or "cancelled", so check the JSON status as well as the HTTP status.
Handle timeouts and older runs
A client-side timeout means you stopped waiting for a response. Check the existing operation before deciding whether to abandon the environment. Teardown cancels an active reset; do not tear down solely because one HTTP request exceeded 60 seconds. If starting a reset returns409 with Async reset requires an updated worker. Reprovision after the worker rollout., provision a new Twin Run and retry there. Older runs cannot accept durable reset operations.
The synchronous POST /validate/twins/provision/{run_id}/reset route remains available. The Python and TypeScript SDK reset() helpers currently use that route and wait for the result. Awaiting an SDK method, including on Python’s AsyncArga, does not by itself use the durable start-and-poll API. Use the HTTP endpoints above when you need a saved operation ID and safe admission retries.
