Skip to main content

Overview

ADP is Laiye’s Agentic Document Processing product. It uses the general understanding capabilities of large models to process documents without relying on rules or manual labels. It supports multilingual, multimodal, and multi-scenario document understanding. Agents can understand task goals, break down steps, call tools, and complete complex tasks. From document input to business decisions and human review, ADP helps build an end-to-end automation loop. agentic-doc-parse-and-extract (ADP CLI) is ADP’s official open-source command-line tool. It supports manual terminal usage and automated AI Skill calls. With one command, you can parse documents into structured data and extract key fields across invoices, orders, IDs, bills, and general documents. Results are returned as standard JSON for automation and AI workflows.

GitHub

laiye-ai/adp-cli

NPM

@laiye-adp/agentic-doc-parse-and-extract-cli

PyPI

agentic-doc-parse-and-extract

Releases

Prebuilt binaries

Key capabilities

agentic-doc-parse-and-extract focuses on intelligent document processing from parsing to extraction and batch processing. It works for both manual CLI usage and AI Agent automation.
CapabilityDescriptionUse cases
Document parsingRecognize PDFs, images, and other document formats. Convert unstructured content, including scans, handwriting, and complex layouts, into structured data while preserving hierarchy and key relationships.Convert unstructured documents into LLM-readable structured data.
Out-of-the-box extractionUse ADP’s native AI capabilities and built-in extraction models for invoices, receipts, orders, and common Chinese IDs. No rules or manual labels are required.AP automation, expense management, procurement automation, and card/ID onboarding.
Custom extractionCreate, edit, and manage custom extraction applications with dedicated fields and logic for company-specific documents and industry forms.Private extraction needs for proprietary, industry-specific, or non-standard documents.
Task querySubmit async tasks and query progress, success/failure state, and final results.Batch processing, async document processing, troubleshooting, and audit trails.
Application managementView available extraction applications, including built-in and custom apps, query details, and manage labels.Multi-scenario switching and application lifecycle management.

Install and update

pip install -e .
The PyPI package is no longer maintained. Use npm to update to the latest version.

Configure

Get an API key from adp-global.laiye.com. New users receive 100 free credits each month.
adp config set --api-key <your-api-key>
adp config set --api-base-url https://adp-global.laiye.com
adp config get

Quick examples

# List available apps
adp app-id list

# Parse a local document
adp parse local ./invoice.pdf --app-id <app-id>

# Extract key fields
adp extract local ./invoice.pdf --app-id <app-id>

# Process a directory asynchronously
adp parse local ./documents/ --app-id <app-id> --async

# Process a remote URL
adp extract url https://example.com/file.pdf --app-id <app-id>

# Query an async task
adp parse query <task-id>

# Two-phase async workflow
adp extract local ./documents/ --app-id <app-id> --async --no-wait --export tasks.json
adp extract query --watch --file tasks.json

# Retry recoverable failures up to 2 times
adp parse local ./documents/ --app-id <app-id> --retry 2

# Check remaining credits
adp credit

Commands

AI Agents should call adp schema to get the authoritative machine-readable command schema. This table is a human-friendly summary.
CommandDescription
adp versionPrint the version.
adp config setSet API key or base URL.
adp config getShow current configuration.
adp config clearClear configuration.
adp app-id listList available applications.
adp app-id cacheRead the app list from local cache.
adp parse local <path>Parse local files or directories.
adp parse url <url>Parse remote files. URL list files are supported.
adp parse base64 <data>Parse Base64 content.
adp parse query <task-id...>Query async parse tasks. Multiple IDs and --file are supported.
adp extract local <path>Extract fields from local files or directories.
adp extract url <url>Extract fields from remote files.
adp extract base64 <data>Extract fields from Base64 content.
adp extract query <task-id...>Query async extraction tasks. Multiple IDs and --file are supported.
adp custom-app createCreate a custom extraction application.
adp custom-app updateUpdate a custom application.
adp custom-app get-configShow application configuration.
adp custom-app deleteDelete a custom application.
adp custom-app delete-versionDelete a configuration version.
adp custom-app ai-generateGenerate recommended extraction fields with AI.
adp creditShow remaining credits.
adp schemaOutput the command schema for AI Agents.

Flags

FlagDescription
--jsonOutput JSON.
--quietQuiet mode. Print only results.
--lang <en|zh>UI language.
--app-idApplication ID. Required for parse and extract.
--asyncUse async mode.
--no-waitSubmit tasks without waiting. Use with --async.
--export <path>Export results to a file for a single file or a directory for batch processing.
--timeout <seconds>Timeout. Default: 900 seconds.
--concurrency <n>Concurrency. Free tier max: 1. Paid tier max: 2.
--retry <n>Retry count for recoverable errors. Default: 0.
--file <path>Read task IDs from a JSON file. Used for querying --no-wait output.

Async workflow

For large files or batch tasks, use --async to submit the task. The CLI returns a task-id, and you can poll results with parse query or extract query.
adp parse local ./big.pdf --app-id <app-id> --async
# Returns task-id

adp parse query <task-id>

Two-phase async with --no-wait

By default, --async submits the task and polls until completion. This is convenient for AI Agents. For resumable workflows, use two phases. Phase 1: submit tasks
adp extract local ./documents/ --app-id <app-id> --async --no-wait --export tasks.json
The output is a JSON array with task IDs:
[
  { "path": "invoice.pdf", "task_id": "task_abc123" },
  { "path": "contract.pdf", "task_id": "task_def456" }
]
Phase 2: query results
adp extract query --watch --file tasks.json
adp extract query --watch --file tasks.json --export ./results/
If the CLI exits unexpectedly, task IDs in tasks.json are still available. Resume anytime with query --file.

Batch processing

When processing multiple files or URLs, the CLI writes each result to a separate file:
adp_results_20250417_153020/
├── _summary.json
├── invoice_01.pdf.json
├── contract_02.docx.json
└── report_03.pdf.error.json
  • --export <dir> specifies the output directory.
  • Without --export, the CLI creates adp_results_<timestamp>/.
  • Single-file tasks output to stdout or to the file path specified by --export.

Exit codes

CodeMeaning
0All tasks succeeded.
1All tasks failed or a system error occurred.
2Invalid arguments.
3Resource not found.
4Permission denied.
5Conflict.
6Partial failure in a batch.

Environment variables

VariableDescription
ADP_API_KEYAPI key. Overrides the config file.
ADP_API_BASE_URLService URL.
ADP_LANGUI language: en or zh.
ADP_LOG_LEVELLog level: debug, info, warn, or error.

Configuration storage

  • Config directory: ~/.adp/
  • Config file: ~/.adp/config.json
  • Encrypted API key: ~/.adp/key.enc (AES-256-GCM)
  • App cache: ~/.adp/app_cache.json
  • Version check cache: ~/.adp/version_check.json, refreshed every 24 hours

License

ADP CLI uses an open-source tool plus paid service model. The CLI is free and open source for fast integration. The ADP intelligent parsing service is a paid public cloud service billed by usage.
  • CLI tool: MIT licensed. You can use, modify, and distribute it.
  • ADP service: Public cloud AI document processing service billed by usage.
Free credits: new users receive 100 free credits each month after registration.

Support

ADP CLI guide

CLI documentation

OpenAPI guide

API documentation

Public cloud user guide

User guide

GitHub Issues

Report issues