I’m working on a local animation generation pipeline and would appreciate some official guidance or clarification regarding running the `agy` CLI from an external Python orchestration script.
What I’m Doing:
To process multiple video segments in batch, I wrote a lightweight native Python runner (`subprocess.Popen` / `ThreadPoolExecutor`) that calls the official CLI binary directly:
- Runs headless in print / Q&A mode: `agy -p “”`
- Uses `–model gemini-3.8-flash-high` with high reasoning effort.
- Restricts local worker concurrency (e.g., maximum 3 to 5 parallel processes).
- Uses thread-safe launch staggering (5–6 second hold between subprocess launches) and exponential backoff to respect gateway rate limits.
- Captures standard output stream (`stdout`) once each segment finishes, saves the code locally, and compiles it with downstream Node.js/HTML scripts.
My Question:
Is driving the official `agy` CLI headlessly through a native Python batch runner like this an accepted / supported workflow for batch automation? Are there any specific CLI flags, environment variables, or concurrency recommendations from the team to ensure we stay fully aligned with best practices? @chunduriv@Rebbanpalli_Naveen pls reply asap
Per Google staff (@chunduriv) in topic #187241 and Headless mode, invoking agy -p from local scripts or CI pipelines is documented and consumes plan quota. However, staff also noted that routing automated loops or third-party agents through a consumer login can trigger automated ToS enforcement. Keep consumer logins for moderate direct scripts, and shift unattended high-volume batch loops to billed API credentials.
For your Popen runner, keep --model gemini-3.8-flash-high (a valid agy models slug) and swap plain text stdout scraping for --output-format json (status, response, error, usage, conversation_id) with optional --json-schema validation before downstream Node.js/HTML builds:
Check both a non-zero exit code and status != "SUCCESS", and capture stderr separately: headless mode prints diagnostics there, and unapproved tool calls soft-deny to stderr while still exiting 0. Scoped rules under permissions.allow in ~/.gemini/antigravity-cli/settings.json (plus an isolated cwd per worker) prevent silent denials without --dangerously-skip-permissions. For multi-turn sequential work, stream NDJSON into agy --input-format stream-json --output-format stream-json without -p, reading line-by-line until each result event before closing stdin.
Official Plans publish no fixed worker cap (3-5) or concurrency env vars because limits scale with total agent work. For sustained batch animation volume, switch to pip install google-antigravity (Antigravity Python SDK) with GEMINI_API_KEY or vertex=True, or set "modelProvider": "gemini" in settings.json with GEMINI_API_KEY exported.
Yes, third party tools and softwares are not allowed or permitted but my specific pipeline is Solely python based so it falls under direct scripting which is allowed
To confirm your follow-up: yes, running the unmodified agy -p binary from your own standalone Python script on tasks you write and trigger yourself counts as direct scripting under the FAQ (with no third-party agent coordination, credential extraction, or account rotation).
Two additional points beyond what was shared above:
Concurrency on consumer sign-in: Consumer plans enforce automated rate, capacity, and anti-abuse protections (Plans, Terms). Keeping runs sequential is safest on consumer sign-in—for sustained 3–5 worker batch runs, use Pay As You Go via Google Cloud (or the API key path above).
Prevent updater locks & overages: Update to Antigravity CLI v1.5.13 (Releases), set AGY_CLI_DISABLE_AUTO_UPDATE=true to avoid update.lock collisions (Troubleshooting), and keep Use AI Credits set to off in /config to stay within baseline quota (AI credits).