Skip to main content

Multi-agent LaTeX document generation with LangGraph QA pipeline

Project description

DeepAgents PrintShop - Intelligent LaTeX Document Generator

License Python Built with LangGraph Built with DeepAgents CLI

An advanced multi-agent system that generates professional LaTeX documents with comprehensive quality assurance, LLM-based document optimization, and automated visual quality analysis. Orchestrated by a LangGraph StateGraph with quality gates, iterative refinement, and inter-agent communication.

Example Output

The system generates five types of professional documents:

Research Report

A professional academic-style research report with tables, figures, TikZ diagrams, and citations.

Features:

  • Cover page disclaimer stating content is fictitious sample data
  • Auto-generated table of contents matching the config manifest
  • Data tables rendered from CSV files
  • Performance comparison charts
  • TikZ vector diagrams (neural network architecture)
  • "Typeset by DeepAgents PrintShop" attribution

View sample PDF (~217KB, 10 pages) | View pipeline walkthrough

Magazine

A full-color magazine layout with multi-column text, pull quotes, and professional typography.

Features:

  • Full-page cover with background image
  • Creative table of contents with large section numbers
  • Two-column article layouts with drop caps
  • Pull quotes and infographic statistics
  • Dark sections with inverted colors
  • Back cover with barcode and issue/price info
  • "Generated by DeepAgents PrintShop" attribution

View sample PDF (~7MB, 25 pages) | View pipeline walkthrough

IEEE Conference Paper

A 6-page two-column conference paper in standard IEEE format with tables, TikZ diagrams, pgfplots charts, and numbered references.

Features:

  • IEEEtran document class with standard IEEE two-column layout
  • Multi-author block with affiliations and emails
  • Abstract and IEEE keywords
  • TikZ pipeline architecture diagram
  • pgfplots line and bar charts
  • booktabs data tables with experimental results
  • 20 numbered references in IEEE citation style
  • NSF funding acknowledgment

View sample PDF (~180KB, 6 pages) | View pipeline walkthrough

Resume

A 2-page senior-engineer resume with a multi-theme design system — same macro contract, swappable visual skin via the theme: field in config.md.

Features:

  • Four themes: banker (deep navy + light navy), letterpress (navy + brass on cream), architect (slate sidebar + sage rules), editorial (serif + oxblood on cream)
  • Stable macro contract across all themes (\resumeheader, \resumesection, \jobentry, \subjobentry, \jobcontext, \skillgroup, \speakentry)
  • ATS-friendly single-column body, 2-column skills block via multicols
  • Demo banner + AI-disclosure footer: "Drafted with AI assistance via DeepAgents PrintShop."
  • Sample tailored for a fictional Chief Typographic Officer role at TypeWithAI.com (typography parody — not a real biography)

View sample PDF (~50KB, 2 pages) | View 4-theme palette preview

Resume Cover Letter

A 1-page cover letter visually matched to the resume so the two ship as a coordinated application packet.

Features:

  • Mirrors the resume's four themes; selecting the same theme on both produces a matched pair
  • Header treatment matches the resume (slate sidebar in architect, navy band in banker, etc.)
  • Date / recipient block / Re: subject / 3–5 body paragraphs / signature
  • Same demo banner + AI-disclosure footer as the resume

View sample PDF (~35KB, 1 page)

Note: All generated documents include a disclaimer stating they contain fictitious sample content created for demonstration purposes.

LangGraph Pipeline Architecture

The QA pipeline is orchestrated as a LangGraph StateGraph with conditional edges for quality gate decisions:

