Showcase > Content & AI

YouTube Scriptwriter

43-node n8n workflow using Anthropic, Qdrant, Brave Search, and Google Sheets style libraries for RAG-powered scriptwriting.

ShowcaseIntermediate5 min read

A focused 43-node workflow that combines document-ingestion RAG with AI scriptwriting and a distinctive approach to consistent voice: Google Sheets as style libraries. Rather than hoping an AI model maintains a consistent tone across scripts, this workflow feeds the agent structured libraries of hooks, linking phrases, and narrative progression patterns pulled directly from spreadsheets. The result is an AI scriptwriter that writes like a specific creator, not a generic chatbot.

Nodes Category Complexity Key Integrations
43 Content Creation & AI Intermediate Google Drive, Qdrant, Cohere, Anthropic, OpenAI, Brave Search, Redis Memory

Prerequisites

  • Anthropic API key (primary LLM for the AI Agent scriptwriter)
  • OpenAI API key (supporting AI tasks)
  • Qdrant instance (cloud or self-hosted) for the RAG knowledge base
  • Cohere API key for embedding generation during document ingestion
  • Brave Search API key for real-time web research during script generation
  • Redis instance (cloud or self-hosted) for session memory across writing stages
  • Google Drive OAuth2 credentials for reference document retrieval
  • Google Sheets OAuth2 credentials for style libraries (Hook Library, Linking Phrases, Narrative Progression) and script output
  • Mistral API key for OCR text extraction via HTTP Request
  • Knowledge level: Intermediate -- requires understanding of RAG pipelines, vector databases, and dual-mode workflow design

Estimated Setup Time

45-60 minutes including Qdrant setup, Redis configuration, style library spreadsheet creation, reference document ingestion, and credential wiring.

What It Does

The workflow operates in two modes. The first mode is document ingestion: reference documents (PDFs, articles, notes) are pulled from Google Drive, processed through Mistral OCR via HTTP Request for text extraction, chunked, embedded using Cohere, and stored in the Qdrant vector store. This builds the knowledge base that the AI agent draws from when writing scripts. You run this mode whenever you have new reference material to add.

The second mode is script generation. You provide a topic, and the AI Agent -- powered by Anthropic Claude -- retrieves relevant context from Qdrant, searches the web via Brave Search for current information, and then writes the script. What makes this workflow distinctive is how it handles writing style. Three Google Sheets serve as AI "style libraries": a Hook Library containing proven opening patterns, a Linking Phrases sheet with transition language that matches the creator's voice, and a Narrative Progression sheet defining how the creator typically structures arguments and stories.

The AI Agent accesses these sheets as tools during generation. Rather than relying on vague prompt instructions like "write in a conversational tone," the agent has concrete examples of the creator's actual language patterns. Redis Memory maintains context across the writing session, allowing the agent to reference earlier sections of the script as it writes later ones. The finished script is output to Google Sheets with section markers and timing estimates.

Workflow Diagram

Workflow Diagram

Node Breakdown

Triggers

  • Manual Trigger

AI & Language Models

  • AI Agent
  • Anthropic
  • OpenAI
  • Qdrant Vector Store
  • Cohere Embeddings
  • Redis Memory

Data & Integrations

  • Google Drive
  • HTTP Request (Mistral OCR)
  • Brave Search
  • Google Sheets (incl. Tool Access)
  • Code

Step-by-Step Flow

  1. Ingestion Mode: Manual Trigger starts document ingestion from a specified Google Drive folder.
  2. Google Drive retrieves reference documents (PDFs, articles, notes).
  3. Mistral OCR (HTTP Request) extracts and cleans text from the documents.
  4. Cohere Embeddings generates vectors for each document chunk.
  5. Qdrant stores the embedded chunks, building the knowledge base.
  6. Generation Mode: Manual Trigger accepts a topic and initiates script generation.
  7. AI Agent (Anthropic Claude) receives the topic and begins script construction.
  8. Qdrant retrieval provides relevant context from the ingested knowledge base.
  9. Brave Search supplies current web information for freshness and supporting data.
  10. Google Sheets tools deliver style libraries: Hook Library, Linking Phrases, and Narrative Progression patterns.
  11. Redis Memory maintains context across the writing session as the agent builds section by section.
  12. Google Sheets output receives the completed script with section markers and timing estimates.

What Sets It Apart

  • Google Sheets as style libraries. This is the standout technique. Instead of prompt-engineering voice and tone, the workflow gives the AI agent access to curated libraries of the creator's actual language patterns: hooks that have worked, linking phrases that sound natural, and narrative structures that define the creator's style.
  • Full RAG pipeline. The ingestion mode builds a growing knowledge base from reference documents, ensuring scripts are grounded in specific, curated information rather than generic LLM knowledge.
  • Brave Search for freshness. Real-time web search ensures scripts include current data and recent developments, not just information from the training data cutoff.
  • Dual-mode design. The clean separation between ingestion and generation modes means the knowledge base can be maintained independently of script production.

Cost Considerations

  • Anthropic Claude: Primary model for script generation; ~$0.50-2.00 per script depending on length and context retrieved
  • OpenAI: Supporting role; minimal per-script cost
  • Cohere: Embedding cost during document ingestion is one-time per document; very low ongoing cost
  • Brave Search: Free tier (2,000 requests/month); paid plans from $5/month
  • Qdrant Cloud: Free tier (1GB) sufficient for moderate knowledge bases
  • Redis Cloud: Free tier (30MB) sufficient for session memory
  • Mistral OCR: Minimal per-document cost during ingestion
  • Google Drive & Sheets: Free with Google account
  • Estimated cost per script: $0.75-3.00 in API costs

Ideal For

  • Professional YouTubers who need to maintain a consistent voice across many videos
  • Video production agencies writing scripts that must match a client's established brand voice
  • Content teams where multiple writers need to produce scripts in a single creator's style
  • Solo creators who want AI assistance without losing their distinctive voice

Tip: Key Techniques Used in This Workflow

  • Google Sheets as AI tools -- Providing Google Sheets as callable tools to an AI Agent is a powerful pattern for injecting structured, editable knowledge into AI workflows. The creator can update their style libraries at any time, immediately changing how the AI writes.
  • Document ingestion pipeline -- The Google Drive to Mistral OCR to Cohere to Qdrant pipeline is a reusable pattern for building RAG-ready knowledge bases from document collections.
  • Brave Search integration -- Adding real-time web search to a RAG-equipped agent gives it both deep (vector store) and fresh (web) context.
  • Redis session memory -- Maintaining context across a multi-section writing task ensures coherent long-form output where later sections build on earlier ones.
  • Dual-mode workflows -- Separating ingestion from generation within a single workflow file keeps related logic together while allowing independent execution of each mode.

Download

The workflow.json file in this folder can be imported directly into your n8n instance via Settings > Import Workflow.

Want this running in your stack?

I build production n8n and Cloudflare automation for teams — the same engineering behind HarperFlow. Fixed-price, escrow-protected, US-based.