shinshin86/comfy-agent

Comfy Agent is a tool to use ComfyUI from the CLI. It is suitable for both direct CLI usage and AI-agent-driven automation.

14

stars

162

commits

TypeScript

primary language

Sep 5, 2026

updated

www.npmjs.com/package/comfy-agent
ai-agents
cli
comfyui

README

Comfy Agent

Logo

npm version CI

Comfy Agent is a CLI for GPU-less individual creators to delegate image, video, and music generation to AI agents across any ComfyUI server—Google Colab, RunPod, or a home GPU.

Japanese documentation: README.ja.md

QuickStart (3 lines)

npm install -g comfy-agent
comfy-agent connect http://127.0.0.1:8188            # or a Colab tunnel URL: https://<id>.trycloudflare.com
comfy-agent run default --source remote --prompt "a cat riding a bicycle"

connect verifies the server once and remembers the URL (re-run it when a Colab tunnel changes — presets and outputs stay local). run submits the workflow, waits, and saves files under ./.comfy-agent/outputs/<preset>/<timestamp>/. default is any workflow saved in the ComfyUI UI; to run your own JSON, comfy-agent import <file> --name <preset>.

No GPU? Jump to Run on Google Colab. Driving this from an AI agent? See For AI agents.

Why comfy-agent

  • Verified environment catalog39 kits expose GPU, download size, setup time, license, and E2E evidence as machine-readable data.
  • Artifacts and instructions stay local — presets, outputs, recipes, and jobs survive server resets; connect absorbs volatile URLs.
  • Facts and policy stay separate — the CLI returns a structured error contract, while the playbook defines agent-independent recovery policy.
  • Production recipes and verification — reusable recipes combine generation with verify and evidence-based artifact review.

For AI agents (Claude Code, Codex, Cursor, Gemini CLI, OpenClaw)

Install the bundled skill for your agent and read the live policy:

comfy-agent skill install --agent claude
comfy-agent skill install --agent codex
comfy-agent playbook

Other supported targets are cursor, gemini, and openclaw; use comfy-agent skill list to see bundled skills. Repository agents should also follow AGENTS.md. Prefer --json, branch on structured error codes, and use only exit codes 0, 2, and 3; the CLI reference is canonical.

For a reusable character, start every generation with brief <name> --preset <preset> --json. Use run <preset> --character <name> to inject its canonical prompt/reference/LoRA data. Keep only human-approved outputs in its gallery; record rejects and kit notes for the next session.

Run on Google Colab

No local GPU? The bundled kits run ComfyUI on a Colab GPU and expose it to the local CLI through a cloudflared tunnel. Start with this five-step flow:

