Don't Build Another AI Agent Until You See This: Anthropic's Secret to Effective Agents ~ n8n
By Mahmut Kasimoglu
Key Concepts
- Prompt Chaining: Decomposing a task into a sequence of steps, where each LLM call processes the output of the previous one.
- Routing: Classifying an input and directing it to a specialized follow-up task.
- Parallelization: Running LLMs simultaneously on a task and aggregating their outputs programmatically. Includes sectioning and voting.
- Orchestrator Workers: A central LLM dynamically breaks down tasks, delegates them to worker LLMs, and synthesizes their results.
- Evaluator Optimizer: One LLM generates a response, while another provides evaluation and feedback in a loop.
- Agents: LLMs with access to tools and memory, capable of autonomously deciding on the steps to take to complete a request.
- Workflows: Predefined steps to complete a task.
- Augmented LLMs: LLMs with access to tools but without the autonomy of agents.
Prompt Chaining
- Definition: Decomposes a task into a sequence of steps, where each LLM call processes the output of the previous one.
- When to Use: Ideal for tasks that can be easily decomposed into fixed subtasks.
- Goal: Trade off latency for higher accuracy by making each LLM call an easier task.
- Example: Creating a report on obesity.
- Step 1: Generate key points and angles for the topic using one LLM.
- Step 2: Use a report planner LLM to create an outline of the report based on the key points and angles.
- Step 3: Use a report generator LLM to generate the report based on the outline.
- Benefits:
- Higher accuracy.
- Flexibility in choosing models for each step.
- Ease of debugging: Issues can be isolated to specific LLM calls.
- Technical Details: The example uses separate models for each step to demonstrate flexibility. The final report is sent via Gmail.
Routing
- Definition: Classifies an input and directs it to a specialized follow-up task.
- Goal: Separation of concerns and building more specialized prompts. Optimizing for one kind of input can hurt performance on others.
- Example: A system that manages Gmail, calendar, and Slack.
- Create specialized agents for each platform (Gmail, calendar, Slack).
- A classifier LLM determines the type of request (e.g., "get my last emails").
- The request is routed to the appropriate LLM (e.g., Gmail LLM).
- Example 2: Routing to different content generators.
- Input: "Tell me a joke about a cat."
- Text classifier categorizes the input as a joke.
- The workflow is routed to a joke generator LLM.
- Benefits: Minimizes the scope of responsibility for each LLM, allowing for more focused prompts.
Parallelization
- Definition: LLMs can work simultaneously on a task, and their outputs are aggregated programmatically.
- Two Key Variations:
- Sectioning: Breaking a task into independent subtasks that run in parallel.
- Voting: Running the same task multiple times to get diverse outputs.
- Sectioning Example: A travel agent system.
- Input: Location (e.g., "Toksim stumble").
- Parallel LLMs find:
- Restaurants
- Hotels
- Activities
- Outputs are merged and aggregated into a single report.
- Uses Ser API for real-time browsing.
- Voting Example: Generating slogans for a brand.
- Input: "AI athletic, an AI-driven fitness app..."
- Three LLMs with the same prompt but different models generate slogans.
- Outputs are merged and formatted to show which model generated each slogan.
- Technical Details: The example uses different models for each LLM in the voting example to further diversify the outputs.
Orchestrator Workers
- Definition: A central LLM dynamically breaks down tasks, delegates them to worker LLMs, and synthesizes their results.
- Difference from Parallelization: Offers the flexibility to choose how many LLMs to run for a particular task.
- Example: Translating text into multiple languages.
- Orchestrator LLM:
- Input: "Please translate the following to Spanish, Turkish, and French: [text]."
- Identifies the languages and creates a JSON array with language and text fields.
- Translator LLM:
- Translates the text into the given language.
- The translator LLM is run in parallel for each language.
- The translated texts are aggregated and sent via email.
- Orchestrator LLM:
- Benefits: Creates a very flexible and dynamic system. The orchestrator doesn't know how many subtasks to create beforehand.
Evaluator Optimizer
- Definition: One LLM generates a response, while another provides evaluation and feedback in a loop.
- When to Use: Effective when there are clear evaluation criteria and when iterative refinement provides measurable value.
- Example: An email-based customer support system.
- Email Classifier: Determines if an email is a customer inquiry.
- Customer Support LLM: Generates an email response.
- Evaluator LLM: Evaluates the response based on clarity, completeness, tone, etc.
- Outputs "pass" or "fail" and provides feedback.
- If the evaluator rejects the response, the feedback is passed back to the customer support LLM to refine its output.
- The loop continues until the evaluator accepts the output.
- Technical Details: The evaluator checks for specific criteria, such as the presence of a signature ("John Doe").
- Benefits: Ensures that the email meets specific criteria through iterative refinement.
Agents vs. Workflows
- Agents: LLMs with access to tools and memory, capable of autonomously deciding on the steps to take to complete a request.
- Workflows: Predefined steps to complete a task.
- Key Difference: Agents have agency and autonomy in decision-making, while workflows have predetermined steps.
- Example: A calendar agent with access to Gmail and calendar tools can create a calendar event and send an email without predefined steps.
- Rule of Thumb:
- Use fixed workflows for repetitive, well-defined tasks with predictable outcomes.
- Use AI agents for complex, dynamic tasks that require decision-making and adaptation.
- Augmented LLMs: LLMs with access to tools but without the autonomy of agents. The agent nodes used in the previous examples were actually augmented LLMs, not true agents.
Synthesis/Conclusion
The video provides a detailed overview of several agentic frameworks, including prompt chaining, routing, parallelization (sectioning and voting), orchestrator workers, and evaluator optimizer. It emphasizes the importance of understanding the distinction between workflows and agents, highlighting that workflows involve predefined steps, while agents have the autonomy to decide on the steps to take. The choice between workflows and agents depends on the complexity and predictability of the task. The video also provides practical examples of each framework, demonstrating how they can be implemented using n8n. The key takeaway is that by mastering these workflow patterns, developers can make informed design choices when building agentic systems.
Chat with this Video
AI-PoweredLoad the transcript when you're ready to chat so the initial page stays lighter.
Related Videos

How the hometown humiliation of Putin marks a turning point for Ukraine | DW News
DW News

Shocking video shows moment paramedics are hit by Israel in 'double-tap' strike
Sky News

Putin Xi, To Catch a Castro, Red Carpet Rebellion • FRANCE 24 English
FRANCE 24 English

Trump's supporters furious over Trump smartphone scam.
ABC News In-depth

Nvidia Crushes Earnings again — What Jensen Huang sees next for AI
CGTN America

Samsung union suspends strike after reaching tentative pay deal • FRANCE 24 English
FRANCE 24 English

OH SH*T! The Banks are Dumping AI Loans!
Steven Van Metre