hf spaces wait waits for a Space runtime state
Introduced 2026-06-18 · score 0.98
HOW TO USE IT
After restarting a Space, wait until it leaves an intermediate runtime stage. Run `hf spaces wait <owner>/<space>` and continue only if it reaches `RUNNING` (exit code 0).
hf spaces restart <owner>/<space> && hf spaces wait <owner>/<space>hf spaces wait <owner>/<space> --timeout 5mfrom huggingface_hub import restart_space, wait_for_space
restart_space("<owner>/<space>")
runtime = wait_for_space("<owner>/<space>")
runtime.stageWHY THIS HELPS
Restart a Space and wait for it to reach a final runtime state before continuing a repository workflow.
REQUIREMENTS AND LIMITATIONS
- Version: v1.20.0
- SPACE_ID (required): Space ID, such as `<owner>/<space>`.
- --timeout: Maximum time to wait; accepts a duration with `s`, `m`, `h`, or `d` units. Defaults to seconds.
- repo_id (required): ID of the Space to wait for.
- timeout: Maximum wait time in seconds; `None` waits indefinitely.
- poll_interval: Seconds between status checks; defaults to 1 second.
- token: User access token; defaults to the locally saved token. Set to `False` to disable authentication.
- The CLI exits 0 when the Space is `RUNNING` and non-zero otherwise.
FIRST-PARTY EVIDENCE
- https://github.com/huggingface/huggingface_hub/releases/tag/v1.20.0
- https://github.com/huggingface/huggingface_hub/blob/main/docs/source/en/package_reference/cli.md
- https://huggingface.co/docs/huggingface_hub/main/package_reference/hf_api
Check the installed version and the source before using it. Entry JSON