- per-step — not a global switch on the whole workflow
- explicit — you declare what matters in the cache key
- derived from declared inputs and dependencies — no hidden state
- validated against the current output model before reuse — stale shapes are rejected
Step-Level Caching
Caching belongs on the step that produces reusable work. Why per-step and not per-workflow? Because different steps have different purity profiles. A summarization step might be safely cacheable. A deployment step never is. Putting the cache declaration on the step forces you to make that judgment where it matters. For example:- cache
analyze - key it from the declared
byfunction - invalidate old entries if the algorithm or provider changes by bumping
version
Default Mental Model
Here is the one sentence you should internalize:A step is cacheable when it behaves like a pure function of its declared inputs.If a step depends on:
inputneeds- stable service behavior
What Goes Into the Cache Key
The default cache key should be derived from durable workflow structure plus the explicitcache.by payload.
Good key components:
- workflow name
- step id
- output model identity
cache.version- serialized value returned by
cache.by
Why Explicit Keys Matter
Imagine debugging a production workflow where a step returned a stale result. With magic cache keys, you’d be spelunking through framework internals trying to figure out what the cache thought was “the same.” With explicit keys, you open the step definition and read it. Explicit keys make cache behavior reviewable. You can answer:- what exact data invalidates this step?
- did the provider/model change?
- does this step depend on hidden filesystem or network state?
- should this cache survive a workflow refactor?
Cache Validation
Here’s a subtle problem. You cached a step’s output last week. Since then, you changed the output schema — added a field, tightened a type. The cached bytes still exist, keyed to the same inputs. Should Smithers blindly hand you the old shape? No. When Smithers finds a cache hit, it should still validate the cached payload against the current output model before reusing it. That protects against:- model shape changes
- decoding changes
- old invalid cache entries
Example
summary row instead of calling the agent again.
Read the by function. It tells you everything: this step’s output depends on the analysis summary and the severity. Change either one, and you get a fresh call. Change neither, and you get the cached result. No guessing.
What Should Not Be Cached
Ask yourself: “If I replayed the cached output instead of running this step, would anything be wrong?” For a summarization step, no — you’d get the same summary. For a deployment step, absolutely yes — you’d skip the actual deploy. Caching is a bad fit for steps that are primarily about side effects. Examples:- deploy to production
- send email
- mutate a Git branch
- call an external system whose current state matters
- open an approval request
Caching and Effect Services
Effect services are not part of the cache key automatically. That is intentional. Service instances are often not serializable or stable. If service behavior affects the output, encode that in the cache version:Runtime Behavior
With caching enabled on a step, Smithers should:- compute the cache key before executing the step
- look for a previously successful cached output
- validate the cached payload against the output model
- if valid, mark the step as completed from cache
- otherwise run the step normally and persist the fresh output
Resume vs Cache
Resuming and caching are related but distinct.Resume
Resume reuses outputs from the same execution id. Your workflow crashed at step 4. You restart it. Steps 1 through 3 already succeeded in this run, so Smithers skips them. That’s resume — replaying within a single execution.Cache
Cache reuses outputs across different executions when the declared cache key matches. You run a new workflow with the same ticket. The analysis step sees a cache hit from last Tuesday’s run. That’s caching — reuse across executions. Resume is about durability. Cache is about recomputation.Storage
Cached outputs should live in Smithers-managed metadata, keyed by:- workflow id
- step id
- cache key
- cache version
Suggested Rule
Only cache a step if you would be comfortable describing it as:“Given these explicit inputs, I want the same persisted output back.”If that sentence feels false, the step probably should not use caching.
Next Steps
- Planner Internals — See how the workflow graph is planned and scheduled internally.
- Execution Model — See where cache lookup happens in the durable step lifecycle.
- Runtime Events — This page will need cache-hit and cache-miss events in the new design.