comfy-agent colab kit z_image      # prints installed paths: 01_setup.py / 02_start_comfyui.py / workflows
# paste setup + launcher into Colab, copy the tunnel URL
comfy-agent connect https://<id>.trycloudflare.com
comfy-agent import <workflow path printed above> --name z_image_turbo
comfy-agent run z_image_turbo --prompt "a cat riding a bicycle"
MediaKit / modelStatusMinimum GPUCapability
Imagez_image/VerifiedT4Z-Image Turbo text-to-image
Imagesdxl/VerifiedT4Stable Diffusion XL Base text-to-image
Imagesdxl_turbo/VerifiedT4SDXL Turbo one-step text-to-image
Imageanima/VerifiedT4Anima Base v1.0 anime text-to-image
Imageooo_anima/VerifiedT4OOO_Anima v10 anime text-to-image
Imageanima_pencil/VerifiedT4anima_pencil v2 anime text-to-image
Imagez_anime/PartialT4Z-Anime base / distilled text-to-image
Imageqwen_image/StarterL4Qwen-Image text-to-image
Imageqwen_image_edit/StarterL4Qwen-Image-Edit instruction-based editing
Imageboogu/VerifiedL4Boogu-Image Turbo text-to-image
Imagekrea2/VerifiedL4Krea 2 Turbo text-to-image
Imageflux1/VerifiedL4Flux 1 dev text-to-image
Imageflux2/VerifiedA100Flux 2 dev text-to-image
Imagehidream_i1/VerifiedL4HiDream-I1 Fast / Dev / Full text-to-image
Imagehidream_o1/VerifiedA100HiDream-O1 Dev reasoning-oriented 2K text-to-image
Imageideogram4/VerifiedL4Ideogram 4.0 text-to-image with strong text rendering
Imagesd35/VerifiedL4Stable Diffusion 3.5 Large text-to-image
Imagebirefnet/VerifiedT4BiRefNet background removal / transparent PNG
Imageseedvr2/VerifiedL4SeedVR2 image upscaling and restoration
Videowan21/PartialT4Wan 2.1 1.3B / 14B text-to-video
Videowan22/PartialA100Wan 2.2 TI2V 5B / T2V 14B
Videowan22_s2v/VerifiedA100Wan 2.2 S2V reference-image + audio-to-video
Videoanimegen_t2v/VerifiedA100AnimeGen-T2V anime text-to-video
Videohunyuan_video/VerifiedL4Hunyuan Video text-to-video
Videoltx23/StarterA100LTX-2.3 image / image+audio-to-video
Videoltx23_t2v/VerifiedA100LTX-2.3 text-to-video with generated audio
Videoltx25/VerifiedA100LTX-2.5 T2V / I2V / first-last-frame video with audio
Videominimax_h3/VerifiedA100MiniMax H3 T2V / I2V / reference image+audio R2V
Videominimax_h3_fast/VerifiedA100FastH3 four-forward T2VA with mandatory VSA
Video10eros_max/StarterA10010Eros-Max H3 T2V / I2V with native stereo audio
Videosulphur2/VerifiedA100Sulphur-2 T2V / I2V
Video10eros/PartialA10010Eros T2V / I2V
Audioace_step_1_5/PartialT4ACE-Step 1.5 full songs with lyrics and vocals
Audiominimax_music3/VerifiedL4MiniMax Music 3 songs with lyrics and vocals
Audiostable_audio3_small_music/PartialT4Stable Audio 3 Small Music instrumental / BGM
Audiostable_audio3/VerifiedL4Stable Audio 3 Medium music and sound effects
Audiomoss_soundeffect_v2/VerifiedA100MOSS-SoundEffect v2 48 kHz sound effects
Combomusic_video/VerifiedA100Song + keyframes + video clips music-video recipe
Combokrea2_h3/VerifiedA100Krea 2 keyframes + MiniMax H3 I2V / lip-sync R2V

Statuses are evidence levels, not model quality: Verified passed the complete Colab-to-local flow, Partial passed only some GPUs or workflow variants, and Starter is statically validated but awaits recorded E2E verification. Review each kit README for gated, non-commercial, territory, acceptable-use, and paid-GPU cautions.

Use the catalog before choosing a runtime:

comfy-agent colab catalog --json
comfy-agent colab suggest "fast image generation on a T4" --json
comfy-agent colab kit z_image --json

Presets and outputs survive Colab resets. Rerun the two printed scripts, then connect the new tunnel URL; do not re-import the preset. Full setup and license notes are in the Colab kit guide.

Install & requirements

  • Node.js 22 or newer.
  • A reachable ComfyUI server for connection and generation commands.
npm install -g comfy-agent
comfy-agent --help

Contributors can use npm install, npm run build, and npm run dev -- <command>. On Windows, use PowerShell and quote file paths containing spaces.

The npm package includes the playbooks, skills, recipes, catalog, setup scripts, and workflow JSON used by the commands above. No repository checkout is required to read or install those bundled resources.

Commands at a glance

CommandPurpose
initCreate a local or global work directory.
connectVerify and remember a ComfyUI URL.
importTurn API/UI workflow JSON into a local preset.
runPreflight, submit, wait/download, or submit with --async.
historySearch and annotate creative generation history.
characterManage reusable identity, references, LoRAs, notes, and approved work.
character sheetBuild an identity board from human-approved gallery outputs.
briefLoad character memory and preset applicability before generation.
jobs list|show|wait|pruneInspect and resume persisted jobs.
doctorCheck connection, workdirs, nodes, and models.
listDiscover local and remote workflows.
presetShow parameters, aliases, uploads, and metadata.
statusShow resolved runtime configuration.
verifyProbe outputs and create review aids offline.
analyzeEvaluate an image with OpenAI image input.
colab catalog|suggest|kitInspect and resolve bundled Colab kits.
playbookRead bundled agent policy documents.
skill list|installInstall bundled skills for supported agents.

