Skip to content

AI workflow automation with n8n + RAG + LLM agents. Production-ready patterns for content generation, code review, and knowledge management.

License

Notifications You must be signed in to change notification settings

aekoky/AI-content-engine-RAG-n8n

Repository files navigation

AI Workflow System: Production-Ready Automation Architecture

Treat AI workflows like real systems, not demos

License: MIT GitHub stars Last Commit

A production-grade framework for building reliable AI automation systems using modular architecture patterns. This repository demonstrates how to architect sophisticated AI workflows with clear separation between orchestration, retrieval, reasoning, and side effects.

🎯 Philosophy

AI workflows should be treated as distributed systems with:

  • Clear separation of concerns: Orchestration, retrieval, reasoning, and side effects
  • Production-ready patterns: Error handling, state management, observability
  • Modular design: Swap components without breaking the system
  • Real-world reliability: Not just demosβ€”actual production deployments

πŸ—οΈ Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚   Orchestration │───▢│     Retrieval   │───▢│    Reasoning    │───▢│   Side Effects  β”‚
β”‚   (n8n/Temporal)β”‚    β”‚   (RAG/Embeds)  β”‚    β”‚  (LLM + Tools)  β”‚    β”‚ (APIs/Databases)β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Component Breakdown

Component Responsibility Examples
Orchestration Workflow coordination, state management n8n, Temporal, Prefect
Retrieval Knowledge gathering, context building RAG, vector stores, embeddings
Reasoning Decision making, content generation LLM agents, tool calling
Side Effects External interactions API calls, database writes, notifications

πŸš€ Quick Start

Option 1: Docker (Recommended)

# Clone the repository
git clone https://github.com/yourusername/AI-Workflow-System.git
cd AI-Workflow-System

# Copy environment template
cp docker/.env.example docker/.env

# Edit .env with your API keys
nano docker/.env

# Launch the stack
cd docker
docker-compose up -d

# Access n8n at http://localhost:5678

Option 2: Manual Setup

# Install n8n globally
npm install -g n8n

# Start n8n
n8n start

# Import workflows from examples/
# Navigate to http://localhost:5678
# Settings β†’ Import from File β†’ Select AI content engine RAG + n8n.json

πŸ“š Use Cases

Use Case Description Example Workflow
LinkedIn Content Automation Ingests GitHub repos, builds RAG knowledge base, generates technical posts examples/linkedin-automation/
Code Review Automation Analyzes PRs, extracts insights, posts review comments examples/code-review-automation/
Knowledge Base Sync Maintains internal documentation from multiple sources examples/internal-tooling/knowledge-base-automation/

πŸ’‘ Example Output

Here's a LinkedIn post generated by the LinkedIn automation workflow:

"Just reviewed a clean architecture implementation that uses mediator pattern for domain events. The abstraction ensures business logic remains pure while infrastructure concerns are handled separately. Key takeaway: strategic separation of concerns isn't just theoreticalβ€”it directly reduces bug density in complex systems.

Explore the implementation: https://github.com/username/CleanArchitecture

#SoftwareArchitecture #CleanCode #DomainDrivenDesign #SoftwareEngineering #SystemDesign #BestPractices"

πŸ› οΈ Technology Stack

Layer Technologies
Orchestration n8n (primary), Temporal (alternative)
Vector Stores In-memory (demo), Qdrant, Pinecone (production)
Embeddings OpenAI, Google Gemini, Local models
LLMs Google Gemini (primary), Groq (fast), OpenAI, Claude
APIs GitHub, LinkedIn, Slack, Discord
Storage n8n Data Tables, PostgreSQL, Redis

πŸ“– Documentation

Comprehensive documentation is available in the docs/ directory:

🧩 Templates

Reusable components to accelerate your workflow development:

n8n Node Templates

Agent Prompts

πŸ”§ Scripts

Utility scripts for setup and testing:

# One-click environment setup
bash scripts/setup-environment.sh

# Export/import workflows programmatically
python scripts/export-workflow.py --workflow-id YOUR_ID

# Test embedding quality
python scripts/test-embeddings.py --sample-file examples/sample.txt

πŸ§ͺ Testing

Integration tests ensure workflow reliability:

# Run integration tests
python -m pytest tests/integration/

# Test with sample repositories
python tests/integration/test-workflow-execution.py

🌟 Key Features

  • βœ… Production-Grade Error Handling: Retry logic, fallbacks, error monitoring
  • βœ… State Management: Track workflow execution, prevent duplicates
  • βœ… Cost Optimization: Intelligent caching, model selection strategies
  • βœ… Modular Architecture: Swap LLMs, vector stores, APIs without workflow changes
  • βœ… Observability: Comprehensive logging and monitoring hooks
  • βœ… Security: API key management, data sanitization patterns

🀝 Contributing

We welcome contributions! Please see our Contributing Guide for details.

πŸ—ΊοΈ Roadmap

See our roadmap for planned features and enhancements.

πŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

πŸ™ Acknowledgments

Built with:


Ready to build production AI workflows? Start with the LinkedIn automation example and adapt it to your needs.

About

AI workflow automation with n8n + RAG + LLM agents. Production-ready patterns for content generation, code review, and knowledge management.

Topics

Resources

License

Contributing

Stars

Watchers

Forks