$npx -y skills add landing-ai/ade-document-processing-skills --skill document-extractionParses, extracts, and classifies documents using LandingAI's Agentic Document Extraction (ADE). Supports PDFs, images, spreadsheets, and presentations; outputs structured Markdown with hierarchical JSON. Covers schema-based field extraction (JSON Schema or Pydantic), document cla
| 1 | # Document Extraction (ADE) |
| 2 | |
| 3 | ## Overview |
| 4 | |
| 5 | LandingAI's Agentic Document Extraction (ADE) is a document processing SaaS that parses, extracts, and classifies documents without requiring templates or training. The `landingai-ade` Python library is the recommended approach for most use cases. It wraps the REST API and handles authentication and response parsing for you. |
| 6 | |
| 7 | ADE provides these core API functions: |
| 8 | |
| 9 | | API | Python Method | What It Does | |
| 10 | |-----|--------------|--------------| |
| 11 | | **Parse** | `client.parse()` | Converts documents into structured Markdown, chunks, and metadata. Always the first step. | |
| 12 | | **Extract** | `client.extract()` | Pulls specific fields from Markdown using a JSON schema. | |
| 13 | | **Build Extract Schema** | `client.extract_build_schema()` | Generates or refines a JSON extraction schema from Markdown using AI. | |
| 14 | | **Split** | `client.split()` | Classifies and separates multi-document batches by document type. | |
| 15 | | **Classify** | `client.classify()` | Classifies each page in a document by type. Use to route pages before parsing. (Preview) | |
| 16 | | **Section** | `client.section()` | Generates a hierarchical table of contents from parsed Markdown. (Preview) | |
| 17 | | **Parse Jobs (Create)** | `client.parse_jobs.create()` | Creates an async parse job for large files (up to 6,000 pages). | |
| 18 | | **Parse Jobs (Get)** | `client.parse_jobs.get()` | Retrieves the status and results of an async parse job. | |
| 19 | | **Parse Jobs (List)** | `client.parse_jobs.list()` | Lists all async parse jobs with optional status filtering. | |
| 20 | | **Extract Jobs (Create)** | REST API (no SDK method) | Creates an async extract job for long documents or large, complex schemas. | |
| 21 | | **Extract Jobs (Get)** | REST API (no SDK method) | Retrieves the status and results of an async extract job. | |
| 22 | | **Extract Jobs (List)** | REST API (no SDK method) | Lists all async extract jobs with optional status filtering. | |
| 23 | |
| 24 | **Key Benefits:** |
| 25 | - No ML training or templates required |
| 26 | - Layout-agnostic parsing (works with any document structure) |
| 27 | - Supports 20+ file formats (PDF, images, spreadsheets, presentations) |
| 28 | - Precise visual grounding (bounding boxes, page numbers) |
| 29 | - Multiple models optimized for different document types |
| 30 | |
| 31 | ## Quick Start |
| 32 | |
| 33 | ### 1. Installation |
| 34 | |
| 35 | Never install packages globally without user approval. Always check for a local Python environment first. |
| 36 | |
| 37 | ``` |
| 38 | 1. .venv/bin/python : uv-managed (this project) |
| 39 | 2. venv/bin/python : standard Python venv |
| 40 | 3. uv run python : if pyproject.toml exists |
| 41 | 4. poetry run python : if poetry.lock exists |
| 42 | 5. python3 : system fallback; warn the user |
| 43 | ``` |
| 44 | Use the local environment to install: `landingai-ade`, `python-dotenv` |
| 45 | |
| 46 | ### 2. API Key Setup |
| 47 | |
| 48 | The user may have already setup a `.env` file in the same directory as the `document-extraction` skill with the API key. You MUST check this path first (ls -la .*/skills/document-extraction/.env). Also try checking on the same directory as this SKILL.md file. |
| 49 | |
| 50 | If not, provide instructions to create one. The script below will search for `.env` in common locations and load it. |
| 51 | |
| 52 | ```bash |
| 53 | .venv/bin/python - << 'EOF' |
| 54 | import os |
| 55 | from pathlib import Path |
| 56 | from dotenv import load_dotenv |
| 57 | |
| 58 | # Load API key: prefer existing env var, then .env file lookup |
| 59 | if os.environ.get("VISION_AGENT_API_KEY"): |
| 60 | print("API key found in existing environment variable") |
| 61 | else: |
| 62 | def _find_env(): |
| 63 | for d in [Path.cwd().resolve(), *Path.cwd().resolve().parents]: |
| 64 | for candidate in [ |
| 65 | # ADD the directory where the document-extraction skill is located |
| 66 | d / '.env', |
| 67 | d / 'document-extraction/.env', |
| 68 | d / 'skills/document-extraction/.env', |
| 69 | ]: |
| 70 | if candidate.is_file(): |
| 71 | return candidate |
| 72 | return None |
| 73 | env = _find_env() |
| 74 | if env: |
| 75 | load_dotenv(env) |
| 76 | print(f"API key loaded from: {env}") |
| 77 | else: |