An intelligent AI agent system that handles the entire content lifecycle, from research to publication. Built with LangChain and powered by OpenAI's GPT models.
📚 View Complete Wiki Documentation | 🚀 Quick Start | 📖 API Reference
✨ Automated Research - Intelligently searches and gathers information from multiple sources
✍️ Content Generation - Creates well-structured, engaging articles with proper formatting
🖼️ Image Curation - Finds and suggests relevant images from Unsplash
📤 Multi-Platform Publishing - Publishes to file, Medium, and other platforms
🔄 End-to-End Pipeline - Orchestrates the entire workflow automatically
The system consists of five specialized agents:
- AudienceStrategist - Generates detailed reader personas to tailor content
- ResearchAgent - Conducts web research, analyzes topics, and synthesizes findings
- WriterAgent - Creates outlines, writes articles, generates metadata and tags
- ImageAgent - Searches for relevant images and curates visual content
- PublisherAgent - Handles publication to various platforms
All agents are coordinated by the ContentCreationOrchestrator which manages the workflow state and error handling.
- Python 3.8 or higher
- OpenAI API key
- Clone the repository:
git clone https://github.com/eggressive/agentic-writer.git
cd agentic-writer- Install dependencies:
pip install -r requirements.txtOr install in development mode:
pip install -e .- Configure environment variables:
cp .env.example .env
# Edit .env and add your API keysRequired configuration:
OPENAI_API_KEY- Your OpenAI API key (required)
Optional configuration:
MEDIUM_ACCESS_TOKEN- For publishing to MediumUNSPLASH_ACCESS_KEY- For image search functionalityOPENAI_MODEL- Model to use (default: gpt-4-turbo-preview)TEMPERATURE- Model temperature (default: 0.7)
Create content on a topic:
python main.py create "Artificial Intelligence in Healthcare"With options:
python main.py create "Sustainable Energy Solutions" \
--style professional \
--audience "business executives" \
--platform file \
--output-dir ./articlesCheck configuration:
python main.py configView version:
python main.py versionfrom src.orchestrator import ContentCreationOrchestrator
from src.utils import Config
# Load configuration
config = Config.from_env()
config.validate_required()
# Initialize orchestrator
orchestrator = ContentCreationOrchestrator(config)
# Create content
results = orchestrator.create_content(
topic="The Future of Quantum Computing",
style="technical",
target_audience="technology enthusiasts",
platforms=["file", "medium"],
output_dir="./output"
)
# Print summary
print(orchestrator.get_summary(results))agentic-writer/
├── src/
│ ├── agents/
│ │ ├── __init__.py
│ │ ├── audience_strategist.py # Audience analysis agent
│ │ ├── researcher.py # Research agent
│ │ ├── writer.py # Writing agent
│ │ ├── image_handler.py # Image handling agent
│ │ └── publisher.py # Publishing agent
│ ├── utils/
│ │ ├── __init__.py
│ │ ├── config.py # Configuration management
│ │ └── logger.py # Logging utilities
│ ├── __init__.py
│ ├── orchestrator.py # Main orchestration logic
│ └── cli.py # Command-line interface
├── tests/ # Test suite
├── output/ # Default output directory
├── .github/
│ ├── workflows/ci.yml # CI pipeline (lint + test)
│ └── merge-policy.yml # Machine-readable merge contract
├── main.py # Entry point
├── setup.py # Package setup
├── requirements.txt # Dependencies
├── CLAUDE.md # Agent guidance for Claude Code
├── BACKLOG.md # Prioritized improvement backlog
├── .env.example # Environment template
├── .gitignore
├── LICENSE
└── README.md
The agent creates two files per article:
- Markdown file - The complete article with metadata
- JSON metadata file - Structured data including tags, images, and statistics
Example output structure:
output/
├── artificial_intelligence_in_healthcare.md
├── artificial_intelligence_in_healthcare_metadata.json
└── ...
- Performs web searches using DuckDuckGo
- Analyzes topics and generates research questions
- Synthesizes findings from multiple sources
- Provides structured research data for writing
- Creates detailed article outlines
- Generates well-structured content (1200-1500 words)
- Produces engaging titles and meta descriptions
- Generates relevant tags automatically
- Supports multiple writing styles and audiences
- Generates contextual image search queries
- Searches Unsplash for high-quality images
- Selects diverse, relevant images
- Provides image suggestions when API is unavailable
- Saves articles as markdown files
- Exports metadata as JSON
- Ready for Medium API integration
- Extensible for additional platforms
pytest tests/ -v --cov=srcblack src/ tests/ruff check src/ tests/This repository uses markdownlint to enforce markdown standards. Configuration is defined in .markdownlint-cli2.jsonc.
npm install -g markdownlint-cli2markdownlint-cli2 "**/*.md"markdownlint-cli2 --fix "**/*.md"This project includes a .pre-commit-config.yaml with hooks for black, ruff, trailing whitespace, and YAML validation:
pip install pre-commit
pre-commit install| Environment Variable | Description | Default | Required |
|---|---|---|---|
| OPENAI_API_KEY | OpenAI API key | - | Yes |
| MEDIUM_ACCESS_TOKEN | Medium API token | - | No |
| UNSPLASH_ACCESS_KEY | Unsplash API key | - | No |
| OPENAI_MODEL | OpenAI model to use | gpt-4-turbo-preview | No |
| TEMPERATURE | Model temperature | 0.7 | No |
| LOG_LEVEL | Logging level | INFO | No |
| MAX_RESEARCH_SOURCES | Max sources to research | 5 | No |
| MAX_RETRIES | Max retry attempts | 3 | No |
The system includes:
- Automatic retry logic with exponential backoff
- Comprehensive error logging
- Graceful degradation (continues without optional features)
- Detailed error messages for debugging
- Requires OpenAI API access (paid service)
- Medium publishing requires API token
- Image search requires Unsplash API key
- Web research depends on DuckDuckGo availability
- Generated content should be reviewed before publishing
This project includes comprehensive documentation:
- 📚 Complete Wiki - Full documentation with 10+ pages
- 🚀 Getting Started Guide - 5-minute quick start
- 📦 Installation Guide - Detailed setup instructions
- 📖 Usage Guide - Complete usage documentation
- 🔧 API Reference - Python API documentation
- 🏗️ Architecture - System design and components
- 🗺️ Roadmap - Future plans and features
- ❓ FAQ - Frequently asked questions
- 🔍 Troubleshooting - Common issues and solutions
- 🤝 Contributing Guide - How to contribute
All pull requests are validated by the CI pipeline (.github/workflows/ci.yml):
- Preflight gate (fast) —
black --checkandruff checkmust pass - Test gate —
pytestwith a minimum 60% coverage threshold
See .github/merge-policy.yml for the machine-readable merge contract defining risk tiers and required checks.
Contributions are welcome! Please see our Contributing Guide for details on how to get started.
We use Conventional Commits and automated releases via release-please. This means:
- Use conventional commit format (e.g.,
feat:,fix:,docs:) - Releases are automated based on your commits
- Version bumping and changelog generation happen automatically
- Release PRs from release-please are automatically approved and merged
This project is licensed under the MIT License - see the LICENSE file for details.
- Built with LangChain
- Powered by OpenAI
- Images from Unsplash
- Search via DuckDuckGo
- Support for more LLM providers (Anthropic Claude, Google Gemini)
- WordPress integration
- Custom image generation with DALL-E
- Multi-language support
- SEO optimization suggestions
- Plagiarism checking
- Content scheduling
- Analytics integration