Nodes/ComfyUI Griptape Nodes/Griptape Run: Agent
ComfyUI Node

Griptape Run: Agent

The node that makes ComfyUI talk back

By griptape-ai·Created 2 years ago·Updated about a year ago· 238
Griptape Run: Agent
  • agent
  • key_value_replacement
  • OUTPUT
  • AGENT
input_string
STRING
max_subtasks3

If you install this pack and only use one node, it's this one. Griptape Run: Agent is the workhorse - you type a prompt, it runs a Griptape agent, and you get text back as a STRING you can pipe anywhere: into another prompt, into a save node, into a display, even into a workflow that writes a file. It's the "make ComfyUI talk" node.

Out of the box it's almost too easy. Type a prompt, run, get an answer. The agent defaults to an OpenAI-backed config, so if you've set an OPENAI_API_KEY in the sidebar Settings → Griptape (or in a .env), it just works. Prefer local? Connect an Ollama-based agent config and run everything on your own machine with a model like llama3.

The AGENT output is the sleeper feature. It's the same agent object after the run, with its conversation state intact - wire it into another Run or Task node and you get chained, context-aware turns. That's how you build multi-step agent pipelines instead of one-shot prompts.

How it works

The node takes your STRING prompt (optionally appended with input_string, which lands after it), hands it to the agent as a PromptTask, and returns the response text. max_subtasks (default 3) caps how many tool-calling subtasks the agent can chain when it has tools - a real knob, since runaway tool loops are how agents eat your API credits. key_value_replacement swaps {{ key }} placeholders in your prompt before it runs, which is the pack's template mechanism.

If no agent is connected, a default one is created - which means the "it just worked" experience and also the "why is it using a random OpenAI config" confusion are the same thing.

The inputs that matter

  • STRING - your prompt. This is the one you'll touch every run.
  • agent - optional; an agent built by the config/agent nodes, or from a previous Run's AGENT output.
  • max_subtasks - tool-call depth limit, default 3.
  • input_string / key_value_replacement - prompt appendix and template fill-in.

Outputs: OUTPUT (the reply) and AGENT (for chaining).

Installing

ComfyUI Manager → search "Griptape" → Install, or:

cd ComfyUI/custom_nodes
git clone https://github.com/griptape-ai/ComfyUI-Griptape

Restart ComfyUI. Deps: griptape[all], python-dotenv, openai. Heavy first install. Set your API key (or ollama run llama3 for local).

Common gotchas

The pack installs torch as a side effect, and on Nvidia that can break ComfyUI's own torch - if imports start failing, pip uninstall torch then pip install torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/cu121.

The other classic is the stale-griptape error ImportError: cannot import name 'OllamaPromptDriver' after an update - fix with python -m pip install griptape -U. And if you get a response that says something like "You have provided a blank model", the agent has no model configured - connect a real config instead of the default.

CategoryGriptape/Agent

Inputs (5)

NameTypeDefaultDescription
agentoptAGENTAn existing agent to use. If not provided, a new agent will be created.
input_stringoptSTRINGAdditional text be appended to the STRING with a newline character.
key_value_replacementoptDICTThe will replace the {{ key }} with a value.
STRINGoptSTRINGThe prompt text.
max_subtasksoptINT3The maximum number of subtasks to run when an Agent uses a Tool

Outputs (2)

NameTypeDescription
OUTPUTSTRINGText response from the Agent
AGENTAGENTThe Agent. Can be connected to other nodes.