Skip to main content

🧠 Build AI agents with Think-Plan-Act architecture using Llama-4 reasoning

Workflow preview

Workflow preview
100%
🧠 Build AI agents with Think-Plan-Act architecture using Llama-4 reasoning preview
Open on n8n.io

Important notice

This workflow is provided as-is. Please review and test before using in production.

1. Workflow Overview

A plug and play n8n workflow that adds LLM powered reasoning, planning, and action to your automations — with prompts, schemas, and full agent logic included. Ever wish...

Best for

  • Engineering automation workflows
  • AI Chatbot automation workflows
  • advanced n8n builders looking for reusable templates

Tools used

@n8n/n8n-nodes-langchain.lmchatopenrouter, @n8n/n8n-nodes-langchain.outputparserstructured, @n8n/n8n-nodes-langchain.outputparserautofixing, n8n-nodes-base.webhook, n8n-nodes-base.noop, n8n-nodes-base.stickynote, @n8n/n8n-nodes-langchain.agent, n8n-nodes-base.code

Source and attribution

This workflow is cataloged by N8N Workflows and links back to its original n8n.io source page by Lucas Dias.

Original n8n.io source

1.1 Workflow description

Title
🧠 Build AI agents with Think-Plan-Act architecture using Llama-4 reasoning
Workflow name
🧠 Build AI agents with Think-Plan-Act architecture using Llama-4 reasoning

🧠 A plug-and-play n8n workflow that adds LLM-powered reasoning, planning, and action to your automations — with prompts, schemas, and full agent logic included.

Ever wish your n8n flows could think before they act?

Now they can. Say hello to the ultimate agent-based upgrade:

"Think → Plan → Act" – fully automated. Fully intelligent.⚡

🧩 What Is This? This product is a ready-to-use AI-powered workflow template for n8n, featuring a smart “Thinking Agent” that:

🧠 Analyzes tasks 📋 Generates a step-by-step plan 🛠️ Executes actions intelligently 🧾 Returns structured JSON outputs for your next steps

Inspired by the Hugging Face agent architecture, this template gives your automations a brain before they press the red button. 🔴✅

A clean 2-step process: THINK mode → Generates structured reasoning (goal, subgoals, tools, assumptions) ACT mode → Executes subgoals step-by-step using tools and AI.

🧬 What's Inside? This isn’t just a flow — it’s a framework. You get: 🔹 Modular Agent Loop 🔹 A demonstration workflow

📝 Requirements 🔹 OpenRouter API Key (or any other provider like OpenAI, groq...)

🔹 Built-in Parsers 🧾 Structured JSON parser for reliable outputs 🪄 Natural language and unstructured parsing fallback

🛠️ Plug in your own goals, tools, and OpenRouter keys

📦 Includes a demo (e.g., “get the weather”) to get started fast

💡 Why You'll Love It ✅ Plug & Play – Drop into any existing n8n flow ✅ Tool-Aware Reasoning – Plans include which tool to use and why ✅ Composable – Build workflows like agents: Reason → Plan → Execute ✅ Customizable by anyone – Even your intern can tweak the prompts

⚙️ Agent customization 🔹 Feel free to customize the agent settings by changing the Config node. Here's the default configuration:

const config = {
  THINK: {
    CONTEXT: ``, // Add the necessary context to the AI.
    CONSTRAINTS: [`Rule 1`, `Rule 2`], // here are the rules that your AI should follow
    TOOLS: [
      {
        tool: "",
        description: "",
      },
    ], // add here the list of the tools that the AI will call in your backend or workflow.
  },
};

return {
  json: {
    config: config,
    input: $input.last().json,
  },
};

After updating the configuration file, you will see the AI reasoning for your input. Feel free to connect with any other node creating smart tasks!

1.2 Logical Blocks

This catalog entry is organized from the workflow JSON. The node-level section below shows the executable blocks available for review before importing the template.

2. Block-by-Block Analysis

Block 1 - OpenRouter Chat Model

Type / Role
@n8n/n8n-nodes-langchain.lmChatOpenRouter - lmChatOpenRouter
Config choices
Version 1

Block 2 - Structured Output Parser

Type / Role
@n8n/n8n-nodes-langchain.outputParserStructured - outputParserStructured
Config choices
Version 1.2

Block 3 - OpenRouter Chat Model1

Type / Role
@n8n/n8n-nodes-langchain.lmChatOpenRouter - lmChatOpenRouter
Config choices
Version 1

Block 4 - OpenRouter Chat Model4

Type / Role
@n8n/n8n-nodes-langchain.lmChatOpenRouter - lmChatOpenRouter
Config choices
Version 1

Block 5 - OpenRouter Chat Model5

