Antigravity _Agent_ Terminal using wrong environment

The Issue: The Agent executes commands successfully, but they run in the Base/System environment instead of the project’s virtual environment. It ignores the active .venv shown in the editor.
I have so far failed in figuring out a correct fix for this. Any advice is welcome.

3 Likes

Hello,

Thank you for reporting this.

To ensure the Agent consistently uses your project’s virtual environment, you should define the environment path explicitly in your Workspace Rules.

  • Create or update a rule file (e.g., .agent/rules/env.md) with the following instruction:
# Environment Configuration
When executing Python commands, ALWAYS use the interpreter located at:
`./.venv/bin/python` (or `.\.venv\Scripts\python.exe` on Windows).

Do not run `python` directly from the global path.
  • Alternatively, you can force the agent to activate the environment at the start of its task sequence by adding this to your prompt: "Activate the virtual environment in .venv before running any scripts.