XunLong is an intelligent content generation system powered by Large Language Models, capable of automatically generating high-quality Research Reports, Novels, and Presentations (PPT) through natural language commands.
The system employs a multi-agent collaborative architecture, orchestrating agent workflows via LangGraph to achieve end-to-end automation from requirement analysis, information retrieval, content generation, to format export.
Clone the Repository ```bash git clone https://github.com/yourusername/XunLong.git cd XunLong ```
Create Virtual Environment ```bash python -m venv venv source venv/bin/activate # Windows: venv\Scripts\activate ```
Install Dependencies ```bash pip install -r requirements.txt ```
Install System Dependencies (For PDF Export)
macOS: ```bash brew install pango gdk-pixbuf libffi ```
Ubuntu/Debian: ```bash sudo apt-get install libpango-1.0-0 libpangoft2-1.0-0 gdk-pixbuf2.0 ```
Install Browser (For Web Search) ```bash playwright install chromium ```
Configure Environment Variables
Copy `.env.example` to `.env` and fill in your API keys: ```bash cp .env.example .env ```
Edit `.env` file: ```env
OPENAI_API_KEY=your_openai_api_key OPENAI_BASE_URL=https://api.openai.com/v1 OPENAI_MODEL=gpt-4o
ANTHROPIC_API_KEY=your_anthropic_api_key ANTHROPIC_MODEL=claude-3-5-sonnet-20241022
DEEPSEEK_API_KEY=your_deepseek_api_key DEEPSEEK_BASE_URL=https://api.deepseek.com/v1 DEEPSEEK_MODEL=deepseek-chat
PERPLEXITY_API_KEY=your_perplexity_api_key
LANGFUSE_PUBLIC_KEY=your_langfuse_public_key LANGFUSE_SECRET_KEY=your_langfuse_secret_key LANGFUSE_HOST=https://cloud.langfuse.com ```
XunLong provides a clean command-line interface:
```bash python xunlong.py [command] [arguments] [options] ```
```bash
python xunlong.py report "2025 AI Industry Trends Analysis"
python xunlong.py report "Blockchain Technology Research" \ --style academic \ --depth comprehensive \ --verbose ```
Style Options:
Depth Options:
```bash
python xunlong.py fiction "A sci-fi story about time travel"
python xunlong.py fiction "Urban mystery thriller" \ --style mystery \ --chapters 10 \ --verbose ```
Style Options:
```bash
python xunlong.py ppt "2025 AI Product Launch" --slides 15
python xunlong.py ppt "Annual Company Review" \ --style business \ --slides 20 \ --speech-notes "Presentation for all employees" \ --verbose ```
Style Options:
Speaker Notes: Use `--speech-notes` to generate speaker notes for each slide
Modify previously generated content:
```bash
python xunlong.py iterate <project_id> "Add more case studies in Chapter 2"
python xunlong.py iterate <project_id> "Change chart on slide 5 to pie chart"
python xunlong.py iterate <project_id> "Rewrite Chapter 3 with more suspense" ```
Project ID: The folder name in `storage/` directory, e.g., `20251004_220823`
```bash
python xunlong.py export <project_id> pdf
python xunlong.py export <project_id> docx
python xunlong.py export <project_id> pptx
python xunlong.py export <project_id> pdf --output /path/to/output.pdf ```
``` XunLong/ ├── src/ │ ├── agents/ # Agent modules │ │ ├── coordinator.py # Main coordinator │ │ ├── iteration_agent.py # Iteration agent │ │ ├── report/ # Report generation agents │ │ ├── fiction/ # Fiction generation agents │ │ ├── ppt/ # PPT generation agents │ │ └── html/ # HTML conversion agents │ ├── llm/ # LLM management │ │ ├── manager.py # LLM manager │ │ ├── client.py # LLM client │ │ └── prompts.py # Prompt management │ ├── search/ # Search module │ │ ├── web_search.py # Web search │ │ └── content_extractor.py # Content extraction │ ├── export/ # Export module │ │ ├── pdf_exporter.py # PDF export │ │ ├── docx_exporter.py # DOCX export │ │ └── pptx_exporter.py # PPTX export │ └── storage/ # Storage management │ └── manager.py ├── config/ # Configuration files ├── templates/ # HTML templates ├── storage/ # Project storage directory ├── xunlong.py # CLI entry point ├── requirements.txt # Dependencies └── README.md # English documentation ```
XunLong uses LangGraph-based state machine workflow:
Each project creates an independent folder in `storage/`:
``` storage/20251004_220823_ProjectName/ ├── metadata.json # Project metadata ├── intermediate/ # Intermediate results │ ├── 01_task_decomposition.json │ ├── 02_search_results.json │ └── 03_content_outline.json ├── reports/ # Final outputs │ ├── FINAL_REPORT.md │ ├── FINAL_REPORT.html │ └── PPT_DATA.json # PPT projects only ├── versions/ # Iteration versions │ └── 20251005_101435/ └── exports/ # Exported files ├── report.pdf └── report.docx ```
Configure multiple LLM providers in `config/llm_config.yaml`:
```yaml providers: default: provider: "openai" model: "gpt-4o" temperature: 0.7
creative: provider: "anthropic" model: "claude-3-5-sonnet-20241022" temperature: 0.9
search: provider: "perplexity" model: "sonar" ```
Configure search behavior in `config/search_config.yaml`:
```yaml search: max_results: 10 timeout: 30 engines: - perplexity # Primary: Perplexity - playwright # Fallback: Browser search ```
HTML templates in `templates/` directory support customization:
We welcome all forms of contributions!
Please report issues via GitHub Issues with:
A: Currently supports OpenAI (GPT-4/GPT-3.5), Anthropic (Claude series), DeepSeek, etc. Through LangChain integration, theoretically supports all OpenAI API-compatible models.
A: Depends on report depth and search scope. Standard reports take 5-10 minutes, in-depth reports may take 15-20 minutes.
A: No. The system requires LLM API calls and web searches, so internet connection is necessary.
A: Generated content follows MIT license, but note: 1) Comply with LLM provider's terms of service 2) Take responsibility for content accuracy and legality.
A: Suggestions: 1) Use more powerful models (e.g., GPT-4) 2) Provide more detailed requirements 3) Use iteration feature for refinement 4) Configure Perplexity API for better search results.
This project is licensed under the MIT License.
Thanks to these open-source projects:
If this project helps you, please give us a ⭐️
Made with ❤️ by XunLong Team