Antigravity CLI 命令执行
Run Google's Antigravity (or Any CLI) From Inside Your Graph
- stdout
- stderr
- return_code
The name is honest: this node runs a CLI command, in a working directory of your choosing, and hands you back the stdout, stderr, and exit code as graph values. The default command is agy --print "Describe what you can do." - agy being the command-line agent from Google's Antigravity, the agentic coding tool that people have been wiring into ComfyUI as a "director" that plans scenes and pushes prompts to the sampler. This is the node that bridges those two worlds.
What it's for
Think of it as a shell escape hatch inside your workflow. The rest of the Kongshan pack is a product-photo pipeline; this node is what happens after you've prepared a prompt file and an output path (that's KSCLIImageInputFiles's job) and you want an agent to actually do the work - read the prompt, look at the image, and render a final e-commerce shot by calling whatever tooling it has. The agent's output lands in a file, and KSCLIImageOutputFile pulls it back into the graph. Round trip complete.
It's not Antigravity-specific despite the name - the command field runs through shell=True, so you can invoke codex, claude, git, python, anything with a CLI. The Antigravity focus just shows in the defaults and in the PATH handling: the node prepends ~/.local/bin and ~/.gemini/antigravity/bin to your PATH so agy resolves even when it isn't on your login shell's path.
The inputs that matter
command- the full command line. Multiline, run viashell=True, so pipes,&&, and quoting all work. The default is a harmless self-introspection call; replace it with the assembled command fromKSCLIImageInputFiles.stdin(optional) - text piped to the process's standard input. Leave blank to send nothing; handy for feeding an agent JSON or a prompt that expects to read stdin.working_directory(optional) - where the command runs. Blank = ComfyUI's current working directory. Fill in a project path and relative paths and tool configs resolve against it. It must exist, or the node raises.timeout_seconds- default 1800, max 86400. Long generations need a big number; on timeout the node kills the process and reports the error.
Outputs: stdout, stderr, and return_code (0 = success, non-zero = the process's exit code, -1 = the node caught an exception while running).
Installing
With the pack:
cd ComfyUI/custom_nodes
git clone https://github.com/kongshan4219/ComfyUI-Kongshan-Nodes
restart ComfyUI. Then install the CLI you actually want to run - for agy, install Google's Antigravity CLI. The node needs no API key itself; the agent it runs does its own auth.
Where people get burned
working_directorysuddenly becomes a number. The source code carries a warning for this exact case: if the value shows up numeric, ComfyUI shifted the widget values (a known widget-ordering quirk) and the node silently falls back to the current working directory. If your command can't find its project files, check this first.- It's
shell=Truewith your full command string. That's powerful and it's a footgun: anything in that field executes on your machine with your permissions. Treat it like a terminal, not a prompt box - don't wire untrusted text intocommand. - Exit code 0 but no output - some CLIs write to stderr even on success, or you forgot to
--print. Check bothstdoutandstderr; this pack's output-loading node reads both on purpose. - It re-runs every queue -
IS_CHANGEDreturnsnan, so ComfyUI never caches the result. Each run is a fresh agent call, which is usually what you want and also usually slow.
This pack is young and nearly unknown (zero impressions everywhere as of now), and honestly the whole CLI trio is the most distinctive thing in it - there aren't many packs that pipe a product image through an autonomous coding agent and load the result back. Ambitious, janky, and genuinely interesting.
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| command | STRING | agy --print "Describe what you can do." | 要执行的命令行。可使用上一节点拼好的 agy 命令;命令会通过 shell=True 执行。 |
| stdinopt | STRING | 传给命令标准输入的文本。留空时不发送 stdin;连接提示词或 JSON 时可让 CLI 从 stdin 读取。 | |
| working_directoryopt | STRING | 命令执行目录。留空使用当前 Python 工作目录;填写项目路径可让相对路径和工具配置按该目录解析。 | |
| timeout_secondsopt | INT | 18001–86400 | 命令最长运行秒数。数值越大越适合长时间生图;超时会终止并返回错误信息。 |
Outputs (3)
| Name | Type | Description |
|---|---|---|
| stdout | STRING | — |
| stderr | STRING | — |
| return_code | INT | — |