Building AI Agents & Automations
You've built an insight report automation and a Contentful translation agent. This module formalizes the mental model — how to think about agents, when to use n8n vs code vs APIs, and how to design reliable multi-step workflows.
Step 1 of 5 · Read the lesson
The 4-step agent pattern
- Receive a goal
- Use tools (APIs, files, search)
- Reason about what's next
- Repeat until done or stuck
Decision framework
n8n — linear logic, existing integrations, non-engineers can edit.
Direct API — custom logic, performance-critical, tight integration with your code.
Agent framework (LangChain, CrewAI) — multi-step reasoning, dynamic tool selection.
Reliability
Most AI automations work 80% of the time and fail silently. Add: input validation, output schema checks, retry with backoff, human-in-the-loop for high-stakes paths, observability.
Prompts as code
Version them. Test edge cases. Document the expected output contract. A regression suite for prompts is not overkill — it's table stakes once a flow runs in prod.