A production-ready AI Content Marketing Assistant powered by LangGraph multi-agent orchestration and Streamlit.
ContentAlchemy is a sophisticated multi-agent system designed to help content marketers create high-quality, SEO-optimized content efficiently. It leverages specialized AI agents working in coordination to research, create, and optimize content across various formats.
- Query Handler: Intelligently routes user intent to the correct workflow
- Deep Research Agent: Conducts comprehensive web research with source attribution
- SEO Blog Writer: Generates long-form, search-engine optimized blog posts
- LinkedIn Post Writer: Creates engaging professional social media posts with hashtag strategies
- Image Generation Agent: Crafts high-quality DALL-E 3 prompts and generates visuals
- Content Strategist: Organizes research into structured, readable formats
- Multi-Turn Conversations: Iteratively refine content based on feedback
- Research-First Workflow: Automatic deep research before content generation
- Error Handling: Robust fallback mechanisms to secondary LLM providers
- Quality Scoring: Automated quality assessment for brand voice and SEO compliance
- Memory & Context: Conversation history and context preservation across interactions
- Clean Streamlit dashboard with chat interface
- Real-time content preview panels
- Quality scores and metrics visualization
- Research sources display
- Content refinement capabilities
ContentAlchemy/
├── agents/ # Specialized agent implementations
│ ├── query_handler.py
│ ├── research_agent.py
│ ├── blog_writer.py
│ ├── linkedin_writer.py
│ ├── image_agent.py
│ └── content_strategist.py
├── core/ # Orchestration and routing
│ ├── router.py
│ └── langgraph_workflow.py
├── integrations/ # API clients
│ ├── openai_client.py
│ ├── serp_client.py
│ ├── fallback_clients.py
│ └── image_client.py
├── web_app/ # Streamlit frontend
│ └── streamlit_app.py
├── requirements.txt
├── .env.example
└── README.md
- Python 3.9 or higher
- API keys for required services (see Configuration)
-
Clone the repository (or navigate to the project directory)
cd Content_Generator -
Create a virtual environment
python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate
-
Install dependencies
pip install -r requirements.txt
-
Configure environment variables
Create a
.envfile in the project root with the following format:# .env file OPENAI_API_KEY=your_openai_api_key_here SERP_API_KEY=your_serp_api_key_here ANTHROPIC_API_KEY=your_anthropic_api_key_here GOOGLE_API_KEY=your_google_api_key_hereReplace the placeholder values with your actual API keys:
OPENAI_API_KEY(Required) - Get from https://platform.openai.com/api-keysSERP_API_KEY(Optional, recommended) - Get from https://serpapi.com/ANTHROPIC_API_KEY(Optional) - Get from https://console.anthropic.com/GOOGLE_API_KEY(Optional) - Get from https://makersuite.google.com/app/apikey
Run the Streamlit app:
streamlit run web_app/streamlit_app.pyThe application will open in your browser at http://localhost:8501
-
Generate Content: Type your request in the chat interface
- Example: "Write a blog post about AI in marketing"
- Example: "Create a LinkedIn post about remote work trends"
- Example: "Generate an image of a modern office workspace"
-
Research Mode: The system automatically conducts research when needed
- Example: "Research the latest trends in content marketing and write a blog post"
-
Refine Content: Iteratively improve generated content
- Example: "Make the tone more professional"
- Example: "Add more statistics"
- Example: "Make it shorter"
User: "Write a comprehensive blog post about sustainable marketing"
↓
Query Handler: Classifies intent as "blog"
↓
Research Agent: Conducts deep research on sustainable marketing
↓
SEO Blog Writer: Generates optimized blog post with research integration
↓
Content Strategist: Quality scoring and optimization
↓
Output: Complete blog post with sources, meta description, and quality scores
- OpenAI API Key: Required for GPT-4 content generation and DALL-E 3 image generation
- Get it from: https://platform.openai.com/api-keys
-
SERP API Key: Enables web research functionality
- Get it from: https://serpapi.com/
- Without this, research functionality will be limited
-
Anthropic Claude API Key: Fallback LLM provider
- Get it from: https://console.anthropic.com/
-
Google Gemini API Key: Alternative fallback LLM provider (uses Gemini 2.0 Flash)
- Get it from: https://makersuite.google.com/app/apikey
- Multi-Agent System: LangGraph
- Language Model: OpenAI GPT-4 Turbo (Primary)
- Fallback LLMs: Anthropic Claude 3.5 Sonnet, Google Gemini 2.0 Flash
- Research Engine: SERP API + GPT
- Image Generation: DALL-E 3
- Content Optimization: Custom LLM Prompts
- Web Interface: Streamlit
- State Management: LangGraph Memory (Checkpointing)
- Language: Python 3.9+
- Intent classification → "blog"
- Research (if needed) → Web search and synthesis
- Content generation → SEO-optimized blog post
- Quality check → Brand voice and SEO compliance
- Output → Formatted blog with metadata
- Intent classification → "linkedin"
- Research (if needed) → Quick research on topic
- Post generation → Engaging post with hashtags
- Engagement scoring → Quality assessment
- Output → Formatted LinkedIn post
- Intent classification → "image"
- Prompt crafting → Optimized DALL-E 3 prompt
- Image generation → Visual creation
- Output → Image with generation details
The system includes comprehensive error handling:
- Automatic fallback to secondary LLM providers on primary failure
- Graceful degradation when optional APIs are unavailable
- Detailed error logging for debugging
- User-friendly error messages in the UI
- Be Specific: Provide clear, detailed requests for better results
- Use Research: Request research for data-driven content
- Iterate: Use refinement features to improve content iteratively
- Check Quality Scores: Review quality metrics before publishing
- Review Sources: Always verify research sources for accuracy
- API rate limits apply based on your provider plans
- Research quality depends on SERP API availability
- Image generation requires DALL-E 3 API access
- Content quality depends on prompt clarity
-
"OPENAI_API_KEY not found"
- Ensure
.envfile exists and contains your API key - Check that the key is correctly formatted (no quotes needed)
- Ensure
-
Research not working
- Verify SERP_API_KEY is set in
.env - Check your SERP API quota
- Verify SERP_API_KEY is set in
-
Fallback LLMs not working
- Fallback providers are optional
- Ensure API keys are correctly set if you want fallback support
-
Import errors
- Ensure all dependencies are installed:
pip install -r requirements.txt - Verify Python version is 3.9+
- Ensure all dependencies are installed:
This is a capstone project. For improvements or fixes:
- Review the code structure
- Test changes thoroughly
- Update documentation as needed
This project is for educational purposes.
- Built with LangGraph for multi-agent orchestration
- Powered by OpenAI GPT-4 and DALL-E 3
- Research capabilities via SERP API
- UI built with Streamlit
For issues or questions:
- Check the troubleshooting section
- Review API key configuration
- Check error logs in the console
ContentAlchemy - Transform your content creation workflow with AI 🚀