Feature request: stable, public API for a custom node to read another node's already-computed output value
- Dominant language
- Python
- Stars
- 133k
- Forks
- 15.7k
- Avg merge
- 1d 7h
- Merged PRs (30d)
- 158
Description
## Feature request: a stable, public way for a custom node to read another (already-executed) node's output value
### Problem
A recurring class of custom nodes needs to read the **already-computed output value** of some *other* node in the current prompt graph while running — not just their own resolved inputs. Typical use case: a "save/send image with full generation metadata" node wants to embed the actual sampler name, seed, steps, checkpoint name, etc. that were used upstream (Civitai-style PNG info, Eagle/asset-manager integrations, workflow debugging/introspection tools, and similar).
There is currently no public/documented API for this. The existing "hidden input" mechanism (`Hidden.unique_id`, `Hidden.prompt`, `Hidden.extra_pnginfo`, `Hidden.dynprompt`) exposes the **graph structure** (which nodes exist, how they're linked, the raw prompt dict) but not **computed output values** of other nodes.
As a result, node authors reach into private execution internals instead — typically by monkeypatching `execution.PromptExecutor.execute` / `execution.get_input_data` and then reading `prompt_executor.caches.outputs` (or the `execution_list` object passed into `get_input_data`) directly, guessing at whatever method name/shape that internal cache currently exposes.
This is inherently unstable and breaks on essentially every non-trivial refactor of the execution/caching internals, because there was never a supported contract for third parties to depend on:
- **[watarika/ComfyUI-SendToEagle-w-Metadata#25](https://github.com/watarika/ComfyUI-SendToEagle-w-Metadata/pull/25)** (opened today): broke because `RAMPressureCache.get()` (`comfy_execution/caching.py`) became a coroutine as part of the dynamic VRAM/RAM-pressure caching work, and the node's homemade proxy called it synchronously, silently dropping all captured metadata.
- **[#10481](https://github.com/Comfy-Org/ComfyUI/issues/10481)**: an unrelated node (reported against `comfy-pack`, also seen with `ReActor`) hit `AttributeError: 'dict' object has no attribute 'get_output_cache'` from the same category of monkeypatch, after an unrelated internal change to `get_input_data`'s `execution_list` argument shape. That issue was closed as "not Comfy's issue" — which is fair, since nothing was ever promised to stay stable there, but it also means this whole category of plugin has no supported path forward.
Both nodes independently arrived at the same defensive pattern: try several method names (`get`, `get_cache`, `get_output_cache`) via `getattr`/`hasattr`, hoping one exists on whatever internal object the current ComfyUI version happens to pass around. That's a strong signal the underlying need is real and recurring, not a one-off misuse.
### Proposal
Expose a small, stable, public accessor for this specific need — for example, one of:
1. A new hidden input, e.g. `Hidden.executed_outputs` (or similar), giving the node a callable/mapping that resolves `(node_id, output_index=None) -> value | None` for nodes that have already executed earlier in the same prompt, backed by whatever the internal cache implementation is under the hood.
2. Or a documented module-level helper, e.g. `execution.get_node_output(dynprompt, node_id, output_index=None)`, that custom nodes can import and call directly, insulating callers from cache implementation details (sync vs. async, eviction policy, RAM-pressure staging, method naming) going forward.
Either shape would let this category of node stop depending on `PromptExecutor` internals and monkeypatching `get_input_data`, and would give future internal refactors of the caching/execution layer a real compatibility boundary to preserve (or a documented breaking-change note to publish) instead of silently breaking downstream nodes.
Happy to discuss the exact shape, or take a pass at an implementation/PR if there's interest in this direction.
Contributor guide
Research direction
Start by reading execution.PromptExecutor.execute, execution.get_input_data, and comfy_execution/caching.py, especially the cache access involved in already-computed outputs. Review the existing Hidden inputs and the linked examples of downstream breakage. Done means agreeing on and documenting one stable public accessor that avoids monkeypatching execution internals and remains compatible with cache changes.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- backend-api-design
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Quiet
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100