Spaces:
Paused
Paused
feat: overhaul README documentation and add .env.example configuration template
Browse filesFiles changed (2)
- .env.exampleAdded+50
- README.md+102-145
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950# ============================================================================# HuggingMess - Hermes Agent on Hugging Face Spaces# Configuration Reference# ============================================================================
# ── REQUIRED: Core Configuration ──# Your LLM provider API keyLLM_API_KEY=your_api_key_here
# LLM model to use (e.g. google/gemini-2.0-flash, openai/gpt-4o)LLM_MODEL=google/gemini-2.0-flash
# Bearer token for the proxied Hermes API routes and Dashboard# Generate: openssl rand -hex 32GATEWAY_TOKEN=your_gateway_token_here
# ── OPTIONAL: Chat Integrations ──# Get bot token from: https://t.me/BotFather# TELEGRAM_BOT_TOKEN=your_bot_token_here
# Allowed Telegram User IDs (comma-separated numeric IDs)# TELEGRAM_ALLOWED_USERS=123456789,987654321
# ── OPTIONAL: Cloudflare Proxy & Keep-Alive ──# Cloudflare API token for automatic Worker proxy and KeepAlive setup# CLOUDFLARE_WORKERS_TOKEN=your_cloudflare_token_here
# Alternatively, manual proxy config:# CLOUDFLARE_PROXY_URL=https://your-proxy.workers.dev# CLOUDFLARE_PROXY_SECRET=your_proxy_secret_here
# Extra domains to proxy, comma-separated. Set to "*" to proxy all.# CLOUDFLARE_PROXY_DOMAINS=api.sendgrid.com,slack.com
# ── OPTIONAL: Workspace Backup to HF Dataset ──# HF token with write access for private Dataset backupHF_TOKEN=hf_your_token_here
# Dataset name (default: huggingmess-backup)# BACKUP_DATASET_NAME=huggingmess-backup
# Backup interval in seconds (default: 180)SYNC_INTERVAL=180
# ── OPTIONAL: Advanced ──# Telegram mode (webhook/polling)TELEGRAM_MODE=webhook
# Include .env in backups (default: false)# SYNC_INCLUDE_ENV=false8 unmodified lines91011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112128 unmodified lineslicense: mitsecrets:- name: LLM_API_KEYdescription: "Your LLM provider API key. HuggingMess maps it to the right Hermes provider env var."- name: LLM_MODELdescription: "Optional model ID override, e.g. openrouter/anthropic/claude-sonnet-4 or anthropic/claude-opus-4.6."- name: TELEGRAM_BOT_TOKENdescription: "Telegram bot token from @BotFather."- name: TELEGRAM_ALLOWED_USERSdescription: "Comma-separated numeric Telegram user IDs allowed to use the bot."- name: GATEWAY_TOKENdescription: "Bearer token for the proxied Hermes API routes."- name: HF_TOKENdescription: "Hugging Face token with write access for private Dataset backup."- name: CLOUDFLARE_WORKERS_TOKENdescription: "Cloudflare API token for automatic Telegram proxy and keep-awake Worker setup."---# HuggingMessHuggingMess runs [Nous Research Hermes Agent](https://github.com/NousResearch/hermes-agent) as a Hugging Face Docker Space. It follows the same practical shape as HuggingClaw: one public Space port, Telegram gateway support, Cloudflare Worker proxy setup, Cloudflare cron keep-awake, and private HF Dataset backup for Hermes state.## Quick Start1. Duplicate this Space or push this folder to a new Docker Space.2. Add these secrets in Space Settings:| Secret | Required | Notes || :--- | :--- | :--- || `LLM_MODEL` | Optional | Model override. If unset, HuggingMess leaves Hermes default/restored config alone. || `LLM_API_KEY` | Usually | Used to populate the provider-specific env var automatically || `TELEGRAM_BOT_TOKEN` | For Telegram | Bot token from BotFather || `TELEGRAM_ALLOWED_USERS` | Recommended | Comma-separated numeric Telegram user IDs || `GATEWAY_TOKEN` | Recommended | Bearer token for `/v1/*` API routes || `HF_TOKEN` | Optional | Enables private Dataset backup named `huggingmess-backup` || `CLOUDFLARE_WORKERS_TOKEN` | Optional | Auto-creates Workers for Telegram proxy and `/health` keep-awake |## Access ControlHermes' built-in dashboard is local-first and does not provide its own public auth layer. HuggingMess adds wrapper-level auth for the exposed Space routes.Set this Space secret:```textGATEWAY_TOKEN=your-strong-password-or-token```Then:- Opening `/app/` shows a HuggingMess login page with one field.- Paste `GATEWAY_TOKEN` into that field.- HuggingMess stores an HTTP-only session cookie for the dashboard routes.- API routes under `/v1/*` accept `Authorization: Bearer <GATEWAY_TOKEN>`.## LLM ProvidersHuggingMess supports two configuration styles:1. **Simple wrapper style:** set `LLM_MODEL` and `LLM_API_KEY`; HuggingMess maps them into Hermes config and provider-specific API key variables.2. **Native Hermes style:** set Hermes variables directly, such as `HERMES_MODEL`, `HERMES_INFERENCE_PROVIDER`, and the provider API key.### GeminiFor Google Gemini, add these Space secrets:| Secret | Value || :--- | :--- || `LLM_MODEL` | `google/gemini-2.5-flash` || `LLM_API_KEY` | Your Google AI Studio API key |HuggingMess will convert that into Hermes config:```yamlmodel:default: gemini-2.5-flashprovider: gemini```And it exports both `GOOGLE_API_KEY` and `GEMINI_API_KEY` for Hermes. You can also use `gemini/gemini-2.5-flash`; the prefix is stripped the same way.Native Hermes equivalent:| Secret | Value || :--- | :--- || `HERMES_MODEL` | `gemini-2.5-flash` || `HERMES_INFERENCE_PROVIDER` | `gemini` || `GOOGLE_API_KEY` or `GEMINI_API_KEY` | Your Google AI Studio API key |### Common Examples| Provider | Simple `LLM_MODEL` | API key secret || :--- | :--- | :--- || Gemini | `google/gemini-2.5-flash` | `LLM_API_KEY` || OpenRouter | `openrouter/anthropic/claude-sonnet-4` | `LLM_API_KEY` || Anthropic | `anthropic/claude-opus-4.6` | `LLM_API_KEY` || OpenAI | `openai/gpt-4o` | `LLM_API_KEY` || Hugging Face Router | `huggingface/meta-llama/Llama-3.3-70B-Instruct` | `LLM_API_KEY` |## Telegram on HF SpacesWhen `TELEGRAM_BOT_TOKEN` and `SPACE_HOST` are present, HuggingMess defaults Telegram to webhook mode:```bashTELEGRAM_WEBHOOK_URL=https://your-space.hf.space/telegramTELEGRAM_WEBHOOK_PORT=8765```If you need polling instead, set:```bashTELEGRAM_MODE=polling```Hermes requires numeric Telegram IDs for allowlists. You can use either Hermes-native `TELEGRAM_ALLOWED_USERS` or the HuggingClaw-style aliases `TELEGRAM_USER_ID` / `TELEGRAM_USER_IDS`.## Cloudflare WorkersHugging Face Spaces can be restrictive for outbound bot API traffic. Add `CLOUDFLARE_WORKERS_TOKEN`, and HuggingMess will:1. create a Telegram proxy Worker,2. generate a shared proxy secret,3. set Hermes Telegram `base_url` to `https://worker.example.workers.dev/bot`,4. set `base_file_url` to `https://worker.example.workers.dev/file/bot`,5. create a second scheduled keep-awake Worker that pings your Space `/health` route.Manual mode is also supported:```bashCLOUDFLARE_PROXY_URL=https://your-worker.workers.devCLOUDFLARE_PROXY_SECRET=optional-shared-secret```The manual Worker source is included in `cloudflare-worker.js`.### Keep AwakeWhen `CLOUDFLARE_WORKERS_TOKEN` is present, HuggingMess creates a scheduled Worker that pings your Space's `/health` route. It automatically detects your Space hostname:```texthttps://your-space.hf.space/health```Default schedule:```text*/10 * * * *```Optional variables:| Variable | Default | Description || :--- | :--- | :--- || `CLOUDFLARE_KEEPALIVE_ENABLED` | `true` | Set `false` to skip keep-awake Worker setup || `CLOUDFLARE_KEEPALIVE_CRON` | `*/10 * * * *` | Cloudflare cron expression || `CLOUDFLARE_KEEPALIVE_URL` | `https://<auto-detected-space-host>/health` | URL to ping || `CLOUDFLARE_KEEPALIVE_WORKER_NAME` | derived from space host | Custom Worker name |## BackupSet `HF_TOKEN` with write access to enable backup. HuggingMess syncs `/opt/data` to a private Dataset named `huggingmess-backup` every 180 seconds by default.| Variable | Default | Description || :--- | :--- | :--- || `BACKUP_DATASET_NAME` | `huggingmess-backup` | Dataset name under your HF account || `SYNC_INTERVAL` | `180` | Backup interval in seconds || `SYNC_INCLUDE_ENV` | `false` | Include `/opt/data/.env` in backup |By default `.env` is excluded from backups because HF Space secrets are already injected at runtime.## Local Development```bashdocker compose up --build```Then open:```texthttp://localhost:7861```## Useful Routes| Route | Purpose || :--- | :--- || `/` | HuggingMess dashboard || `/health` | Health check for HF and Cloudflare keep-awake || `/status` | JSON status || `/app/` | Proxied Hermes dashboard/app || `/v1/*` | Proxied Hermes OpenAI-compatible API routes || `/telegram` | Telegram webhook endpoint |The `/v1/*` routes require:```textAuthorization: Bearer <GATEWAY_TOKEN>```## Links- [Hermes Agent GitHub](https://github.com/NousResearch/hermes-agent)- [Hermes Agent Docs](https://hermes-agent.nousresearch.com/docs)- [Hermes Docker Docs](https://hermes-agent.nousresearch.com/docs/user-guide/docker/)- [Hermes Telegram Docs](https://hermes-agent.nousresearch.com/docs/user-guide/messaging/telegram)8 unmodified lines91011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681698 unmodified lineslicense: mitsecrets:- name: LLM_API_KEYdescription: "Your LLM provider API key (e.g. Anthropic, OpenAI, Google, OpenRouter)."- name: LLM_MODELdescription: "Model ID to use, e.g. google/gemini-2.0-flash or openai/gpt-4o."- name: GATEWAY_TOKENdescription: "Strong token to secure your dashboard and API (generate: openssl rand -hex 32)."- name: TELEGRAM_BOT_TOKENdescription: "Telegram bot token from @BotFather."- name: TELEGRAM_ALLOWED_USERSdescription: "Comma-separated list of numeric user IDs allowed to use the bot."- name: HF_TOKENdescription: "Hugging Face token with write access. Used for automatic workspace backup."- name: CLOUDFLARE_WORKERS_TOKENdescription: "Cloudflare API token for automatic Worker proxy and KeepAlive setup."---<!-- Badges -->[](https://github.com/NousResearch/hermes-agent)[](https://opensource.org/licenses/MIT)[](https://huggingface.co/spaces)[](https://github.com/NousResearch/hermes-agent)**Self-hosted Hermes AI agent gateway — free, no server needed.** HuggingMess runs [Nous Research Hermes Agent](https://github.com/NousResearch/hermes-agent) on HuggingFace Spaces, providing a 24/7 personal AI assistant. It includes a premium management dashboard, automatic persistent backup to HF Datasets, and built-in connectivity fixes to bypass platform restrictions. Deploy in minutes on the free HF Spaces tier with full data persistence.## Table of Contents- [✨ Features](#-features)- [🚀 Quick Start](#-quick-start)- [🔐 Access Control](#-access-control)- [🤖 LLM Providers](#-llm-providers)- [📱 Telegram Setup](#-telegram-setup)- [🌐 Cloudflare Proxy](#-cloudflare-proxy)- [💾 Backup & Persistence](#-backup--persistence)- [💓 Staying Alive](#-staying-alive)- [🔐 Security & Advanced](#-security--advanced)- [💻 Local Development](#-local-development)- [🏗️ Architecture](#️-architecture)- [🐛 Troubleshooting](#-troubleshooting)- [🌟 More Projects](#-more-projects)## ✨ Features- 🧠 **Hermes Core:** Runs the powerful Hermes agent framework for multi-modal chat and tool use.- 🔐 **Secure by Default:** Adds a custom auth layer to protect the Hermes dashboard and API routes.- 🌐 **Built-in Connectivity:** Includes transparent outbound proxying via Cloudflare Workers for Telegram, Google APIs, and more.- 📊 **Premium Dashboard:** Beautiful Web UI at `/` for real-time monitoring of uptime, sync health, and agent status.- 💾 **Persistent Backup:** Automatically syncs agent state, chats, and config to a private HF Dataset.- ⏰ **Easy Keep-Alive:** Uses `CLOUDFLARE_WORKERS_TOKEN` to automatically set up a cron-triggered keep-awake worker at boot.- 🐳 **Optimized Infrastructure:** Minimal resource usage with clean startup logs and production-ready proxying.## 🚀 Quick Start### Step 1: Duplicate this Space[](https://huggingface.co/spaces/somratpro/HuggingMess?duplicate=true)### Step 2: Add Your SecretsNavigate to your new Space's **Settings → Variables and secrets**, and add the following three under **Secrets**:- `LLM_API_KEY` – Your provider API key (e.g., Anthropic, OpenAI, OpenRouter).- `LLM_MODEL` – The model ID string (e.g., `google/gemini-2.0-flash` or `openai/gpt-4o`).- `GATEWAY_TOKEN` – A custom password to secure your dashboard.### Step 3: Access Your DashboardOnce the build is complete, visit your Space's public URL. You will see the HuggingMess management dashboard. Click **Open Hermes UI** and enter your `GATEWAY_TOKEN` to access the agent interface.## 🔐 Access ControlHermes' built-in dashboard is local-first. HuggingMess adds a secure wrapper:- **Dashboard:** Opening `/app/` requires your `GATEWAY_TOKEN`.- **API:** Routes under `/v1/*` (OpenAI-compatible) require `Authorization: Bearer <GATEWAY_TOKEN>`.## 🤖 LLM ProvidersHuggingMess automatically maps your `LLM_MODEL` and `LLM_API_KEY` to the correct Hermes configuration.| Provider | Prefix | Example `LLM_MODEL` || :--- | :--- | :--- || **Google** | `google/` | `google/gemini-2.0-flash` || **OpenRouter** | `openrouter/` | `openrouter/anthropic/claude-3.5-sonnet` || **Anthropic** | `anthropic/` | `anthropic/claude-3-opus-latest` || **OpenAI** | `openai/` | `openai/gpt-4o` || **HuggingFace** | `huggingface/` | `huggingface/meta-llama/Llama-3.3-70B-Instruct` |## 📱 Telegram Setup *(Optional)*To use Hermes via Telegram:1. Add `TELEGRAM_BOT_TOKEN` from [@BotFather](https://t.me/BotFather).2. Add `TELEGRAM_ALLOWED_USERS` (comma-separated numeric IDs) to restrict access.3. Add `CLOUDFLARE_WORKERS_TOKEN` to bypass HF network restrictions automatically.## 🌐 Cloudflare ProxyHuggingFace Spaces often block outbound connections to external APIs. HuggingMess handles this automatically:1. Add `CLOUDFLARE_WORKERS_TOKEN` as a Space secret.2. Restart the Space.HuggingMess will auto-provision a Worker proxy for Telegram and other restricted traffic, and set up a keep-awake cron.## 💾 Backup & PersistenceSet `HF_TOKEN` with **Write** access to enable backup. HuggingMess syncs all agent data to a private Dataset named `huggingmess-backup` every 180 seconds.## 💓 Staying Alive *(Recommended on Free HF Spaces)*Your Space will automatically be kept awake by a background Cloudflare Worker when you configure the `CLOUDFLARE_WORKERS_TOKEN` secret. The worker uses a cron trigger to regularly ping your Space's `/health` endpoint. The dashboard displays the current keep-alive worker status.## 🔐 Security & Advanced| Variable | Default | Description || :--- | :--- | :--- || `GATEWAY_TOKEN` | — | Token for dashboard and API auth || `HF_TOKEN` | — | HF token with write access for backups || `CLOUDFLARE_WORKERS_TOKEN` | — | Cloudflare API token for proxy & keep-awake || `SYNC_INTERVAL` | `180` | Backup frequency in seconds || `CLOUDFLARE_KEEPALIVE_ENABLED` | `true` | Set `false` to disable keep-awake worker || `TELEGRAM_MODE` | `webhook` | `webhook` or `polling` |## 💻 Local Development```bashdocker compose up --build# Dashboard: http://localhost:7861# Hermes App: http://localhost:7861/app/```## 🏗️ Architecture- **Dashboard (`/`)**: Real-time management and monitoring.- **Hermes App (`/app/`)**: Secure proxied access to the Hermes UI.- **API (`/v1/*`)**: Proxied OpenAI-compatible agent API.- **Health Check (`/health`)**: Readiness probe for HF and Keep-Alive.- **Sync Engine**: Python background task for HF Dataset persistence.## 🐛 Troubleshooting- **Telegram bot not responding:** Ensure `CLOUDFLARE_WORKERS_TOKEN` is set. Check logs for "Setting up Cloudflare proxy".- **Authentication failed:** Clear your browser cookies or use an incognito window if your `GATEWAY_TOKEN` has changed.- **Data not persisting:** Ensure `HF_TOKEN` has **Write** permissions.- **Space keeps sleeping:** Add `CLOUDFLARE_WORKERS_TOKEN` as a Space secret to enable automatic keep-awake monitoring via Cloudflare Workers.## 🌟 More ProjectsSimilar projects by [@somratpro](https://github.com/somratpro) — all free, one-click deploy on HF Spaces:| Project | What it runs | HF Space | GitHub || :--- | :--- | :--- | :--- || **Hugging8n** | n8n — workflow & automation platform | [Space](https://huggingface.co/spaces/somratpro/Hugging8n) | [Repo](https://github.com/somratpro/hugging8n) || **HuggingClaw** | OpenClaw — Claude Code in the browser | [Space](https://huggingface.co/spaces/somratpro/HuggingClaw) | [Repo](https://github.com/somratpro/huggingclaw) || **HuggingClip** | Paperclip — AI agent orchestration platform | [Space](https://huggingface.co/spaces/somratpro/HuggingClip) | [Repo](https://github.com/somratpro/huggingclip) || **HuggingPost** | Postiz — social-media scheduler | [Space](https://huggingface.co/spaces/somratpro/HuggingPost) | [Repo](https://github.com/somratpro/huggingpost) |---*Made with ❤️ by [@somratpro](https://github.com/somratpro)*
.env.exampleAdded+50
README.md+102-145