deepagents-printshop 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- deepagents_printshop-0.1.0/.env.example +11 -0
- deepagents_printshop-0.1.0/.gitattributes +10 -0
- deepagents_printshop-0.1.0/.github/workflows/ci.yml +18 -0
- deepagents_printshop-0.1.0/.gitignore +84 -0
- deepagents_printshop-0.1.0/CLAUDE.md +200 -0
- deepagents_printshop-0.1.0/Dockerfile +35 -0
- deepagents_printshop-0.1.0/HANDOFF.md +112 -0
- deepagents_printshop-0.1.0/LICENSE +86 -0
- deepagents_printshop-0.1.0/PKG-INFO +744 -0
- deepagents_printshop-0.1.0/README.md +707 -0
- deepagents_printshop-0.1.0/SETUP.md +237 -0
- deepagents_printshop-0.1.0/SYSTEM_DEPS.md +91 -0
- deepagents_printshop-0.1.0/agents/content_editor/__init__.py +1 -0
- deepagents_printshop-0.1.0/agents/content_editor/agent.py +279 -0
- deepagents_printshop-0.1.0/agents/content_editor/content_reviewer.py +327 -0
- deepagents_printshop-0.1.0/agents/content_editor/versioned_agent.py +455 -0
- deepagents_printshop-0.1.0/agents/latex_specialist/__init__.py +1 -0
- deepagents_printshop-0.1.0/agents/latex_specialist/agent.py +531 -0
- deepagents_printshop-0.1.0/agents/latex_specialist/latex_analyzer.py +510 -0
- deepagents_printshop-0.1.0/agents/latex_specialist/latex_optimizer.py +1192 -0
- deepagents_printshop-0.1.0/agents/qa_orchestrator/__init__.py +1 -0
- deepagents_printshop-0.1.0/agents/qa_orchestrator/agent.py +603 -0
- deepagents_printshop-0.1.0/agents/qa_orchestrator/langgraph_workflow.py +733 -0
- deepagents_printshop-0.1.0/agents/qa_orchestrator/pipeline_types.py +72 -0
- deepagents_printshop-0.1.0/agents/qa_orchestrator/quality_gates.py +495 -0
- deepagents_printshop-0.1.0/agents/qa_orchestrator/workflow_coordinator.py +139 -0
- deepagents_printshop-0.1.0/agents/research_agent/__init__.py +1 -0
- deepagents_printshop-0.1.0/agents/research_agent/agent.py +258 -0
- deepagents_printshop-0.1.0/agents/research_agent/llm_report_generator.py +1023 -0
- deepagents_printshop-0.1.0/agents/research_agent/report_generator.py +536 -0
- deepagents_printshop-0.1.0/agents/visual_qa/__init__.py +1 -0
- deepagents_printshop-0.1.0/agents/visual_qa/agent.py +410 -0
- deepagents_printshop-0.1.0/architecture.png +0 -0
- deepagents_printshop-0.1.0/artifacts/output/.gitkeep +1 -0
- deepagents_printshop-0.1.0/artifacts/reviewed_content/.gitkeep +0 -0
- deepagents_printshop-0.1.0/artifacts/sample_content/ieee_conference/conclusion.md +7 -0
- deepagents_printshop-0.1.0/artifacts/sample_content/ieee_conference/config.md +58 -0
- deepagents_printshop-0.1.0/artifacts/sample_content/ieee_conference/data/ablation_study.csv +5 -0
- deepagents_printshop-0.1.0/artifacts/sample_content/ieee_conference/data/overall_performance.csv +7 -0
- deepagents_printshop-0.1.0/artifacts/sample_content/ieee_conference/data/per_cluster_results.csv +4 -0
- deepagents_printshop-0.1.0/artifacts/sample_content/ieee_conference/experimental_setup.md +33 -0
- deepagents_printshop-0.1.0/artifacts/sample_content/ieee_conference/images/README.md +39 -0
- deepagents_printshop-0.1.0/artifacts/sample_content/ieee_conference/introduction.md +15 -0
- deepagents_printshop-0.1.0/artifacts/sample_content/ieee_conference/related_work.md +13 -0
- deepagents_printshop-0.1.0/artifacts/sample_content/ieee_conference/results.md +29 -0
- deepagents_printshop-0.1.0/artifacts/sample_content/ieee_conference/system_design.md +41 -0
- deepagents_printshop-0.1.0/artifacts/sample_content/magazine/conclusion.md +117 -0
- deepagents_printshop-0.1.0/artifacts/sample_content/magazine/config.md +60 -0
- deepagents_printshop-0.1.0/artifacts/sample_content/magazine/cover_story.md +103 -0
- deepagents_printshop-0.1.0/artifacts/sample_content/magazine/data/adoption_metrics.csv +5 -0
- deepagents_printshop-0.1.0/artifacts/sample_content/magazine/data/framework_comparison.csv +6 -0
- deepagents_printshop-0.1.0/artifacts/sample_content/magazine/data/model_performance.csv +6 -0
- deepagents_printshop-0.1.0/artifacts/sample_content/magazine/data/training_metrics.csv +6 -0
- deepagents_printshop-0.1.0/artifacts/sample_content/magazine/detailed_results.md +91 -0
- deepagents_printshop-0.1.0/artifacts/sample_content/magazine/images/README.md +76 -0
- deepagents_printshop-0.1.0/artifacts/sample_content/magazine/images/adoption_chart.png +0 -0
- deepagents_printshop-0.1.0/artifacts/sample_content/magazine/images/cost_comparison.png +0 -0
- deepagents_printshop-0.1.0/artifacts/sample_content/magazine/images/cover-image.jpg +0 -0
- deepagents_printshop-0.1.0/artifacts/sample_content/magazine/images/fake-barcode.png +0 -0
- deepagents_printshop-0.1.0/artifacts/sample_content/magazine/images/framework_comparison.png +0 -0
- deepagents_printshop-0.1.0/artifacts/sample_content/magazine/images/image2.jpg +0 -0
- deepagents_printshop-0.1.0/artifacts/sample_content/magazine/images/image3.png +0 -0
- deepagents_printshop-0.1.0/artifacts/sample_content/magazine/images/image4.jpg +0 -0
- deepagents_printshop-0.1.0/artifacts/sample_content/magazine/images/image5.png +0 -0
- deepagents_printshop-0.1.0/artifacts/sample_content/magazine/images/image6.jpg +0 -0
- deepagents_printshop-0.1.0/artifacts/sample_content/magazine/images/image7.png +0 -0
- deepagents_printshop-0.1.0/artifacts/sample_content/magazine/images/model_performance.png +0 -0
- deepagents_printshop-0.1.0/artifacts/sample_content/magazine/introduction.md +34 -0
- deepagents_printshop-0.1.0/artifacts/sample_content/magazine/methodology.md +80 -0
- deepagents_printshop-0.1.0/artifacts/sample_content/magazine/performance_table.md +57 -0
- deepagents_printshop-0.1.0/artifacts/sample_content/magazine/research_areas.md +70 -0
- deepagents_printshop-0.1.0/artifacts/sample_content/magazine/results.md +82 -0
- deepagents_printshop-0.1.0/artifacts/sample_content/research_report/conclusion.md +27 -0
- deepagents_printshop-0.1.0/artifacts/sample_content/research_report/config.md +20 -0
- deepagents_printshop-0.1.0/artifacts/sample_content/research_report/data/model_performance.csv +7 -0
- deepagents_printshop-0.1.0/artifacts/sample_content/research_report/data/research_metrics.csv +0 -0
- deepagents_printshop-0.1.0/artifacts/sample_content/research_report/images/README.md +37 -0
- deepagents_printshop-0.1.0/artifacts/sample_content/research_report/images/performance_comparison.png +0 -0
- deepagents_printshop-0.1.0/artifacts/sample_content/research_report/introduction.md +17 -0
- deepagents_printshop-0.1.0/artifacts/sample_content/research_report/methodology.md +27 -0
- deepagents_printshop-0.1.0/artifacts/sample_content/research_report/research_areas.md +19 -0
- deepagents_printshop-0.1.0/artifacts/sample_content/research_report/results.md +68 -0
- deepagents_printshop-0.1.0/artifacts/sample_content/research_report/visualizations.md +37 -0
- deepagents_printshop-0.1.0/content_types/magazine/type.md +373 -0
- deepagents_printshop-0.1.0/content_types/research_report/type.md +111 -0
- deepagents_printshop-0.1.0/docker-compose.yml +17 -0
- deepagents_printshop-0.1.0/docs/pipeline-walkthrough/PIPELINE_WALKTHROUGH.md +158 -0
- deepagents_printshop-0.1.0/docs/pipeline-walkthrough/after_intro_reflow.png +0 -0
- deepagents_printshop-0.1.0/docs/pipeline-walkthrough/after_last_page.png +0 -0
- deepagents_printshop-0.1.0/docs/pipeline-walkthrough/after_toc.png +0 -0
- deepagents_printshop-0.1.0/docs/pipeline-walkthrough/before_intro_reflow.png +0 -0
- deepagents_printshop-0.1.0/docs/pipeline-walkthrough/before_last_page.png +0 -0
- deepagents_printshop-0.1.0/docs/pipeline-walkthrough/before_toc.png +0 -0
- deepagents_printshop-0.1.0/get-docker.sh +720 -0
- deepagents_printshop-0.1.0/llms.txt +54 -0
- deepagents_printshop-0.1.0/pos-visual-qa-llm-optimized.png +0 -0
- deepagents_printshop-0.1.0/pre-visual-qa-checkpoint.png +0 -0
- deepagents_printshop-0.1.0/pyproject.toml +76 -0
- deepagents_printshop-0.1.0/recursion-flow.png +0 -0
- deepagents_printshop-0.1.0/requirements.txt +14 -0
- deepagents_printshop-0.1.0/research_report/latex_best_practices.md +32 -0
- deepagents_printshop-0.1.0/research_report/optimization_patterns.md +30 -0
- deepagents_printshop-0.1.0/research_report/table_figure_standards.md +38 -0
- deepagents_printshop-0.1.0/research_report/typography_rules.md +25 -0
- deepagents_printshop-0.1.0/run_agent.py +27 -0
- deepagents_printshop-0.1.0/run_agent.sh +11 -0
- deepagents_printshop-0.1.0/run_llm_generator.py +27 -0
- deepagents_printshop-0.1.0/tests/__init__.py +0 -0
- deepagents_printshop-0.1.0/tests/conftest.py +119 -0
- deepagents_printshop-0.1.0/tests/test_langgraph_workflow.py +497 -0
- deepagents_printshop-0.1.0/tests/test_quality_gates.py +162 -0
- deepagents_printshop-0.1.0/tools/__init__.py +1 -0
- deepagents_printshop-0.1.0/tools/change_tracker.py +419 -0
- deepagents_printshop-0.1.0/tools/content_type_loader.py +171 -0
- deepagents_printshop-0.1.0/tools/graph_generator.py +281 -0
- deepagents_printshop-0.1.0/tools/latex_generator.py +374 -0
- deepagents_printshop-0.1.0/tools/llm_latex_generator.py +678 -0
- deepagents_printshop-0.1.0/tools/magazine_layout.py +462 -0
- deepagents_printshop-0.1.0/tools/pattern_injector.py +250 -0
- deepagents_printshop-0.1.0/tools/pattern_learner.py +477 -0
- deepagents_printshop-0.1.0/tools/pdf_compiler.py +386 -0
- deepagents_printshop-0.1.0/tools/version_manager.py +346 -0
- deepagents_printshop-0.1.0/tools/visual_qa.py +799 -0
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# DeepAgents API Keys
|
|
2
|
+
# Copy this file to .env and fill in your API keys
|
|
3
|
+
|
|
4
|
+
# Required: Anthropic API key for Claude
|
|
5
|
+
ANTHROPIC_API_KEY=your_anthropic_api_key_here
|
|
6
|
+
|
|
7
|
+
# Optional: OpenAI API key (alternative to Anthropic)
|
|
8
|
+
OPENAI_API_KEY=your_openai_api_key_here
|
|
9
|
+
|
|
10
|
+
# Optional: Tavily API key for web search functionality
|
|
11
|
+
TAVILY_API_KEY=your_tavily_api_key_here
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
# Binary files
|
|
2
|
+
*.pdf binary
|
|
3
|
+
*.png binary
|
|
4
|
+
*.jpg binary
|
|
5
|
+
*.jpeg binary
|
|
6
|
+
|
|
7
|
+
# Large file tracking (enable if using Git LFS)
|
|
8
|
+
# *.pdf filter=lfs diff=lfs merge=lfs -text
|
|
9
|
+
# *.png filter=lfs diff=lfs merge=lfs -text
|
|
10
|
+
# *.jpg filter=lfs diff=lfs merge=lfs -text
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on: [push, pull_request]
|
|
4
|
+
|
|
5
|
+
jobs:
|
|
6
|
+
lint-and-test:
|
|
7
|
+
runs-on: ubuntu-latest
|
|
8
|
+
steps:
|
|
9
|
+
- uses: actions/checkout@v4
|
|
10
|
+
- uses: actions/setup-python@v5
|
|
11
|
+
with:
|
|
12
|
+
python-version: "3.11"
|
|
13
|
+
- name: Install dependencies
|
|
14
|
+
run: pip install -e ".[dev]"
|
|
15
|
+
- name: Lint
|
|
16
|
+
run: ruff check .
|
|
17
|
+
- name: Test
|
|
18
|
+
run: pytest tests/ -v
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
# Python
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[cod]
|
|
4
|
+
*$py.class
|
|
5
|
+
*.so
|
|
6
|
+
.Python
|
|
7
|
+
build/
|
|
8
|
+
develop-eggs/
|
|
9
|
+
dist/
|
|
10
|
+
downloads/
|
|
11
|
+
eggs/
|
|
12
|
+
.eggs/
|
|
13
|
+
lib/
|
|
14
|
+
lib64/
|
|
15
|
+
parts/
|
|
16
|
+
sdist/
|
|
17
|
+
var/
|
|
18
|
+
wheels/
|
|
19
|
+
*.egg-info/
|
|
20
|
+
.installed.cfg
|
|
21
|
+
*.egg
|
|
22
|
+
|
|
23
|
+
# Test and Development Files (root-level ad-hoc scripts only; tests/ dir is tracked)
|
|
24
|
+
/test_*.py
|
|
25
|
+
/demo_*.py
|
|
26
|
+
/debug_*.py
|
|
27
|
+
/*_test.py
|
|
28
|
+
MILESTONE_*.md
|
|
29
|
+
*SUMMARY.md
|
|
30
|
+
|
|
31
|
+
# Virtual Environment
|
|
32
|
+
venv/
|
|
33
|
+
ENV/
|
|
34
|
+
env/
|
|
35
|
+
|
|
36
|
+
# IDE
|
|
37
|
+
.vscode/
|
|
38
|
+
.idea/
|
|
39
|
+
*.swp
|
|
40
|
+
*.swo
|
|
41
|
+
*~
|
|
42
|
+
|
|
43
|
+
# Environment variables
|
|
44
|
+
.env
|
|
45
|
+
|
|
46
|
+
# DeepAgents
|
|
47
|
+
.deepagents/
|
|
48
|
+
|
|
49
|
+
# Claude Code
|
|
50
|
+
.claude/
|
|
51
|
+
|
|
52
|
+
# LaTeX
|
|
53
|
+
*.aux
|
|
54
|
+
*.log
|
|
55
|
+
*.out
|
|
56
|
+
*.toc
|
|
57
|
+
*.bbl
|
|
58
|
+
*.blg
|
|
59
|
+
*.fls
|
|
60
|
+
*.fdb_latexmk
|
|
61
|
+
*.synctex.gz
|
|
62
|
+
|
|
63
|
+
# Output files and directories (generated content)
|
|
64
|
+
artifacts/output/*
|
|
65
|
+
artifacts/visual_qa/*
|
|
66
|
+
artifacts/reviewed_content/*
|
|
67
|
+
artifacts/version_history/
|
|
68
|
+
artifacts/agent_reports/*
|
|
69
|
+
!artifacts/output/.gitkeep
|
|
70
|
+
!artifacts/visual_qa/.gitkeep
|
|
71
|
+
!artifacts/reviewed_content/.gitkeep
|
|
72
|
+
!artifacts/agent_reports/quality/.gitkeep
|
|
73
|
+
!artifacts/agent_reports/orchestration/.gitkeep
|
|
74
|
+
|
|
75
|
+
# Keep input content
|
|
76
|
+
!artifacts/sample_content/
|
|
77
|
+
|
|
78
|
+
# OS
|
|
79
|
+
.DS_Store
|
|
80
|
+
Thumbs.db
|
|
81
|
+
nul
|
|
82
|
+
|
|
83
|
+
# Docker
|
|
84
|
+
.dockerignore
|
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
# CLAUDE.md
|
|
2
|
+
|
|
3
|
+
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
|
|
4
|
+
|
|
5
|
+
## Project Overview
|
|
6
|
+
|
|
7
|
+
DeepAgents PrintShop is a document generation system that produces professional LaTeX documents with comprehensive formatting, citations, tables, images, and diagrams. It uses the DeepAgents CLI framework, LangGraph for pipeline orchestration, and runs in Docker with TeX Live for PDF compilation.
|
|
8
|
+
|
|
9
|
+
**Important: Do not hardcode LaTeX output into deterministic Python logic.** Rendering behavior is controlled by natural language instructions in `content_types/*/type.md` files, which the LaTeX agent reads at generation time. To change how a document looks (disclaimers, footers, spacing, section formatting), edit the type.md rendering instructions — not the Python code.
|
|
10
|
+
|
|
11
|
+
## Common Commands
|
|
12
|
+
|
|
13
|
+
### Running the Pipeline
|
|
14
|
+
```bash
|
|
15
|
+
# Full QA pipeline (content editing → LaTeX generation → Visual QA)
|
|
16
|
+
python agents/qa_orchestrator/agent.py
|
|
17
|
+
|
|
18
|
+
# Run individual agents
|
|
19
|
+
python agents/content_editor/versioned_agent.py
|
|
20
|
+
python agents/latex_specialist/agent.py
|
|
21
|
+
python agents/visual_qa/agent.py
|
|
22
|
+
|
|
23
|
+
# Run tests
|
|
24
|
+
python -m pytest tests/ -v
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
### Development Environment
|
|
28
|
+
```bash
|
|
29
|
+
# Build and run Docker container
|
|
30
|
+
docker-compose build
|
|
31
|
+
docker-compose run --rm deepagents-printshop
|
|
32
|
+
|
|
33
|
+
# Run the QA pipeline inside Docker
|
|
34
|
+
docker-compose run --rm deepagents-printshop python agents/qa_orchestrator/agent.py
|
|
35
|
+
|
|
36
|
+
# Access container shell
|
|
37
|
+
docker-compose run --rm deepagents-printshop bash
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
### LaTeX/PDF Operations
|
|
41
|
+
```bash
|
|
42
|
+
# Manual PDF compilation (requires texlive)
|
|
43
|
+
pdflatex artifacts/output/research_report.tex
|
|
44
|
+
|
|
45
|
+
# Test LaTeX generator import
|
|
46
|
+
python -c "from tools.latex_generator import LaTeXGenerator; print('LaTeX generator loaded')"
|
|
47
|
+
|
|
48
|
+
# Test PDF compiler
|
|
49
|
+
python -c "from tools.pdf_compiler import PDFCompiler; PDFCompiler().compile_pdf('artifacts/output/research_report.tex')"
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
## Prerequisites
|
|
53
|
+
|
|
54
|
+
**LaTeX Distribution Required**: PDF compilation requires a LaTeX distribution. The Docker container includes TeX Live, but if running outside Docker:
|
|
55
|
+
- **Windows**: [MiKTeX](https://miktex.org/)
|
|
56
|
+
- **macOS**: [MacTeX](https://www.tug.org/mactex/) or `brew install --cask mactex`
|
|
57
|
+
- **Linux**: TeX Live via `apt install texlive-full` or equivalent
|
|
58
|
+
|
|
59
|
+
Without a LaTeX distribution, the system can generate `.tex` files but cannot compile them to PDF.
|
|
60
|
+
|
|
61
|
+
## Architecture
|
|
62
|
+
|
|
63
|
+
### Pipeline (LangGraph StateGraph)
|
|
64
|
+
|
|
65
|
+
The QA orchestrator (`agents/qa_orchestrator/agent.py`) runs a LangGraph StateGraph with three stages, each gated by a quality threshold:
|
|
66
|
+
|
|
67
|
+
1. **Content Editor** (gate: 80) — Reviews markdown for grammar, academic tone, readability. Iterates up to 4 times.
|
|
68
|
+
2. **LaTeX Specialist** (gate: 85) — Converts edited markdown to `.tex` using config manifest and content type instructions. Applies automated optimizations.
|
|
69
|
+
3. **Visual QA** (gate: 80) — Compiles PDF, renders pages as images, uses Claude vision to find formatting issues, applies fixes. Iterates up to 3 times.
|
|
70
|
+
|
|
71
|
+
Each stage creates versioned artifacts in `artifacts/reviewed_content/` (e.g., `v0_original`, `v1_content_edited`, `v2_latex_optimized`, `v3_visual_qa`). Pipeline reports are saved to `artifacts/agent_reports/`.
|
|
72
|
+
|
|
73
|
+
### Core Components
|
|
74
|
+
|
|
75
|
+
**agents/qa_orchestrator/agent.py**: Main pipeline entry point. Orchestrates the LangGraph workflow with quality gates and iteration limits.
|
|
76
|
+
|
|
77
|
+
**agents/qa_orchestrator/langgraph_workflow.py**: LangGraph StateGraph definition with conditional edges for quality gate decisions.
|
|
78
|
+
|
|
79
|
+
**agents/content_editor/versioned_agent.py**: Content editing agent that reviews and improves markdown files using Claude. Scores content on grammar, readability (Flesch Reading Ease), and academic tone.
|
|
80
|
+
|
|
81
|
+
**agents/latex_specialist/latex_optimizer.py**: Core LaTeX generation logic. Converts markdown to LaTeX using LLM, processes inline references (`<!-- IMAGE: -->`, `<!-- CSV_TABLE: -->`, `<!-- TIKZ: -->`), sanitizes Unicode for pdflatex, and applies automated optimizations. This is where most LaTeX logic lives.
|
|
82
|
+
|
|
83
|
+
**agents/visual_qa/agent.py**: Compiles PDF, renders pages to images, inspects with Claude vision, and applies targeted LaTeX fixes.
|
|
84
|
+
|
|
85
|
+
**tools/latex_generator.py**: LaTeXGenerator class with DocumentConfig for building LaTeX document structure (preamble, sections, tables, figures).
|
|
86
|
+
|
|
87
|
+
**tools/pdf_compiler.py**: PDFCompiler class for LaTeX-to-PDF conversion with multi-pass compilation.
|
|
88
|
+
|
|
89
|
+
**tools/content_type_loader.py**: Loads content type definitions from `content_types/` directory.
|
|
90
|
+
|
|
91
|
+
### Content Types
|
|
92
|
+
|
|
93
|
+
Content type definitions live in `content_types/<type_id>/type.md`. Each file contains:
|
|
94
|
+
- **Type metadata**: document class, font size, paper size
|
|
95
|
+
- **Rendering instructions**: Natural language instructions that the LaTeX agent follows when generating the document (disclaimers, headers/footers, typography, table formatting, figure placement, citation style, etc.)
|
|
96
|
+
- **LaTeX requirements**: Required packages and preamble configuration
|
|
97
|
+
- **Structure rules**: Constraints for valid output
|
|
98
|
+
|
|
99
|
+
To change how a document renders, edit the rendering instructions in the appropriate type.md file. The LaTeX agent reads these at generation time.
|
|
100
|
+
|
|
101
|
+
### Sample Content Structure
|
|
102
|
+
|
|
103
|
+
Each sample content directory (`artifacts/sample_content/<type_id>/`) contains:
|
|
104
|
+
- **config.md**: Document metadata (title, author, abstract) and a content manifest listing sections in order
|
|
105
|
+
- **Section files**: Markdown files referenced by the manifest (e.g., `introduction.md`, `results.md`)
|
|
106
|
+
- **images/**: Images referenced by inline `<!-- IMAGE: -->` comments in markdown
|
|
107
|
+
- **data/**: CSV files referenced by inline `<!-- CSV_TABLE: -->` comments in markdown
|
|
108
|
+
|
|
109
|
+
### Inline Reference Syntax
|
|
110
|
+
|
|
111
|
+
Markdown content files use HTML comments to reference external assets. The LaTeX optimizer processes these into proper LaTeX:
|
|
112
|
+
|
|
113
|
+
```markdown
|
|
114
|
+
<!-- IMAGE: path=images/chart.png, caption=Performance Chart, label=fig:chart -->
|
|
115
|
+
|
|
116
|
+
<!-- CSV_TABLE: path=data/results.csv, caption=Model Results, label=tab:results -->
|
|
117
|
+
|
|
118
|
+
<!-- TIKZ:
|
|
119
|
+
caption: Neural Network Architecture
|
|
120
|
+
label: fig:neural_net
|
|
121
|
+
code:
|
|
122
|
+
\node[circle, draw] (input) at (0,0) {Input};
|
|
123
|
+
\node[circle, draw] (output) at (3,0) {Output};
|
|
124
|
+
\draw[->] (input) -- (output);
|
|
125
|
+
-->
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
### Data Flow
|
|
129
|
+
|
|
130
|
+
1. Orchestrator loads content from `artifacts/sample_content/<type_id>/`
|
|
131
|
+
2. Content editor iteratively improves markdown files, saving versions to `artifacts/reviewed_content/`
|
|
132
|
+
3. LaTeX specialist reads the final edited markdown + config manifest + content type instructions, generates `.tex`
|
|
133
|
+
4. LaTeX optimizer processes inline references (images, CSV tables, TikZ), sanitizes Unicode, applies formatting fixes
|
|
134
|
+
5. Visual QA compiles PDF, inspects rendered pages, applies fixes, recompiles
|
|
135
|
+
6. Final output saved to `artifacts/output/<run_id>/`
|
|
136
|
+
|
|
137
|
+
### Memory System
|
|
138
|
+
|
|
139
|
+
DeepAgents persistent memory stored in `.deepagents/`:
|
|
140
|
+
|
|
141
|
+
**Research Agent** (`.deepagents/research_agent/memories/`):
|
|
142
|
+
- `latex_knowledge.md`: LaTeX best practices and patterns
|
|
143
|
+
- `report_structure.md`: Research report structure templates
|
|
144
|
+
- `artifacts_tracking.md`: Artifact and content management
|
|
145
|
+
|
|
146
|
+
**Content Editor Agent** (`.deepagents/content_editor/memories/`):
|
|
147
|
+
- `grammar_rules.md`: Grammar and style correction rules
|
|
148
|
+
- `readability_patterns.md`: Readability improvement patterns
|
|
149
|
+
- `quality_metrics.md`: Content quality scoring criteria
|
|
150
|
+
|
|
151
|
+
### Configuration
|
|
152
|
+
|
|
153
|
+
**DocumentConfig** (tools/latex_generator.py): Controls document class, formatting, headers/footers, bibliography, and layout options.
|
|
154
|
+
|
|
155
|
+
**Environment**: Uses `.env` file for ANTHROPIC_API_KEY, Docker volumes for persistence.
|
|
156
|
+
|
|
157
|
+
## Development Patterns
|
|
158
|
+
|
|
159
|
+
### Adding New Content Types
|
|
160
|
+
1. Create `content_types/<type_id>/type.md` with metadata, rendering instructions, and LaTeX requirements
|
|
161
|
+
2. Create `artifacts/sample_content/<type_id>/` with `config.md` and section markdown files
|
|
162
|
+
3. Add images to `artifacts/sample_content/<type_id>/images/` and CSV data to `data/`
|
|
163
|
+
4. Reference assets from markdown using inline `<!-- IMAGE: -->`, `<!-- CSV_TABLE: -->`, or `<!-- TIKZ: -->` comments
|
|
164
|
+
|
|
165
|
+
### Changing Document Appearance
|
|
166
|
+
- Edit `content_types/<type_id>/type.md` rendering instructions (preferred — changes are picked up by the LLM at generation time)
|
|
167
|
+
- For structural changes to inline reference processing: edit `agents/latex_specialist/latex_optimizer.py`
|
|
168
|
+
- For changes to the LaTeX document builder: edit `tools/latex_generator.py`
|
|
169
|
+
- Add new LaTeX packages to Dockerfile if needed
|
|
170
|
+
|
|
171
|
+
### Quality Tuning
|
|
172
|
+
- Quality gate thresholds: `agents/qa_orchestrator/quality_gates.py`
|
|
173
|
+
- Content scoring (Flesch readability, grammar): `agents/content_editor/content_reviewer.py`
|
|
174
|
+
- LaTeX scoring (structure, typography, tables/figures, best practices): `agents/latex_specialist/latex_optimizer.py`
|
|
175
|
+
- Iteration limits: `agents/qa_orchestrator/langgraph_workflow.py`
|
|
176
|
+
|
|
177
|
+
### Pipeline Status Reporting
|
|
178
|
+
- **Completed / Human Handoff Ready**: All quality gates passed. Report as "completed successfully."
|
|
179
|
+
- **Escalated**: Pipeline hit iteration limits or quality gates were not met. Report as "completed with issues" and note what failed (e.g., visual QA score plateaued below threshold). Do NOT call this a successful run.
|
|
180
|
+
- **Failed**: A stage crashed or errored out. Report as "failed" with the error.
|
|
181
|
+
|
|
182
|
+
### Known Gotchas
|
|
183
|
+
- **Flesch readability vs. academic tone**: The content editor may lower scores on first pass by making prose more academic. Dense sentences score poorly on Flesch Reading Ease. If content consistently fails the gate, simplify sentence structure in the source markdown rather than lowering thresholds.
|
|
184
|
+
- **Unicode in LaTeX**: pdflatex cannot handle Unicode math symbols (superscripts, subscripts like `⁻`, `²`). The `_sanitize_unicode_for_latex()` method in latex_optimizer.py handles known cases, but new Unicode characters from LLM output may need to be added to the replacement map.
|
|
185
|
+
- **Duplicate figure labels**: If images appear both via inline `<!-- IMAGE: -->` comments and via a separate image-walking step, you get duplicate `\label{}` errors. All images should be referenced inline from markdown — there is no separate image directory scan.
|
|
186
|
+
|
|
187
|
+
## Dependencies
|
|
188
|
+
|
|
189
|
+
Python packages (requirements.txt):
|
|
190
|
+
- deepagents-cli: Core agent framework
|
|
191
|
+
- anthropic, openai: LLM APIs
|
|
192
|
+
- langchain, langchain-anthropic, langchain-openai: LLM orchestration
|
|
193
|
+
- langgraph: Pipeline state graph orchestration
|
|
194
|
+
- pandas: Data processing
|
|
195
|
+
- pillow, matplotlib: Image handling
|
|
196
|
+
|
|
197
|
+
System dependencies (Dockerfile):
|
|
198
|
+
- texlive-latex-base, texlive-latex-extra: LaTeX distribution
|
|
199
|
+
- texlive-fonts-recommended, texlive-science: LaTeX packages
|
|
200
|
+
- ghostscript, imagemagick: Image processing
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
FROM python:3.11-slim
|
|
2
|
+
|
|
3
|
+
# Install all system dependencies and LaTeX in one step to reduce update calls
|
|
4
|
+
RUN apt-get update && apt-get install -y \
|
|
5
|
+
wget \
|
|
6
|
+
curl \
|
|
7
|
+
git \
|
|
8
|
+
texlive-latex-base \
|
|
9
|
+
texlive-fonts-recommended \
|
|
10
|
+
texlive-latex-extra \
|
|
11
|
+
texlive-science \
|
|
12
|
+
ghostscript \
|
|
13
|
+
imagemagick \
|
|
14
|
+
poppler-utils \
|
|
15
|
+
&& rm -rf /var/lib/apt/lists/*
|
|
16
|
+
|
|
17
|
+
# Set working directory
|
|
18
|
+
WORKDIR /app
|
|
19
|
+
|
|
20
|
+
# Copy requirements first for better caching
|
|
21
|
+
COPY requirements.txt .
|
|
22
|
+
RUN pip install --no-cache-dir -r requirements.txt
|
|
23
|
+
|
|
24
|
+
# Copy project files
|
|
25
|
+
COPY . .
|
|
26
|
+
|
|
27
|
+
# Create artifact directories
|
|
28
|
+
RUN mkdir -p artifacts/sample_content artifacts/images artifacts/data artifacts/output
|
|
29
|
+
|
|
30
|
+
# Set environment variables
|
|
31
|
+
ENV PYTHONUNBUFFERED=1
|
|
32
|
+
ENV DEEPAGENTS_HOME=/app/.deepagents
|
|
33
|
+
|
|
34
|
+
# Default command
|
|
35
|
+
CMD ["bash"]
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
# Handoff: LangGraph Migration, Packaging & Promotion
|
|
2
|
+
|
|
3
|
+
**Branch**: `feature/langgraph-migration` (off `main`)
|
|
4
|
+
**Last updated**: 2026-01-30
|
|
5
|
+
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
## Plan Overview
|
|
9
|
+
|
|
10
|
+
Migrate the QA orchestrator from a manual state machine to a LangGraph StateGraph, add inter-agent communication, package for PyPI, and prepare for open-source promotion.
|
|
11
|
+
|
|
12
|
+
Four phases:
|
|
13
|
+
1. **LangGraph StateGraph Migration** — replace the `while` loop in `workflow_coordinator.py` with a declarative graph
|
|
14
|
+
2. **Inter-Agent Communication** — `agent_context` dict flows upstream notes between nodes
|
|
15
|
+
3. **Python Package** — `pyproject.toml`, tests, CI
|
|
16
|
+
4. **Promotion Prep** — `llms.txt`, README updates, badges
|
|
17
|
+
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
## Current Progress
|
|
21
|
+
|
|
22
|
+
### DONE
|
|
23
|
+
|
|
24
|
+
| # | Item | Status |
|
|
25
|
+
|---|------|--------|
|
|
26
|
+
| 1 | `requirements.txt` — add `langgraph` | Done |
|
|
27
|
+
| 2 | `agents/qa_orchestrator/langgraph_workflow.py` — StateGraph, nodes, conditional edges, inter-agent context | Done |
|
|
28
|
+
| 3 | `agents/qa_orchestrator/agent.py` — `orchestrate_qa_pipeline()` now uses `compile_qa_pipeline()` + `app.invoke()` | Done |
|
|
29
|
+
| 4 | `tests/__init__.py`, `conftest.py`, `test_langgraph_workflow.py`, `test_quality_gates.py` — 37 tests, all passing | Done |
|
|
30
|
+
| 5 | `pyproject.toml` — hatchling build, `printshop` entry point, `[dev]` extras | Done |
|
|
31
|
+
| 6 | `.github/workflows/ci.yml` — ruff + pytest on push/PR | Done |
|
|
32
|
+
| 7 | `SYSTEM_DEPS.md` — system dependency install docs | Done |
|
|
33
|
+
| 8 | `llms.txt` — AI-discoverable project summary | Done |
|
|
34
|
+
| 9 | `README.md` — badges, gallery, Mermaid diagram, PyPI install, GitHub topics | Done |
|
|
35
|
+
|
|
36
|
+
### NOT YET COMMITTED
|
|
37
|
+
|
|
38
|
+
All changes are staged but not committed. Run:
|
|
39
|
+
```bash
|
|
40
|
+
git add ... && git commit
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
### NOT YET DONE
|
|
44
|
+
|
|
45
|
+
| Item | Notes |
|
|
46
|
+
|------|-------|
|
|
47
|
+
| Push to remote | Branch exists locally only |
|
|
48
|
+
| Create PR | After push |
|
|
49
|
+
| `pip install -e .` verification | Works locally but not formally tested in CI yet |
|
|
50
|
+
| Docker build verification | Needs `docker-compose build` — not run yet |
|
|
51
|
+
| Full pipeline E2E test | Requires API key + Docker/TeX Live |
|
|
52
|
+
| PyPI publish | Not in scope yet — `pyproject.toml` is ready |
|
|
53
|
+
|
|
54
|
+
---
|
|
55
|
+
|
|
56
|
+
## Key Architecture Decisions
|
|
57
|
+
|
|
58
|
+
### LangGraph integration is additive, not destructive
|
|
59
|
+
- `workflow_coordinator.py` and `quality_gates.py` are **untouched**
|
|
60
|
+
- Node functions in `langgraph_workflow.py` are thin wrappers that call existing `WorkflowCoordinator` methods
|
|
61
|
+
- `state_to_workflow_execution()` converts the final LangGraph state back to `WorkflowExecution` so all existing reporting works
|
|
62
|
+
|
|
63
|
+
### Inter-agent communication (Phase 2)
|
|
64
|
+
- `agent_context` field in `PipelineState` uses a custom `merge_dicts` reducer
|
|
65
|
+
- Content editor writes `content_editor_notes` (quality_score, issues, has_complex_tables)
|
|
66
|
+
- LaTeX specialist reads those notes and writes `latex_specialist_notes` (structure_score, typography_issues, packages_used)
|
|
67
|
+
- Visual QA reads both upstream note sets for prioritization
|
|
68
|
+
|
|
69
|
+
### Graph structure
|
|
70
|
+
```
|
|
71
|
+
START → content_review
|
|
72
|
+
content_review → [latex_optimization | iteration | escalation]
|
|
73
|
+
latex_optimization → [visual_qa | iteration | escalation]
|
|
74
|
+
visual_qa → quality_assessment
|
|
75
|
+
quality_assessment → [completion | iteration | escalation]
|
|
76
|
+
iteration → content_review (back-edge)
|
|
77
|
+
completion → END
|
|
78
|
+
escalation → END
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
Recursion limit: 30. Checkpointer: `MemorySaver` (in-memory, per invocation).
|
|
82
|
+
|
|
83
|
+
---
|
|
84
|
+
|
|
85
|
+
## Files Changed/Created
|
|
86
|
+
|
|
87
|
+
| File | Action |
|
|
88
|
+
|------|--------|
|
|
89
|
+
| `requirements.txt` | Modified — added `langgraph` |
|
|
90
|
+
| `agents/qa_orchestrator/langgraph_workflow.py` | **New** — ~300 lines |
|
|
91
|
+
| `agents/qa_orchestrator/agent.py` | Modified — new `orchestrate_qa_pipeline()` using LangGraph |
|
|
92
|
+
| `tests/__init__.py` | **New** — empty |
|
|
93
|
+
| `tests/conftest.py` | **New** — fixtures |
|
|
94
|
+
| `tests/test_langgraph_workflow.py` | **New** — 17 tests |
|
|
95
|
+
| `tests/test_quality_gates.py` | **New** — 20 tests |
|
|
96
|
+
| `pyproject.toml` | **New** — package config |
|
|
97
|
+
| `.github/workflows/ci.yml` | **New** — CI |
|
|
98
|
+
| `SYSTEM_DEPS.md` | **New** — system deps docs |
|
|
99
|
+
| `llms.txt` | **New** — AI discoverability |
|
|
100
|
+
| `README.md` | Modified — badges, gallery, install, architecture |
|
|
101
|
+
|
|
102
|
+
---
|
|
103
|
+
|
|
104
|
+
## Verification Checklist
|
|
105
|
+
|
|
106
|
+
- [x] `pytest tests/ -v` — 37/37 passing
|
|
107
|
+
- [x] `ruff check` on new files — clean
|
|
108
|
+
- [x] `python -c "from agents.qa_orchestrator.langgraph_workflow import export_mermaid_diagram; print(export_mermaid_diagram())"` — valid Mermaid output
|
|
109
|
+
- [ ] `pip install -e .` — editable install
|
|
110
|
+
- [ ] `docker-compose build` — Docker still works
|
|
111
|
+
- [ ] `printshop --content research_report` — CLI entry point
|
|
112
|
+
- [ ] Full pipeline E2E with API key
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
# DeepAgents PrintShop License
|
|
2
|
+
|
|
3
|
+
## Software License (Apache 2.0)
|
|
4
|
+
|
|
5
|
+
Copyright 2025-2026 DeepAgents PrintShop Contributors
|
|
6
|
+
|
|
7
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
8
|
+
you may not use this file except in compliance with the License.
|
|
9
|
+
You may obtain a copy of the License at
|
|
10
|
+
|
|
11
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
12
|
+
|
|
13
|
+
Unless required by applicable law or agreed to in writing, software
|
|
14
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
15
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
16
|
+
See the License for the specific language governing permissions and
|
|
17
|
+
limitations under the License.
|
|
18
|
+
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
## Attribution Requirement for Generated Works
|
|
22
|
+
|
|
23
|
+
Any documents, publications, or media generated using DeepAgents PrintShop
|
|
24
|
+
must include the following attribution in a reasonably visible location
|
|
25
|
+
(such as in the document's footer, credits page, colophon, or acknowledgments):
|
|
26
|
+
|
|
27
|
+
"Generated with DeepAgents PrintShop (https://github.com/kormco/deepagents-printshop)"
|
|
28
|
+
|
|
29
|
+
or the shorter form:
|
|
30
|
+
|
|
31
|
+
"Powered by DeepAgents PrintShop"
|
|
32
|
+
|
|
33
|
+
This attribution requirement applies to:
|
|
34
|
+
- PDF documents generated by the system
|
|
35
|
+
- LaTeX source files distributed to others
|
|
36
|
+
- Published works derived from PrintShop output
|
|
37
|
+
- Any derivative media products
|
|
38
|
+
|
|
39
|
+
This requirement does NOT apply to:
|
|
40
|
+
- Internal drafts and working documents not distributed publicly
|
|
41
|
+
- Documents where you substantially rewrite the generated content
|
|
42
|
+
- Uses where attribution is technically impractical
|
|
43
|
+
|
|
44
|
+
---
|
|
45
|
+
|
|
46
|
+
## Sample Content License (CC BY-SA 4.0)
|
|
47
|
+
|
|
48
|
+
The sample content in `artifacts/sample_content/` is licensed under the
|
|
49
|
+
Creative Commons Attribution-ShareAlike 4.0 International License.
|
|
50
|
+
|
|
51
|
+
You are free to:
|
|
52
|
+
- **Share** — copy and redistribute the material in any medium or format
|
|
53
|
+
- **Adapt** — remix, transform, and build upon the material for any purpose
|
|
54
|
+
|
|
55
|
+
Under the following terms:
|
|
56
|
+
- **Attribution** — You must give appropriate credit, provide a link to the
|
|
57
|
+
license, and indicate if changes were made.
|
|
58
|
+
- **ShareAlike** — If you remix, transform, or build upon the material, you
|
|
59
|
+
must distribute your contributions under the same license.
|
|
60
|
+
|
|
61
|
+
Full license text: https://creativecommons.org/licenses/by-sa/4.0/legalcode
|
|
62
|
+
|
|
63
|
+
---
|
|
64
|
+
|
|
65
|
+
## Third-Party Content
|
|
66
|
+
|
|
67
|
+
Images in `artifacts/sample_content/images/` are sourced from Pixabay and are
|
|
68
|
+
used under the Pixabay License (https://pixabay.com/service/license-summary/).
|
|
69
|
+
These images are free for commercial use with no attribution required, but
|
|
70
|
+
attribution is appreciated.
|
|
71
|
+
|
|
72
|
+
---
|
|
73
|
+
|
|
74
|
+
## Disclaimer
|
|
75
|
+
|
|
76
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
77
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
78
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
79
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
80
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
81
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
82
|
+
SOFTWARE.
|
|
83
|
+
|
|
84
|
+
This software uses third-party AI services (Claude API). Users are responsible
|
|
85
|
+
for compliance with those services' terms of use. Content processed through
|
|
86
|
+
these services is subject to their respective privacy policies.
|