Force to VENV
To ensure Hermes Agent strictly and permanently uses a Python virtual environment named "devlop" for all Python tasks—even after restarting the agent or server—you should apply a combination of Agentic Instructions (so the AI knows what to do) and System Configuration (so the execution environment enforces it).
Here is the step-by-step guide to setting this up as the default:
- Update the Agent's Core Persona (SOUL.md)
Hermes Agent uses a file called SOUL.md as its absolute source of truth (it occupies Slot #1 in the system prompt). Any rule you put here will be obeyed across all future sessions, chats, and restarts.
- Open your terminal and edit the soul file: nano ~/.hermes/SOUL.md
- Add a strict instruction at the bottom of the file:
*PYTHON EXECUTION RULES
When executing shell commands, installing pip packages, or running Python scripts via the terminal tool, ALWAYS activate the virtual environment named 'devlop' first (e.g., run
source devlop/bin/activateon Linux/macOS ordevlop\Scripts\activateon Windows). Never use the system Python. Ensure all generated programmatic scripts execute using the 'devlop' python path. -
Save and exit. Note: You can also place this in ~/.hermes/memories/USER.md if you want it treated as a user preference rather than a hard system boundary.
-
Configure config.yaml for Code Execution
Hermes has a specific tool called execute_code for programmatic Python execution. You need to make sure it runs in your workspace and not in an isolated sandbox.
- Open the Hermes configuration file: nano ~/.hermes/config.yaml
- Locate the code_execution block.
-
Ensure the mode is set to project (not strict). strict forces Hermes to use its own temporary sandbox and internal Python, whereas project forces it to respect the active environment in your working directory. code_execution: mode: project timeout: 300
-
Force the Terminal Backend via Shell (Foolproof Method)
Even with strict prompting, LLMs can occasionally forget to type the source command. To make this 100% foolproof at the system level, you can force the Hermes Terminal backend to default to the "devlop" venv.
If you are using the default local terminal backend, Hermes inherits your system's shell environment.
- Open the shell configuration file for the user running Hermes (usually ~/.bashrc or ~/.zshrc).
- Add the path to your devlop environment at the very bottom: *Auto-activate the devlop venv for Hermes Agent source /path/to/your/workspace/devlop/bin/activate
-
Run source ~/.bashrc.
-
Create an Enforcing "Skill" (Optional but Powerful)
Hermes gets smarter through its "Skills" system. You can literally chat with Hermes to create a permanent habit:
- Send this prompt to Hermes in your next chat: "Create a new skill for yourself. Whenever I ask you to run Python code, run a python script, or use pip, you must first check if the 'devlop' virtual environment is active. If it is not, activate it before proceeding. Save this as a permanent skill."
Hermes will generate the logic, save it to ~/.hermes/skills/, and permanently register this custom execution flow so it remembers exactly how to interact with devlop every single time it boots up.