# Docker Space that serves the deployment-agnostic Hermes Agent API. # # The Hermes agent repo is public, so we clone it at build time. Cloning (rather # than `pip install git+...`) guarantees every module is present — the project's # pyproject only packages a subset of the source tree, but api_server.py imports # the full agent (run_agent, agent/, tools/, ...). FROM python:3.11-slim RUN apt-get update && \ apt-get install -y --no-install-recommends \ git build-essential ca-certificates && \ rm -rf /var/lib/apt/lists/* WORKDIR /app # Clone the public Hermes agent (includes api_server.py on main) and install its # dependencies. Pin to a tag/sha here if you want reproducible builds. RUN git clone --depth 1 https://github.com/morongosteve/hermes-agent.git /app RUN pip install --no-cache-dir --upgrade pip && \ pip install --no-cache-dir -e /app # Hugging Face Spaces serves on port 7860; api_server reads PORT. ENV PORT=7860 EXPOSE 7860 # Run as uid 1000 (HF Spaces convention). RUN useradd -m -u 1000 user && chown -R 1000 /app USER 1000 # Import the agent on the MAIN thread before starting the threaded server. # tools/browser_tool registers signal handlers at import time, and signal.signal() # only works on the main thread; pre-importing here keeps worker threads from # tripping over it (also handled inside api_server.main(), this is belt-and-braces). CMD ["python", "-c", "import run_agent; import api_server; api_server.main()"]