← All posts

Memoized Workflow Runs: Why Changing the Last Step Should Not Re-Bill the First

Wavemaker content-addresses block outputs per org — identical inputs hit the memo cache, while retryUntil and bestOfN use instance salt. How memoization makes iterative workflow runs affordable.

Illustration for: Memoized Workflow Runs: Why Changing the Last Step Should Not Re-Bill the First
Conceptual illustration — product screenshots appear in the guide below where they help you click through.

Change one line of copy at the end of a ten-block pipeline — should you pay again for scraping, storyboarding, and six reviewed seed frames? No. Wavemaker memoizes workflow block outputs: identical work resolves to the same content-addressed artifact and skips re-billing on the next run. That is how the AI workflow builder stays usable for iteration, not just one-shot demos.

The problem memoization solves

Without caching, every “Run” is a full greenfield production:

  • Re-scrape the brand site.
  • Re-plan music and dialogue.
  • Re-generate every scene image and clip.

Creators would avoid experimentation; API integrators would fear idempotent retries that double-charge. Chat workflows memoize some steps at the Inngest layer too, but kernel runs make memo per block with explicit keys auditable in kernel_run_nodes.

Memoization targets stable upstream work when you edit downstream params — tweak CTA text, swap music genre, re-run compose only.

How memo keys are built

computeMemoKey hashes canonical JSON over:

InputRole
blockRefPinned manifest major (generate_image@1)
paramsLiterals, $input, $from, $expr resolved values
inputHashesContent hashes of wired input artifacts
bindingFingerprintResolved LoRA/voice pins
instanceSaltScheduler stamp for contract retries / Best of N
styleSaltHash of effective WorkflowSpec.style

Match → reuse artifact, reconstruct port facts, mark node complete without calling providers.

Excluded: which credential paid (BYOK vs platform). Same pixels, same key — prevents double-spend when toggling BYOK mid-project.

Instance salt and quality contracts

Plain memoization would break retryUntil: attempt 1’s rejected image would memo-hit on attempt 2 with identical prompts. The scheduler adds instanceSalt from the instance key (@2, ~3) for attempts ≥ 2. Invariant from building workflows: quality contracts cannot cache-loop on rejected artifacts.

Read more: Quality contracts for AI pipelines and Best of N generation explained.

Style salt and creative locks

When you set cinematic medium, look anchor, or style reference images in the spec panel, workflowStyleSalt mixes into every block key. Change the look → bust memo for styled generation — old frames cannot slip through after a rebrand. Detail: Style-locked workflows.

Waves, checkpoints, and replay

Runs execute in waves (one Inngest step per wave). Inside a wave, nodes checkpoint to Neon; Inngest replay skips completed nodes. Memo hits align with checkpoints: a re-entered wave is a no-op for finished work.

runToNode / pin launches iterate on a suffix while upstream memo saves credits — common in Training Studio eval loops and “fix the last scene” refinements.

Hub app page: published workflow form, estimate, and run without exposing premium graph internals

Published Hub app page at /w/{slug} with typed inputs and Run.

Quotes, holds, and settlement still apply

Memo hits reduce actual spend; envelope hold still uses compile-time upper bounds before run start. Settlement charges executed nodes only — memo-skipped nodes do not appear as fresh provider calls. Failed runs refund unused hold idempotently (refund_{holdIdempotencyKey}).

Foreign runners on /w/{slug} benefit from your org’s memo only when they share your org — typically each customer org has its own cache. Published workflows run in the runner org’s tenant; memo is per org, not global CDN.

Operational tips

  1. Promote stable inputs — bind URLs and brand facts early so downstream edits do not perturb hashes accidentally.
  2. Version pin subworkflows at publish — memo keys include resolved binding versions.
  3. Expect cold cache after style or binding changes — re-quote before batch jobs.
  4. Use idempotency keys on API submit — duplicate POST returns the same run without duplicate holds (workflows as API).

Where to go next

runToNode and pin launches

Authors often iterate on the last segment of a long graph. Pin a node or use runToNode semantics to execute only the suffix while upstream nodes memo-hit. Training Studio evaluation grids reuse the same artifact store with different instance keys for variant caps — the mental model matches: unchanged inputs should not re-scrape the web or re-plan music when you only changed a LoRA weight on the final image block.

Estimate path parity

