Multi-agent content pipeline with human-in-the-loop validation. Planner → Researcher → Writer → Editor → Human Checkpoint → Publisher.
Built with LangGraph · LangChain · Streamlit · LinkedIn API · DuckDuckGo / Tavily
- Multi-Agent Orchestration: Planner → Researcher → Writer → Editor → Publisher
- Intelligent Revision Loop: Automatic rewriting when content scores below quality threshold
- Human Checkpoint: Pause execution for review, approval, or custom edits before publishing
- Dataset Export (JSONL): Automatically save approved content with full context (metadata, research, scores, feedback) for LLM training and RAG pipelines
- Multi-Provider LLM Support: DeepSeek (default), OpenAI, Anthropic, Google Gemini (free tier)
- Web Research Integration: DuckDuckGo (free) and Tavily (premium) search providers
- Platform-Aware Content: Optimize for LinkedIn, Twitter, YouTube with platform-specific formatting
- Run Resumption: SQLite-backed checkpointing — resume interrupted runs without losing progress
- Dual Interface: CLI for scripting, Streamlit UI for interactive review
- Orchestration: LangGraph (state machine-based agentic workflows)
- LLM Integration: LangChain with multi-provider support
- Persistence: SQLite with LangGraph checkpointer
- UI: Streamlit (human-in-the-loop interface)
- Monitoring: Loguru (structured logging)
- Planner Agent — topic → specific content brief (angle, audience, key points)
- Research Agent — web search, trends, data synthesis
- Writer Agent — draft adapted to platform and format
- Editor + Fact-Checker — quality score (0–1), feedback, triggers rewrite if below threshold
- Human Checkpoint — review, edit, approve, or reject with feedback
- Publisher Agent — posts to LinkedIn (or dry-runs in dev mode)
- Dataset Export — approved content saved to JSONL (training_data.jsonl) with full audit trail
# 1. Install
pip install -r requirements.txt
# 2. Configure
cp .env.example .env
# Edit .env with your LLM provider key
# 3. Run (CLI)
python -m src.main --topic "Why RAG systems fail in production" --platform linkedin
# Or run (UI)
streamlit run ui/app.py
python -m src.main \
--topic "LangGraph patterns for AI agents" \
--platform linkedin \
--language en \
--context "Target senior engineers. Focus on production patterns, not toy examples."
python -m src.main --thread-id <thread-id-from-previous-run>
streamlit run ui/app.py
# Opens at http://localhost:8501
# Tab 1: Start new content pipeline
# Tab 2: Review, edit, approve, or request revision
# Tab 3: View run history
ContentAgentOS/
├── src/
│ ├── core/
│ │ ├── config.py # Settings & environment variables
│ │ └── state.py # ContentState TypedDict + factory
│ ├── agents/
│ │ ├── llm.py # LLM factory (4 providers)
│ │ ├── planner.py # Topic → brief
│ │ ├── researcher.py # Web search + synthesis
│ │ ├── writer.py # Brief + research → draft
│ │ ├── editor.py # Draft → quality score + feedback
│ │ └── publisher.py # Draft → LinkedIn (+ dataset export)
│ ├── graph/
│ │ └── builder.py # LangGraph orchestration
│ ├── tools/
│ │ ├── search.py # Web search (DuckDuckGo / Tavily)
│ │ └── dataset_exporter.py # JSONL export for LLM training
│ └── main.py # CLI entrypoint
├── ui/
│ └── app.py # Streamlit UI
├── docs/
│ ├── ARCHITECTURE.md # System design & patterns
│ ├── SETUP.md # Installation & configuration
│ └── DATASET_EXPORT.md # Dataset format & usage guide
├── datasets/ # Generated training data (JSONL)
├── requirements.txt
├── .env.example
└── README.md
pytest tests/
tail -f /tmp/contentagentos.log
After human approval, content is automatically exported to datasets/training_data.jsonl with full context:
- Topic, angle, target audience, key points
- Research notes and sources
- Draft versions and editor scores
- Human feedback and final edits
- Publishing status
Perfect for:
- LLM Fine-tuning: Train custom models on your approved content
- RAG Pipelines: Use approved content as reference material
- Quality Analysis: Track trends and scoring patterns
- Compliance Audits: Maintain audit trail of approvals
See DATASET_EXPORT.md for usage examples.
See SETUP.md for detailed configuration options.
LLM_PROVIDER: Which LLM to use (deepseek | openai | anthropic | gemini)
QUALITY_THRESHOLD: Auto-rewrite threshold (0.0–1.0, default 0.7)
MAX_RETRIES: Max automatic rewrite attempts (default 2)
DRY_RUN: Log instead of publish to LinkedIn (default true)
| Variable | Default | Description |
|---|---|---|
| LLM_PROVIDER | deepseek | deepseek | openai | anthropic | gemini |
| SEARCH_PROVIDER | duckduckgo | duckduckgo (free) | tavily (premium) |
| QUALITY_THRESHOLD | 0.7 | Editor score gate (0.0–1.0) |
| MAX_RETRIES | 2 | Max automatic rewrite attempts |
| DRY_RUN | true | Log instead of publish to LinkedIn |
- ARCHITECTURE.md — System design, module responsibilities, data flow, patterns
- SETUP.md — Installation, configuration, troubleshooting, running the pipeline
- DATASET_EXPORT.md — Dataset format (JSONL), schema, usage examples, fine-tuning guide
- Batch content generation from CSV
- More platform integrations (Medium, Substack, Dev.to)
- Prompt optimization via LangSmith
- Evaluation framework (benchmark against competitors)
- Async agent execution for parallel processing
- Database persistence (runs analytics, trending topics)
