Key Concepts
Code node: A workflow step that runs deterministic code (typically JavaScript). It produces the same output every time given the same input. Use it when the task requires precision, not judgment.
LLM node: A workflow step powered by a language model. Use it when the task requires reasoning, interpretation, or handling ambiguity.
Quick Reference
The decision filter
Ask: Does this step need judgment, or does it need to be exact?
- Judgment → LLM node
- Exact → Code node
Five patterns that always call for a code node
- Math - Percentage change, averages, budget pacing, summing totals. Any number derived from other numbers.
- Filtering - Checking each item in a list against a condition (e.g., only rows where clicks dropped more than 20%).
- Sorting and ranking - Ordering items by a specific field. One correct answer, no interpretation.
- Formatting - Date formats, number display, Slack markdown, @mentions, emoji. Pattern, not interpretation.
- De-duplication - Removing exact duplicate entries from a list.
Where code nodes typically sit in a workflow
- Beginning: Cleaning API responses, calculating differences, filtering to significant changes before passing data to an LLM node.
- End: Building the final output format (Slack message, report structure, markdown).
How to generate and test code node logic
- Write a plain-English description of the transformation (input, operation, output)
- Give it to an LLM to generate the code
- Test with a small sample (3-4 items) where you can verify the correct answer manually
- If the output is wrong, describe what's wrong to the LLM and regenerate