See the complete CLI reference for every option and payload.

Outputs & work directory

connect or init creates .comfy-agent/ with workflows/, presets/, outputs/, jobs/, and cache/; the remembered URL is in config.yaml. Use --global for ~/.config/.comfy-agent. Generated files default to .comfy-agent/outputs/<preset>/<timestamp>/, alongside run.json; verify writes review aids below <run-dir>/verify/.

Exit codes & JSON

The CLI returns only 0 (success), 2 (invalid invocation/input/local environment), or 3 (server/executed target/artifact state differs from expectations). With --json, success is { "ok": true, ... } and failure is { "ok": false, "error": { "code": "...", "message": "...", "details": ... } }. run --dry-run --json prints raw workflow JSON when no character option is present; with --character, it returns an envelope containing the patched workflow and character injection metadata. PROMPT_REJECTED (exit 3) means ComfyUI rejected the submitted workflow; inspect details.error and details.node_errors, correct the reported node inputs, and rerun. See Exit codes and errors.

Documentation

Contributing / License

Contributors must follow the E2E verification discipline in CLAUDE.md. Comfy Agent is available under the MIT License.

Command reference

For complete command documentation, see docs/cli-reference.md.

Optional H3 profiles (Starter)

  • H3 extensions: SNS LoRA, Guide, motion/audio continuation.
  • VDN H3: explicit-only efficiency experiment.

Ordinary H3/FastH3 stay unchanged; extensions are opt-in. The new kits are not Colab E2E verified.

H3 selection and compatibility

Contributors

shinshin86

162 commits

shinshin86/comfy-agent

Comfy Agent is a tool to use ComfyUI from the CLI. It is suitable for both direct CLI usage and AI-agent-driven automation.

14

stars

162

commits

TypeScript

primary language

Sep 5, 2026

updated

www.npmjs.com/package/comfy-agent
ai-agents
cli
comfyui

README

Comfy Agent

Logo

npm version CI

Comfy Agent is a CLI for GPU-less individual creators to delegate image, video, and music generation to AI agents across any ComfyUI server—Google Colab, RunPod, or a home GPU.

Japanese documentation: README.ja.md

QuickStart (3 lines)

npm install -g comfy-agent
comfy-agent connect http://127.0.0.1:8188            # or a Colab tunnel URL: https://<id>.trycloudflare.com
comfy-agent run default --source remote --prompt "a cat riding a bicycle"

connect verifies the server once and remembers the URL (re-run it when a Colab tunnel changes — presets and outputs stay local). run submits the workflow, waits, and saves files under ./.comfy-agent/outputs/<preset>/<timestamp>/. default is any workflow saved in the ComfyUI UI; to run your own JSON, comfy-agent import <file> --name <preset>.

No GPU? Jump to Run on Google Colab. Driving this from an AI agent? See For AI agents.

Why comfy-agent

  • Verified environment catalog39 kits expose GPU, download size, setup time, license, and E2E evidence as machine-readable data.
  • Artifacts and instructions stay local — presets, outputs, recipes, and jobs survive server resets; connect absorbs volatile URLs.
  • Facts and policy stay separate — the CLI returns a structured error contract, while the playbook defines agent-independent recovery policy.
  • Production recipes and verification — reusable recipes combine generation with verify and evidence-based artifact review.

For AI agents (Claude Code, Codex, Cursor, Gemini CLI, OpenClaw)

Install the bundled skill for your agent and read the live policy:

comfy-agent skill install --agent claude
comfy-agent skill install --agent codex
comfy-agent playbook