Type / Role
@n8n/n8n-nodes-langchain.lmChatOpenRouter - lmChatOpenRouter
Config choices
Version 1

Block 6 - Thinking output parser

Type / Role
@n8n/n8n-nodes-langchain.outputParserAutofixing - outputParserAutofixing
Config choices
Version 1

Block 7 - Task Output Parser

Type / Role
@n8n/n8n-nodes-langchain.outputParserAutofixing - outputParserAutofixing
Config choices
Version 1

Block 8 - Structured Output Parser1

Type / Role
@n8n/n8n-nodes-langchain.outputParserStructured - outputParserStructured
Config choices
Version 1.2

Block 9 - start-thinking

Type / Role
n8n-nodes-base.webhook - webhook
Config choices
Version 2

Block 10 - No Operation, do nothing

Type / Role
n8n-nodes-base.noOp - noOp
Config choices
Version 1

Block 11 - Sticky Note

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 12 - Sticky Note1

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 13 - Think

Type / Role
@n8n/n8n-nodes-langchain.agent - agent
Config choices
Version 1.8

Block 14 - Act

Type / Role
@n8n/n8n-nodes-langchain.agent - agent
Config choices
Version 1.8

Block 15 - Sticky Note2

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 16 - OpenRouter Chat Model2

Type / Role
@n8n/n8n-nodes-langchain.lmChatOpenRouter - lmChatOpenRouter
Config choices
Version 1

Block 17 - Structured Output Parser2

Type / Role
@n8n/n8n-nodes-langchain.outputParserStructured - outputParserStructured
Config choices
Version 1.2

Block 18 - OpenRouter Chat Model3

Type / Role
@n8n/n8n-nodes-langchain.lmChatOpenRouter - lmChatOpenRouter
Config choices
Version 1

Block 19 - OpenRouter Chat Model6

Type / Role
@n8n/n8n-nodes-langchain.lmChatOpenRouter - lmChatOpenRouter
Config choices
Version 1

Block 20 - OpenRouter Chat Model7

Type / Role
@n8n/n8n-nodes-langchain.lmChatOpenRouter - lmChatOpenRouter
Config choices
Version 1

Block 21 - Thinking output parser1

Type / Role
@n8n/n8n-nodes-langchain.outputParserAutofixing - outputParserAutofixing
Config choices
Version 1

Block 22 - Task Output Parser1

Type / Role
@n8n/n8n-nodes-langchain.outputParserAutofixing - outputParserAutofixing
Config choices
Version 1

Block 23 - Structured Output Parser3

Type / Role
@n8n/n8n-nodes-langchain.outputParserStructured - outputParserStructured
Config choices
Version 1.2

Block 24 - Config1

Type / Role
n8n-nodes-base.code - code
Config choices
Version 2

Showing the first 24 of 33 workflow blocks. Download the JSON for the full node graph.

3. Summary Table

Workflow 🧠 Build AI agents with Think-Plan-Act architecture using Llama-4 reasoning
Complexity advanced
Nodes 33
Categories Engineering, AI Chatbot
Author Lucas Dias
Published 08 Apr 2025

4. Reproducing the Workflow from Scratch

  1. 1. Download the workflow JSON

    Use the JSON export at /data/workflows/3489/3489.json as the source template for this automation.

  2. 2. Import the template into n8n

    Open n8n, import the downloaded JSON, and review each node before activating the workflow.

  3. 3. Configure credentials and variables

    Replace placeholder credentials, API keys, webhook URLs, account IDs, and environment-specific values with your own settings.

  4. 4. Test with sample data

    Run the workflow manually or in a staging workspace, inspect node output, and confirm downstream systems receive the expected data.

  5. 5. Activate and monitor

    Enable the workflow only after testing, then monitor executions, errors, and rate limits during the first production runs.

5. General Notes & Resources

Review imported nodes carefully before activation. This catalog entry is intended to help you inspect the workflow structure, understand required services, and find related templates faster.

Node names, credentials, schedules, webhook paths, and external service limits may need adjustment for your workspace.

Frequently asked questions

What does 🧠 Build AI agents with Think-Plan-Act architecture using Llama-4 reasoning do?

A plug and play n8n workflow that adds LLM powered reasoning, planning, and action to your automations — with prompts, schemas, and full agent logic included. Ever wish...

What do I need before importing this workflow?

Review the workflow JSON, configure any required credentials in n8n, and test the automation in a safe workspace before using it in production.

Can I customize this workflow?

Yes. Use the block-by-block analysis and the downloadable JSON to inspect each node, then adjust credentials, prompts, schedules, filters, or destinations for your Engineering, AI Chatbot use case.