Content RAG agent
An agent that writes content grounded in your own material.
This article was originally posted on workflows.io

Tools used: Apify, n8n, Claude, Ergo, Jungler.ai, Clay, Beehiiv, ChatGPT, LinkedIn
HOW IT WORKS
Step 1: Collect knowledge base content
Gather all internal content into one structured folder.
Pull LinkedIn posts from target creators using Apify.
Include internal sources:
SOPs, playbooks, and copywriting
Blogs, podcasts, previous posts
Sales call recordings via Ergo
Save all files to a Google Drive folder.
Step 2: Set up the vector database
Create the Pinecone database that stores your knowledge as embeddings.
Log in to Pinecone and create a new index.
Set embedding model to OpenAI text-embedding-3-small.
Step 3: Build the data ingestion pipeline
Automate the flow from Google Drive into Pinecone using n8n.
Set up two Google Drive Trigger nodes watching your folder:
One for File Created, one for File Updated.
Add a Code node to extract and clean text from binary files.
Add a Recursive Text Splitter:
Chunk size: 1000 characters, overlap: 200 characters.
Connect to a Pinecone Vector Store node set to Insert Documents.
Log every ingested file to a Google Sheets tracking sheet.
Step 4: Configure the RAG agent
Build the agent that reads your knowledge base and generates content.
Add an AI Agent node in n8n with Claude or OpenAI.
Set temperature to 0.3.
Connect Pinecone Vector Store as a tool in Retrieve Documents mode.
Add a Simple Memory node set to 5 conversation window.
Write the system message defining the agent's role and instructing it to call the vector store on every query.
Step 5: Connect social listening signals
Feed the agent real-time niche content alongside the knowledge base.
Monitor LinkedIn via Jungler AI and X.com via Tweet Hunter.
Pull signals from YouTube, View Stats, Reddit, and Clay.
Route incoming posts into the agent's context as live input.
Step 6: Connect Slack as the front end
Replace the test chat trigger with a live Slack integration.
Create a Slack app at api.slack.com/apps.
Add bot token scopes: app_mentions:read, chat:write, channels:history.
Replace the Chat Trigger in n8n with a Slack Trigger node.
Add a Slack Response node to post replies to your dedicated channel.
Step 7: Generate content drafts
Use the agent to produce written content from the knowledge base.
Route output to a Writer and a Designer.
Distribute across:
LinkedIn via Ordinal
X.com via Tweet Hunter
Newsletter via Beehiiv
Step 8: Generate video drafts
Use the agent to produce video scripts alongside written content.
Route output to a Script Writer for refinement.
Record and send to a Video Editor.
Publish to YouTube.
Step 9: Track performance
Measure what lands and feed learnings back into the knowledge base.
Track via Hyperfury, Shield, and YouTube Studio.
Add high-performing content back into Google Drive as new SOPs.
Comments
Login to leave a comment