Other supported targets are cursor, gemini, and openclaw; use comfy-agent skill list to see bundled skills. Repository agents should also follow AGENTS.md. Prefer --json, branch on structured error codes, and use only exit codes 0, 2, and 3; the CLI reference is canonical.

For a reusable character, start every generation with brief <name> --preset <preset> --json. Use run <preset> --character <name> to inject its canonical prompt/reference/LoRA data. Keep only human-approved outputs in its gallery; record rejects and kit notes for the next session.

Run on Google Colab

No local GPU? The bundled kits run ComfyUI on a Colab GPU and expose it to the local CLI through a cloudflared tunnel. Start with this five-step flow:

comfy-agent colab kit z_image      # prints installed paths: 01_setup.py / 02_start_comfyui.py / workflows
# paste setup + launcher into Colab, copy the tunnel URL
comfy-agent connect https://<id>.trycloudflare.com
comfy-agent import <workflow path printed above> --name z_image_turbo
comfy-agent run z_image_turbo --prompt "a cat riding a bicycle"
MediaKit / modelStatusMinimum GPUCapability
Imagez_image/VerifiedT4Z-Image Turbo text-to-image
Imagesdxl/VerifiedT4Stable Diffusion XL Base text-to-image
Imagesdxl_turbo/VerifiedT4SDXL Turbo one-step text-to-image
Imageanima/VerifiedT4Anima Base v1.0 anime text-to-image
Imageooo_anima/VerifiedT4OOO_Anima v10 anime text-to-image
Imageanima_pencil/VerifiedT4anima_pencil v2 anime text-to-image
Imagez_anime/PartialT4Z-Anime base / distilled text-to-image
Imageqwen_image/StarterL4Qwen-Image text-to-image
Imageqwen_image_edit/StarterL4Qwen-Image-Edit instruction-based editing
Imageboogu/VerifiedL4Boogu-Image Turbo text-to-image
Imagekrea2/VerifiedL4Krea 2 Turbo text-to-image
Imageflux1/VerifiedL4Flux 1 dev text-to-image
Imageflux2/VerifiedA100Flux 2 dev text-to-image
Imagehidream_i1/VerifiedL4HiDream-I1 Fast / Dev / Full text-to-image
Imagehidream_o1/VerifiedA100HiDream-O1 Dev reasoning-oriented 2K text-to-image
Imageideogram4/VerifiedL4Ideogram 4.0 text-to-image with strong text rendering
Imagesd35/VerifiedL4Stable Diffusion 3.5 Large text-to-image
Imagebirefnet/VerifiedT4BiRefNet background removal / transparent PNG
Imageseedvr2/VerifiedL4SeedVR2 image upscaling and restoration
Videowan21/PartialT4Wan 2.1 1.3B / 14B text-to-video
Videowan22/PartialA100Wan 2.2 TI2V 5B / T2V 14B
Videowan22_s2v/VerifiedA100Wan 2.2 S2V reference-image + audio-to-video
Videoanimegen_t2v/VerifiedA100AnimeGen-T2V anime text-to-video
Videohunyuan_video/VerifiedL4Hunyuan Video text-to-video
Videoltx23/StarterA100LTX-2.3 image / image+audio-to-video
Videoltx23_t2v/VerifiedA100LTX-2.3 text-to-video with generated audio
Videoltx25/VerifiedA100LTX-2.5 T2V / I2V / first-last-frame video with audio
Videominimax_h3/VerifiedA100MiniMax H3 T2V / I2V / reference image+audio R2V
Videominimax_h3_fast/VerifiedA100FastH3 four-forward T2VA with mandatory VSA
Video10eros_max/StarterA10010Eros-Max H3 T2V / I2V with native stereo audio
Videosulphur2/VerifiedA100Sulphur-2 T2V / I2V
Video10eros/PartialA10010Eros T2V / I2V
Audioace_step_1_5/PartialT4ACE-Step 1.5 full songs with lyrics and vocals
Audiominimax_music3/VerifiedL4MiniMax Music 3 songs with lyrics and vocals
Audiostable_audio3_small_music/PartialT4Stable Audio 3 Small Music instrumental / BGM
Audiostable_audio3/VerifiedL4Stable Audio 3 Medium music and sound effects
Audiomoss_soundeffect_v2/VerifiedA100MOSS-SoundEffect v2 48 kHz sound effects
Combomusic_video/VerifiedA100Song + keyframes + video clips music-video recipe
Combokrea2_h3/VerifiedA100Krea 2 keyframes + MiniMax H3 I2V / lip-sync R2V

