Data Processing & Analysisintermediate
October 21, 2025
6 min read
35 minutes
Generate Creative Solutions with Dual AI Agents, Randomization & Redis - Workflow
Revolutionize brainstorming with AI and randomness. This n8n workflow uses dual agents and Redis to generate and refine breakthrough ideas.
By Kazi Sakib

Ever stared at a blank page, waiting for that perfect business idea to strike? Or maybe you're facing a complex problem that demands fresh thinking, but your brain keeps circling the same tired solutions. Traditional brainstorming has limits. We get stuck in our cognitive patterns, drawn to familiar concepts, replaying what we already know. What if you could inject true randomness into your ideation process? What if you could harness the power of two specialized AI agents working in tandem, one generating wild, keyword-driven concepts and another ruthlessly critiquing and synthesizing them into viable strategies?
This n8n workflow does exactly that. It combines random word generation using the Mersenne Twister algorithm, Redis for intelligent data management, and dual AI agents (one creative, one critical) to produce innovative, actionable solutions to any problem you throw at it. Think of it as your personal innovation factory, running 24/7, ready to break through creative blocks with mathematical randomness and artificial intelligence.
Prerequisites: What You'll Need
Before diving into the workflow construction, make sure you have the following accounts and credentials configured:
- n8n instance (cloud or self-hosted)
- Redis account for data storage and queue management
- OpenAI API key for GPT-4 access
- Google Gemini API key for the brainstorming agent
- Gmail account (optional, for email delivery of results)
Key Components: The Building Blocks
This workflow leverages several specialized n8n nodes working together:
- Chat Trigger: Initiates the workflow with user input
- Code Node: Implements Mersenne Twister random number generator
- AI Agent Nodes: Three distinct agents with specialized roles
- Redis Nodes: Manage data storage, queuing, and counters
- Conditional Logic Nodes: Control workflow flow based on data states
- Gmail Node: Delivers the final synthesized solution
Step 1: Generating True Randomness with Mersenne Twister

img_1.png
The workflow begins when a user submits a problem through the chat interface. Instead of relying on JavaScript's default random function (which can be predictable), this workflow implements the Mersenne Twister MT19937 algorithm in a Code node.
Why does this matter? The Mersenne Twister is a pseudorandom number generator with a period of 2^19937-1, offering exceptional distribution properties. It seeds itself using the current timestamp and generates truly unpredictable numbers that serve as inputs for word generation.

img_2.png
The code creates random integers that get processed into a final seed value using multiplication and modulo operations. This seed becomes the creative fuel that powers everything downstream.
Step 2: Converting Numbers into Random Words
Here's where things get interesting. The random number feeds into an AI agent called "Random Word Generator." This isn't just pulling from a predefined list. It's an OpenAI-powered agent with a specialized system prompt designed to maximize entropy.
The agent treats the number as a deterministic seed and maps it to the complete English lexicon. It considers all word classes (nouns, verbs, adjectives, prepositions), all registers (formal, technical, slang), and all frequency levels (common to extremely rare). The result? Truly unexpected words that serve as creative triggers.
Each generated word gets pushed into a Redis list called "brainstorm." Simultaneously, a Redis counter increments to track how many keywords have been generated. The workflow continues generating random words until it reaches five unique keywords.
Step 3: Building the Keyword Foundation
The conditional logic node checks the Redis counter. If fewer than five ideas exist, the workflow loops back to generate more random words. This continues until the storage contains exactly five diverse, unpredictable keywords.

