n8n or code? How I decide when to automate visually
Visual workflow tools and plain Python both have a place. A practical guide to choosing between them — and to the hybrid approach most of my automation uses.
For workflow automation I use both visual tools like n8n and Zapier and plain Python with FastAPI. People ask which is better. The honest answer: they're good at different jobs, and most of my real systems use both.
Where visual workflows shine
Glue between SaaS tools
"When a form is submitted, add the person to the CRM, tag them, send a welcome email and post a note to the team chat." That's four integrations with authentication, retries and field mapping. A visual tool does it in minutes, and the workflow diagram is the documentation.
Workflows that non-developers need to read
A diagram is something a marketing lead or an operations manager can follow. When the people who own a process can see it, they can also tell you when it's wrong.
Fast experiments
Need to test whether an automated follow-up improves response rates? Build it visually, run it for two weeks, measure. If it works, keep it or harden it. If it doesn't, delete it with no regrets.
Where code wins
Real logic
Once a workflow needs loops over large datasets, careful error handling, non-trivial math or complex branching, a diagram turns into spaghetti. Code is easier to read, test and change.
Anything that needs tests
You can't easily unit test a visual workflow. Statistics engines, pricing rules, data transformations and validation all belong in code with tests around them.
Performance and cost
Running thousands of items through many visual steps can be slow and, on some platforms, expensive. A small Python worker can do the same job faster and cheaper.
Version control
Code diffs cleanly in git. Visual workflows can be exported, but reviewing changes is harder.
The hybrid I actually use
Most of my systems look like this:
- n8n handles the edges: triggers, SaaS integrations, notifications, schedules.
- A FastAPI service handles the core: business logic, validation, AI calls with structured outputs, database writes.
- n8n calls the API with one HTTP request; the API returns a clean result.
The visual layer stays simple and readable. The hard logic lives where it can be tested. And when an integration changes, I edit a node instead of redeploying a service.
A quick decision checklist
- Mostly connecting existing tools? Visual.
- Logic you'd want unit tests for? Code.
- Owned or edited by non-developers? Visual.
- High volume or cost-sensitive? Code.
- Unsure whether it'll even be useful? Visual first, harden later.
AI fits in both
LLM steps work in either world. For quick enrichment — summarize a message, classify a lead — an AI node in n8n is fine. For anything where the output drives decisions, I put the AI call behind an API with schema validation, retries and logging.
The goal isn't purity. It's automation that's quick to build, easy to understand and safe to depend on.
Some links in these notes are affiliate links. If you buy through one, I may earn a commission at no extra cost to you. I only link to tools I use or would recommend.