Statuses are evidence levels, not model quality: Verified passed the complete Colab-to-local flow, Partial passed only some GPUs or workflow variants, and Starter is statically validated but awaits recorded E2E verification. Review each kit README for gated, non-commercial, territory, acceptable-use, and paid-GPU cautions.

Use the catalog before choosing a runtime:

comfy-agent colab catalog --json
comfy-agent colab suggest "fast image generation on a T4" --json
comfy-agent colab kit z_image --json

Presets and outputs survive Colab resets. Rerun the two printed scripts, then connect the new tunnel URL; do not re-import the preset. Full setup and license notes are in the Colab kit guide.

Install & requirements

  • Node.js 22 or newer.
  • A reachable ComfyUI server for connection and generation commands.
npm install -g comfy-agent
comfy-agent --help

Contributors can use npm install, npm run build, and npm run dev -- <command>. On Windows, use PowerShell and quote file paths containing spaces.

The npm package includes the playbooks, skills, recipes, catalog, setup scripts, and workflow JSON used by the commands above. No repository checkout is required to read or install those bundled resources.

Commands at a glance

CommandPurpose
initCreate a local or global work directory.
connectVerify and remember a ComfyUI URL.
importTurn API/UI workflow JSON into a local preset.
runPreflight, submit, wait/download, or submit with --async.
historySearch and annotate creative generation history.
characterManage reusable identity, references, LoRAs, notes, and approved work.
character sheetBuild an identity board from human-approved gallery outputs.
briefLoad character memory and preset applicability before generation.
jobs list|show|wait|pruneInspect and resume persisted jobs.
doctorCheck connection, workdirs, nodes, and models.
listDiscover local and remote workflows.
presetShow parameters, aliases, uploads, and metadata.
statusShow resolved runtime configuration.
verifyProbe outputs and create review aids offline.
analyzeEvaluate an image with OpenAI image input.
colab catalog|suggest|kitInspect and resolve bundled Colab kits.
playbookRead bundled agent policy documents.
skill list|installInstall bundled skills for supported agents.

See the complete CLI reference for every option and payload.

Outputs & work directory

connect or init creates .comfy-agent/ with workflows/, presets/, outputs/, jobs/, and cache/; the remembered URL is in config.yaml. Use --global for ~/.config/.comfy-agent. Generated files default to .comfy-agent/outputs/<preset>/<timestamp>/, alongside run.json; verify writes review aids below <run-dir>/verify/.

Exit codes & JSON

The CLI returns only 0 (success), 2 (invalid invocation/input/local environment), or 3 (server/executed target/artifact state differs from expectations). With --json, success is { "ok": true, ... } and failure is { "ok": false, "error": { "code": "...", "message": "...", "details": ... } }. run --dry-run --json prints raw workflow JSON when no character option is present; with --character, it returns an envelope containing the patched workflow and character injection metadata. PROMPT_REJECTED (exit 3) means ComfyUI rejected the submitted workflow; inspect details.error and details.node_errors, correct the reported node inputs, and rerun. See Exit codes and errors.

Documentation

Contributing / License

Contributors must follow the E2E verification discipline in CLAUDE.md. Comfy Agent is available under the MIT License.

Command reference

For complete command documentation, see docs/cli-reference.md.

Optional H3 profiles (Starter)

  • H3 extensions: SNS LoRA, Guide, motion/audio continuation.
  • VDN H3: explicit-only efficiency experiment.

Ordinary H3/FastH3 stay unchanged; extensions are opt-in. The new kits are not Colab E2E verified.

H3 selection and compatibility

Contributors

shinshin86

162 commits

Languages

TypeScript

80.1%

Python

19.0%