| # Deploy Terminal Agent to Hugging Face Spaces |
|
|
| ## Step 1: Rotate Exposed Token (CRITICAL) |
|
|
| Your HF token was exposed. Revoke it NOW: |
| https://huggingface.co/settings/tokens |
|
|
| Generate a new one with `write` permission. |
|
|
| ## Step 2: Export New Token |
|
|
| ```bash |
| export HUGGING_FACE_TOKEN="hf_YOUR_NEW_TOKEN" |
| export HUGGING_FACE_USERNAME="your-username" |
| ``` |
|
|
| ## Step 3: Install CLI & Login |
|
|
| ```bash |
| pip install huggingface-hub |
| huggingface-cli login --token $HUGGING_FACE_TOKEN |
| ``` |
|
|
| ## Step 4: Create Space |
|
|
| ```bash |
| huggingface-cli space create \ |
| --name terminal-agent \ |
| --sdk docker \ |
| --type public |
| ``` |
|
|
| ## Step 5: Push Code |
|
|
| ```bash |
| cd /Users/alep/Downloads/02_AI_Agents/hf-terminal-agent |
| rm -rf .git |
| git init |
| git branch -m main |
| git add . |
| git commit -m "Terminal Agent deploy" |
| git remote add origin https://huggingface.co/spaces/$HUGGING_FACE_USERNAME/terminal-agent |
| git push -u origin main --force |
| ``` |
|
|
| ## Step 6: Wait for Build |
|
|
| Check status at: |
| ``` |
| https://huggingface.co/spaces/$HUGGING_FACE_USERNAME/terminal-agent |
| ``` |
|
|
| Build takes 2-5 minutes. Once green, visit the URL. |
|
|
| ## Step 7: Test |
|
|
| - Open the Space URL |
| - Append `/terminal` for the web terminal |
| - Try: `uname -a`, `ls`, `pwd` |
|
|