estimate_run and copilot estimate_run share the compile envelope with submit — memo hits are a runtime optimization and do not always appear in pre-run quotes. Expect quotes to reflect worst-case retry and Best-of-N multipliers even if your next run memoizes half the graph. After a successful run, a second run with identical inputs and style should show reduced settlement in the run detail — that is the proof memo worked.

Org boundaries and compliance

Memo artifacts are org-scoped storage. If you fork a Hub workflow (remixing lineage), your org starts with a cold cache — first run pays full cost, subsequent runs benefit locally. Delisted assets remain run-resolvable for published versions that pinned them; changing bindings busts fingerprints intentionally.

Anti-pattern: fighting memo with manual UUID churn

Promoting a new random string input each run on purpose defeats memo for upstream blocks you intended to stabilize. Bind stable brand URLs and subject ids; use workflow inputs for the copy that should change. Style reference swaps belong in WorkflowSpec.style, not ad-hoc param hacks — styleSalt exists so memo busts are explicit (style-locked workflows).

Artifact store facts and port reconstruction

Memo hits are not raw R2 URLs alone — Neon stores metadata plus facts that rebuild which output port fired. That matters when a block exposes multiple outputs and downstream wires depend on a specific port ref. The artifact store re-persists __port facts on cache replay so scheduler completions match a fresh execution. Operators comparing two runs with identical node keys should see the same artifact ids when inputs unchanged — different ids imply salt, style, or binding drift.

Binding fingerprint changes

Attaching a Hub LoRA via Use in workflow changes binding fingerprint — intentional memo bust. Version-pin a model asset at publish so foreign runners resolve the same weights; delisted assets remain run-resolvable for pinned published versions per kernel policy. If you swap bindings without bumping version, expect memo misses and support tickets about “different look same spec.”

Wave replay after deploy

Inngest memoizes completed steps at the wave boundary; inside-wave checkpoints survive runner deploys. A deploy mid-run replays the current wave from Neon checkpoints — memo hits inside that wave still skip provider calls. This is why kernel runs survive Fly deploys better than naive step-per-node designs (building workflows § Deploy-safe).

Credits line items on run detail

Run reads expose per-node costs — memo-skipped nodes may show zero marginal provider spend while still advancing progress. Finance reconciliation should use ledger holds and settle rows, not infer memo from external API bills alone. BYOK nodes still record platform fee lines when applicable.

Field notes

Developer tip: when adding a new block adapter, ensure memo key inputs include every param that affects output bytes — missing param in hash causes wrong memo hits (rare but severe). QA memo by running twice with no changes and asserting identical artifact ids on stable nodes. Change one downstream param only and assert upstream ids unchanged.

The AI workflow builder landing orients new authors; /workflows/new is the authenticated entry. Published runners live at /w/{slug} with JSON Schema exposed on GET /api/v1/w/{slug}. Hub discovery is /hub. Kernel contracts are unauthenticated at GET /api/v1/openapi.json and GET /api/v1/workflow-spec-schema. Docs cluster: workflows overview, building workflows, running workflows, publishing and earning. Comfy transpile honesty: /comfyui and import ComfyUI workflows. API integrators: workflows as API endpoints and agent-driven MCP builder. Next step for this topic: open /workflows/new and apply the pattern from memoized workflow runs, then publish to /hub when the run is stable.

Glossary (quick)

WorkflowSpec — canonical IR JSON. Compile gate — validate before run/publish. Open royalty — 10% to creator on foreign settled platform credits. Premium — creator-priced runs with 80/20 success split. Memoization — content-addressed skip for unchanged blocks. approvalGate — human pause with webhook. bestOfN — parallel candidates, scoreBy winner. Lineage — fork/remix parent attribution. Slug run — execute published workflow by Hub slug without chat orchestrator.

Frequently asked questions

What does memoization mean for workflow runs?
Each block execution computes a memo key from block ref, params, input content hashes, binding fingerprint, optional instance salt, and style salt. A matching org-scoped artifact skips re-execution and re-billing for that node.
Does BYOK change memo keys?
No. Credential source is excluded from the fingerprint — the same model output hashes the same whether platform or BYOK paid for the API call. Provider, model, and adapter versions are included.
When are memo hits intentionally prevented?
retryUntil attempts ≥2 and bestOfN candidates ≥2 add instanceSalt so quality contracts cannot reuse rejected outputs. Editing WorkflowSpec.style adds styleSalt so look changes bust stale image memo.
Can another organization reuse my memo cache?
No. Memo hits are org-scoped. Artifacts live in your org's store with provenance facts for replay.