graph TD
    START --> content_review
    content_review -->|score >= 80| enrich_for_latex
    content_review -->|score < 80| iteration
    content_review -->|max iterations| escalation
    enrich_for_latex --> latex_optimization
    latex_optimization -->|score >= 85| enrich_for_visual_qa
    latex_optimization -->|score < 85| iteration
    latex_optimization -->|max iterations| escalation
    enrich_for_visual_qa --> visual_qa
    visual_qa --> quality_assessment
    quality_assessment -->|score >= 80| completion
    quality_assessment -->|score < 80| iteration
    quality_assessment -->|max iterations| escalation
    iteration --> enrich_for_iteration
    enrich_for_iteration --> content_review
    completion --> END
    escalation --> END

    style enrich_for_latex fill:#e8f4f8,stroke:#5ba4cf
    style enrich_for_visual_qa fill:#e8f4f8,stroke:#5ba4cf
    style enrich_for_iteration fill:#e8f4f8,stroke:#5ba4cf

Context enrichment nodes (blue) sit between processing stages. Each uses a lightweight LLM call (Haiku) to synthesize upstream results, pattern memory, and content type constraints into targeted instructions for the downstream agent. Inter-agent communication flows through a shared agent_context dict.

Recommended: Run with Claude Code

This project is designed to work seamlessly with Claude Code (Anthropic's agentic coding tool). Claude Code can:

  • Run the full QA pipeline and monitor progress
  • Automatically debug LaTeX compilation errors
  • Iterate on document quality issues
  • Make real-time adjustments to generated content
  • Handle the multi-step workflow naturally

Simply open this project in Claude Code and ask it to "run the magazine pipeline" or "generate a research report" - it will handle the rest.

Practical Example 1: Generating a Document from an Existing Content Type

If a content type already exists (e.g., ieee_conference, research_report, magazine), you just need sample content and the pipeline handles the rest.

Example prompt:

"I have a draft paper about distributed caching in ~/papers/caching_draft/. It has an intro, methods, results, and some CSV benchmark data. Create a PrintShop content source for it using the IEEE conference format and generate a PDF."

Claude Code will:

  1. Read your source files and understand the content structure
  2. Create artifacts/sample_content/caching_paper/ with a config.md pointing to ieee_conference as the content type
  3. Organize your draft into markdown sections matching the IEEE structure (Introduction, Related Work, etc.)
  4. Import benchmark data as CSV files with <!-- CSV_TABLE: --> references
  5. Run the full QA pipeline — content editing, LaTeX generation guided by the IEEE type.md instructions, and visual QA to catch formatting issues in the rendered PDF

Practical Example 2: Creating a New Content Type from Reference Material

If you need a document format that doesn't exist yet, you can create a new content type from templates, PDFs, or style guides.

Example prompt:

"I need to produce documents in our company's internal report format. Here's the Word template (~/templates/acme_report.docx), a sample PDF (~/templates/sample_report.pdf), and the style guide (~/templates/acme_style_guide.pdf). Create a new PrintShop content type from these references."

Claude Code will:

  1. Analyze the template, sample PDF, and style guide to extract formatting rules (margins, fonts, heading styles, header/footer layout, logo placement)
  2. Create content_types/acme_report/type.md with rendering instructions derived from the reference material — document class, required packages, typography rules, float placement, citation style
  3. Add a "Packages to AVOID" section for any packages that conflict with the chosen document class
  4. Include structure rules and common mistakes specific to the format
  5. Test the new content type by generating a sample document and running it through the pipeline

What goes into a type.md:

  • Type metadata (document class, font size, paper size)
  • Detailed rendering instructions in natural language — the LaTeX agent reads these fresh every run
  • Required LaTeX packages and preamble configuration
  • Structure rules and constraints
  • Common formatting mistakes to avoid

Once the content type exists, any future document using that format requires zero additional setup — just point config.md at the content type and run the pipeline.

Important Notice

Disclaimer: This software is provided "as-is" without warranty of any kind. The author is not liable for any damages or issues arising from the use of this software.

Security Warning: This project uses third-party packages and AI services (Claude API). Before using this software, especially in scenarios involving confidential data or private information:

  • Review all third-party dependencies in requirements.txt
  • Understand that content is sent to external LLM APIs (Anthropic Claude)
  • Conduct your own security assessment for your use case
  • Never process sensitive, proprietary, or confidential information without proper security measures
  • Consider running in an isolated environment for sensitive workflows

By using this software, you acknowledge these risks and agree to conduct appropriate due diligence.

Features

Core Capabilities

  • LLM-Based LaTeX Generation: Intelligent document creation with Claude Sonnet
  • Content-Driven References: Inline <!-- IMAGE: -->, <!-- CSV_TABLE: -->, and <!-- TIKZ: --> comments in markdown are converted to LaTeX figures, tables, and diagrams
  • Content Type System: Document types (content_types/) define rendering instructions, structure rules, and LaTeX requirements in natural language
  • Self-Correcting Compilation: Automatic error detection and fix generation
  • Unicode Sanitization: Automatic replacement of Unicode math characters with LaTeX equivalents for pdflatex compatibility
  • Multi-Agent QA Pipeline: Automated quality assurance with specialized agents
  • Visual Quality Analysis: AI-powered PDF layout and typography analysis
  • Iterative Refinement: Progressive quality improvement over multiple passes
  • Version Tracking: Complete change history with diff generation
  • Pattern Learning System: Learns from version history to improve future documents

Document Features

  • Professional LaTeX reports with customizable structure
  • Automatic table of contents driven by config.md manifest
  • Data tables from CSV files via inline references
  • Image placement via inline references
  • TikZ vector diagrams via inline references
  • PDF compilation with pdflatex
  • Hyperlink and cross-reference support
  • Cover page disclaimers and production citations from content type definitions

Agent Nodes & Tools

Node Agent Tools Used LLM Calls
ContentReview ContentEditorAgent ContentReviewer, VersionManager, ChangeTracker Claude Sonnet (grammar/readability analysis)
EnrichForLatex PatternInjector, ContentTypeLoader Claude Haiku (context synthesis)
LaTeXOptimization LaTeXSpecialistAgent LaTeXAnalyzer, LaTeXOptimizer, LLMLaTeXGenerator, PDFCompiler Claude Sonnet (LaTeX generation, syntax fixing, self-correction)
EnrichForVisualQA PatternInjector, ContentTypeLoader Claude Haiku (context synthesis)
VisualQA VisualQAFeedbackAgent PDFToImageConverter, VisualValidator, MultimodalLLMAnalyzer, LLMLaTeXGenerator, PDFCompiler Claude Haiku Vision (page analysis), Claude Sonnet (fix generation)
EnrichForIteration PatternInjector Claude Haiku (iteration strategy)

Quality Gates (Conditional Edges)

┌─────────────────────────────────────────────────────────────────────────┐
│                        QUALITY GATE LOGIC                               │
├─────────────────────────────────────────────────────────────────────────┤
│                                                                         │
│  Content Gate:     score ≥ 80  → PASS    │  score < 80  → ITERATE      │
│  LaTeX Gate:       score ≥ 85  → PASS    │  score < 85  → ITERATE      │
│  Overall Gate:     score ≥ 90  → PASS (human handoff)                  │
│                    score ≥ 80  → PASS (acceptable)                     │
│                    score < 80  → ITERATE (if iterations < 3)           │
│                    iterations ≥ 3 → ESCALATE (human intervention)      │
│                                                                         │
│  Convergence:      improvement < 2 points → plateau detected           │
│                                                                         │
└─────────────────────────────────────────────────────────────────────────┘

Content-Driven Document Assembly

Documents are assembled from a config.md manifest that defines section ordering, and markdown files that contain inline references to data and media:

config.md Manifest

## Content Manifest
1. Abstract
2. Introduction: introduction.md
3. Research Areas: research_areas.md
4. Methodology: methodology.md
5. Results: results.md
6. Visualizations: visualizations.md
7. Conclusion: conclusion.md

Each manifest entry becomes a \section{} in the ToC. Markdown ## headers become \subsection{}, ### become \subsubsection{}.

Inline References

CSV tables — rendered with booktabs:

<!-- CSV_TABLE: model_performance.csv
caption: Complete Model Performance Data
label: tab:complete_perf
columns: all
rows: all
format: professional
-->

Images — rendered as figures:

<!-- IMAGE: images/performance_comparison.png
caption: Performance Comparison Across Model Architectures
label: fig:performance_comparison
-->

TikZ diagrams — rendered as vector graphics:

<!-- TIKZ:
caption: Neural Network Architecture
label: fig:neural_net
code:
\node[circle, draw, minimum size=1cm] (input) at (0,0) {Input};
\node[circle, draw, minimum size=1cm] (hidden1) at (3,1) {H1};
\draw[->] (input) -- (hidden1);
-->

Content Types

Content types in content_types/<type>/type.md define document class, rendering instructions, and LaTeX requirements in natural language. The LLM reads these instructions to generate disclaimers, citations, headers/footers, and other structural elements.

Available types: research_report, magazine, ieee_conference

Pattern Learning System

The system learns from document generation history to continuously improve quality. Patterns are organized by document type (research_report, article, technical_doc, etc.), allowing type-specific optimizations. Instead of hard-coded rules, learned patterns are injected into LLM prompts for intelligent application.

How It Works

1. Generate Documents → 2. Track Quality Metrics → 3. Mine Patterns
                                                         ↓
6. Apply in Next Run ← 5. Inject into Prompts ← 4. Store Learnings

Pattern Learner (tools/pattern_learner.py):

  • Analyzes version history and quality reports
  • Extracts common LaTeX fixes (e.g., "Fixed multiple consecutive spaces")
  • Tracks quality score trends (average: 89/100, target: 94/100)
  • Identifies recurring recommendations (e.g., "Use booktabs package")
  • Generates .deepagents/learned_patterns.json and human-readable reports

Pattern Injector (tools/pattern_injector.py):

  • Loads learned patterns before document generation
  • Provides agent-specific context (LaTeX Specialist, Visual QA, etc.)
  • Injects patterns into Claude's generation prompts
  • LLM reasons about patterns rather than blindly applying rules

LLM Integration (agents/research_agent/llm_report_generator.py):

  • Uses LLMLaTeXGenerator instead of rule-based templates
  • Receives pattern context in generation prompts
  • Claude applies learnings intelligently based on document context
  • Self-correcting with historical knowledge

Running Pattern Learning

# Mine patterns from version history (for research_report document type)
docker-compose run --rm deepagents-printshop python tools/pattern_learner.py

# View learned patterns (organized by document type)
cat .deepagents/memories/research_report/learned_patterns.json
cat .deepagents/memories/research_report/pattern_learning_report.md

# Generate document with pattern learning (automatic - uses research_report patterns)
docker-compose run --rm deepagents-printshop python agents/research_agent/llm_report_generator.py

Installation

PyPI (Python package only)

pip install deepagents-printshop

This installs the Python package and CLI entry point (printshop). You still need system dependencies (TeX Live, Poppler) for PDF compilation — see SYSTEM_DEPS.md.

Sample content: the wheel ships the content_types/ definitions and a text-only copy of artifacts/sample_content/ (markdown + CSV). On first run, printshop --content <type> scaffolds the sample into your CWD if it isn't already there, and downloads any missing images from this GitHub repo. Pass --skip-image-download to skip the network fetch (figures will reference missing files), or set PRINTSHOP_IMAGES_REF=<branch-or-tag> to pin to a specific repo ref.

From Source

git clone https://github.com/kormco/deepagents-printshop
cd deepagents-printshop
pip install -e ".[dev]"

Quick Start

Option 1: Docker (Recommended)

Prerequisites:

  • Docker Desktop (installed and running)
  • Anthropic API key (for Claude)

Setup:

  1. Copy the environment file and add your API keys:

    cp .env.example .env
    

    Edit .env and add your ANTHROPIC_API_KEY

  2. Build and run the Docker container:

    docker-compose build
    docker-compose run --rm deepagents-printshop
    
  3. Run the automated QA pipeline:

    # Generate research report (default)
    python agents/qa_orchestrator/agent.py
    
    # Generate magazine
    python agents/qa_orchestrator/agent.py --content magazine
    

Option 2: Local Setup (Without Docker)

Prerequisites:

  • Python 3.11 or higher
  • LaTeX distribution (required for PDF compilation):
    • Ubuntu/Debian: sudo apt-get install texlive-latex-base texlive-latex-extra texlive-fonts-recommended
    • macOS: brew install --cask mactex or brew install texlive
    • Windows: Download and install MiKTeX (recommended) or TeX Live
      • MiKTeX auto-installs missing packages on first use
      • After install, verify with: pdflatex --version
  • Poppler (for PDF to image conversion in Visual QA)
    • Ubuntu/Debian: sudo apt-get install poppler-utils
    • macOS: brew install poppler
    • Windows: Download from Poppler for Windows and add to PATH
  • Anthropic API key (for Claude)

Windows Users: MiKTeX is required to compile LaTeX to PDF. Without it, the pipeline will generate .tex files but cannot produce PDFs. The Visual QA stage also requires Poppler for PDF-to-image conversion.

Setup:

  1. Clone the repository:

    git clone <your-repo-url>
    cd deepagents-printshop
    
  2. Create and activate a Python virtual environment:

    # Create virtual environment
    python -m venv venv
    
    # Activate virtual environment
    # On Windows:
    venv\Scripts\activate
    # On macOS/Linux:
    source venv/bin/activate
    
  3. Install Python dependencies:

    pip install -r requirements.txt
    
  4. Set up environment variables:

    # Copy the example file
    cp .env.example .env
    
    # Edit .env and add your API key:
    # ANTHROPIC_API_KEY=sk-ant-xxxxxxxxxxxxx
    
  5. Run the automated QA pipeline:

    # Generate research report (default)
    python agents/qa_orchestrator/agent.py
    
    # Generate magazine
    python agents/qa_orchestrator/agent.py --content magazine
    

Running Individual Agents Locally:

# Content quality review
python agents/content_editor/agent.py

# LaTeX generation (Author Agent)
python agents/research_agent/agent.py

# LaTeX optimization
python agents/latex_specialist/agent.py

# Visual quality analysis
python agents/visual_qa/agent.py

Verify LaTeX Installation:

# Test LaTeX compiler
pdflatex --version

# Test PDF to image conversion
pdftoppm -h

Project Structure

deepagents-printshop/
├── agents/
│   ├── content_editor/           # Grammar, readability, style improvement
│   │   ├── agent.py              # Main agent entry point
│   │   ├── content_reviewer.py   # Claude-powered content analysis
│   │   └── versioned_agent.py    # Version-aware agent wrapper
│   ├── latex_specialist/         # LaTeX formatting and typography
│   │   ├── agent.py
│   │   ├── latex_analyzer.py     # LaTeX structure analysis
│   │   └── latex_optimizer.py    # Typography optimization, TikZ/CSV/image processing
│   ├── qa_orchestrator/          # Multi-agent workflow coordination
│   │   ├── agent.py              # Main orchestrator entry point
│   │   ├── context_enrichment.py # LLM context enrichment between stages
│   │   ├── langgraph_workflow.py # LangGraph StateGraph pipeline
│   │   ├── quality_gates.py      # Pass/iterate/escalate logic
│   │   └── workflow_coordinator.py
│   ├── research_agent/           # Author Agent: LaTeX document generation
│   │   ├── agent.py
│   │   ├── llm_report_generator.py   # LLM-based generation
│   │   └── report_generator.py       # Template-based generator (legacy)
│   └── visual_qa/                # Visual PDF quality analysis
│       └── agent.py
├── content_types/                # Document type definitions
│   ├── research_report/type.md   # Academic report rendering instructions
│   ├── magazine/type.md          # Magazine layout rendering instructions
│   └── ieee_conference/type.md   # IEEE conference paper instructions
├── tools/
│   ├── llm_latex_generator.py    # LLM LaTeX generation with self-correction
│   ├── content_type_loader.py    # Loads content type definitions
│   ├── pattern_learner.py        # Mines version history for patterns
│   ├── pattern_injector.py       # Injects patterns into agent prompts
│   ├── latex_generator.py        # LaTeX document builder (preamble, sections, figures)
│   ├── pdf_compiler.py           # PDF compilation with error handling
│   ├── visual_qa.py              # Visual analysis with Claude Vision
│   ├── version_manager.py        # File versioning system
│   └── change_tracker.py         # Content change tracking and diffs
├── artifacts/
│   ├── sample_content/           # Source content (organized by document type)
│   │   ├── research_report/      # Academic research report content
│   │   │   ├── config.md         # Document configuration & manifest
│   │   │   ├── *.md              # Markdown content files with inline references
│   │   │   ├── data/             # CSV data tables
│   │   │   └── images/           # Charts and figures
│   │   └── magazine/             # Magazine content
│   │       ├── config.md         # Magazine configuration & manifest
│   │       ├── *.md              # Article content files
│   │       └── images/           # Cover, photos, barcode
│   ├── reviewed_content/         # Versioned outputs (created at runtime)
│   └── output/                   # Final LaTeX and PDF files
├── tests/                        # Pytest suite for pipeline and quality gates
├── .deepagents/                  # Agent memory (created at runtime)
├── Dockerfile
├── docker-compose.yml
├── requirements.txt
└── SETUP.md                      # Detailed setup instructions

Workflow Details

Automated Pipeline (Recommended)

Run the QA orchestrator for a fully automated multi-agent workflow:

python agents/qa_orchestrator/agent.py

Pipeline Stages:

  1. Content Review (Content Editor Agent + Claude LLM)

    • Grammar and spelling correction with AI analysis
    • Readability improvement using Claude
    • Style consistency enforcement
    • Pattern learning integration
    • Quality scoring (0-100)
  2. LaTeX Optimization (LaTeX Specialist Agent + Claude LLM)

    • Markdown to LaTeX conversion via LLM (subsections from markdown headings)
    • Config manifest titles become \section{} entries in the ToC
    • Inline CSV_TABLE, IMAGE, and TIKZ references converted to LaTeX
    • Cover page disclaimer and production citation from content type instructions
    • Unicode sanitization for pdflatex compatibility
    • Typography and structure optimization
    • Quality scoring (0-100)
  3. Visual QA (Visual QA Agent + Claude Vision)

    • PDF to image conversion
    • Page-by-page visual analysis
    • Layout quality assessment
    • Typography validation
    • LLM Self-Correction Loop:
      • Issues detected → LLM generates fixes
      • Compilation attempted
      • If errors → LLM analyzes and re-generates
      • Repeat until successful or max attempts

Between each stage, a Context Enrichment node (Claude Haiku) synthesizes upstream results, pattern memory, and content type constraints into targeted instructions for the next agent.

  1. Quality Gates
    • Validates each stage meets thresholds
    • Decides: pass, iterate, or escalate
    • Tracks quality progression
    • Generates comprehensive reports

Quality Thresholds

Content Quality:
  Minimum: 80/100
  Good: 85/100
  Excellent: 90/100

LaTeX Quality:
  Minimum: 85/100
  Good: 90/100
  Excellent: 95/100

Overall Pipeline:
  Target: 80/100
  Human Handoff: 90/100

LLM-Based Tools

LLM LaTeX Generator with Pattern Learning

The system uses Claude Sonnet for intelligent LaTeX generation with historical learning:

Features:

  • Reasons about document structure and formatting
  • Applies learned patterns from historical documents
  • Receives context about common issues and best practices
  • Handles edge cases dynamically
  • Self-corrects compilation errors
  • Learns from feedback loops
  • Avoids problematic package combinations

Self-Correction Loop with Pattern Learning:

0. Load learned patterns → Inject into LLM context
   ↓
1. Generate LaTeX (with pattern awareness) → 2. Compile
                                               ↓
                                            Error?
                                               ↓
3. LLM analyzes error (with historical context) ← Yes
   ↓
4. Generate corrected version
   ↓
5. Retry compilation (max 3 attempts)
   ↓
6. Track fixes → Update learned patterns for next run

Visual QA with Claude Vision

Uses multimodal LLM analysis for PDF quality:

Analyzed Aspects:

  • Title page layout and typography
  • Table of contents structure
  • Content page formatting
  • Header/footer consistency
  • Figure and table quality
  • Critical: LaTeX syntax detection (flags unrendered LaTeX commands)

Visual QA Modes

The autonomous visual QA stage is the most expensive and most Claude-dependent part of the pipeline. The VISUAL_QA_MODE env var lets you opt out and either ship straight after LaTeX generation or drive the visual review yourself in Claude Code:

Mode Pipeline behavior Visual QA
auto (default) Runs all three stages Claude vision, automated, gated
disabled Stops after LaTeX gen, emits PDF + report Skipped — review manually or out-of-band
interactive Stops after LaTeX gen, writes a handoff manifest Skipped — invoke /printshop-review in Claude Code to walk page-by-page through the rendered PDF
# Run without autonomous visual QA
VISUAL_QA_MODE=disabled python agents/qa_orchestrator/agent.py

# Run, then drive the review yourself in Claude Code
VISUAL_QA_MODE=interactive python agents/qa_orchestrator/agent.py
# ... then in Claude Code: /printshop-review

In interactive mode the pipeline writes artifacts/output/<run_id>/handoff.json (run id, .tex/PDF paths, page count, concerns from the LaTeX stage). The .claude/skills/printshop-review/ skill picks that up and runs an interactive review loop — render pages, propose targeted fixes, accept/reject, recompile, continue.

Recompilation after a skill-applied fix goes through python -m tools.recompile <run_id>, which wraps PDFCompiler to keep multi-pass behavior and regex-fix support consistent with the autonomous pipeline.

Version Control System

All content versions are tracked with complete change history:

Version Progression:

v0_original (baseline markdown content)
  ↓
v1_content_edited (improved content)
  ↓
v2_latex_optimized (LaTeX + initial PDF)
  ↓
v3_visual_qa (visual analysis + iterative PDF improvements)

Change Tracking:

  • JSON diff between versions
  • Markdown summary of changes
  • File-level change tracking
  • Quality score progression
  • Agent metadata and timestamps

Output Files

After running the pipeline:

artifacts/
├── output/<run_id>/              # Final generated documents
│   ├── research_report.pdf       # Research report PDF
│   └── research_report.tex       # Research report LaTeX source
├── reviewed_content/              # Versioned outputs (created at runtime)
│   ├── v1_content_edited/
│   │   └── *.md                  # After content review
│   └── v2_latex_optimized/
│       └── *.tex, *.pdf          # After LaTeX optimization
├── agent_reports/
│   ├── quality/
│   │   └── content_review_report.md
│   └── orchestration/
│       └── <run_id>_pipeline_summary.md
└── version_history/
    ├── changes/
    │   └── v0_to_v1_summary.md
    └── version_manifest.json

Development

Adding Custom Content

  1. Create a new content folder: artifacts/sample_content/my_document/
  2. Add a config.md with document settings, content manifest, and abstract
  3. Place markdown files in the folder with inline <!-- IMAGE: -->, <!-- CSV_TABLE: -->, and <!-- TIKZ: --> references
  4. Add CSV tables to artifacts/sample_content/my_document/data/
  5. Add images to artifacts/sample_content/my_document/images/
  6. Optionally create a content type in content_types/my_type/type.md with rendering instructions
  7. Run the pipeline with: python agents/qa_orchestrator/agent.py --content my_document

See artifacts/sample_content/research_report/config.md for config.md format.

Extending Agents

Each agent follows the DeepAgents framework pattern:

  • Persistent memory in .deepagents/[agent_name]/memories/
  • Configurable quality thresholds
  • Versioned outputs
  • Comprehensive reporting

Customizing Quality Gates

Edit agents/qa_orchestrator/quality_gates.py:

QualityThresholds(
    content_minimum=80,
    latex_minimum=85,
    overall_target=80,
    max_iterations=3
)

Troubleshooting

Common Issues

Docker Build Fails:

  • Ensure Docker Desktop is running
  • Check for symlink issues on Windows (delete current symlinks)

API Errors:

  • Verify ANTHROPIC_API_KEY is set in .env
  • Check API rate limits

PDF Compilation Fails:

  • Check LaTeX logs in artifacts/output/
  • LLM self-correction will attempt fixes automatically
  • Review error messages in console output

Visual QA Errors:

  • Ensure poppler-utils is installed in Docker
  • Check PDF exists at expected path
  • Verify Claude API has vision enabled

Architecture Highlights

Multi-Agent Coordination

  • QA Orchestrator manages workflow state machine
  • Quality Gates enforce standards and decision logic
  • Version Manager tracks all content changes
  • Change Tracker generates detailed diffs

LLM Integration

  • Claude Sonnet for LaTeX generation and correction
  • Claude Haiku for content analysis
  • Claude Vision for PDF visual quality assessment
  • Temperature tuning for consistent vs. creative outputs

Quality Assurance

  • Automated testing at each pipeline stage
  • Progressive quality improvement over iterations
  • Human-in-the-loop escalation when needed
  • Comprehensive reporting and analytics

License

This project uses a dual license structure. See LICENSE for full details.

Software: Apache License 2.0 — free to use, modify, and distribute with attribution.

Generated Content Attribution: Documents generated using DeepAgents PrintShop must include attribution such as:

"Generated with DeepAgents PrintShop" or "Powered by DeepAgents PrintShop"

Sample Content: The example magazine content in artifacts/sample_content/ is licensed under CC BY-SA 4.0.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND. See LICENSE for full disclaimer.

GitHub Topics

Recommended repository topics: latex, document-generation, multi-agent, langgraph, pdf, ai-agent, quality-assurance, deep-agents

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

deepagents_printshop-0.3.0.tar.gz (238.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

deepagents_printshop-0.3.0-py3-none-any.whl (239.0 kB view details)

Uploaded Python 3

File details

Details for the file deepagents_printshop-0.3.0.tar.gz.

File metadata

  • Download URL: deepagents_printshop-0.3.0.tar.gz
  • Upload date:
  • Size: 238.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.15

File hashes

Hashes for deepagents_printshop-0.3.0.tar.gz
Algorithm Hash digest
SHA256 9f958aace9b4ea390065afaffaf95dd0b081d8edfc6c6c0d9f84ee687d221dfb
MD5 526f525cf17e4b6d3af37fd03086d66b
BLAKE2b-256 74724f90c30de7ce5cd00cc7f38af3304e85803585e577da4e7538a90e4f46d7

See more details on using hashes here.

File details

Details for the file deepagents_printshop-0.3.0-py3-none-any.whl.

File metadata

File hashes

Hashes for deepagents_printshop-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c1795d406fac56b17b044de312e3c0acc31114b876571f65d1e2d1fa5fa9908e
MD5 bc8a0fdf582e34c0bb2711f7ba52f454
BLAKE2b-256 76919f0f8d836c51e143438052c3b2a7809d075a6fc56bb080c4cc889840a4db

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page