com um clique
deploy-hf
// Deploy an OpenEnv environment to Hugging Face Spaces. Use when asked to deploy, push to Hugging Face, or update a space.
// Deploy an OpenEnv environment to Hugging Face Spaces. Use when asked to deploy, push to Hugging Face, or update a space.
Generate OpenEnv environments from a concrete use case (for example, "generate an env for the library textarena"). Use when asked to design or implement a new environment under envs/ by researching a target library/API, selecting matching OpenEnv examples, asking key implementation questions, and building models/client/server/openenv.yaml. Do not use for model training or evaluation tasks.
Release workflow for deploying OpenEnv environments to Hugging Face Spaces and keeping canonical references in sync.
Monitor a PR's CI checks and Greptile code review after submission. Polls CI status, auto-fixes failures via ralph-loop, waits for Greptile review, addresses comments, and iterates until green.
Diagnose and recover failing or stuck Hugging Face Space deployments for OpenEnv environments. Use when deploying envs from `envs/` to the Hub (`openenv` namespace with version suffixes), when Spaces are in `BUILDING`/`APP_STARTING`/`RUNTIME_ERROR`, or when release collections need to be reconciled after targeted redeploys.
Validate changes before submitting a pull request. Run comprehensive checks including lint, tests, alignment review, and RFC analysis. Use before creating a PR, when asked if code is ready for review, or before pushing for PR.
Work on a batch of GitHub issues in parallel using Agent Teams. Creates one worktree per issue with TDD enforcement, coordinates via a lead agent, then produces stacked PRs.
| name | deploy-hf |
| description | Deploy an OpenEnv environment to Hugging Face Spaces. Use when asked to deploy, push to Hugging Face, or update a space. |
| allowed-tools | Bash, Read |
Deploy an OpenEnv environment to Hugging Face Spaces using the OpenEnv CLI.
Before deploying, ensure:
openenv.yaml fileserver/DockerfileDetermine which environment to deploy:
Repository ID format: username/space-name
openenv.yaml for default repo-idIMPORTANT: Always run from the project root directory.
Before deploying, ensure OpenEnv is installed:
cd /path/to/OpenEnv # Navigate to project root if needed
uv pip install -e .
If this fails with "does not appear to be a Python project", you're not in the project root.
Execute the deployment:
PYTHONPATH=src uv run python -m openenv.cli push <environment-dir> --repo-id <username/space-name>
Parameters:
<environment-dir>: Path to environment (e.g., envs/carla_env)--repo-id: Hugging Face Spaces repository ID (e.g., sergiopaniego/carla-env-real-updated)Optional flags:
--private: Deploy as a private space--no-interface: Disable the web interface (deploy API-only)--base-image <image>: Override the base Docker image--hardware <hw> / -H <hw>: Request Hugging Face Space hardware (e.g. t4-medium, a10g-small, cpu-basic)After successful deployment:
curl https://<username>-<space-name>.hf.space/health
PYTHONPATH=src uv run python -m openenv.cli push envs/carla_env --repo-id sergiopaniego/carla-env-real-updated
PYTHONPATH=src uv run python -m openenv.cli push envs/echo_env --repo-id username/my-echo-env --private
PYTHONPATH=src uv run python -m openenv.cli push envs/carla_env --repo-id username/carla-env --hardware t4-medium
PYTHONPATH=src uv run python -m openenv.cli push envs/browser_env --repo-id username/browser-env --base-image nvidia/cuda:11.8.0-runtime-ubuntu22.04
Report deployment status:
## Hugging Face Deployment
### Environment
- Environment: <env-name>
- Directory: <path>
- Dockerfile: <path-to-dockerfile>
### Deployment
- Repository ID: <username/space-name>
- Space URL: <https://huggingface.co/spaces/username/space-name>
- Status: ✓ Deployed successfully
### Next Steps
1. Wait for space to build (5 min for CPU, 30-60 min for GPU/CARLA)
2. Visit space URL to check build status
3. Test environment once build completes
### Testing Commands
```bash
# Health check
curl https://<username>-<space-name>.hf.space/health
# Reset environment
curl -X POST https://<username>-<space-name>.hf.space/reset
# Step action
curl -X POST https://<username>-<space-name>.hf.space/step \
-H "Content-Type: application/json" \
-d '{"action_type": "observe"}'
## Troubleshooting
### Error: "ModuleNotFoundError: No module named 'openenv'"
**Solution**: Install OpenEnv first (must be run from project root):
```bash
cd /path/to/OpenEnv # Navigate to project root
uv pip install -e .
Cause: You're not in the project root directory.
Solution: Navigate to the OpenEnv project root where pyproject.toml exists:
cd /Users/sergiopaniegoblanco/Documents/Projects/OpenEnv # Adjust path
uv pip install -e .
Solution: Ensure you're passing the correct environment directory path:
# Correct
PYTHONPATH=src uv run python -m openenv.cli push envs/carla_env --repo-id ...
# Incorrect
PYTHONPATH=src uv run python -m openenv.cli push carla_env --repo-id ...
Solution: Login to Hugging Face CLI first:
huggingface-cli login
Solutions:
--hardware setting on HF)openenv.yaml is valid| Environment | Path | Typical Repo ID | Hardware |
|---|---|---|---|
| carla_env (standalone) | envs/carla_env | username/carla-env-real | GPU (T4/A10G) |
| carla_env (mock) | envs/carla_env | username/carla-env-mock | CPU |
| echo_env | envs/echo_env | username/echo-env | CPU |
| browser_env | envs/browser_env | username/browser-env | CPU |
| tbench2_env | envs/tbench2_env | username/tbench2-env | CPU |
huggingface-cli is logged in)--private for private spaces)--no-interface for API-only)--hardware (e.g. --hardware t4-medium)