img_3.png
Once the threshold is met, the workflow extracts all keywords from the Redis queue using a pop operation. These words get concatenated into a single message and stored temporarily in Redis with a five-second TTL (time to live). This ephemeral storage ensures the workflow remains clean and doesn't accumulate stale data.
The filtering node removes extra line breaks and formats the keyword list for optimal AI consumption.
Step 4: The Brainstorming Agent Takes Over
Now comes the creative explosion. The formatted keywords, along with the original problem statement, feed into the "Ideation Specialist" agent powered by Google Gemini 2.0 Flash.
This agent operates under strict instructions to generate exactly five distinct, innovative ideas. Each idea must incorporate one or more of the random keywords and directly address the original problem. The agent employs divergent thinking principles, seeking unexpected connections between seemingly unrelated concepts.
For example, if you asked about opening a Yokai-themed Japanese restaurant and the random words were "crystalline," "momentum," "obsolete," "whisper," and "kaleidoscope," the agent might propose:
- An AR experience where ghost stories whisper to diners through hidden speakers
- A kaleidoscope-inspired rotating menu that changes with seasonal yokai legends
- A strategy to make traditional Western dining feel obsolete by comparison
Each idea includes a catchy title, executive summary, detailed explanation, strategic justification, and the inspiring keywords.
Step 5: The Critic Synthesizes the Final Solution
Five ideas are great, but decision paralysis is real. This is where the second AI agent enters: the "Innovation Strategist" powered by OpenAI GPT-4.
This agent plays the role of the ruthless editor. It deconstructs each proposal, assessing impact, viability, innovation potential, scalability, and risks. It extracts the most powerful components from all five ideas and forges them into a single, unified, actionable solution.
The output is formatted as HTML suitable for email delivery, containing:
- A compelling final proposal title
- An executive summary
- Detailed solution description
- Strategic justification explaining why this synthesis is optimal
- Critical risks with mitigation strategies
Finally, the workflow sends this synthesized solution via Gmail, delivering a polished, strategic recommendation directly to your inbox.

img_5.png
Why This Workflow Changes the Game
This isn't just another brainstorming tool. It's a systematic approach to breaking cognitive biases. By injecting mathematical randomness into the creative process, you force your mind (and the AI) to make connections it would never naturally consider.
The dual-agent architecture is equally crucial. The Brainstorming agent operates with maximum temperature settings (high creativity, low constraint), while the Critic agent uses default settings (balanced, analytical). This mirrors how human innovation teams work: wild ideation sessions followed by rigorous evaluation.
Redis serves as the intelligent middleware, managing ephemeral data with TTL expiration to prevent database bloat. The queue structure ensures keywords get processed in order, while the counter mechanism provides precise flow control.
Real-World Applications
This workflow shines in multiple scenarios:
- Business Strategy: Generate unconventional market entry strategies or product differentiation approaches
- Marketing Campaigns: Develop unique campaign angles that competitors wouldn't consider
- Product Development: Discover feature combinations inspired by unrelated domains
- Problem Solving: Break through analysis paralysis on complex technical or organizational challenges
- Creative Writing: Generate plot twists or character concepts using random conceptual triggers
The workflow's true power lies in repeatability. Run it multiple times on the same problem, and you'll get different keywords each time, leading to entirely new solution spaces. It's like having an infinite brainstorming team that never gets tired, never falls into groupthink, and always brings fresh perspectives.
By combining algorithmic randomness, distributed data management, and specialized AI agents, this workflow represents a new paradigm in automated creative problem solving. It doesn't replace human insight, but rather it amplifies it, giving you raw material that your expertise can shape into breakthrough innovations.
Share this article
Help others discover this content
Tap and hold the link button above to access your device's native sharing options
More in Data Processing & Analysis
Continue exploring workflows in this category

Data Processing & Analysisadvanced
1 min read
Fully Automated Tech News Publishing Pipeline with n8n, OpenAI, Google Workspace & Slack
Nayma Sultana
Oct 20
Est: 1 hour

Data Processing & Analysisintermediate
1 min read
Build an AI-Powered Data Analytics Department with n8n and OpenAI: A Multi-Agent Workflow Guide
Kazi Sakib
Oct 20
Est: 45 minutes

Data Processing & Analysisintermediate
1 min read
From Voice to Action: Automating Tasks with Telegram and GPT-4o
Nayma Sultana
Oct 19
Est: 50 minutes