{"id":"5214a363-c87b-4ca5-ac14-778da75a0abe","entityType":"agent","slug":"clawhub-laiye-adp-laiye-ocr","name":"Laiye-OCR","canonicalUrl":"https://www.xpersona.co/agent/clawhub-laiye-adp-laiye-ocr","canonicalPath":"/agent/clawhub-laiye-adp-laiye-ocr","generatedAt":"2026-10-10T14:45:35.744Z","source":"CLAWHUB","claimStatus":"UNCLAIMED","verificationTier":"NONE","summary":{"evidence":{"source":"CLAWHUB","verified":false,"confidence":"medium","updatedAt":"2026-10-10T12:13:53.287Z","emptyReason":null},"description":"Enables AI-powered parsing and key information extraction from high-frequency documents including invoices, orders, receipts, long texts, and common Chinese...","descriptionLabel":"Source description","evidenceSummary":"Capability contract not published. No trust telemetry is available yet. 1.4K downloads reported by the source. Last updated 10/10/2026.","installCommand":"clawhub skill install s17cqxy7t90jwwf5x1jhnss4td85c8ch:laiye-ocr","sourceUrl":"https://clawhub.ai/laiye-adp/laiye-ocr","homepage":"https://clawhub.ai/laiye-adp/skills/laiye-ocr","primaryLinks":[{"label":"View on ClawHub","url":"https://clawhub.ai/laiye-adp/laiye-ocr","kind":"source"},{"label":"Homepage","url":"https://clawhub.ai/laiye-adp/skills/laiye-ocr","kind":"homepage"}],"safetyScore":84,"overallRank":62,"popularityScore":63,"trustScore":null,"claimedByName":null,"isOwner":false,"seoDescription":"Laiye-OCR technical dossier on Xpersona with agent coverage, OPENCLEW support, and live trust metadata."},"coverage":{"evidence":{"source":"public-profile","verified":false,"confidence":"medium","updatedAt":"2026-10-10T12:13:53.287Z","emptyReason":null},"protocols":[{"protocol":"OPENCLEW","label":"OpenClaw","status":"self-declared","notes":"Declared in the public agent profile."}],"capabilities":[],"verifiedCount":0,"selfDeclaredCount":1,"capabilityMatrix":{"rows":[{"key":"OPENCLEW","type":"protocol","support":"unknown","confidenceSource":"profile","notes":"Listed on profile"}],"flattenedTokens":"protocol:OPENCLEW|unknown|profile"}},"adoption":{"evidence":{"source":"CLAWHUB","verified":false,"confidence":"medium","updatedAt":"2026-10-10T12:13:53.287Z","emptyReason":null},"stars":null,"forks":null,"downloads":1440,"packageName":null,"latestVersion":"1.10.3","tractionLabel":"1.4K downloads"},"release":{"evidence":{"source":"CLAWHUB","verified":false,"confidence":"medium","updatedAt":"2026-10-10T12:13:53.287Z","emptyReason":null},"lastUpdatedAt":"2026-10-10T12:13:53.287Z","lastCrawledAt":"2026-10-10T12:13:53.287Z","lastIndexedAt":null,"nextCrawlAt":"2026-10-11T12:13:53.287Z","lastVerifiedAt":null,"highlights":[{"version":"1.10.3","createdAt":"2026-04-24T10:44:21.260Z","changelog":"- No changes to functionality or implementation.","fileCount":10,"zipByteSize":34069},{"version":"1.10.0","createdAt":"2026-04-24T09:11:13.996Z","changelog":"**Summary:** Major update with improved documentation structure, new reference guides, and a focus on CLI usage for document parsing and extraction. - Comprehensive overhaul of documentation with a new step-by-step workflow for AI agents and humans. - Added detailed usage guides for commands, authentication, error handling, and performance best practices. - Introduced new reference files: command list, error handling, response schemas, and practical examples. - Added multilingual README (README-CN.md) and updated licensing information. - Clarified product capabilities: batch processing, template customization, support for Chinese documents, and process automation scenarios. - Removed legacy config files (_meta.json, package.json) for a cleaner project structure.","fileCount":9,"zipByteSize":33998},{"version":"1.4.0","createdAt":"2026-03-16T02:09:22.832Z","changelog":"- Skill name changed from \"laiye-adp-doc-processing\" to \"laiye-ocr\". - Added a prominent API Key acquisition link and highlighted support for a free trial. - Minor adjustments to descriptions and titles for clarity and emphasis on OCR functionality. - No API or usage changes; documentation improvements only.","fileCount":4,"zipByteSize":8853},{"version":"1.3.0","createdAt":"2026-03-09T06:30:31.903Z","changelog":"License: Published under MIT-0 (ClawHub platform mandatory). This skill only provides API calling logic; the underlying service (API access) requires a valid API Key from our official web platform. Commercial license and usage credits are managed via our web portal (https://adp-global.laiye.com/?utm_source=clawhub). New users receive 100 free monthly credits (applicable only to valid API Key holders).","fileCount":4,"zipByteSize":8820},{"version":"1.1.1","createdAt":"2026-03-09T06:28:43.512Z","changelog":"- Updated documentation URL parameters from `utm_source=github` to `utm_source=clawhub` for all API endpoints and references. - No functional or code changes; documentation only.","fileCount":4,"zipByteSize":8821},{"version":"1.1.0","createdAt":"2026-03-04T03:53:19.514Z","changelog":"- Added comprehensive README.md with setup guides, API usage, and security notes. - Updated documentation (SKILL.md) with new examples, improved formatting, and clarified advanced features. - Adjusted references from \"clawhub\" to \"github\" in base URL and security notes. - Enhanced use case examples with more specific field extraction descriptions. - No changes to functionality or the API itself; documentation and usage instructions improved for clarity.","fileCount":4,"zipByteSize":8867},{"version":"1.0.0","createdAt":"2026-03-02T02:44:03.304Z","changelog":"Initial release of enterprise-grade agentic document processing API. - Accurately extracts key fields and line items from invoices, receipts, orders, and more across 10+ file formats (.jpeg, .png, .pdf, .docx, .xlsx, etc.) into structured JSON/Excel. - Offers per-field confidence scores, async extraction for large documents, and access to VLM/LLM recognition results. - Simple integration with zero configuration and environment variable support for credentials. - Robust security guidance for handling sensitive documents and credential management. - Free monthly usage credits for new users; commercial license required for continued use.","fileCount":3,"zipByteSize":4536}]},"execution":{"evidence":{"source":"CLAWHUB","verified":false,"confidence":"low","updatedAt":null,"emptyReason":"No published capability contract is available yet."},"installCommand":"clawhub skill install s17cqxy7t90jwwf5x1jhnss4td85c8ch:laiye-ocr","setupComplexity":"low","setupSteps":["Install using `clawhub skill install s17cqxy7t90jwwf5x1jhnss4td85c8ch:laiye-ocr` in an isolated environment before connecting it to live workloads.","No published capability contract is available yet, so validate auth and request/response behavior manually.","Review the upstream CLAWHUB listing at https://clawhub.ai/laiye-adp/laiye-ocr before using production credentials."],"contract":{"contractStatus":"missing","authModes":[],"requires":[],"forbidden":[],"supportsMcp":false,"supportsA2a":false,"supportsStreaming":false,"inputSchemaRef":null,"outputSchemaRef":null,"dataRegion":null,"contractUpdatedAt":null,"sourceUpdatedAt":null,"freshnessSeconds":null},"invocationGuide":{"preferredApi":{"snapshotUrl":"https://www.xpersona.co/api/v1/agents/clawhub-laiye-adp-laiye-ocr/snapshot","contractUrl":"https://www.xpersona.co/api/v1/agents/clawhub-laiye-adp-laiye-ocr/contract","trustUrl":"https://www.xpersona.co/api/v1/agents/clawhub-laiye-adp-laiye-ocr/trust"},"curlExamples":["curl -s \"https://www.xpersona.co/api/v1/agents/clawhub-laiye-adp-laiye-ocr/snapshot\"","curl -s \"https://www.xpersona.co/api/v1/agents/clawhub-laiye-adp-laiye-ocr/contract\"","curl -s \"https://www.xpersona.co/api/v1/agents/clawhub-laiye-adp-laiye-ocr/trust\""],"jsonRequestTemplate":{"query":"summarize this repo","constraints":{"maxLatencyMs":2000,"protocolPreference":["OPENCLEW"]}},"jsonResponseTemplate":{"ok":true,"result":{"summary":"...","confidence":0.9},"meta":{"source":"CLAWHUB","generatedAt":"2026-10-10T14:45:35.740Z"}},"retryPolicy":{"maxAttempts":3,"backoffMs":[500,1500,3500],"retryableConditions":["HTTP_429","HTTP_503","NETWORK_TIMEOUT"]}},"endpoints":{"dossierUrl":"https://www.xpersona.co/api/v1/agents/clawhub-laiye-adp-laiye-ocr/dossier","snapshotUrl":"https://www.xpersona.co/api/v1/agents/clawhub-laiye-adp-laiye-ocr/snapshot","contractUrl":"https://www.xpersona.co/api/v1/agents/clawhub-laiye-adp-laiye-ocr/contract","trustUrl":"https://www.xpersona.co/api/v1/agents/clawhub-laiye-adp-laiye-ocr/trust"}},"reliability":{"evidence":{"source":"runtime-metrics","verified":false,"confidence":"low","updatedAt":null,"emptyReason":"No trust, reliability, or runtime telemetry is available."},"trust":{"status":"unavailable","handshakeStatus":"UNKNOWN","verificationFreshnessHours":null,"reputationScore":null,"p95LatencyMs":null,"successRate30d":null,"fallbackRate":null,"attempts30d":null,"trustUpdatedAt":null,"trustConfidence":"unknown","sourceUpdatedAt":null,"freshnessSeconds":null},"decisionGuardrails":{"doNotUseIf":["Contract metadata is missing or unavailable for deterministic execution."],"safeUseWhen":[],"riskFlags":["missing_or_unavailable_contract","trust_data_unavailable","schema_references_missing"],"operationalConfidence":"low"},"executionMetrics":{"observedLatencyMsP50":null,"observedLatencyMsP95":null,"estimatedCostUsd":null,"uptime30d":null,"rateLimitRpm":null,"rateLimitBurst":null,"lastVerifiedAt":null,"verificationSource":null},"runtimeMetrics":{"successRate":null,"avgLatencyMs":null,"avgCostUsd":null,"hallucinationRate":null,"retryRate":null,"disputeRate":null,"p50Latency":null,"p95Latency":null,"lastUpdated":null}},"benchmarks":{"evidence":{"source":"no-benchmark-data","verified":false,"confidence":"low","updatedAt":null,"emptyReason":"No benchmark suites or observed failure patterns are available."},"suites":[],"failurePatterns":[]},"artifacts":{"evidence":{"source":"CLAWHUB","verified":false,"confidence":"medium","updatedAt":"2026-10-10T12:13:53.287Z","emptyReason":null},"readme":"Skill: Laiye-OCR\n\nOwner: laiye-adp\n\nSummary: Enables AI-powered parsing and key information extraction from high-frequency documents including invoices, orders, receipts, long texts, and common Chinese...\n\nTags: latest:1.10.3\n\nVersion history:\n\nv1.10.3 | 2026-04-24T10:44:21.260Z | user\n\n- No changes to functionality or implementation.\n\nv1.10.0 | 2026-04-24T09:11:13.996Z | user\n\n**Summary:** Major update with improved documentation structure, new reference guides, and a focus on CLI usage for document parsing and extraction.\n\n- Comprehensive overhaul of documentation with a new step-by-step workflow for AI agents and humans.\n- Added detailed usage guides for commands, authentication, error handling, and performance best practices.\n- Introduced new reference files: command list, error handling, response schemas, and practical examples.\n- Added multilingual README (README-CN.md) and updated licensing information.\n- Clarified product capabilities: batch processing, template customization, support for Chinese documents, and process automation scenarios.\n- Removed legacy config files (_meta.json, package.json) for a cleaner project structure.\n\nv1.4.0 | 2026-03-16T02:09:22.832Z | user\n\n- Skill name changed from \"laiye-adp-doc-processing\" to \"laiye-ocr\".\n- Added a prominent API Key acquisition link and highlighted support for a free trial.\n- Minor adjustments to descriptions and titles for clarity and emphasis on OCR functionality.\n- No API or usage changes; documentation improvements only.\n\nv1.3.0 | 2026-03-09T06:30:31.903Z | user\n\nLicense: Published under MIT-0 (ClawHub platform mandatory). \nThis skill only provides API calling logic; the underlying service (API access) requires a valid API Key from our official web platform. \nCommercial license and usage credits are managed via our web portal (https://adp-global.laiye.com/?utm_source=clawhub). \nNew users receive 100 free monthly credits (applicable only to valid API Key holders).\n\nv1.1.1 | 2026-03-09T06:28:43.512Z | user\n\n- Updated documentation URL parameters from `utm_source=github` to `utm_source=clawhub` for all API endpoints and references.\n- No functional or code changes; documentation only.\n\nv1.1.0 | 2026-03-04T03:53:19.514Z | user\n\n- Added comprehensive README.md with setup guides, API usage, and security notes.\n- Updated documentation (SKILL.md) with new examples, improved formatting, and clarified advanced features.\n- Adjusted references from \"clawhub\" to \"github\" in base URL and security notes.\n- Enhanced use case examples with more specific field extraction descriptions.\n- No changes to functionality or the API itself; documentation and usage instructions improved for clarity.\n\nv1.0.0 | 2026-03-02T02:44:03.304Z | user\n\nInitial release of enterprise-grade agentic document processing API.\n\n- Accurately extracts key fields and line items from invoices, receipts, orders, and more across 10+ file formats (.jpeg, .png, .pdf, .docx, .xlsx, etc.) into structured JSON/Excel.\n- Offers per-field confidence scores, async extraction for large documents, and access to VLM/LLM recognition results.\n- Simple integration with zero configuration and environment variable support for credentials.\n- Robust security guidance for handling sensitive documents and credential management.\n- Free monthly usage credits for new users; commercial license required for continued use.\n\nArchive index:\n\nArchive v1.10.3: 10 files, 34069 bytes\n\nFiles: license.md (5206b), README-CN.md (9974b), README.md (12683b), references/commands.md (11665b), references/error-handling.md (5044b), references/examples.md (19770b), references/response-schema.md (9375b), skill-card.md (3136b), SKILL.md (15512b), _meta.json (129b)\n\nFile v1.10.3:SKILL.md\n\n---\r\nname: agentic-doc-parse-and-extract\r\ndescription: Enables AI-powered parsing and key information extraction from high-frequency documents including invoices, orders, receipts, long texts, and common Chinese identity & credential documents. Supports reusable custom templates for non-standard business files. Features batch concurrent processing to automate document workflows for finance, administration, HR data entry and other departments.\r\n---\r\n# agentic-doc-parse-and-extract Skill\r\n\r\nagentic-doc-parse-and-extract is an official command-line tool released by Laiye Technology's ADP (Agentic Document Processing) product, enabling both humans and AI agents to invoke ADP capabilities in the terminal for document parsing and extraction.\r\n\r\n## Quick Start Guide for AI Agents\r\n\r\n### Core Workflow\r\n1. **Install dependencies**: On first execution, install the ADP CLI tool and dependencies by following the instructions in [references/examples.md](references/examples.md).\r\n2. **Discover commands**: Run `adp schema` to get the machine-readable JSON spec of all commands, parameters, types, and defaults.\r\n3. **Authentication**: On first execution, run `adp config get` to verify credentials. If no valid configuration exists, prompt the user to provide an API Key.\r\n4. **Check Application**: On first execution, retrieve the application list via `adp app-id list`. For subsequent executions, prioritize `adp app-id cache` (cached in context). If the cache is unavailable, refresh it by calling `adp app-id list` again.\r\n5. **Execute**: Run `adp extract url <URL> --app-id <ID>` or `adp parse url <URL> --app-id <ID>`.\r\n6. **Query**: Check results asynchronously with `adp extract query <task_id>` or `adp parse query <task_id>`.\r\n7. **Error handling**: When a command fails, parse the stderr JSON to determine error type and recovery action. See [references/error-handling.md](references/error-handling.md).\r\n\r\n### Common Scenarios → Command Mapping\r\n| User Intent | Recommended Command | Handling Rules |\r\n| :---------- | :------------------ | :------------- |\r\n| - Read full document content<br>- Parse layout & structure<br>- Convert document to text<br>- Process / analyze full document | `adp parse` | - Sync processing for small files<br>- Async processing (`--async` parameter) for files >20MB or >200 pages |\r\n| - Extract key fields (amount, date, name, ID, etc.)<br>- Output structured results (JSON/table) | `adp extract` | - Use Extract directly, **no need to parse first**<br>- Use matched existing app<br>- Create a custom extraction app if the document type is not in the known app list |\r\n| Batch processing of local files | `adp extract local <folder path>` <br> `adp parse local <folder path> `  | Batch processing can accept files from the local folder. |\r\n| Batch processing of URL files | `adp extract url <URL list file path>` <br> `adp parse url <URL list file path> `  | If you need to process multiple URLs in a batch, you can first save the list of URLs in a text file, and then input the corresponding URL of this text file to achieve batch processing at once. |\r\n\r\nNote:\r\n- The `adp extract` command has built-in document parsing capabilities. After ADP automatically parses the document, it performs structured extraction. Therefore, when users need to extract the structured content of the document, there is no need to use apd for parsing.\r\n- URL list file format: A plain text file where each line is a URL pointing to a document to be processed.\r\n\r\n\r\n### Quick Reference for Common Commands\r\n\r\n```bash\r\n# Command Discovery (for Agent introspection)\r\nadp schema\r\n\r\n# Configuration Check\r\nadp config get\r\n\r\n# Query Applications (First Use)\r\nadp app-id list\r\n\r\n# Document Extraction (Invoice/Receipt)\r\nadp extract url <file URL> --app-id <app_id>\r\n\r\n# Document Parsing (Long Document)\r\nadp parse url <file URL> --app-id <app_id>\r\n\r\n# Base64 Input\r\nadp extract base64 <base64_string> --app-id <app_id> --file-name invoice.pdf\r\nadp parse base64 <base64_string> --app-id <app_id> --file-name document.pdf\r\n\r\n# Asynchronous Query\r\nadp extract query <task_id>\r\nadp parse query <task_id>\r\nadp parse query <task_id1> <task_id2> --watch  # batch query with auto-poll\r\n\r\n# Batch Processing\r\nadp extract local <folder path> --app-id <app_id> --export <folder path> --concurrency 2\r\nadp parse local <folder path> --app-id <app_id> --export <folder path> --concurrency 2\r\n```\r\n\r\n## Performance Optimization Suggestions\r\n- **Reuse APP_ID**: Cache it in the context after one query to avoid calling `app-id list` every time.\r\n- **Sync First**: For small files (<20MB), prioritize using synchronous calls to avoid asynchronous polling.\r\n- **Batch Processing**: Processes multiple documents via `url <URL list file path>` or `local <folder path>` in a single run, without looped invocations. Default `--concurrency 2`.\r\n- **Local Cache**: Store commonly used APP_IDs in environment variables or configuration files.\r\n- **Priority Extraction**: If only key information needs to be extracted, use `extract` instead of `parse` (faster).\r\n- **Use --retry for batch**: Set `--retry 2` for batch processing to auto-recover from transient failures.\r\n- **Use --timeout for large files**: Increase `--timeout` for files >20MB. Default is 900s.\r\n\r\n---\r\n\r\n## Detailed Product Introduction\r\n\r\n### Core Function Definition\r\n- **parse**: Parses the entire document to retrieve full text, layout, structure, and content.\r\n- **extract**: Extracts specific structured fields from the document, such as amount, date, company name, and order number.\r\n\r\n### Application Scenarios\r\n- **Long Document Parsing**: Efficiently process long documents with fast parsing speed, accurately extract multiple elements such as text, tables and images, replace manual extraction, and improve efficiency.\r\n- **Structured Extraction for Scanned/Photographed Documents**: For scanned documents and photos, complete structured extraction in reading order, generate clear and editable electronic documents, and eliminate manual entry errors.\r\n- **Intelligent Invoice Extraction**: After uploading invoice images/documents, AI automatically invokes preset applications to accurately extract 10+ key fields such as invoice number and amount, suitable for financial filing scenarios.\r\n- **Intelligent Order Extraction**: Support batch upload of orders from multiple distributors, AI extracts 10+ key fields such as order number and buyer-seller information, automatically identifies currencies, and reduces manual verification costs.\r\n- **Domestic ID Document Extraction**: Process in seconds, supporting the identification and extraction of more than 10 common types of documents in China; for example, core information such as name and ID number can be quickly extracted from ID card scans.\r\n- **Automatic Splitting and Extraction of Mixed Documents**: Batch upload mixed documents such as contracts and invoices, AI automatically classifies, splits and completes structured extraction to improve processing efficiency.\r\n- **Batch Document Processing**: Support batch upload of various business documents, extract information and output standardized structured data, reducing repetitive manual operations.\r\n\r\n## Detailed Usage Steps\r\n\r\n### Step 1: Obtain the Installation Package\r\nFor details, see [references/examples.md](references/examples.md)\r\n\r\n### Step 2: Obtain and Configure API Key\r\n\r\n   #### 1. Access the ADP Portal to Obtain Credentials\r\n\r\n   We provide independent Public Cloud access addresses for domestic and international users, which need to be configured separately by region. Accessing nearby can better ensure high-speed and stable calls across the network.\r\n\r\n   | Region | Login Address | API Base URL |\r\n   |-----|----------|--------------|\r\n   | Chinese Mainland | [https://adp.laiye.com/](https://adp.laiye.com/?utm_source=clawhub) | `https://adp.laiye.com/` |\r\n   | Overseas Region | [https://adp-global.laiye.com/](https://adp-global.laiye.com/?utm_source=clawhub) | `https://adp-global.laiye.com/` |\r\n\r\n   #### 2. Get API Key after registration/login\r\n   New users need to register an ADP account first, and after registration, they can get 100 free credits/month\r\n   - After logging in, click on the personal avatar, and you can directly access the `API_Key` entry.\r\n   \r\n   #### 3. Complete the authentication configuration\r\n   For details, see [references/examples.md](references/examples.md)\r\n   \r\n   #### 4. Verify the configuration\r\n   For details, see [references/examples.md](references/examples.md)\r\n   \r\n   **Notes**:\r\n   1. If API Key and API Base URL have been configured, the configuration information needs to be stored in environment variables to avoid uploading configuration items every time they are used.\r\n   2. If API Key and API Base URL have not been configured yet, they need to be configured according to the above steps.\r\n\r\n### Step 3: Upload Documents\r\nAfter completing the authentication of the API Key, guide the user to upload local files or specify the file URL. After the user uploads the document, they can query the supported application scope of ADP and select the appropriate application for document parsing and extraction. If no suitable application is found, they can choose to create a custom extraction application, configure exclusive fields and parsing modes to meet the personalized document processing requirements.\r\n\r\n### Step 4: Query Available Applications \r\nThis function is used to query the built-in applications under the user's account (such as invoices/receipts, orders, common cards and certificates in China region, etc. which are standardized documents). Based on the `app-label`, you can assist in filtering the suitable application IDs. If no suitable application is found, you can choose to create a custom extraction application, configure specific fields and parsing modes to meet the personalized document processing requirements.\r\n\r\n**Notes**:\r\n1. For the first execution, use `adp app-id list`. For subsequent executions, prefer to use `adp app-id cache` (cache the application ID in the context). If the cache becomes invalid or there are no suitable applications in the cache, call `adp app-id list` again to update the cache.\r\n\r\nFor detailed examples of commands and responses, see [references/examples.md](references/examples.md).\r\n\r\n\r\n### Step 5: Add custom extraction application\r\n\r\nSupport creating custom extraction applications, and independently add business-specific extraction fields as needed, and improve the detailed description of each field; the system will accurately identify the document content based on the configured fields and definitions, and complete customized information extraction for personalized documents and non-standard forms.\r\n\r\nFor example commands, responses, and detailed parameter descriptions, please refer to [references/examples.md](references/examples.md) \r\n\r\n### Step 6: Execute Document Processing\r\n\r\n### Single Document Parsing\r\n\r\nPerform document parsing based on the selected application ID, which will return a formatted JSON result containing information such as document content, element position coordinates, OCR Confidence Level, etc.\r\n\r\nFor examples of commands and responses, please refer to [references/examples.md](references/examples.md)\r\n\r\n### Single Document Extraction\r\n\r\nPerform document extraction based on the selected application ID, which will return a formatted JSON result containing information such as extraction fields, extraction results, and Confidence Level.\r\n\r\nFor examples of commands and responses, please refer to [references/examples.md](references/examples.md)\r\n\r\n\r\n### Batch Document Processing\r\n\r\nADP supports batch processing capabilities. Users can upload multiple file URLs or local folder paths at once, and the system will automatically identify each document type and match the most suitable application for processing, greatly improving the efficiency of batch document processing.\r\n\r\nFor detailed command examples, see [references/examples.md](references/examples.md)\r\n\r\n**Note**: The number of concurrent requests is limited to 1 for free users, while enterprise users can adjust it according to their needs, with a maximum support of 2.\r\n\r\n### Asynchronous Processing (Suitable for Large Documents)\r\n\r\nADP provides asynchronous processing capabilities, allowing users to choose asynchronous mode to perform document parsing and extraction. The system will return a task ID, and users can periodically query the task status and results through the query interface, which is suitable for processing complex documents or batch documents with long processing times. If the document uploaded by the user is larger than 20MB or contains more than 200 pages, it is recommended to use the asynchronous processing mode.\r\n\r\nFor examples of commands and responses, see [references/examples.md](references/examples.md)\r\n\r\n---\r\n\r\n## Complete Command List\r\n\r\nFor a complete list of all available commands with full parameter specs, see [references/commands.md](references/commands.md)\r\n\r\n## Response Schema Reference\r\n\r\nFor the output structure of each command (including batch processing output mechanism), see [references/response-schema.md](references/response-schema.md)\r\n\r\n## Error Handling Guide\r\n\r\nFor error codes, types, and Agent auto-recovery strategies, see [references/error-handling.md](references/error-handling.md)\r\n\r\n---\r\n\r\n## Precautions\r\n\r\nWhen using ADP output, always present the returned data as-is. Do not modify, add, or remove any fields during extraction or parsing to ensure data integrity.\r\n\r\n1. **API Key Security**: Please keep your API Key secure and avoid disclosing it to unauthorized third parties.\r\n2. **API Base URL Configuration**: Select the corresponding address based on the region. For Chinese Mainland, use `https://adp.laiye.com/`, and for overseas regions, use `https://adp-global.laiye.com/`\r\n3. **File Size Limit**: The maximum size of a single file is 50MB\r\n4. **Supported Formats**: .jpg, .jpeg, .png, .bmp, .tiff, .tif, .pdf, .doc, .docx, .xls, .xlsx\r\n5. **Free Quota**: New users receive 100 free credits per month, which are reset at the beginning of each month. Credits can be used for document parsing and extraction processing.\r\n6. **Check Balance**: Run `adp credit` to check the current account's credit balance.\r\n7. **Billing Rules**:\r\n   - Document parsing: 0.5 credits per page\r\n   - Invoice/receipt extraction: 1.5 credits per page\r\n   - Order extraction: 1.5 credits per page\r\n   - Custom extraction: 1 credit per page\r\n8. **App ID Reuse**: The app ID used by the user can be remembered for direct use next time, eliminating the need to enter the app_id after each query. The app ID under each user is unique and fixed; unless the user deletes the app, the app_id will not change, and the previously queried app_id can be directly used for document processing calls.\r\n\r\n---\r\n\r\n## Related Resources\r\n- **CLI Documentation**: [ADP CLI User Guide](https://laiye-tech.feishu.cn/wiki/YIaawiK2DimisZk5KfDc8a8cnLh)\r\n- **API Documentation**: [OpenAPI User Guide](https://laiye-tech.feishu.cn/wiki/S1t2wYR04ivndKkMDxxcp2SFnKd)\r\n- **User Guide**: [Public Cloud Operation Manual](https://laiye-tech.feishu.cn/wiki/OfexwgVUQiOpEek4kO7c7NEJnAe)\r\n- **Problem Feedback**: [GitHub Issues](https://github.com/laiye-ai/adp-cli/issues) | global_product@laiye.com\r\n- **Official Website**: [Laiye Technology](https://laiye.com)\r\n\r\n---\r\n\r\nCopyright © 2026 [Laiye Technology (Beijing) Co., Ltd.] All rights reserved.\n\nFile v1.10.3:README.md\n\n<div align=\"center\">\r\n<a id=\"agentic_doc_parse_and_extract\"></a>\r\n\r\n# 📄 Laiye Agentic Document Processing CLI (agentic_doc_parse_and_extract)\r\n\r\nagentic_doc_parse_and_extract is the official command-line tool released by Laiye Technology's ADP (Agentic Document Processing) product, enabling both humans and AI Agents to invoke ADP capabilities in the terminal for document parsing and extraction.\r\n\r\n[English](README.md) | [Simplified Chinese](README-CN.md)\r\n\r\n</div>\r\n\r\n## 🚀 About Laiye ADP\r\n\r\nADP is Laiye's **intelligent agent document processing product (Agentic Document Processing, referred to as ADP)** , based on the general understanding ability of large models, without relying on rules and annotations, with the general understanding ability of multi-language, MultiModal Machine Learning, and multi-scene; autonomous planning and execution of intelligent agents, able to understand task goals, autonomous planning steps, invoke tools, and complete complex tasks; end-to-end business automation, from document input to business decision-making to human-machine collaboration, forming a complete closed loop.\r\n\r\n**agentic-doc-parse-and-extract** is the official open-source CLI tool of ADP, supporting both manual terminal invocation and automatic invocation via AI Skill. With a single command, it can accomplish: structured document parsing + intelligent extraction of key fields, covering all scenarios including invoices, orders, certificates, bills, and general documents, outputting standard JSON, and seamlessly integrating with automation and AI workflows.\r\n\r\n---\r\n\r\n### 💡 Core Features\r\n\r\nagentic-doc-parse-and-extract focuses on intelligent processing of the entire document workflow, taking into account both manual terminal calls and automatic calls by AI Agents. Its core functions cover all scenarios of parsing, extraction, and batch processing, requiring no complex configuration, and operations can be completed with a single command:\r\n\r\n| Function Name | Function Description | Optimal Scenario |\r\n|---------|------------------|----------|\r\n| **Document Parsing** | Automatically recognize multi-format documents such as PDFs and images, convert messy unstructured content (e.g., scanned documents, handwritten text, complex layout documents) into standardized Structured Data, while preserving the original document hierarchy and key relationships | Convert unstructured documents into Structured Data for LLM reading and subsequent extraction |\r\n| **Out Of The Box Document Extraction** | Based on the native AI capabilities of the ADP large model, it comes with built-in standardized extraction models for invoices, receipts, orders, commonly used certificates in China, etc. No need to configure rules or manual annotation, one-click extraction of key fields from various types of general documentation, outputting standard JSON | Account Payable automation, expense management, procurement automation, quick entry of card and certificate information into the system |\r\n| **Custom Document Extraction** | Supports independent creation, editing, and management of personalized extraction applications, allowing configuration of exclusive extraction fields and recognition logic for enterprise-specific documentation and industry-customized forms | Private extraction requirements for enterprise-specific documentation, industry-customized forms, and non-standardized documents |\r\n| **Task Query** | Supports asynchronous task submission and status query, enabling quick viewing of task execution progress, success/failure status, and final task processing results | Batch task processing, asynchronous document processing, problem troubleshooting, and processing record tracing |\r\n| **Application Management** | Provides comprehensive application management capabilities, allowing users to view all available extraction applications (system-built + custom), query application details, and manage application tags | Multi-scenario business switching, full lifecycle management of applications, and custom application management |\r\n\r\n---\r\n\r\n### 🎯 Target Audience\r\n\r\n- **AI Agent Developers:** Quickly integrate document parsing and extraction capabilities through standard Skills to empower intelligent agents in automated work processes\r\n- **Enterprise R&D and Architecture Team:** Unified access to CLI tools, enabling low-cost implementation of structured and automated processing for all types of documentation\r\n- **Finance & Administrative Operations Team:** Batch parsing of invoices, receipts, and reimbursement forms, reducing manual entry and verification costs\r\n- **Business System Integrator:** Relying on standardized JSON output, seamlessly connecting with upstream and downstream systems such as ERP, RPA, and Central Product Platform\r\n- **Internal Platform Builder:** Supporting local deployment and environment adaptation to meet the requirements of enterprise intranet security and permission management\r\n\r\n## 📁 Project File Structure and File Description\r\n\r\n```\r\nagentic-doc-parse-and-extract/\r\n├── skill.md                  # Skill configuration and invocation instructions\r\n├── README.md                 # Introduction to Laiye ADP product and instructions for CLI download and invocation\r\n├── references/               # Parameter enumeration, error codes, and JSON return instructions\r\n    ├── examples.md           # Sample code for invocation and return with parameter explanations\r\n    ├── commands.md           # List of all commands\r\n    ├── response-schema.md    # Return parameter description\r\n    ├── error-handling.md     # Mistakes and what to do about them\r\n├── License                   # License authorization\r\n```\r\n\r\n## 📋 API Key\r\n### Get API Key\r\n1. Visit [ADP China Region URL](https://adp.laiye.com/?utm_source=clawhub), [ADP Global Region URL](https://adp-global.laiye.com/?utm_source=clawhub)\r\n2. Register a new account (new users get 100 free credits per month)\r\n\r\n## 💻 Environment and Installation\r\n### Supported Platforms and Versions\r\n| Platform | Minimum Requirements |\r\n|---------|------------------|\r\n| **Windows** | Windows 10 or later |\r\n| **Linux** | Ubuntu 18.04+, CentOS 7+, or mainstream Linux distributions |\r\n| **macOS** | macOS 10.14 (Mojave) or later |\r\n---\r\n\r\n### Install\r\n\r\n ```bash\r\n  # Method 1: npm (recommended, works on all platforms, China-friendly with npmmirror)\r\n  npm install -g @laiye-adp/agentic-doc-parse-and-extract-cli --registry=https://registry.npmmirror.com/ || npm install -g @laiye-adp/agentic-doc-parse-and-extract-cli\r\n  export PATH=\"$(npm prefix -g)/bin:$PATH\"\r\n\r\n  # Method 2: Shell script (Linux / macOS, if npm is not available)\r\n  curl -fsSL https://raw.githubusercontent.com/laiye-ai/adp-cli/main/scripts/adp-init.sh | bash\r\n\r\n  # Method 3: PowerShell script (Windows, if npm is not available)\r\n  Invoke-WebRequest -Uri \"https://raw.githubusercontent.com/laiye-ai/adp-cli/main/scripts/adp-init.ps1\" -OutFile \"$env:TEMP\\adp-init.ps1\"; & \"$env:TEMP\\adp-init.ps1\"\r\n  ```\r\n\r\n---\r\n\r\n## ✨ Product & Technical Highlights\r\n\r\n### 📦 Out Of The Box Product\r\n\r\n| Product | Extracted Content | Optimal Scenario |\r\n|---------|------------------|----------|\r\n| **Document Parsing** | Extract elements such as text, tables, images, seals, etc. from the document | Convert the document into structured data for LLM to read |\r\n| **Invoice/Receipt Extraction** | Invoice number, date, supplier, item details, total amount, taxes | Accounts payable automation, expense management |\r\n| **Order Extraction** | Purchase Order Number, Commodity, Quantity, Price, Delivery Information | Procurement Automation, E-commerce Integration |\r\n| **Card Extraction** | 11 types of commonly used cards and certificates such as ID card, bank card, driver's license, business license, etc. | Quick entry of card and certificate information into the system |\r\n\r\n### 🛠️ Technical Capabilities\r\n\r\n- **10+ File Formats**: Covers mainstream image and work document formats (.jpg,.jpeg,.png,.bmp,.tiff,.tif,.pdf,.doc,.docx,.xls,.xlsx)\r\n- **VLM + LLM Dual Engines**: Visual understanding + semantic extraction to achieve maximum accuracy\r\n- **Synchronous and Asynchronous Modes**: All functions are open to external synchronous and asynchronous APIs\r\n- **File Restrictions:** Maximum file size: 50MB\r\n- **Batch Processing:** Supports folder recursion processing\r\n### 🌟 Product Advantages\r\n- Relying on the core capabilities of Laiye Technology's ADP large model and combining the lightweight features of CLI tools, we have created an efficient, flexible, and easily integrated document processing solution with prominent core advantages:\r\n- Zero-threshold entry: No professional technical background is required, no rule configuration or data annotation is needed, with a built-in standardized extraction model that is out of the box, and a single command can complete document parsing and extraction.\r\n- Full-scenario adaptation: Covers common scenarios such as invoices, receipts, orders, certificates, etc., while supporting custom extensions to adapt to enterprise-specific documentation and industry-specific forms, taking into account both general and personalized needs.\r\n- Efficient integration and adaptation: Supports native calls of AI Agent Skill and manual calls from terminals, outputs in standard JSON format, seamlessly connects with upstream and downstream systems such as RPA, ERP, and Central Product Platform, reducing integration costs.\r\n- Multi-terminal compatibility: Supports all platforms including Windows, macOS, and Linux, requires no additional installation of dependencies, can be globally called after configuring environment variables, and adapts to local deployment and multi-scenario work requirements.\r\n- High Precision and Stability: Optimized based on the ADP large model, it has high recognition accuracy for unstructured documents (scanned documents, handwritten text, complex layouts), supports asynchronous task management, and ensures the stable operation of business processes.\r\n\r\n<a id=\"credit\"></a>\r\n### 💰 Billing\r\n\r\n- **New User Benefits:** Receive 100 free credits per month, with no restrictions on application usage\r\n- **Asset Consumption Rules:**\r\n    | Processing Stage | Cost |\r\n    |-----------------|------|\r\n    | Document Parsing | 0.5 points/page |\r\n    | Purchase Order Extraction | 1.5 points/page |\r\n    | Invoice/Receipt Extraction | 1.5 points/page |\r\n    | Custom Extraction | 1 point/page |\r\n\r\n- **Asset Recharge:**  You can directly log in to the ADP Portal to recharge assets. We provide independent Public Cloud access addresses for domestic and international users, which need to be configured separately by region. Accessing from a nearby location can better ensure high-speed and stable invocation across the network.\r\n  - Users in Chinese Mainland [Log in](https://adp.laiye.com/?utm_source=clawhub)\r\n  - Users outside Chinese Mainland [Log in](https://adp-global.laiye.com/?utm_source=clawhub)\r\n\r\n If you encounter any issues with payment, please contact the support email: 📧 global_product@laiye.com\r\n\r\n## 📜 License\r\n\r\nWe adopt a combined model of open-source tools + paid services: the CLI tool is completely free and open-source, making it easy for everyone to quickly integrate; while the core ADP intelligent parsing capability is a Public Cloud commercial service, billed based on actual usage, aiming to provide users with a highly accurate and stable document processing experience.\r\n\r\n- **CLI Tool**: Open source under the MIT License, freely available for use, modification, and distribution\r\n- **ADP Service**: AI document processing service based on Public Cloud, billed by usage, [Billing Rules](#credit)\r\n\r\n### 💰 Free Quota\r\nNew users can receive **100 free credits** per month after registration, allowing them to experience full functionality\r\n\r\n## 📞 Support and Contact\r\n- **CLI Documentation**: [ADP CLI User Guide](https://laiye-tech.feishu.cn/wiki/YIaawiK2DimisZk5KfDc8a8cnLh)\r\n- **API Documentation**: [OpenAPI User Guide](https://laiye-tech.feishu.cn/wiki/S1t2wYR04ivndKkMDxxcp2SFnKd?from=from_copylink)\r\n- **User Guide**: [Public Cloud Operation Manual](https://laiye-tech.feishu.cn/wiki/OfexwgVUQiOpEek4kO7c7NEJnAe)\r\n- **Problem Feedback**: [GitHub Issues](https://github.com/laiye-ai/adp-cli/issues) | global_product@laiye.com\r\n- **Official Website**: [Laiye Technology](https://laiye.com/en/)\r\n\r\n---\r\n\r\n<div align=\"center\">\r\n[⬆ Back to Top](#agentic_doc_parse_and_extract)\r\n\r\n**Build the Future of Agentic AI with ❤️**\r\nCopyright © 2026 [Laiye Technology (Beijing) Co., Ltd.] All rights reserved.\r\n\r\n</div>\n\nFile v1.10.3:_meta.json\n\n{\n  \"ownerId\": \"kn770b2vgq91s7c13mz7syttqh81xj81\",\n  \"slug\": \"laiye-ocr\",\n  \"version\": \"1.10.3\",\n  \"publishedAt\": 1777027461260\n}\n\nFile v1.10.3:references/commands.md\n\n# ADP CLI Complete Command Reference\r\n\r\n> This document is strictly aligned with the CLI's built-in `adp schema` output. Agent can also run `adp schema` to get the machine-readable JSON version of this spec.\r\n\r\n## Global Options\r\n\r\n| Option | Type | Description |\r\n|--------|------|-------------|\r\n| `--lang` | string | Set language (`en` or `zh`) |\r\n| `--json` | boolean | Output in JSON format (recommended for Agent) |\r\n| `--quiet` | boolean | Suppress all output except errors |\r\n\r\n---\r\n\r\n## config — Configuration Management\r\n\r\n### `adp config set`\r\n\r\nSet API Key or Base URL.\r\n\r\n| Option | Type | Required | Description |\r\n|--------|------|----------|-------------|\r\n| `--api-key` | string | No | API Key for authentication |\r\n| `--api-base-url` | string | No | API Base URL |\r\n\r\n### `adp config get`\r\n\r\nView current configuration (no options).\r\n\r\n### `adp config clear`\r\n\r\nClear all configuration.\r\n\r\n| Option | Type | Description |\r\n|--------|------|-------------|\r\n| `--force`, `-y` | boolean | Skip confirmation prompt |\r\n\r\n---\r\n\r\n## app-id — Application Management\r\n\r\n### `adp app-id list`\r\n\r\nQuery available applications.\r\n\r\n| Option | Type | Required | Default | Description |\r\n|--------|------|----------|---------|-------------|\r\n| `--app-label` | string | No | — | Filter by application label |\r\n| `--app-type` | integer | No | — | Filter by application type: `0`=system preset, `1`=custom; omit to list all |\r\n| `--limit` | integer | No | 120 | Maximum number of results |\r\n\r\n### `adp app-id cache`\r\n\r\nView cached application list (no options). Cache is permanent and does not expire.\r\n\r\n---\r\n\r\n## credit — Credit Balance\r\n\r\n### `adp credit`\r\n\r\nCheck current account credit balance.\r\n\r\n| Option | Type | Required | Description |\r\n|--------|------|----------|-------------|\r\n| `--api-key` | string | No | Override configured API Key |\r\n\r\n---\r\n\r\n## parse — Document Parsing\r\n\r\nParses the entire document to retrieve full text, layout, structure, and content.\r\n\r\n### `adp parse local <file-path>`\r\n\r\nParse local file or folder (batch mode when path is a folder).\r\n\r\n| Option | Type | Required | Default | Description |\r\n|--------|------|----------|---------|-------------|\r\n| `--app-id` | string | **Yes** | — | Application ID |\r\n| `--async` | boolean | No | false | Enable asynchronous processing |\r\n| `--no-wait` | boolean | No | false | Submit async task and return immediately (use with `--async`) |\r\n| `--export` | string | No | — | Export results to specified path |\r\n| `--timeout` | integer | No | 900 | Timeout in seconds |\r\n| `--concurrency` | integer | No | 1 | Concurrent processing count (max 1 free, max 2 paid) |\r\n| `--retry` | integer | No | 0 | Number of retries on failure (exponential backoff) |\r\n\r\n### `adp parse url <url>`\r\n\r\nParse document from URL. When the URL points to a text file containing a list of URLs (one per line), batch mode is activated.\r\n\r\n| Option | Type | Required | Default | Description |\r\n|--------|------|----------|---------|-------------|\r\n| `--app-id` | string | **Yes** | — | Application ID |\r\n| `--async` | boolean | No | false | Enable asynchronous processing |\r\n| `--no-wait` | boolean | No | false | Submit async task and return immediately (use with `--async`) |\r\n| `--export` | string | No | — | Export results to specified path |\r\n| `--timeout` | integer | No | 900 | Timeout in seconds |\r\n| `--concurrency` | integer | No | 1 | Concurrent processing count |\r\n| `--retry` | integer | No | 0 | Number of retries on failure |\r\n\r\n### `adp parse base64 <base64-strings>`\r\n\r\nParse base64-encoded document content.\r\n\r\n| Option | Type | Required | Default | Description |\r\n|--------|------|----------|---------|-------------|\r\n| `--app-id` | string | **Yes** | — | Application ID |\r\n| `--async` | boolean | No | false | Enable asynchronous processing |\r\n| `--no-wait` | boolean | No | false | Submit async task and return immediately |\r\n| `--export` | string | No | — | Export results to specified path |\r\n| `--timeout` | integer | No | 900 | Timeout in seconds |\r\n| `--file-name` | string | No | \"document\" | Display name with extension for the base64 content (used to detect file type; does not read from disk) |\r\n| `--concurrency` | integer | No | 1 | Concurrent processing count |\r\n| `--retry` | integer | No | 0 | Number of retries on failure |\r\n\r\n### `adp parse query <task-ids...>`\r\n\r\nQuery async parse task status and results. Supports multiple task IDs as arguments.\r\n\r\n| Option | Type | Required | Default | Description |\r\n|--------|------|----------|---------|-------------|\r\n| `--watch` | boolean | No | false | Continuously poll until task completes |\r\n| `--file` | string | No | — | Read task IDs from a JSON file (produced by `--no-wait`) |\r\n| `--export` | string | No | — | Export results to specified path |\r\n| `--timeout` | integer | No | 900 | Watch mode timeout in seconds |\r\n| `--concurrency` | integer | No | 1 | Concurrent query count |\r\n\r\n---\r\n\r\n## extract — Document Extraction\r\n\r\nExtracts specific structured fields from documents (amount, date, company name, etc.).\r\n\r\n### `adp extract local <file-path>`\r\n\r\nExtract from local file or folder (batch mode when path is a folder).\r\n\r\n| Option | Type | Required | Default | Description |\r\n|--------|------|----------|---------|-------------|\r\n| `--app-id` | string | **Yes** | — | Application ID |\r\n| `--async` | boolean | No | false | Enable asynchronous processing |\r\n| `--no-wait` | boolean | No | false | Submit async task and return immediately |\r\n| `--export` | string | No | — | Export results to specified path |\r\n| `--timeout` | integer | No | 900 | Timeout in seconds |\r\n| `--concurrency` | integer | No | 1 | Concurrent processing count |\r\n| `--retry` | integer | No | 0 | Number of retries on failure |\r\n\r\n### `adp extract url <url>`\r\n\r\nExtract from URL document. Supports URL list file for batch mode.\r\n\r\n| Option | Type | Required | Default | Description |\r\n|--------|------|----------|---------|-------------|\r\n| `--app-id` | string | **Yes** | — | Application ID |\r\n| `--async` | boolean | No | false | Enable asynchronous processing |\r\n| `--no-wait` | boolean | No | false | Submit async task and return immediately |\r\n| `--export` | string | No | — | Export results to specified path |\r\n| `--timeout` | integer | No | 900 | Timeout in seconds |\r\n| `--concurrency` | integer | No | 1 | Concurrent processing count |\r\n| `--retry` | integer | No | 0 | Number of retries on failure |\r\n\r\n### `adp extract base64 <base64-strings>`\r\n\r\nExtract from base64-encoded document content.\r\n\r\n| Option | Type | Required | Default | Description |\r\n|--------|------|----------|---------|-------------|\r\n| `--app-id` | string | **Yes** | — | Application ID |\r\n| `--async` | boolean | No | false | Enable asynchronous processing |\r\n| `--no-wait` | boolean | No | false | Submit async task and return immediately |\r\n| `--export` | string | No | — | Export results to specified path |\r\n| `--timeout` | integer | No | 900 | Timeout in seconds |\r\n| `--file-name` | string | No | \"document\" | Display name with extension for the base64 content (used to detect file type; does not read from disk) |\r\n| `--concurrency` | integer | No | 1 | Concurrent processing count |\r\n| `--retry` | integer | No | 0 | Number of retries on failure |\r\n\r\n### `adp extract query <task-ids...>`\r\n\r\nQuery async extract task status and results. Supports multiple task IDs.\r\n\r\n| Option | Type | Required | Default | Description |\r\n|--------|------|----------|---------|-------------|\r\n| `--watch` | boolean | No | false | Continuously poll until task completes |\r\n| `--file` | string | No | — | Read task IDs from a JSON file (produced by `--no-wait`) |\r\n| `--export` | string | No | — | Export results to specified path |\r\n| `--timeout` | integer | No | 900 | Watch mode timeout in seconds |\r\n| `--concurrency` | integer | No | 1 | Concurrent query count |\r\n\r\n---\r\n\r\n## custom-app — Custom Extraction Application Management\r\n\r\n### `adp custom-app create`\r\n\r\nCreate a custom extraction application.\r\n\r\n| Option | Type | Required | Description |\r\n|--------|------|----------|-------------|\r\n| `--api-key` | string | No | Override configured API Key |\r\n| `--app-name` | string | **Yes** | Application name |\r\n| `--app-label` | string | No | Application labels (up to 5) |\r\n| `--extract-fields` | string (JSON) | **Yes** | Field definitions in JSON format |\r\n| `--parse-mode` | string | **Yes** | Parsing mode: `advance`, `standard`, or `agentic` |\r\n| `--enable-long-doc` | string | **Yes** | Enable long document processing (`true`/`false`) |\r\n| `--long-doc-config` | string (JSON) | No | Long document type configuration (only applied when `--enable-long-doc true`) |\r\n\r\n### `adp custom-app update`\r\n\r\nUpdate an existing custom extraction application.\r\n\r\n| Option | Type | Required | Description |\r\n|--------|------|----------|-------------|\r\n| `--api-key` | string | No | Override configured API Key |\r\n| `--app-id` | string | **Yes** | Application ID to update |\r\n| `--app-name` | string | No | New application name |\r\n| `--app-label` | string | No | New application labels |\r\n| `--extract-fields` | string (JSON) | **Yes** | Updated field definitions |\r\n| `--parse-mode` | string | **Yes** | Parsing mode: `advance`, `standard`, or `agentic` |\r\n| `--enable-long-doc` | string | No | Enable long document processing (`true`/`false`); if omitted, server default behavior is preserved |\r\n| `--long-doc-config` | string (JSON) | No | Long document type configuration (only applied when `--enable-long-doc true`) |\r\n\r\n### `adp custom-app get-config`\r\n\r\nView custom application configuration.\r\n\r\n| Option | Type | Required | Description |\r\n|--------|------|----------|-------------|\r\n| `--api-key` | string | No | Override configured API Key |\r\n| `--app-id` | string | **Yes** | Application ID |\r\n| `--config-version` | string | No | Configuration version (e.g., `v1`) |\r\n\r\n### `adp custom-app delete`\r\n\r\nDelete a custom application.\r\n\r\n| Option | Type | Required | Description |\r\n|--------|------|----------|-------------|\r\n| `--api-key` | string | No | Override configured API Key |\r\n| `--app-id` | string | **Yes** | Application ID to delete |\r\n\r\n### `adp custom-app delete-version`\r\n\r\nDelete a specific version of a custom application.\r\n\r\n| Option | Type | Required | Description |\r\n|--------|------|----------|-------------|\r\n| `--api-key` | string | No | Override configured API Key |\r\n| `--app-id` | string | **Yes** | Application ID |\r\n| `--config-version` | string | **Yes** | Version to delete (e.g., `v2`) |\r\n\r\n### `adp custom-app ai-generate`\r\n\r\nAI-powered field recommendation based on a sample document.\r\n\r\n| Option | Type | Required | Description |\r\n|--------|------|----------|-------------|\r\n| `--api-key` | string | No | Override configured API Key |\r\n| `--app-id` | string | **Yes** | Application ID |\r\n| `--file-url` | string | No | Sample document URL |\r\n| `--file-local` | string | No | Sample document local path |\r\n| `--base64` | string | No | Sample document base64 content |\r\n\r\n> Note: Provide exactly one of `--file-url`, `--file-local`, or `--base64`.\r\n\r\n---\r\n\r\n## schema — Machine-Readable Command Spec\r\n\r\n### `adp schema`\r\n\r\nOutput the complete command schema in JSON format. Designed for Agent introspection — Agent can call this command at startup to dynamically discover all available commands, parameters, types, and defaults.\r\n\r\n---\r\n\r\n## help — Help\r\n\r\n### `adp --help`\r\n\r\nView the complete list of commands and usage instructions.\r\n\r\n---\r\n\r\n## ADP Error Codes\r\n\r\nSee [error-handling.md](error-handling.md) for the complete error code reference and Agent recovery strategies.\n\nFile v1.10.3:references/error-handling.md\n\n# ADP CLI Error Handling Guide for Agent\r\n\r\n> This document defines all error types, exit codes, and recommended Agent recovery strategies.\r\n\r\n## Error Output Format\r\n\r\nErrors are output to **stderr**. In JSON mode (`--json` or non-TTY), the format is:\r\n\r\n```json\r\n{\r\n  \"type\": \"ERROR_TYPE\",\r\n  \"message\": \"Human-readable error description\",\r\n  \"fix\": \"Suggested fix action\",\r\n  \"retryable\": true,\r\n  \"details\": {\"context\": \"command_name\"}\r\n}\r\n```\r\n\r\nKey field for Agent: **`retryable`** — if `true`, the Agent should retry with exponential backoff.\r\n\r\n---\r\n\r\n## Error Types and Agent Recovery Strategies\r\n\r\n### AUTH_ERROR (Exit Code: 4)\r\n\r\n**Triggers:** Invalid API Key, expired API Key, authentication failed, 401/403 HTTP status.\r\n\r\n**Agent strategy:**\r\n1. Run `adp config get` to check if API Key is configured\r\n2. If not configured → prompt user to provide API Key\r\n3. If configured but invalid → prompt user to verify/update API Key\r\n4. Do NOT retry automatically — authentication errors are not transient\r\n\r\n### PARAM_ERROR (Exit Code: 2)\r\n\r\n**Triggers:** Invalid JSON format, unsupported file type, invalid parameter value, missing required parameter.\r\n\r\n**Agent strategy:**\r\n1. Read the `message` field to identify which parameter is wrong\r\n2. Fix the parameter and retry\r\n3. Common fixes:\r\n   - JSON parse error → validate JSON syntax in `--extract-fields` or `--long-doc-config`\r\n   - Unsupported file type → check file extension is one of: .jpg, .jpeg, .png, .bmp, .tiff, .tif, .pdf, .doc, .docx, .xls, .xlsx\r\n   - Invalid enum value → check `--parse-mode` is one of: `advance`, `standard`, `agentic`\r\n\r\n### RESOURCE_ERROR (Exit Code: 3)\r\n\r\n**Triggers:** app-id not found, file not found, task not found, version not found, 404 HTTP status.\r\n\r\n**Agent strategy:**\r\n1. If app-id not found → run `adp app-id list` to refresh, then retry with correct app-id\r\n2. If local file not found → verify file path exists\r\n3. If task not found → the task_id may be incorrect or expired\r\n4. Do NOT retry with same parameters\r\n\r\n### NETWORK_ERROR (Exit Code: 1)\r\n\r\n**Triggers:** Connection refused, DNS lookup failure, timeout, TLS handshake error.\r\n\r\n**Agent strategy:**\r\n1. This is retryable — retry with exponential backoff (2s, 4s, 8s)\r\n2. Max 3 retries\r\n3. If still failing → check network connectivity, verify `--api-base-url` is correct\r\n4. Consider using `--timeout` with a larger value for slow networks\r\n\r\n### API_ERROR (Exit Code: 1)\r\n\r\n**Triggers:** Rate limiting (429), server error (5xx), generic API failures.\r\n\r\n**Agent strategy:**\r\n1. If 429 (rate limited) → wait 30 seconds, then retry\r\n2. If 5xx → retry with exponential backoff, max 3 attempts\r\n3. If persistent → suggest user contact support (global_product@laiye.com)\r\n\r\n### CONFLICT_ERROR (Exit Code: 5)\r\n\r\n**Triggers:** Resource already exists, duplicate app name.\r\n\r\n**Agent strategy:**\r\n1. If creating custom-app with duplicate name → use a different `--app-name`\r\n2. If updating → check current state with `custom-app get-config` first\r\n3. Do NOT retry with same parameters\r\n\r\n### SYSTEM_ERROR (Exit Code: 1)\r\n\r\n**Triggers:** Unexpected internal errors.\r\n\r\n**Agent strategy:**\r\n1. Log the error message for diagnostics\r\n2. Do NOT retry — these are typically programming errors or unexpected states\r\n3. Suggest user report the issue\r\n\r\n---\r\n\r\n## Exit Codes Quick Reference\r\n\r\n| Code | Name | Retryable | Agent Action |\r\n|------|------|-----------|--------------|\r\n| 0 | Success | — | Proceed normally |\r\n| 1 | General Error | Depends on type | Check `retryable` field in error JSON |\r\n| 2 | Parameter Error | No | Fix parameter and retry |\r\n| 3 | Resource Not Found | No | Verify resource ID/path |\r\n| 4 | Permission Denied | No | Prompt user for credentials |\r\n| 5 | Conflict | No | Change conflicting parameter |\r\n| 6 | Partial Failure | — | Check batch summary for per-file status |\r\n\r\n---\r\n\r\n## Batch Processing Error Handling\r\n\r\nExit code `6` (Partial Failure) means some files succeeded and some failed in a batch.\r\n\r\n**Agent strategy:**\r\n1. Parse the stdout summary JSON\r\n2. For files with `\"status\": \"failed\"`, read the `error` field\r\n3. Decide per-file: retry failed files individually, or report to user\r\n4. Use `--retry N` flag to enable automatic retry with exponential backoff at CLI level\r\n\r\n---\r\n\r\n## Credit-Related Errors\r\n\r\nWhen credit balance is insufficient, the API returns a specific error. Agent should:\r\n1. Run `adp credit` to check remaining balance\r\n2. Report the balance to user\r\n3. Provide billing reference:\r\n   - Document parsing: 0.5 credits/page\r\n   - Invoice/receipt extraction: 1.5 credits/page\r\n   - Order extraction: 1.5 credits/page\r\n   - Custom extraction: 1 credit/page\r\n\r\n---\r\n\r\n## Timeout Handling\r\n\r\nDefault timeout is 900 seconds (15 minutes). For large documents or slow networks:\r\n\r\n**Agent strategy:**\r\n1. If timeout occurs on sync processing → retry with `--async` mode\r\n2. For files >20MB or >200 pages → always use `--async`\r\n3. Increase timeout with `--timeout 1800` if needed\n\nFile v1.10.3:references/examples.md\n\n# ADP CLI Sample code and response\r\n\r\n## 1. Install ADP CLI\r\n\r\nFirst check if ADP CLI is already installed by running `adp version`. If it succeeds, skip to step 2.\r\n\r\nIf not installed, choose the appropriate method:\r\n\r\n```bash\r\n# Method 1: npm (recommended, works on all platforms, China-friendly with npmmirror)\r\nnpm install -g @laiye-adp/agentic-doc-parse-and-extract-cli --registry=https://registry.npmmirror.com/ || npm install -g @laiye-adp/agentic-doc-parse-and-extract-cli\r\n\r\n# Method 2: Shell script (Linux / macOS, if npm is not available)\r\ncurl -fsSL https://raw.githubusercontent.com/laiye-ai/adp-cli/main/scripts/adp-init.sh | bash\r\n\r\n# Method 3: PowerShell script (Windows, if npm is not available)\r\nInvoke-WebRequest -Uri \"https://raw.githubusercontent.com/laiye-ai/adp-cli/main/scripts/adp-init.ps1\" -OutFile \"$env:TEMP\\adp-init.ps1\"; & \"$env:TEMP\\adp-init.ps1\"\r\n```\r\n\r\n### Resolving `adp` when it's not on PATH (important for Agents)\r\n\r\nAfter `npm install -g`, the npm global bin directory is often **not** on the current shell's `PATH`, so a bare `adp` call will fail with \"command not found\". Agents must resolve the absolute path to the `adp` binary instead of relying on `PATH`.\r\n\r\n**Resolution rule:**\r\n- **Windows**: `npm prefix -g` returns the directory that already contains `adp.cmd` / `adp.exe`. Use `<prefix>\\adp.cmd`.\r\n- **Linux / macOS**: `npm prefix -g` returns the prefix; the binary lives at `<prefix>/bin/adp`.\r\n\r\n**Cross-platform one-liner to locate the binary:**\r\n\r\n```bash\r\n# Linux / macOS (bash/zsh)\r\nADP_BIN=\"$(npm prefix -g)/bin/adp\"\r\n\"$ADP_BIN\" version\r\n```\r\n\r\n```powershell\r\n# Windows (PowerShell)\r\n$ADP_BIN = Join-Path (npm prefix -g) \"adp.cmd\"\r\n& $ADP_BIN version\r\n```\r\n\r\n```bash\r\n# Windows (Git Bash / MSYS in Claude Code)\r\nADP_BIN=\"$(npm prefix -g)/adp.cmd\"\r\n\"$ADP_BIN\" version\r\n```\r\n\r\n**Optional**: prepend the directory to PATH for the current shell session only (does not persist):\r\n```bash\r\n# bash/zsh\r\nexport PATH=\"$(dirname \"$ADP_BIN\"):$PATH\"\r\n```\r\n```powershell\r\n# PowerShell\r\n$env:PATH = \"$(Split-Path $ADP_BIN);$env:PATH\"\r\n```\r\n\r\n### Agent installation logic\r\n\r\n1. Run `adp version` — if it succeeds, CLI is already installed and on PATH, skip installation and use bare `adp` for all subsequent commands.\r\n2. If not installed, check if `npm` is available → use Method 1. Else detect OS: Linux / macOS → Method 2; Windows → Method 3.\r\n3. **After install, do NOT assume `adp` is on PATH.** Resolve `ADP_BIN`:\r\n   - **Method 1 (npm)**: use the platform rule above (`npm prefix -g` ± `/bin`).\r\n   - **Method 2 / 3 (shell scripts)**: parse the last line of script output — it prints `ADP_INSTALL_PATH=<absolute path>` for this exact purpose.\r\n4. Verify with `\"$ADP_BIN\" version` (or `& $ADP_BIN version` in PowerShell). If it succeeds, install is good.\r\n5. For all subsequent `adp ...` examples in this document, substitute the bare `adp` with `\"$ADP_BIN\"` (or your resolved absolute path) until the user opens a new terminal where PATH is refreshed.\r\n\r\n## 2. Configure API Key and Base URL\r\n\r\n### Verify configuration\r\n\r\n```bash\r\nadp config get\r\n```\r\n\r\n**Response example**：\r\n```json\r\n{\r\n  \"configured\": true,\r\n  \"api_key_masked\": \"9ce0...ab4f\",\r\n  \"api_base_url\": \"https://adp.laiye.com/\"\r\n}\r\n```\r\n### configuration\r\n```bash\r\n# Configure API Key\r\nadp config set --api-key YOUR_API_KEY\r\n\r\n# Configure Base URL\r\nadp config set --api-base-url https://your-api-url.com\r\n```\r\n\r\n\r\n## 3. Query the list of available applications\r\n\r\n```bash\r\n# List available applications\r\nadp app-id list \r\n\r\n# Show cached applications（The application ID cache is permanent and will not expire）\r\nadp app-id cache \r\n```\r\n\r\n\r\n**Response example**：\r\n```json\r\n  [\r\n    {\r\n      \"app_id\": \"2f74******58400\",\r\n      \"app_label\": null,\r\n      \"app_name\": \"Custom Application Name\",\r\n      \"app_type\": 1\r\n    },\r\n   {\r\n      \"app_id\": \"ootb_******c8d1\",\r\n      \"app_label\": [\r\n        \"invoice\",\r\n        \"Receipt\",\r\n        \"Bill\",\r\n        \"Financial document\",\r\n        \"Information extraction\"\r\n      ],\r\n      \"app_name\": \"Invoice\",\r\n      \"app_type\": 0\r\n    },\r\n   {\r\n      \"app_id\": \"ootb_******a2b5\",\r\n      \"app_label\": [\r\n        \"Order\",\r\n        \"E-commerce logistics\",\r\n        \"Inventory management\",\r\n        \"Information extraction\"\r\n      ],\r\n      \"app_name\": \"Purchase Order\",\r\n      \"app_type\": 0\r\n    },\r\n    {\r\n      \"app_id\": \"ootb_******y2b4\",\r\n      \"app_label\": [\r\n        \"Document parsing\",\r\n        \"Image extraction\",\r\n        \"OCR\",\r\n        \"Structural analysis\",\r\n        \"Batch Parsing\"\r\n      ],\r\n      \"app_name\": \"Document parsing\",\r\n      \"app_type\": 0\r\n    },\r\n  ]\r\n```\r\n\r\n## 4. Create a custom extraction application\r\n\r\n```bash\r\n# First, use AI to generate field recommendations\r\nadp custom-app ai-generate --app-id YOUR_APP_ID --file-url https://example.com/sample-invoice.pdf\r\n\r\n# Second, Create a custom application\r\nadp custom-app create \\\r\n  --api-key \"9ce0********4b4f\" \\\r\n  --app-name \"Financial document extraction\" \\\r\n  --extract-fields '[\r\n    {\"field_name\":\"Invoice number\",\"field_type\":\"string\",\"field_prompt\":\"Extract the serial number at the top left corner of the invoice\"},\r\n    {\"field_name\":\"Invoice date\",\"field_type\":\"date\",\"field_prompt\":\"Extract the invoice issuance date\"},\r\n    {\"field_name\":\"Product details\",\"field_type\":\"table\",\"field_prompt\": null,\"sub_fields\": \r\n    [\r\n      {\"field_name\":\"Contract Number\",\"field_type\":\"string\",\"field_prompt\":\"Extract the contract number\"},\r\n      {\"field_name\":\"Signing Date\",\"field_type\": \"date\",\"field_prompt\":\"Extract the signing date\"}\r\n    ]\r\n    }\r\n  ]' \\\r\n  --parse-mode \"standard\" \\\r\n  --enable-long-doc true \\\r\n  --long-doc-config '[\r\n    {\"doc_type\":\"Contract\",\"doc_desc\":\"Multi-page contract\"},\r\n    {\"doc_type\":\"Tender document\",\"doc_desc\":\"Engineering tender documents\"}\r\n  ]'\r\n```\r\n\r\n**Response example**：\r\n```json\r\n{\r\n  \"code\": \"success\",\r\n  \"message\": \"\",\r\n  \"tips\": null,\r\n  \"data\": {\r\n    \"app_id\": \"ed5195882cd311f19359627c0509427d\",\r\n    \"app_name\": \"Custom Application Name\",\r\n    \"app_label\": [\"Custom Label 1\", \"Custom Label 2\"] , \"config_version\": \"v1\"\r\n  }\r\n}\r\n```\r\n\r\n## 5. Document Parsing\r\n\r\n```bash\r\nadp parse url <File URL> --app-id YOUR_APP_ID\r\n```\r\n\r\n**Response example**：\r\n```json\r\n{\r\n  \"data\": {\r\n    \"task_id\": \"\",\r\n    \"file_url\": \"\",\r\n    \"status\": 4,\r\n    \"message\": \"\",\r\n    \"doc_recognize_result\": [\r\n      {\r\n        \"page_num\": 1,\r\n        \"document_content\": \"Electronic invoice\\n\\nTax Bureau\\n\\nInvoice code: 144032009110\\n\\nInvoice number: 23700770\\n\\ndate: 2020-12-13\",\r\n        \"document_details\": [\r\n          {\r\n            \"type\": \"Text\",\r\n            \"text\": \"Incoice\",\r\n            \"position\": [\r\n              {\r\n                \"points\": [\r\n                  {\"x\": 311, \"y\": 50},\r\n                  {\"x\": 369, \"y\": 50},\r\n                  {\"x\": 369, \"y\": 59},\r\n                  {\"x\": 311, \"y\": 59}\r\n                ]\r\n              }\r\n            ],\r\n            \"ocr_confidence\": {\r\n              \"ocr_mean_confidence\": 0.9989976211580984,\r\n              \"ocr_min_confidence\": 0.9989976211580984,\r\n              \"is_overall_confidence\": 1\r\n            }\r\n          },\r\n          {\r\n            \"type\": \"Text\",\r\n            \"text\": \"invoice number: 23700770\",\r\n            \"position\": [\r\n              {\r\n                \"points\": [\r\n                  {\"x\": 493, \"y\": 32},\r\n                  {\"x\": 573, \"y\": 32},\r\n                  {\"x\": 573, \"y\": 42},\r\n                  {\"x\": 493, \"y\": 42}\r\n                ]\r\n              }\r\n            ],\r\n            \"ocr_confidence\": {\r\n              \"ocr_mean_confidence\": 0.9999735751246535,\r\n              \"ocr_min_confidence\": 0.9997363785557283,\r\n              \"is_overall_confidence\": 1\r\n            }\r\n          },\r\n          {\r\n            \"type\": \"Text\",\r\n            \"text\": \"Date: 2020-12-13\",\r\n            \"position\": [\r\n              {\r\n                \"points\": [\r\n                  {\"x\": 493, \"y\": 50},\r\n                  {\"x\": 623, \"y\": 50},\r\n                  {\"x\": 623, \"y\": 60},\r\n                  {\"x\": 493, \"y\": 60}\r\n                ]\r\n              }\r\n            ],\r\n            \"ocr_confidence\": {\r\n              \"ocr_mean_confidence\": 0.9999853806227165,\r\n              \"ocr_min_confidence\": 0.9998685294404747,\r\n              \"is_overall_confidence\": 1\r\n            }\r\n          },\r\n          {\r\n            \"type\": \"Picture\",\r\n            \"text\": \"https://adp.laiye.com/web/agentic_doc_processor/laiye/file/e4b140162cd511f19d1c627c0509427d\",\r\n            \"position\": [\r\n              {\r\n                \"points\": [\r\n                  {\"x\": 541, \"y\": 329},\r\n                  {\"x\": 666, \"y\": 329},\r\n                  {\"x\": 666, \"y\": 428},\r\n                  {\"x\": 541, \"y\": 428}\r\n                ]\r\n              }\r\n            ],\r\n            \"ocr_confidence\": {\r\n              \"ocr_mean_confidence\": 0.9506070037576528,\r\n              \"ocr_min_confidence\": 0.07206936378157035,\r\n              \"is_overall_confidence\": 0\r\n            }\r\n          }\r\n        ]\r\n      }\r\n    ]\r\n  },\r\n  \"code\": \"success\",\r\n  \"message\": \"\",\r\n  \"tips\": null\r\n}\r\n```\r\n\r\n## 6. Document extraction\r\n\r\n```bash\r\nadp extract url <file URL> --app-id YOUR_APP_ID\r\n```\r\n\r\n**Response example**：\r\n```json\r\n[\r\n  {\r\n    \"field_key\": \"invoice_number\",\r\n    \"field_name\": \"invoice number\",\r\n    \"field_values\": [\r\n      {\r\n        \"field_value\": \"24VLT0591617\",\r\n        \"field_confidence\": 1.0,\r\n        \"references\": []\r\n      }\r\n    ]\r\n  },\r\n  {\r\n    \"field_key\": \"invoice_date\",\r\n    \"field_name\": \"date\",\r\n    \"field_values\": [\r\n      {\r\n        \"field_value\": \"2024-11-01\",\r\n        \"field_confidence\": 1.0,\r\n        \"references\": []\r\n      }\r\n    ]\r\n  },\r\n  {\r\n    \"field_key\": \"currency\",\r\n    \"field_name\": \"Currency type\",\r\n    \"field_values\": [\r\n      {\r\n        \"field_value\": \"EUR\",\r\n        \"field_confidence\": 0.0,\r\n        \"references\": []\r\n      }\r\n    ]\r\n  },\r\n  {\r\n    \"field_key\": \"total_without_tax\",\r\n    \"field_name\": \"Total amount (excluding tax)\",\r\n    \"field_values\": [\r\n      {\r\n        \"field_value\": \"€ 1.223,43\",\r\n        \"field_confidence\": 1.0,\r\n        \"references\": []\r\n      }\r\n    ]\r\n  },\r\n  {\r\n    \"field_key\": \"line_items\",\r\n    \"field_name\": \"Product Details Table\",\r\n    \"references\": [],\r\n    \"field_confidence\": 1.0,\r\n    \"table_values\": [\r\n      [\r\n        {\r\n          \"field_name\": \"Project code\",\r\n          \"field_values\": [\r\n            {\r\n              \"field_value\": \"241021 SI0421.00\",\r\n              \"field_confidence\": 1.0,\r\n              \"references\": \"Project code: 241021 SI0421.00\"\r\n            }\r\n          ],\r\n          \"field_key\": \"line_items_item_code\"\r\n        },\r\n        {\r\n          \"field_name\": \"Description\",\r\n          \"field_values\": [\r\n            {\r\n              \"field_value\": \"TESLA MODEL 3 BEV LONG-RANGE DUAL MOTOR AWD\",\r\n              \"field_confidence\": 1.0,\r\n              \"references\": \"Description: TESLA MODEL 3 BEV LONG-RANGE DUAL MOTOR AWD\"\r\n            }\r\n          ],\r\n          \"field_key\": \"line_items_description\"\r\n        },\r\n        {\r\n          \"field_name\": \"number\",\r\n          \"field_values\": [\r\n            {\r\n              \"field_value\": \"1\",\r\n              \"field_confidence\": 1.0,\r\n              \"references\": \"number: 1\"\r\n            }\r\n          ],\r\n          \"field_key\": \"line_items_quantity\"\r\n        },\r\n        {\r\n          \"field_name\": \"Unit price\",\r\n          \"field_values\": [\r\n            {\r\n              \"field_value\": \"€ 1.223,43\",\r\n              \"field_confidence\": 1.0,\r\n              \"references\": \"Unit price: € 1.223,43\"\r\n            }\r\n          ],\r\n          \"field_key\": \"line_items_unit_price\"\r\n        },\r\n        {\r\n          \"field_name\": \"Total amount\",\r\n          \"field_values\": [\r\n            {\r\n              \"field_value\": \"€ 1.223,43\",\r\n              \"field_confidence\": 1.0,\r\n              \"references\": \"Total amount: € 1.223,43\"\r\n            }\r\n          ],\r\n          \"field_key\": \"line_items_total_amount\"\r\n        }\r\n      ]\r\n    ]\r\n  }\r\n]\r\n```\r\n\r\n## 7. Batch Processing \r\n```bash\r\n# Batch processing of documents in the local folder\r\nadp parse local <folder path> --app-id <app_ID> --export <folder path> --concurrency 2\r\nadp extract local <folder path> --app-id <app_ID> --export <folder path> --concurrency 2 \r\n\r\n# Batch processing of documents within the URL list file\r\nadp parse url <URL list file path> --app-id <app_ID> --export <folder path> --concurrency 2\r\nadp extract url <URL list file path> --app-id <app_ID> --export <folder path> --concurrency 2\r\n```\r\n\r\n**Note**: Batch processing requires processing all the files in the folder sequentially, and the output result supports being specified to be saved in the user-defined folder path.\r\n\r\n## 8. Asynchronous Processing \r\n```bash\r\n# Batch processing of documents in the local folder\r\nadp parse local <file path> --app-id <app_ID> --export <folder path> --concurrency 2 --async\r\nadp extract local <file path> --app-id <app_ID> --export <folder path> --concurrency 2 --async \r\n\r\n# Batch processing of documents within the URL list file\r\nadp parse url <file URL> --app-id <app_ID> --export <folder path> --concurrency 2 --async\r\nadp extract url <file URL> --app-id <app_ID> --export <folder path> --concurrency 2 --async \r\n\r\n# Query the status and results of asynchronous parsing processing tasks \r\nadp parse query <task_id>\r\n\r\n# Query the status and results of asynchronous extraction processing tasks \r\nadp extract query <task_id>\r\n```\r\n\r\n\r\n**Query Response example**：\r\n```json\r\n{\r\n  \"Task_ID\": \"dffe****427d\",\r\n  \"Status\": \"SUCCESS\"\r\n}\r\n```\r\n\r\n## 9. Batch Processing Output\r\n\r\nWhen processing multiple files, the CLI creates an output directory and writes individual result files.\r\n\r\n### Sync batch output\r\n\r\n```bash\r\nadp extract local ./invoices/ --app-id YOUR_APP_ID --export ./results --concurrency 2\r\n```\r\n\r\n**stdout output (summary JSON):**\r\n```json\r\n{\r\n  \"total\": 3,\r\n  \"success\": 2,\r\n  \"failed\": 1,\r\n  \"output_dir\": \"/home/user/results\",\r\n  \"files\": [\r\n    {\"input\": \"invoice1.pdf\", \"output\": \"invoice1.pdf.json\", \"status\": \"success\"},\r\n    {\"input\": \"invoice2.pdf\", \"output\": \"invoice2.pdf.json\", \"status\": \"success\"},\r\n    {\"input\": \"corrupted.pdf\", \"output\": \"corrupted.pdf.error.json\", \"status\": \"failed\", \"error\": \"Bad request: unsupported file format\"}\r\n  ]\r\n}\r\n```\r\n\r\n**Output directory structure:**\r\n```\r\nresults/\r\n  ├── invoice1.pdf.json          # Full extract result (same format as single-file response)\r\n  ├── invoice2.pdf.json\r\n  ├── corrupted.pdf.error.json   # {\"input\": \"corrupted.pdf\", \"status\": \"failed\", \"error\": \"...\"}\r\n  └── _summary.json              # Same content as stdout summary\r\n```\r\n\r\n**Agent must:** Read `output_dir` from summary, then read each `{output_dir}/{filename}.json` to get individual results.\r\n\r\n### Async batch with --no-wait\r\n\r\n```bash\r\nadp extract local ./invoices/ --app-id YOUR_APP_ID --async --no-wait --export tasks.json\r\n```\r\n\r\n**Output (tasks.json):**\r\n```json\r\n[\r\n  {\"path\": \"invoice1.pdf\", \"task_id\": \"abc123def456\"},\r\n  {\"path\": \"invoice2.pdf\", \"task_id\": \"ghi789jkl012\"}\r\n]\r\n```\r\n\r\n**Later, query all tasks:**\r\n```bash\r\nadp extract query --file tasks.json --watch --export ./results\r\n```\r\n\r\n---\r\n\r\n## 10. Error Scenario Examples\r\n\r\n### Authentication error (API Key not configured)\r\n\r\n```bash\r\nadp extract url https://example.com/invoice.pdf --app-id YOUR_APP_ID --json\r\n```\r\n\r\n**stderr output:**\r\n```json\r\n{\r\n  \"type\": \"AUTH_ERROR\",\r\n  \"message\": \"Authentication error: unauthorized\",\r\n  \"fix\": \"Check your API key is correct and has not expired.\",\r\n  \"retryable\": false,\r\n  \"details\": {\"context\": \"extract\"}\r\n}\r\n```\r\n**Exit code:** 4\r\n\r\n**Agent recovery:** Run `adp config get` to check, then prompt user for API Key.\r\n\r\n### Credit balance insufficient\r\n\r\n```bash\r\nadp credit --json\r\n```\r\n\r\n```json\r\n{\r\n  \"credit_balance\": 0.0\r\n}\r\n```\r\n\r\n**Agent recovery:** Report balance to user. Billing: parse 0.5/page, extract 1-1.5/page.\r\n\r\n### Invalid app-id\r\n\r\n```bash\r\nadp extract url https://example.com/invoice.pdf --app-id invalid_id --json\r\n```\r\n\r\n**stderr output:**\r\n```json\r\n{\r\n  \"type\": \"RESOURCE_ERROR\",\r\n  \"message\": \"Resource not found: app not found\",\r\n  \"fix\": \"Check the resource ID or path is correct.\",\r\n  \"retryable\": false,\r\n  \"details\": {\"context\": \"extract\"}\r\n}\r\n```\r\n**Exit code:** 3\r\n\r\n**Agent recovery:** Run `adp app-id list` to get valid app IDs.\r\n\r\n### Unsupported file format\r\n\r\n```bash\r\nadp parse local ./readme.txt --app-id YOUR_APP_ID --json\r\n```\r\n\r\n**stderr output:**\r\n```json\r\n{\r\n  \"type\": \"PARAM_ERROR\",\r\n  \"message\": \"Parameter error: unsupported file type\",\r\n  \"fix\": \"Check the input parameters are correct.\",\r\n  \"retryable\": false,\r\n  \"details\": {\"context\": \"parse\"}\r\n}\r\n```\r\n**Exit code:** 2\r\n\r\n**Agent recovery:** Check file extension. Supported: .jpg, .jpeg, .png, .bmp, .tiff, .tif, .pdf, .doc, .docx, .xls, .xlsx\r\n\r\n### Network timeout\r\n\r\n```bash\r\nadp parse url https://example.com/large-doc.pdf --app-id YOUR_APP_ID --json\r\n```\r\n\r\n**stderr output:**\r\n```json\r\n{\r\n  \"type\": \"NETWORK_ERROR\",\r\n  \"message\": \"Network error: i/o timeout\",\r\n  \"fix\": \"Check your network connection and try again.\",\r\n  \"retryable\": true,\r\n  \"details\": {\"context\": \"parse\"}\r\n}\r\n```\r\n**Exit code:** 1\r\n\r\n**Agent recovery:** Retry with `--timeout 1800`, or switch to `--async` mode for large files.\r\n\r\n### Async task not yet complete\r\n\r\n```bash\r\nadp parse query abc123def456 --json\r\n```\r\n\r\n```json\r\n{\r\n  \"task_id\": \"abc123def456\",\r\n  \"status\": \"PROCESSING\"\r\n}\r\n```\r\n\r\n**Agent recovery:** Wait and query again. Use `--watch` flag to auto-poll until completion.\r\n\r\n### Batch partial failure\r\n\r\n```bash\r\nadp extract local ./mixed_docs/ --app-id YOUR_APP_ID --export ./results --json\r\n```\r\n\r\n**Exit code:** 6 (partial failure)\r\n\r\n**Agent recovery:** Parse the summary JSON, handle successful files normally, report or retry failed files individually.\r\n\r\n---\r\n\r\n## Description of Response Fields \r\n\r\n### Document Extraction Response Key Fields\r\n- `field_name`: The name of the extracted field. If it contains \"table_values\", it indicates that this is a table field and the `field_name` is usually the name of the table; if it does not contain \"table_values\", it indicates an ordinary field and the `field_name` is usually the description of the field\r\n- `field_value`: The specific value of the extraction result\r\n- `field_confidence`: The confidence score of the extraction result, ranging from 0 to 1. The higher the value, the more reliable the extraction result\r\n- `table_values`: The extraction result of the table type, presented in a two-dimensional array format, including the extraction result of each cell and the corresponding field name, confidence level, etc. The array under it usually contains the contents of `field_name`, `field_value`, `field_confidence`, etc. \r\n\r\n## Custom Application Parameter Description \r\n\r\n### parse_mode (Parsing Mode)\r\nThere are 3 modes available for selection:\r\n1. `advance`: Enhanced parsing, suitable for documents with complex formats such as seals, signatures, and multi-tables\r\n2. `standard`: Standard parsing, suitable for standard and clear electronic documents\r\n3. `agentic`: Intelligent parsing, intelligently combining multiple models for parsing, significantly improving the stability of parsing for complex documents \r\n\r\n### Other Parameters\r\n- `app_label`: Up to 5 can be added\r\n- `enable-long-doc`: Default is off (false). It can be enabled (true) when dealing with long documents. It precisely extracts fields within the specified document type and uses independent billing (0.5 credit per page). It is usually enabled when the document has more than 20 pages and has multiple types. When enabled, it needs to be used in conjunction with `doc_type` and `doc_desc`.\n\nFile v1.10.3:references/response-schema.md\n\n# ADP CLI Response Schema Reference\r\n\r\n> This document defines the output structure of each command so that Agent can reliably parse results.\r\n\r\n## Output Modes\r\n\r\nThe CLI has two output modes controlled by `--json` flag:\r\n- **Human-readable** (default in TTY): colored text with formatting\r\n- **JSON mode** (`--json` or non-TTY/pipe): structured JSON to stdout, errors to stderr\r\n\r\n**Agent should always use `--json` flag** or pipe output to ensure machine-readable JSON.\r\n\r\n---\r\n\r\n## config get\r\n\r\n```json\r\n{\r\n  \"configured\": true,\r\n  \"api_key_masked\": \"9ce0...ab4f\",\r\n  \"api_base_url\": \"https://adp.laiye.com/\"\r\n}\r\n```\r\n\r\n| Field | Type | Description |\r\n|-------|------|-------------|\r\n| `configured` | boolean | Whether API Key is configured |\r\n| `api_key_masked` | string | Masked API Key (first 4 + last 4 chars) |\r\n| `api_base_url` | string | Current API Base URL |\r\n\r\n---\r\n\r\n## app-id list\r\n\r\n```json\r\n[\r\n  {\r\n    \"app_id\": \"61ac******bd21\",\r\n    \"app_name\": \"Overseas Invoices/Receipts\",\r\n    \"app_label\": [\"Invoice\", \"Receipt\", \"Bill\"],\r\n    \"app_type\": 1\r\n  }\r\n]\r\n```\r\n\r\n| Field | Type | Description |\r\n|-------|------|-------------|\r\n| `app_id` | string | Application ID (use this for `--app-id`) |\r\n| `app_name` | string | Application display name |\r\n| `app_label` | string[] | Labels for matching user intent |\r\n| `app_type` | int | 0:Out-of-the-box application(Pre-set);1:Custom application|\r\n\r\n---\r\n\r\n## credit\r\n\r\n```json\r\n{\r\n  \"credit_balance\": 95.5\r\n}\r\n```\r\n\r\n---\r\n\r\n## parse (single file, sync)\r\n\r\nTop-level response:\r\n\r\n```json\r\n{\r\n  \"code\": \"success\",\r\n  \"message\": \"\",\r\n  \"tips\": null,\r\n  \"data\": {\r\n    \"task_id\": \"\",\r\n    \"file_url\": \"\",\r\n    \"status\": 4,\r\n    \"message\": \"\",\r\n    \"doc_recognize_result\": [...]\r\n  }\r\n}\r\n```\r\n\r\n### doc_recognize_result item\r\n\r\n```json\r\n{\r\n  \"page_num\": 1,\r\n  \"document_content\": \"Full text content of this page...\",\r\n  \"document_details\": [\r\n    {\r\n      \"type\": \"Text | Picture | Table\",\r\n      \"text\": \"content or image URL\",\r\n      \"position\": [{\"points\": [{\"x\": 311, \"y\": 50}, ...]}],\r\n      \"ocr_confidence\": {\r\n        \"ocr_mean_confidence\": 0.999,\r\n        \"ocr_min_confidence\": 0.998,\r\n        \"is_overall_confidence\": 1\r\n      }\r\n    }\r\n  ]\r\n}\r\n```\r\n\r\n| Field | Type | Description |\r\n|-------|------|-------------|\r\n| `page_num` | integer | Page number (1-indexed) |\r\n| `document_content` | string | Full text of the page in reading order |\r\n| `document_details` | array | Element-level details with position and confidence |\r\n| `document_details[].type` | string | Element type: `Text`, `Picture`, or `Table` |\r\n| `document_details[].text` | string | Text content, or image URL for Picture type |\r\n| `document_details[].position` | array | Bounding box coordinates (4 corner points) |\r\n| `document_details[].ocr_confidence.ocr_mean_confidence` | float | Average OCR confidence (0-1) |\r\n| `document_details[].ocr_confidence.ocr_min_confidence` | float | Minimum OCR confidence (0-1) |\r\n\r\n---\r\n\r\n## extract (single file, sync)\r\n\r\nReturns an array of extracted fields:\r\n\r\n```json\r\n[\r\n  {\r\n    \"field_key\": \"invoice_number\",\r\n    \"field_name\": \"Invoice Number\",\r\n    \"field_values\": [\r\n      {\r\n        \"field_value\": \"24VLT0591617\",\r\n        \"field_confidence\": 1.0,\r\n        \"references\": []\r\n      }\r\n    ]\r\n  },\r\n  {\r\n    \"field_key\": \"line_items\",\r\n    \"field_name\": \"Product Details Table\",\r\n    \"references\": [],\r\n    \"field_confidence\": 1.0,\r\n    \"table_values\": [\r\n      [\r\n        {\r\n          \"field_name\": \"Description\",\r\n          \"field_key\": \"line_items_description\",\r\n          \"field_values\": [\r\n            {\r\n              \"field_value\": \"TESLA MODEL 3\",\r\n              \"field_confidence\": 1.0,\r\n              \"references\": \"Description: TESLA MODEL 3\"\r\n            }\r\n          ]\r\n        }\r\n      ]\r\n    ]\r\n  }\r\n]\r\n```\r\n\r\n### Field types\r\n\r\n**Regular field** (no `table_values`):\r\n\r\n| Field | Type | Description |\r\n|-------|------|-------------|\r\n| `field_key` | string | Machine-readable field identifier |\r\n| `field_name` | string | Human-readable field name |\r\n| `field_values` | array | Extracted values |\r\n| `field_values[].field_value` | string | The extracted value |\r\n| `field_values[].field_confidence` | float | Confidence score (0-1) |\r\n\r\n**Table field** (has `table_values`):\r\n\r\n| Field | Type | Description |\r\n|-------|------|-------------|\r\n| `field_key` | string | Table identifier (e.g., `line_items`) |\r\n| `field_name` | string | Table name |\r\n| `table_values` | array[array] | 2D array: rows of cells, each cell has `field_name`, `field_key`, `field_values` |\r\n\r\n### How to distinguish field types\r\n\r\n- If the field object contains `table_values` → it is a table field, read from `table_values`\r\n- If the field object contains `field_values` without `table_values` → it is a regular field\r\n\r\n---\r\n\r\n## Async task submission (--async)\r\n\r\nWhen using `--async` without `--no-wait`, the CLI polls until completion and returns the same response as sync mode.\r\n\r\nWhen using `--async --no-wait`, the CLI returns immediately:\r\n\r\n```json\r\n{\r\n  \"task_id\": \"dffe****427d\",\r\n  \"status\": \"PROCESSING\"\r\n}\r\n```\r\n\r\n---\r\n\r\n## Async query (parse query / extract query)\r\n\r\n```json\r\n{\r\n  \"task_id\": \"dffe****427d\",\r\n  \"status\": \"SUCCESS\"\r\n}\r\n```\r\n\r\n| Status | Meaning |\r\n|--------|---------|\r\n| `SUCCESS` | Task completed, result data included |\r\n| `PROCESSING` | Still processing, query again later |\r\n| `FAILED` | Task failed |\r\n\r\nWhen status is `SUCCESS`, the full parse/extract result is included in the response.\r\n\r\n---\r\n\r\n## Batch Processing Output\r\n\r\n### Sync batch (multiple files)\r\n\r\n**stdout** outputs a summary JSON:\r\n\r\n```json\r\n{\r\n  \"total\": 5,\r\n  \"success\": 4,\r\n  \"failed\": 1,\r\n  \"output_dir\": \"/absolute/path/to/adp_results_20260417_143025\",\r\n  \"files\": [\r\n    {\"input\": \"invoice1.pdf\", \"output\": \"invoice1.pdf.json\", \"status\": \"success\"},\r\n    {\"input\": \"invoice2.pdf\", \"output\": \"invoice2.pdf.json\", \"status\": \"success\"},\r\n    {\"input\": \"bad.pdf\", \"output\": \"bad.pdf.error.json\", \"status\": \"failed\", \"error\": \"...\"}\r\n  ]\r\n}\r\n```\r\n\r\n| Field | Type | Description |\r\n|-------|------|-------------|\r\n| `total` | integer | Total number of files processed |\r\n| `success` | integer | Number of successful files |\r\n| `failed` | integer | Number of failed files |\r\n| `output_dir` | string | **Absolute path** to the output directory — Agent must read files from here |\r\n| `files` | array | Per-file status and output filename |\r\n| `files[].input` | string | Original input filename |\r\n| `files[].output` | string | Output filename in `output_dir` |\r\n| `files[].status` | string | `success` or `failed` |\r\n| `files[].error` | string | Error message (only when failed) |\r\n\r\n### Output directory structure\r\n\r\n```\r\nadp_results_20260417_143025/     (or --export specified path)\r\n  ├── invoice1.pdf.json          # Successful result (same schema as single-file response)\r\n  ├── invoice2.pdf.json\r\n  ├── bad.pdf.error.json         # Failed result: {\"input\": \"...\", \"status\": \"failed\", \"error\": \"...\"}\r\n  └── _summary.json              # Same content as stdout summary\r\n```\r\n\r\n**Agent workflow for batch results:**\r\n1. Parse the stdout summary JSON\r\n2. Read `output_dir` path from summary\r\n3. For each file in `files` array where `status` is `success`:\r\n   - Read `{output_dir}/{files[].output}` to get the individual result\r\n   - The JSON structure inside each file is identical to the single-file parse/extract response\r\n4. For failed files, the error reason is in both the summary and the `.error.json` file\r\n\r\n### Default output directory\r\n\r\n- If `--export` is specified: uses that path\r\n- If `--export` is not specified: auto-creates `adp_results_{YYYYMMDD_HHMMSS}/` in current directory\r\n\r\n### Async batch (--async --no-wait)\r\n\r\nReturns a JSON array of task IDs:\r\n\r\n```json\r\n[\r\n  {\"path\": \"invoice1.pdf\", \"task_id\": \"abc123\"},\r\n  {\"path\": \"invoice2.pdf\", \"task_id\": \"def456\"},\r\n  {\"path\": \"bad.pdf\", \"error\": \"file too large\"}\r\n]\r\n```\r\n\r\n**Agent workflow for async batch:**\r\n1. Save the output to a file (using `--export tasks.json`)\r\n2. Later, query all tasks: `adp parse query --file tasks.json --watch`\r\n3. The `--file` flag reads the JSON array and queries all task IDs\r\n\r\n---\r\n\r\n## custom-app create\r\n\r\n```json\r\n{\r\n  \"code\": \"success\",\r\n  \"message\": \"\",\r\n  \"tips\": null,\r\n  \"data\": {\r\n    \"app_id\": \"ed5195882cd311f19359627c0509427d\",\r\n    \"app_name\": \"Custom Application Name\",\r\n    \"app_label\": [\"Custom Label 1\"],\r\n    \"config_version\": \"v1\"\r\n  }\r\n}\r\n```\r\n\r\n---\r\n\r\n## custom-app ai-generate\r\n\r\nReturns AI-recommended extraction fields based on the sample document. The Agent can use these recommendations to populate `--extract-fields` when calling `custom-app create`.\r\n\r\n---\r\n\r\n## Error Response Format\r\n\r\nWhen `--json` flag is used, errors are output to **stderr** as:\r\n\r\n```json\r\n{\r\n  \"type\": \"AUTH_ERROR\",\r\n  \"message\": \"Authentication error: invalid API key\",\r\n  \"fix\": \"Check your API key is correct and has not expired.\",\r\n  \"retryable\": false,\r\n  \"details\": {\"context\": \"extract\"}\r\n}\r\n```\r\n\r\nSee [error-handling.md](error-handling.md) for the complete error type reference.\r\n\r\n---\r\n\r\n## Exit Codes\r\n\r\n| Code | Meaning |\r\n|------|---------|\r\n| 0 | Success |\r\n| 1 | General error |\r\n| 2 | Parameter error |\r\n| 3 | Resource not found |\r\n| 4 | Permission denied |\r\n| 5 | Conflict |\r\n| 6 | Partial failure (batch: some succeeded, some failed) |\n\nFile v1.10.3:license.md\n\nCommercial License Agreement\r\n\r\nEffective Date: [March 30, 2026]\r\nCopyright © 2026 [Laiye Technology (Beijing) Co., Ltd.] All rights reserved.\r\n\r\nThis “Skill” (referring to the entirety including models, software, code, weights, documentation, data, and related derivative works, “the Product”) is developed and wholly owned by Laiye Technology (Beijing) Co., Ltd. (“Licensor”). The mentioned derivative works refer to new works created by modifying, integrating, fine-tuning, or further developing the Product. Subject to your (“Licensee” or “you”) compliance with the terms of this Agreement, the Licensor grants you a worldwide, royalty-free, non-exclusive license.\r\n\r\n1. Licensing\r\n\r\n1.1 Free Use and Distribution: The Licensor grants the Licensee a non-transferable, non-exclusive right to freely use, copy, publish, and distribute copies of the Product for non-commercial purposes. The aforementioned \"non-commercial purposes\" include, but are not limited to:\r\nPersonal learning, research, teaching, and evaluation.\r\nTechnical exchanges within academic institutions or open-source communities, non-profit projects.\r\nIntegration or demonstration in non-commercial products or services.\r\n1.2 Commercial License:\tAny activity intended to directly or indirectly obtain commercial benefits, revenue, or consideration (“Commercial Exploitation”) requires the explicit written authorization (i.e., a \"Commercial License\") from the Licensor. Commercial Exploitation includes, but is not limited to:\r\nDistributing the Product or derivative works thereof in forms such as sales, resale, licensing fees, subscription fees, or other charges.\r\nProviding the Product or derivative works thereof as a SaaS (Software as a Service) to third parties.\r\nIntegrating the Product or derivative works thereof, as a core function, into software, hardware, or services intended for sale or lease.\r\nAny for-profit activity that utilizes the functionality or content of the Product to provide services to third parties.\r\n\r\n2. Reserved Rights and Ownership\r\n\r\n2.1\tOwnership, intellectual property rights (including but not limited to copyright, patents, trademarks, trade secrets), and other related rights and interests in the Product (including all copies thereof) belong to the Licensor or its affiliates. This Agreement does not constitute any form of transfer of rights or sale of the Licensor's intellectual property.\r\n2.2\tThe Licensee may non-commercially distribute unmodified copies of the Product through channels such as open-source platforms, or engage in non-commercial further development, and distribution, provided that this Agreement, the copyright notice, and the original identification are fully retained.\r\n3. Distribution Conditions\r\n\r\nWhen the Licensee distributes or provides the Product, all of the following conditions must be met:\r\nRetention of Notices:\tProminently retain all copyright notices of the Product, the text of this License Agreement, and the disclaimer on distributed copies.\r\nNo Misrepresentation:\tShould not imply that the Licensor endorses your distribution version.\r\n\r\n4. Disclaimer of Warranties\r\n\r\nTHE PRODUCT IS PROVIDED \"AS IS\", WITHOUT WARRANTIES OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO: THE LICENSOR DOES NOT WARRANT THAT THE PRODUCT IS FREE FROM ERRORS, BUGS, WILL OPERATE PROPERLY, OR IS SUITABLE FOR A PARTICULAR PURPOSE; THE LICENSOR DOES NOT WARRANT THAT USE OF THE PRODUCT WILL NOT INFRINGE UPON THIRD-PARTY RIGHTS; THE LICENSOR SHALL NOT BE LIABLE TO THE LICENSEE OR ANY THIRD PARTY FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, OR PUNITIVE DAMAGES ARISING FROM THE USE OF THE PRODUCT.\r\n\r\n5. Termination\r\n\r\n5.1\tThis Agreement becomes effective from the Licensee's first use of the Product and continues until terminated.\r\n5.2\tIf the Licensee violates the restrictions in Article 1 \"License Grant\" of this Agreement (e.g., unauthorized Commercial Exploitation), this Agreement will terminate automatically without prior notice.\r\n5.3\tUpon termination, the Licensee must immediately cease using the Product and destroy all copies of the Product in its possession.\r\n\r\n6. Miscellaneous\r\n\r\n6.1\tThe formation, execution, interpretation, and dispute resolution of this Agreement shall be governed by the laws of the People's Republic of China.\r\n6.2\tThe Licensee shall not assign or transfer any of its rights or obligations under this Agreement without the Licensor's prior written consent.\r\n6.3\tThis Agreement constitutes the entire agreement between the parties concerning this license matter and supersedes any prior oral or written communications and agreements between the parties regarding this matter.\r\n6.4\tAny dispute related to this Agreement shall be settled through friendly negotiation between the parties. If negotiation fails, either party has the right to submit the dispute to the competent court in the place where the Licensor is registered.\r\n\r\nFor obtaining a Commercial License or if you have any questions, please contact:\r\n[global_product@laiye.com]\r\n\r\n\r\nThe Product is licensed under the Commercial License Agreement.  For commercial use, please contact us to obtain authorization.\n\nFile v1.10.3:README-CN.md\n\n<div align=\"center\">\r\n<a id=\"agentic_doc_parse_and_extract\"></a>\r\n\r\n# 📄 来也智能体文档处理官方CLI (agentic_doc_parse_and_extract)\r\n\r\nagentic_doc_parse_and_extract 是来也科技ADP（Agentic Document Processing）产品发布的官方命令行工具，让人类和 AI Agent 都能在终端中调用ADP能力进行文档解析与抽取\r\n\r\n[English](README.md) | [简体中文](README-CN.md)\r\n\r\n</div>\r\n\r\n## 🚀 关于来也ADP\r\n\r\nADP是来也科技公司**智能体文档处理产品 (Agentic Document Processing，简称 ADP)**， 基于大模型的通用理解能力，不依赖规则与标注，具备对多语言、多模态、多场景的通用理解能力；智能体的自主规划与执行，能够理解任务目标、自主规划步骤、调用工具、完成复杂任务；端到端的业务自动化，从文档输入到业务决策再到人机协同，形成完整闭环。\r\n\r\n**agentic-doc-parse-and-extract** 是 ADP 官方开源 CLI 工具，同时支持人工终端调用 + AI Skill 自动调用。一条命令即可完成：文档结构化解析 + 关键字段智能抽取，覆盖发票、订单、证件、票据、通用文档全场景，输出标准 JSON，无缝对接自动化与 AI 流程。\r\n\r\n---\r\n\r\n### 💡 核心功能\r\n\r\nagentic-doc-parse-and-extract 聚焦文档全流程智能处理，兼顾人工终端调用与 AI Agent 自动调用，核心功能覆盖解析、抽取、批量处理全场景，无需复杂配置，一条命令即可完成操作：\r\n\r\n| 功能名称 | 功能描述 | 最佳场景 |\r\n|---------|------------------|----------|\r\n| **文档解析** | 自动识别 PDF、图片等多格式文档，将杂乱的非结构化内容（如扫描件、手写体、复杂排版文档）转化为标准化结构化数据，保留原始文档层级与关键关联关系 | 将非结构化文档转换为结构化数据，供 LLM 阅读和后续抽取使用 |\r\n| **开箱即用文档抽取** | 基于 ADP 大模型原生 AI 能力，内置发票、收据、订单、中国地区常用证件等标准化抽取模型，无需配置规则、无需人工标注，一键提取各类通用单据关键字段，输出标准 JSON | 应付账款自动化、费用管理、采购自动化、卡证信息快速录入系统 |\r\n| **自定义文档抽取** | 支持自主创建、编辑与管理个性化抽取应用，可针对企业专属单据、行业定制表单配置专属抽取字段与识别逻辑 | 企业专属单据、行业定制表单、非标准化文档的私有化抽取需求 |\r\n| **任务查询** | 支持异步任务提交与状态查询，可快速查看任务执行进度、成功/失败状态，以及任务最终处理结果 | 批量任务处理、异步文档处理、问题排查与处理记录追溯 |\r\n| **应用管理** | 提供完整的应用管理能力，可查看所有可用的抽取应用（系统内置 + 自定义）、查询应用详情、应用标签 | 多场景业务切换、应用全生命周期管控、自定义应用管理 |\r\n\r\n---\r\n\r\n### 🎯 适用人群\r\n\r\n- **AI Agent 开发者：** 通过标准 Skill 快速集成文档解析抽取能力，赋能智能体自动化办公流程\r\n- **企业研发与架构团队：** 统一接入 CLI 工具，低成本落地全品类单据结构化自动化处理\r\n- **财务 & 行政运营团队：** 批量解析发票、收据、报销单，减少人工录入与核对成本\r\n- **业务系统集成方：** 依赖标准化 JSON 输出，无缝对接 ERP、RPA、业务中台等上下游系统\r\n- **内部平台建设者：** 支持本地部署与环境适配，满足企业内网安全与权限管控要求\r\n\r\n\r\n## 📁 项目文件结构与文件说明\r\n\r\n```\r\nagentic-doc-parse-and-extract/\r\n├── skill.md                  # Skill配置与调用说明\r\n├── README.md                 # 来也ADP产品介绍与CLI下载与调用说明\r\n├── references/               # 参数枚举、错误码、JSON返回说明\r\n    ├── examples.md           # 调用与返回示例代码 参数说明\r\n    ├── commands.md           # 所有命令列表\r\n    ├── response-schema.md    # 返回参数说明\r\n    ├── error-handling.md     # 错误与应对措施\r\n├──  License                  # 授权许可\r\n```\r\n\r\n\r\n## 📋 API Key\r\n### 获取API Key\r\n1. 访问 [ADP 中国地区网址](https://adp.laiye.com/?utm_source=clawhub)、 [ADP 全球地区网址](https://adp-global.laiye.com/?utm_source=clawhub)\r\n2. 注册新账户（新用户每月 100 免费积分）\r\n\r\n\r\n## 💻 环境与安装\r\n### 支持平台与版本\r\n| 平台 | 最低要求 |\r\n|---------|------------------|\r\n| **Windows** | Windows 10 或更高版本 |\r\n| **Linux** | Ubuntu 18.04+, CentOS 7+, 或主流Linux发行版 |\r\n| **macOS** | macOS 10.14 (Mojave) 或更高版本 |\r\n---\r\n\r\n### 安装\r\n\r\n  ```bash\r\n  # 方法 1: npm（推荐，全平台通用，国内可通过 npmmirror 镜像加速）\r\n  npm install -g @laiye-adp/agentic-doc-parse-and-extract-cli --registry=https://registry.npmmirror.com/ || npm install -g @laiye-adp/agentic-doc-parse-and-extract-cli\r\n\r\n  # 方法 2: Shell 脚本（Linux / macOS，无 npm 环境时使用）\r\n  curl -fsSL https://raw.githubusercontent.com/laiye-ai/adp-cli/main/scripts/adp-init.sh | bash\r\n\r\n  # 方法 3: PowerShell 脚本（Windows，无 npm 环境时使用）\r\n  Invoke-WebRequest -Uri \"https://raw.githubusercontent.com/laiye-ai/adp-cli/main/scripts/adp-init.ps1\" -OutFile \"$env:TEMP\\adp-init.ps1\"; & \"$env:TEMP\\adp-init.ps1\"\r\n  ```\r\n\r\n---\r\n\r\n## ✨ 核心特性\r\n\r\n### 📦 开箱即用产品\r\n\r\n| 产品 | 提取内容 | 最佳场景 |\r\n|---------|------------------|----------|\r\n| **文档解析** | 提取文档内的文本、表格、图片、印章等元素 | 将文档转换成结构化数据供LLM阅读 |\r\n| **发票/收据抽取** | 发票号码、日期、供应商、明细项目、总额、税费 | 应付账款自动化、费用管理 |\r\n| **订单抽取** | 采购单号、商品、数量、价格、交付信息 | 采购自动化、电商集成 |\r\n| **卡证抽取** | 身份证、银行卡、驾驶证、营业执照等11种常用卡证 | 卡证信息快速录入系统 |\r\n\r\n### 🛠️ 技术能力\r\n\r\n- **10+ 种文件格式** ： 覆盖主流图片与办公文档格式（.jpg, .jpeg, .png, .bmp, .tiff, .tif, .pdf, .doc, .docx, .xls, .xlsx）\r\n- **VLM + LLM 双引擎** ： 视觉理解 + 语义提取，实现最大准确率\r\n- **同步与异步模式** ： 所有功能均对外开放同步、异步 API\r\n- **文件限制：** 最大文件大小：50MB\r\n- **批量处理：** 支持文件夹递归处理\r\n\r\n### 🌟 产品优势\r\n- 依托来也科技 ADP 大模型核心能力，结合 CLI 工具轻量化特性，打造高效、灵活、易集成的文档处理解决方案，核心优势突出：\r\n- 零门槛上手：无需专业技术背景，无需规则配置与数据标注，内置标准化抽取模型，开箱即用，一条命令完成文档解析与抽取。\r\n- 全场景适配：覆盖发票、收据、订单、证件等通用场景，同时支持自定义扩展，适配企业专属单据、行业定制表单，兼顾通用性与个性化需求。\r\n- 高效集成适配：支持 AI Agent Skill 原生调用、终端手动调用，输出标准 JSON 格式，无缝对接 RPA、ERP、业务中台等上下游系统，降低集成成本。\r\n- 多终端兼容：Windows、macOS、Linux 全平台支持，无需额外安装依赖，配置环境变量后全局可调用，适配本地部署与多场景办公需求。\r\n- 高精度高稳定：基于 ADP 大模型优化，非结构化文档（扫描件、手写体、复杂排版）识别准确率高，支持异步任务管理，保障业务流程稳定运行。\r\n\r\n<a id=\"credit\"></a>\r\n### 💰 计费\r\n\r\n- **新用户福利：** 每月获得 100 免费积分，不限制使用应用\r\n- **资产消耗规则：**\r\n    | 处理阶段 | 费用 |\r\n    |-----------------|------|\r\n    | 文档解析 | 0.5 积分/页 |\r\n    | 采购订单抽取 | 1.5 积分/页 |\r\n    | 发票/收据抽取 | 1.5 积分/页 |\r\n    | 自定义抽取 | 1 积分/页 |\r\n\r\n- **资产充值：** 可直接登录ADP门户网站进行资产充值，我们为国内外用户提供了独立公有云接入地址，需要按区域分开配置，就近访问可更大程度保障全网高速稳定调用。\r\n  - 中国大陆地区[登录](https://adp.laiye.com/?utm_source=clawhub)\r\n  - 非中国大陆地区用户[登录](https://adp-global.laiye.com/?utm_source=clawhub)\r\n\r\n  如支付遇到问题，请联系支持邮箱：📧 global_product@laiye.com\r\n\r\n## 📜 授权许可\r\n\r\n我们采用 开源工具 + 付费服务 的组合模式：CLI 工具完全免费开源，方便大家快速接入；而核心的 ADP 智能解析能力为公有云商业服务，按实际使用量计费，旨在为用户提供高精准、高稳定的文档处理体验。\r\n\r\n- **CLI 工具**：MIT License 开源许可，可自由使用、修改和分发\r\n- **ADP 服务**：基于公有云的 AI 文档处理服务，按使用量计费，[计费规则](#credit)\r\n\r\n### 💰 免费额度\r\n新用户注册后每月可获得 **100 免费积分**，可体验完整功能\r\n\r\n\r\n## 📞 支持与联系\r\n- **CLI 使用指南：** [ADP CLI 使用指南](https://laiye-tech.feishu.cn/wiki/Hz3Vw1IQki3YQtk33gLcSdwSndc)\r\n- **API 接口文档：** [Open API 使用指南](https://laiye-tech.feishu.cn/wiki/PO9Jw4cH3iV2ThkMPW2c539pnkc)\r\n- **ADP 产品操作手册：** [公有云操作手册](https://laiye-tech.feishu.cn/wiki/UDYIwG42pisBbFkJI39ctpeKnWh)\r\n\r\n- **问题反馈：** [GitHub Issues](https://github.com/laiye-ai-repos/adp-skill/issues)\r\n- **邮箱：** global_product@laiye.com\r\n- **官网：** [来也科技](https://laiye.com)\r\n\r\n---\r\n\r\n<div align=\"center\">\r\n[⬆ 返回顶部](#agentic_doc_parse_and_extract)\r\n\r\n**用 ❤️ 构建智能体 AI 的未来**\r\n版权所有 © 2026 [来也科技（北京）有限公司] 保留所有权利。\r\n\r\n</div>\n\nFile v1.10.3:skill-card.md\n\n## Description:\n\nEnables AI-powered parsing and key information extraction from high-frequency documents including invoices, orders, receipts, long texts, and common Chinese identity and credential documents.\n\nThis skill is ready for commercial/non-commercial use.\n\n## Publisher:\n\n[laiye-adp](https://clawhub.ai/user/laiye-adp)\n\n### License/Terms of Use:\n\nCommercial License Agreement\n\n## Use Case:\n\nDevelopers, AI agent builders, and enterprise operations teams use this skill to configure and invoke Laiye ADP CLI workflows for document parsing, structured field extraction, custom extraction apps, batch processing, and asynchronous result queries.\n\n### Deployment Geography for Use:\n\nGlobal\n\n## Known Risks and Mitigations:\n\nRisk: First-use setup may install mutable remote or unpinned global software before processing sensitive documents.\n\nMitigation: Review the skill before installation, use a pinned and verified CLI installation path, and avoid pipe-to-shell or immediate PowerShell execution from mutable URLs.\n\nRisk: The workflow can upload invoices, identity documents, HR files, financial records, local files, or URL lists to Laiye ADP.\n\nMitigation: Only process documents the user is authorized to send to Laiye ADP, and confirm the selected regional API base URL before use.\n\nRisk: API keys and app caches are required for operation and may be stored outside the conversation.\n\nMitigation: Confirm where credentials and application caches are stored, avoid exposing API keys in prompts or logs, and clear configuration when it is no longer needed.\n\nRisk: The artifact license says commercial use requires explicit written authorization.\n\nMitigation: Confirm Laiye's commercial authorization terms before using the skill for revenue-generating or customer-facing work.\n\n## Reference(s):\n\n- [ADP CLI command reference](references/commands.md)\n- [ADP CLI response schema](references/response-schema.md)\n- [ADP CLI examples](references/examples.md)\n- [ADP CLI error handling guide](references/error-handling.md)\n- [ADP CLI User Guide](https://laiye-tech.feishu.cn/wiki/YIaawiK2DimisZk5KfDc8a8cnLh)\n- [OpenAPI User Guide](https://laiye-tech.feishu.cn/wiki/S1t2wYR04ivndKkMDxxcp2SFnKd)\n- [Public Cloud Operation Manual](https://laiye-tech.feishu.cn/wiki/OfexwgVUQiOpEek4kO7c7NEJnAe)\n- [ADP China portal](https://adp.laiye.com/)\n- [ADP Global portal](https://adp-global.laiye.com/)\n- [Laiye Technology](https://laiye.com)\n\n## Skill Output:\n\n**Output Type(s):** [Shell commands, Configuration instructions, Guidance, JSON]\n\n**Output Format:** [Markdown guidance with inline shell commands and JSON response handling]\n\n**Output Parameters:** [1D]\n\n**Other Properties Related to Output:** [Agent-facing CLI workflows may create exported result files when ADP commands are run with export options.]\n\n## Skill Version(s):\n\n1.10.3 (source: server release metadata)\n\n## Ethical Considerations:\n\nUsers should evaluate whether this skill is appropriate for their environment, review any generated or modified files before relying on them, and apply their organization's safety, security, and compliance requirements before deployment.\n\nArchive v1.10.0: 9 files, 33998 bytes\n\nFiles: license.md (5156b), README-CN.md (13085b), README.md (16019b), references/commands.md (11373b), references/error-handling.md (5057b), references/examples.md (19783b), references/response-schema.md (9375b), SKILL.md (15544b), _meta.json (129b)\n\nFile v1.10.0:SKILL.md\n\n---\r\nname: agentic-doc-parse-and-extract\r\ndescription: Enables AI-powered parsing and key information extraction from high-frequency documents including invoices, orders, receipts, long texts, and common Chinese identity & credential documents. Supports reusable custom templates for non-standard business files. Features batch concurrent processing to automate document workflows for finance, administration, HR data entry and other departments.\r\nversion: 1.10.0\r\n---\r\n# agentic-doc-parse-and-extract Skill\r\n\r\nagentic-doc-parse-and-extract is an official command-line tool released by Laiye Technology's ADP (Agentic Document Processing) product, enabling both humans and AI agents to invoke ADP capabilities in the terminal for document parsing and extraction.\r\n\r\n## Quick Start Guide for AI Agents\r\n\r\n### Core Workflow\r\n1. **Install dependencies**: On first execution, install the ADP CLI tool and dependencies by following the instructions in [references/examples.md](references/examples.md).\r\n2. **Discover commands**: Run `adp schema` to get the machine-readable JSON spec of all commands, parameters, types, and defaults.\r\n3. **Authentication**: On first execution, run `adp config get` to verify credentials. If no valid configuration exists, prompt the user to provide an API Key.\r\n4. **Check Application**: On first execution, retrieve the application list via `adp app-id list`. For subsequent executions, prioritize `adp app-id cache` (cached in context). If the cache is unavailable, refresh it by calling `adp app-id list` again.\r\n5. **Execute**: Run `adp extract url <URL> --app-id <ID>` or `adp parse url <URL> --app-id <ID>`.\r\n6. **Query**: Check results asynchronously with `adp extract query <task_id>` or `adp parse query <task_id>`.\r\n7. **Error handling**: When a command fails, parse the stderr JSON to determine error type and recovery action. See [references/error-handling.md](references/error-handling.md).\r\n\r\n### Common Scenarios → Command Mapping\r\n| User Intent | Recommended Command | Handling Rules |\r\n| :---------- | :------------------ | :------------- |\r\n| - Read full document content<br>- Parse layout & structure<br>- Convert document to text<br>- Process / analyze full document | `adp parse` | - Sync processing for small files<br>- Async processing (`--async` parameter) for files >20MB or >200 pages |\r\n| - Extract key fields (amount, date, name, ID, etc.)<br>- Output structured results (JSON/table) | `adp extract` | - Use Extract directly, **no need to parse first**<br>- Use matched existing app<br>- Create a custom extraction app if the document type is not in the known app list |\r\n| Batch processing of local files | `adp extract local <folder path>` <br> `adp parse local <folder path> `  | Batch processing can accept files from the local folder. |\r\n| Batch processing of URL files | `adp extract url <URL list file path>` <br> `adp parse url <URL list file path> `  | If you need to process multiple URLs in a batch, you can first save the list of URLs in a text file, and then input the corresponding URL of this text file to achieve batch processing at once. |\r\n\r\nNote:\r\n- The `adp extract` command has built-in document parsing capabilities. After ADP automatically parses the document, it performs structured extraction. Therefore, when users need to extract the structured content of the document, there is no need to use apd for parsing.\r\n- URL list file format: A plain text file where each line is a URL pointing to a document to be processed.\r\n\r\n\r\n### Quick Reference for Common Commands\r\n\r\n```bash\r\n# Command Discovery (for Agent introspection)\r\nadp schema\r\n\r\n# Configuration Check\r\nadp config get\r\n\r\n# Query Applications (First Use)\r\nadp app-id list\r\n\r\n# Document Extraction (Invoice/Receipt)\r\nadp extract url <file URL> --app-id <app_id>\r\n\r\n# Document Parsing (Long Document)\r\nadp parse url <file URL> --app-id <app_id>\r\n\r\n# Base64 Input\r\nadp extract base64 <base64_string> --app-id <app_id> --file-name invoice.pdf\r\nadp parse base64 <base64_string> --app-id <app_id> --file-name document.pdf\r\n\r\n# Asynchronous Query\r\nadp extract query <task_id>\r\nadp parse query <task_id>\r\nadp parse query <task_id1> <task_id2> --watch  # batch query with auto-poll\r\n\r\n# Batch Processing\r\nadp extract local <folder path> --app-id <app_id> --export <folder path> --concurrency 2\r\nadp parse local <folder path> --app-id <app_id> --export <folder path> --concurrency 2\r\n```\r\n\r\n## Performance Optimization Suggestions\r\n- **Reuse APP_ID**: Cache it in the context after one query to avoid calling `app-id list` every time.\r\n- **Sync First**: For small files (<20MB), prioritize using synchronous calls to avoid asynchronous polling.\r\n- **Batch Processing**: Processes multiple documents via `url <URL list file path>` or `local <folder path>` in a single run, without looped invocations. Default `--concurrency 2`.\r\n- **Local Cache**: Store commonly used APP_IDs in environment variables or configuration files.\r\n- **Priority Extraction**: If only key information needs to be extracted, use `extract` instead of `parse` (faster).\r\n- **Use --retry for batch**: Set `--retry 2` for batch processing to auto-recover from transient failures.\r\n- **Use --timeout for large files**: Increase `--timeout` for files >20MB. Default is 900s.\r\n\r\n---\r\n\r\n## Detailed Product Introduction\r\n\r\n### Core Function Definition\r\n- **parse**: Parses the entire document to retrieve full text, layout, structure, and content.\r\n- **extract**: Extracts specific structured fields from the document, such as amount, date, company name, and order number.\r\n\r\n### Application Scenarios\r\n- **Long Document Parsing**: Efficiently process long documents with fast parsing speed, accurately extract multiple elements such as text, tables and images, replace manual extraction, and improve efficiency.\r\n- **Structured Extraction for Scanned/Photographed Documents**: For scanned documents and photos, complete structured extraction in reading order, generate clear and editable electronic documents, and eliminate manual entry errors.\r\n- **Intelligent Invoice Extraction**: After uploading invoice images/documents, AI automatically invokes preset applications to accurately extract 10+ key fields such as invoice number and amount, suitable for financial filing scenarios.\r\n- **Intelligent Order Extraction**: Support batch upload of orders from multiple distributors, AI extracts 10+ key fields such as order number and buyer-seller information, automatically identifies currencies, and reduces manual verification costs.\r\n- **Domestic ID Document Extraction**: Process in seconds, supporting the identification and extraction of more than 10 common types of documents in China; for example, core information such as name and ID number can be quickly extracted from ID card scans.\r\n- **Automatic Splitting and Extraction of Mixed Documents**: Batch upload mixed documents such as contracts and invoices, AI automatically classifies, splits and completes structured extraction to improve processing efficiency.\r\n- **Batch Document Processing**: Support batch upload of various business documents, extract information and output standardized structured data, reducing repetitive manual operations.\r\n\r\n## Detailed Usage Steps\r\n\r\n### Step 1: Obtain the Installation Package\r\nFor details, see [references/examples.md](references/examples.md)\r\n\r\n### Step 2: Obtain and Configure API Key\r\n\r\n   #### 1. Access the ADP Portal to Obtain Credentials\r\n\r\n   We provide independent Public Cloud access addresses for domestic and international users, which need to be configured separately by region. Accessing nearby can better ensure high-speed and stable calls across the network.\r\n\r\n   | Region | Login Address | API Base URL |\r\n   |-----|----------|--------------|\r\n   | Chinese Mainland | [https://adp.laiye.com/](https://adp.laiye.com/?utm_source=openclaw) | `https://adp.laiye.com/` |\r\n   | Overseas Region | [https://adp-global.laiye.com/](https://adp-global.laiye.com/?utm_source=openclaw) | `https://adp-global.laiye.com/` |\r\n\r\n   #### 2. Get API Key after registration/login\r\n   New users need to register an ADP account first, and after registration, they can get 100 free credits/month\r\n   - After logging in, click on the personal avatar, and you can directly access the `API_Key` entry.\r\n   \r\n   #### 3. Complete the authentication configuration\r\n   For details, see [references/examples.md](references/examples.md)\r\n   \r\n   #### 4. Verify the configuration\r\n   For details, see [references/examples.md](references/examples.md)\r\n   \r\n   **Notes**:\r\n   1. If API Key and API Base URL have been configured, the configuration information needs to be stored in environment variables to avoid uploading configuration items every time they are used.\r\n   2. If API Key and API Base URL have not been configured yet, they need to be configured according to the above steps.\r\n\r\n### Step 3: Upload Documents\r\nAfter completing the authentication of the API Key, guide the user to upload local files or specify the file URL. After the user uploads the document, they can query the supported application scope of ADP and select the appropriate application for document parsing and extraction. If no suitable application is found, they can choose to create a custom extraction application, configure exclusive fields and parsing modes to meet the personalized document processing requirements.\r\n\r\n### Step 4: Query Available Applications \r\nThis function is used to query the built-in applications under the user's account (such as invoices/receipts, orders, common cards and certificates in China region, etc. which are standardized documents). Based on the `app-label`, you can assist in filtering the suitable application IDs. If no suitable application is found, you can choose to create a custom extraction application, configure specific fields and parsing modes to meet the personalized document processing requirements.\r\n\r\n**Notes**:\r\n1. For the first execution, use `adp app-id list`. For subsequent executions, prefer to use `adp app-id cache` (cache the application ID in the context). If the cache becomes invalid or there are no suitable applications in the cache, call `adp app-id list` again to update the cache.\r\n\r\nFor detailed examples of commands and responses, see [references/examples.md](references/examples.md).\r\n\r\n\r\n### Step 5: Add custom extraction application\r\n\r\nSupport creating custom extraction applications, and independently add business-specific extraction fields as needed, and improve the detailed description of each field; the system will accurately identify the document content based on the configured fields and definitions, and complete customized information extraction for personalized documents and non-standard forms.\r\n\r\nFor example commands, responses, and detailed parameter descriptions, please refer to [references/examples.md](references/examples.md) \r\n\r\n### Step 6: Execute Document Processing\r\n\r\n### Single Document Parsing\r\n\r\nPerform document parsing based on the selected application ID, which will return a formatted JSON result containing information such as document content, element position coordinates, OCR Confidence Level, etc.\r\n\r\nFor examples of commands and responses, please refer to [references/examples.md](references/examples.md)\r\n\r\n### Single Document Extraction\r\n\r\nPerform document extraction based on the selected application ID, which will return a formatted JSON result containing information such as extraction fields, extraction results, and Confidence Level.\r\n\r\nFor examples of commands and responses, please refer to [references/examples.md](references/examples.md)\r\n\r\n\r\n### Batch Document Processing\r\n\r\nADP supports batch processing capabilities. Users can upload multiple file URLs or local folder paths at once, and the system will automatically identify each document type and match the most suitable application for processing, greatly improving the efficiency of batch document processing.\r\n\r\nFor detailed command examples, see [references/examples.md](references/examples.md)\r\n\r\n**Note**: The number of concurrent requests is limited to 1 for free users, while enterprise users can adjust it according to their needs, with a maximum support of 2.\r\n\r\n### Asynchronous Processing (Suitable for Large Documents)\r\n\r\nADP provides asynchronous processing capabilities, allowing users to choose asynchronous mode to perform document parsing and extraction. The system will return a task ID, and users can periodically query the task status and results through the query interface, which is suitable for processing complex documents or batch documents with long processing times. If the document uploaded by the user is larger than 20MB or contains more than 200 pages, it is recommended to use the asynchronous processing mode.\r\n\r\nFor examples of commands and responses, see [references/examples.md](references/examples.md)\r\n\r\n---\r\n\r\n## Complete Command List\r\n\r\nFor a complete list of all available commands with full parameter specs, see [references/commands.md](references/commands.md)\r\n\r\n## Response Schema Reference\r\n\r\nFor the output structure of each command (including batch processing output mechanism), see [references/response-schema.md](references/response-schema.md)\r\n\r\n## Error Handling Guide\r\n\r\nFor error codes, types, and Agent auto-recovery strategies, see [references/error-handling.md](references/error-handling.md)\r\n\r\n---\r\n\r\n## Precautions\r\n\r\nWhen using ADP output, always present the returned data as-is. Do not modify, add, or remove any fields during extraction or parsing to ensure data integrity.\r\n\r\n1. **API Key Security**: Please keep your API Key secure and avoid disclosing it to unauthorized third parties.\r\n2. **API Base URL Configuration**: Select the corresponding address based on the region. For Chinese Mainland, use `https://adp.laiye.com/`, and for overseas regions, use `https://adp-global.laiye.com/`\r\n3. **File Size Limit**: The maximum size of a single file is 50MB\r\n4. **Supported Formats**: .jpg, .jpeg, .png, .bmp, .tiff, .tif, .pdf, .doc, .docx, .xls, .xlsx, .ppt, .pptx\r\n5. **Free Quota**: New users receive 100 free credits per month, which are reset at the beginning of each month. Credits can be used for document parsing and extraction processing.\r\n6. **Check Balance**: Run `adp credit` to check the current account's credit balance.\r\n7. **Billing Rules**:\r\n   - Document parsing: 0.5 credits per page\r\n   - Invoice/receipt extraction: 1.5 credits per page\r\n   - Order extraction: 1.5 credits per page\r\n   - Custom extraction: 1 credit per page\r\n8. **App ID Reuse**: The app ID used by the user can be remembered for direct use next time, eliminating the need to enter the app_id after each query. The app ID under each user is unique and fixed; unless the user deletes the app, the app_id will not change, and the previously queried app_id can be directly used for document processing calls.\r\n\r\n---\r\n\r\n## Related Resources\r\n- **CLI Documentation**: [ADP CLI User Guide](https://laiye-tech.feishu.cn/wiki/YIaawiK2DimisZk5KfDc8a8cnLh)\r\n- **API Documentation**: [OpenAPI User Guide](https://laiye-tech.feishu.cn/wiki/S1t2wYR04ivndKkMDxxcp2SFnKd)\r\n- **User Guide**: [Public Cloud Operation Manual](https://laiye-tech.feishu.cn/wiki/OfexwgVUQiOpEek4kO7c7NEJnAe)\r\n- **Problem Feedback**: [GitHub Issues](https://github.com/laiye-ai/adp-cli/issues) | global_product@laiye.com\r\n- **Official Website**: [Laiye Technology](https://laiye.com)\r\n\r\n---\r\n\r\nCopyright © 2026 [Laiye Technology (Beijing) Co., Ltd.] All rights reserved.\n\nFile v1.10.0:README.md\n\n<div align=\"center\">\r\n<a id=\"agentic_doc_parse_and_extract\"></a>\r\n\r\n# 📄 Laiye Agentic Document Processing CLI (agentic_doc_parse_and_extract)\r\n\r\nagentic_doc_parse_and_extract is the official command-line tool released by Laiye Technology's ADP (Agentic Document Processing) product, enabling both humans and AI Agents to invoke ADP capabilities in the terminal for document parsing and extraction.\r\n\r\n[English](README.md) | [Simplified Chinese](README-CN.md)\r\n\r\n</div>\r\n\r\n## 🚀 About Laiye ADP\r\n\r\nADP is Laiye's **intelligent agent document processing product (Agentic Document Processing, referred to as ADP)** , based on the general understanding ability of large models, without relying on rules and annotations, with the general understanding ability of multi-language, MultiModal Machine Learning, and multi-scene; autonomous planning and execution of intelligent agents, able to understand task goals, autonomous planning steps, invoke tools, and complete complex tasks; end-to-end business automation, from document input to business decision-making to human-machine collaboration, forming a complete closed loop.\r\n\r\n**agentic-doc-parse-and-extract** is the official open-source CLI tool of ADP, supporting both manual terminal invocation and automatic invocation via AI Skill. With a single command, it can accomplish: structured document parsing + intelligent extraction of key fields, covering all scenarios including invoices, orders, certificates, bills, and general documents, outputting standard JSON, and seamlessly integrating with automation and AI workflows.\r\n\r\n---\r\n\r\n### 💡 Core Features\r\n\r\nagentic-doc-parse-and-extract focuses on intelligent processing of the entire document workflow, taking into account both manual terminal calls and automatic calls by AI Agents. Its core functions cover all scenarios of parsing, extraction, and batch processing, requiring no complex configuration, and operations can be completed with a single command:\r\n\r\n| Function Name | Function Description | Optimal Scenario |\r\n|---------|------------------|----------|\r\n| **Document Parsing** | Automatically recognize multi-format documents such as PDFs and images, convert messy unstructured content (e.g., scanned documents, handwritten text, complex layout documents) into standardized Structured Data, while preserving the original document hierarchy and key relationships | Convert unstructured documents into Structured Data for LLM reading and subsequent extraction |\r\n| **Out Of The Box Document Extraction** | Based on the native AI capabilities of the ADP large model, it comes with built-in standardized extraction models for invoices, receipts, orders, commonly used certificates in China, etc. No need to configure rules or manual annotation, one-click extraction of key fields from various types of general documentation, outputting standard JSON | Account Payable automation, expense management, procurement automation, quick entry of card and certificate information into the system |\r\n| **Custom Document Extraction** | Supports independent creation, editing, and management of personalized extraction applications, allowing configuration of exclusive extraction fields and recognition logic for enterprise-specific documentation and industry-customized forms | Private extraction requirements for enterprise-specific documentation, industry-customized forms, and non-standardized documents |\r\n| **Task Query** | Supports asynchronous task submission and status query, enabling quick viewing of task execution progress, success/failure status, and final task processing results | Batch task processing, asynchronous document processing, problem troubleshooting, and processing record tracing |\r\n| **Application Management** | Provides comprehensive application management capabilities, allowing users to view all available extraction applications (system-built + custom), query application details, and manage application tags | Multi-scenario business switching, full lifecycle management of applications, and custom application management |\r\n\r\n---\r\n\r\n### 🎯 Target Audience\r\n\r\n- **AI Agent Developers:** Quickly integrate document parsing and extraction capabilities through standard Skills to empower intelligent agents in automated work processes\r\n- **Enterprise R&D and Architecture Team:** Unified access to CLI tools, enabling low-cost implementation of structured and automated processing for all types of documentation\r\n- **Finance & Administrative Operations Team:** Batch parsing of invoices, receipts, and reimbursement forms, reducing manual entry and verification costs\r\n- **Business System Integrator:** Relying on standardized JSON output, seamlessly connecting with upstream and downstream systems such as ERP, RPA, and Central Product Platform\r\n- **Internal Platform Builder:** Supporting local deployment and environment adaptation to meet the requirements of enterprise intranet security and permission management\r\n\r\n## 📁 Project File Structure and File Description\r\n\r\n```\r\nagentic-doc-parse-and-extract/\r\n├── skill.md                  # Skill configuration and invocation instructions\r\n├── README.md                 # Introduction to Laiye ADP product and instructions for CLI download and invocation\r\n├── references/               # Parameter enumeration, error codes, and JSON return instructions\r\n    ├── examples.md           # Sample code for invocation and return with parameter explanations\r\n    ├── commands.md           # List of all commands\r\n    ├── response-schema.md    # Return parameter description\r\n    ├── error-handling.md     # Mistakes and what to do about them\r\n├── License                   # License authorization\r\n```\r\n\r\n## 📋 API Key\r\n### Get API Key\r\n1. Visit [ADP China Region URL](https://adp.laiye.com/?utm_source=openclaw), [ADP Global Region URL](https://adp-global.laiye.com/?utm_source=openclaw)\r\n2. Register a new account (new users get 100 free credits per month)\r\n\r\n## 💻 Environment and Installation\r\n### Supported Platforms and Versions\r\n| Platform | Minimum Requirements |\r\n|---------|------------------|\r\n| **Windows** | Windows 10 or later |\r\n| **Linux** | Ubuntu 18.04+, CentOS 7+, or mainstream Linux distributions |\r\n| **macOS** | macOS 10.14 (Mojave) or later |\r\n---\r\n\r\n### Get the Installation Package\r\n\r\n ```bash\r\n  # Method 1: npm (recommended, works on all platforms, China-friendly with npmmirror)\r\n  npm install -g @laiye-adp/agentic-doc-parse-and-extract-cli --registry=https://registry.npmmirror.com/ || npm install -g @laiye-adp/agentic-doc-parse-and-extract-cli\r\n  export PATH=\"$(npm prefix -g)/bin:$PATH\"\r\n\r\n  # Method 2: Shell script (Linux / macOS, if npm is not available)\r\n  curl -fsSL https://raw.githubusercontent.com/laiye-ai/adp-cli/main/scripts/adp-init.sh | bash\r\n\r\n  # Method 3: PowerShell script (Windows, if npm is not available)\r\n  Invoke-WebRequest -Uri \"https://raw.githubusercontent.com/laiye-ai/adp-cli/main/scripts/adp-init.ps1\" -OutFile \"$env:TEMP\\adp-init.ps1\"; & \"$env:TEMP\\adp-init.ps1\"\r\n  ```\r\n\r\n---\r\n### Local Installation Guide\r\nADP CLI provides pre-compiled executable files that can be used directly without installing a Python environment.\r\n\r\n#### Installation on Windows Systems\r\n- Step 1: Download the executable file\r\n  Windows: Download the [adp.exe](https://laiye-devops.oss-cn-beijing.aliyuncs.com/release/adp/cli/v1.10.0/win/adp.exe) executable file\r\n\r\n- Step 2: Run the executable file\r\n  Run in the command prompt:\r\n    ```\r\n    # Run in the current directory\r\n    adp.exe --help\r\n\r\n    # Or add it to the PATH and use it directly\r\n    adp --help\r\n    ```\r\n- Step 3: Add to System PATH (Optional)\r\n  To use the adp command from any location, you can add the directory where the file is located to the system PATH:\r\n    ```\r\n    # Method 1: Temporary addition (current session window)\r\n    set PATH=%PATH%;C:\\path\\to\\adp-cli\r\n\r\n    # Method 2: Permanent addition (requires administrator privileges)\r\n    setx PATH \"%PATH%;C:\\path\\to\\adp-cli\"\r\n    ```\r\n- Step 4: Verify the installation\r\n    ```\r\n    # Check version information\r\n    adp.exe --version\r\n\r\n    # Or if added to PATH\r\n    adp --version\r\n    ```\r\n---\r\n\r\n#### Linux System Installation\r\n- Step 1: Download the executable file\r\n  Linux/macOS: Download the corresponding platform [binary file](https://laiye-devops.oss-cn-beijing.aliyuncs.com/release/adp/cli/v1.10.0/linux/adp)\r\n\r\n- Step 2: Set executable permissions\r\n    ```\r\n    # Set executable permissions\r\n    chmod +x adp\r\n\r\n    # Run tests\r\n    ./adp --help\r\n    ```\r\n- Step 3: Add to the PATH environment variable (recommended)\r\nTo use the adp command from any location, it is recommended to choose one of the following two methods:\r\n    ```\r\n    # Method 1: Temporary addition (current session window)\r\n    export PATH=$PATH:$(pwd)\r\n\r\n    # Method 2: Permanent addition (add to ~/.bashrc or ~/.zshrc)\r\n    echo 'export PATH=$PATH:/path/to/adp' >> ~/.bashrc\r\n    source ~/.bashrc\r\n\r\n    # Method 3: Create a symbolic link (requires sudo privileges)\r\n    sudo ln -s $(pwd)/adp /usr/local/bin/adp\r\n\r\n    # Verification\r\n    adp --version\r\n    ```\r\n- Step 4: Verify the installation\r\n    ```\r\n    # Use relative path\r\n   ./adp --version\r\n\r\n    # Or if added to PATH\r\n    adp --version\r\n    ```\r\n\r\n---\r\n#### macOS System Installation\r\n- Step 1: Download the executable file\r\n  Linux/macOS: Download the corresponding platform [binary file](https://laiye-devops.oss-cn-beijing.aliyuncs.com/release/adp/cli/v1.10.0/linux/adp)\r\n\r\n- Step 2: Set executable permissions\r\n    ```\r\n    # Set executable permissions\r\n    chmod +x adp\r\n\r\n    # Run tests\r\n    ./adp --help\r\n    ```\r\n- Step 3: Add to the PATH environment variable (recommended)\r\n  To use the adp command from any location, it is recommended to choose one of the following two methods:\r\n    ```\r\n    # Method 1: Temporary addition (current session window)\r\n    export PATH=$PATH:$(pwd)\r\n\r\n    # Method 2: Permanent addition (add to ~/.zshrc)\r\n    echo 'export PATH=$PATH:/path/to/adp' >> ~/.zshrc\r\n    source ~/.zshrc\r\n\r\n    # Method 3: Create a symbolic link (requires sudo privileges)\r\n    sudo ln -s $(pwd)/adp /usr/local/bin/adp\r\n\r\n    # Verify\r\n    adp --version\r\n    ```\r\n- Step 4: Verify Installation\r\n    ```\r\n    # Use relative path\r\n   ./adp --version\r\n\r\n    # Or if added to PATH\r\n    adp --version\r\n    ```\r\n\r\n## ✨ Product & Technical Highlights\r\n\r\n### 📦 Out Of The Box Product\r\n\r\n| Product | Extracted Content | Optimal Scenario |\r\n|---------|------------------|----------|\r\n| **Document Parsing** | Extract elements such as text, tables, images, seals, etc. from the document | Convert the document into structured data for LLM to read |\r\n| **Invoice/Receipt Extraction** | Invoice number, date, supplier, item details, total amount, taxes | Accounts payable automation, expense management |\r\n| **Order Extraction** | Purchase Order Number, Commodity, Quantity, Price, Delivery Information | Procurement Automation, E-commerce Integration |\r\n| **Card Extraction** | 11 types of commonly used cards and certificates such as ID card, bank card, driver's license, business license, etc. | Quick entry of card and certificate information into the system |\r\n\r\n### 🛠️ Technical Capabilities\r\n\r\n- **10+ File Formats**: Covers mainstream image and work document formats (.jpg,.jpeg,.png,.bmp,.tiff,.tif,.pdf,.doc,.docx,.xls,.xlsx,.ppt,.pptx)\r\n- **VLM + LLM Dual Engines**: Visual understanding + semantic extraction to achieve maximum accuracy\r\n- **Synchronous and Asynchronous Modes**: All functions are open to external synchronous and asynchronous APIs\r\n- **File Restrictions:** Maximum file size: 50MB\r\n- **Batch Processing:** Supports folder recursion processing\r\n### 🌟 Product Advantages\r\n- Relying on the core capabilities of Laiye Technology's ADP large model and combining the lightweight features of CLI tools, we have created an efficient, flexible, and easily integrated document processing solution with prominent core advantages:\r\n- Zero-threshold entry: No professional technical background is required, no rule configuration or data annotation is needed, with a built-in standardized extraction model that is out of the box, and a single command can complete document parsing and extraction.\r\n- Full-scenario adaptation: Covers common scenarios such as invoices, receipts, orders, certificates, etc., while supporting custom extensions to adapt to enterprise-specific documentation and industry-specific forms, taking into account both general and personalized needs.\r\n- Efficient integration and adaptation: Supports native calls of AI Agent Skill and manual calls from terminals, outputs in standard JSON format, seamlessly connects with upstream and downstream systems such as RPA, ERP, and Central Product Platform, reducing integration costs.\r\n- Multi-terminal compatibility: Supports all platforms including Windows, macOS, and Linux, requires no additional installation of dependencies, can be globally called after configuring environment variables, and adapts to local deployment and multi-scenario work requirements.\r\n- High Precision and Stability: Optimized based on the ADP large model, it has high recognition accuracy for unstructured documents (scanned documents, handwritten text, complex layouts), supports asynchronous task management, and ensures the stable operation of business processes.\r\n\r\n<a id=\"credit\"></a>\r\n### 💰 Billing\r\n\r\n- **New User Benefits:** Receive 100 free credits per month, with no restrictions on application usage\r\n- **Asset Consumption Rules:**\r\n    | Processing Stage | Cost |\r\n    |-----------------|------|\r\n    | Document Parsing | 0.5 points/page |\r\n    | Purchase Order Extraction | 1.5 points/page |\r\n    | Invoice/Receipt Extraction | 1.5 points/page |\r\n    | Custom Extraction | 1 point/page |\r\n\r\n- **Asset Recharge:**  You can directly log in to the ADP Portal to recharge assets. We provide independent Public Cloud access addresses for domestic and international users, which need to be configured separately by region. Accessing from a nearby location can better ensure high-speed and stable invocation across the network.\r\n  - Users in Chinese Mainland [Log in](https://adp.laiye.com/?utm_source=openclaw)\r\n  - Users outside Chinese Mainland [Log in](https://adp-global.laiye.com/?utm_source=openclaw)\r\n\r\n If you encounter any issues with payment, please contact the support email: 📧 global_product@laiye.com\r\n\r\n## 📜 License\r\n\r\nWe adopt a combined model of open-source tools + paid services: the CLI tool is completely free and open-source, making it easy for everyone to quickly integrate; while the core ADP intelligent parsing capability is a Public Cloud commercial service, billed based on actual usage, aiming to provide users with a highly accurate and stable document processing experience.\r\n\r\n- **CLI Tool**: Open source under the MIT License, freely available for use, modification, and distribution\r\n- **ADP Service**: AI document processing service based on Public Cloud, billed by usage, [Billing Rules](#credit)\r\n\r\n### 💰 Free Quota\r\nNew users can receive **100 free credits** per month after registration, allowing them to experience full functionality\r\n\r\n## 📞 Support and Contact\r\n- **CLI Documentation**: [ADP CLI User Guide](https://laiye-tech.feishu.cn/wiki/YIaawiK2DimisZk5KfDc8a8cnLh)\r\n- **API Documentation**: [OpenAPI User Guide](https://laiye-tech.feishu.cn/wiki/S1t2wYR04ivndKkMDxxcp2SFnKd?from=from_copylink)\r\n- **User Guide**: [Public Cloud Operation Manual](https://laiye-tech.feishu.cn/wiki/OfexwgVUQiOpEek4kO7c7NEJnAe)\r\n- **Problem Feedback**: [GitHub Issues](https://github.com/laiye-ai/adp-cli/issues) | global_product@laiye.com\r\n- **Official Website**: [Laiye Technology](https://laiye.com/en/)\r\n\r\n---\r\n\r\n<div align=\"center\">\r\n[⬆ Back to Top](#agentic_doc_parse_and_extract)\r\n\r\n**Build the Future of Agentic AI with ❤️**\r\nCopyright © 2026 [Laiye Technology (Beijing) Co., Ltd.] All rights reserved.\r\n\r\n</div>\n\nFile v1.10.0:_meta.json\n\n{\n  \"ownerId\": \"kn770b2vgq91s7c13mz7syttqh81xj81\",\n  \"slug\": \"laiye-ocr\",\n  \"version\": \"1.10.0\",\n  \"publishedAt\": 1777021873996\n}\n\nFile v1.10.0:references/commands.md\n\n# ADP CLI Complete Command Reference\r\n\r\n> This document is strictly aligned with the CLI's built-in `adp schema` output. Agent can also run `adp schema` to get the machine-readable JSON version of this spec.\r\n\r\n## Global Options\r\n\r\n| Option | Type | Description |\r\n|--------|------|-------------|\r\n| `--lang` | string | Set language (`en` or `zh`) |\r\n| `--json` | boolean | Output in JSON format (recommended for Agent) |\r\n| `--quiet` | boolean | Suppress all output except errors |\r\n\r\n---\r\n\r\n## config — Configuration Management\r\n\r\n### `adp config set`\r\n\r\nSet API Key or Base URL.\r\n\r\n| Option | Type | Required | Description |\r\n|--------|------|----------|-------------|\r\n| `--api-key` | string | No | API Key for authentication |\r\n| `--api-base-url` | string | No | API Base URL |\r\n\r\n### `adp config get`\r\n\r\nView current configuration (no options).\r\n\r\n### `adp config clear`\r\n\r\nClear all configuration.\r\n\r\n| Option | Type | Description |\r\n|--------|------|-------------|\r\n| `--force`, `-y` | boolean | Skip confirmation prompt |\r\n\r\n---\r\n\r\n## app-id — Application Management\r\n\r\n### `adp app-id list`\r\n\r\nQuery available applications.\r\n\r\n| Option | Type | Required | Default | Description |\r\n|--------|------|----------|---------|-------------|\r\n| `--app-label` | string | No | — | Filter by application label |\r\n| `--app-type` | integer | No | — | Filter by application type: `0`=system preset, `1`=custom; omit to list all |\r\n| `--limit` | integer | No | 120 | Maximum number of results |\r\n\r\n### `adp app-id cache`\r\n\r\nView cached application list (no options). Cache is permanent and does not expire.\r\n\r\n---\r\n\r\n## credit — Credit Balance\r\n\r\n### `adp credit`\r\n\r\nCheck current account credit balance.\r\n\r\n| Option | Type | Required | Description |\r\n|--------|------|----------|-------------|\r\n| `--api-key` | string | No | Override configured API Key |\r\n\r\n---\r\n\r\n## parse — Document Parsing\r\n\r\nParses the entire document to retrieve full text, layout, structure, and content.\r\n\r\n### `adp parse local <file-path>`\r\n\r\nParse local file or folder (batch mode when path is a folder).\r\n\r\n| Option | Type | Required | Default | Description |\r\n|--------|------|----------|---------|-------------|\r\n| `--app-id` | string | **Yes** | — | Application ID |\r\n| `--async` | boolean | No | false | Enable asynchronous processing |\r\n| `--no-wait` | boolean | No | false | Submit async task and return immediately (use with `--async`) |\r\n| `--export` | string | No | — | Export results to specified path |\r\n| `--timeout` | integer | No | 900 | Timeout in seconds |\r\n| `--concurrency` | integer | No | 1 | Concurrent processing count (max 1 free, max 2 paid) |\r\n| `--retry` | integer | No | 0 | Number of retries on failure (exponential backoff) |\r\n\r\n### `adp parse url <url>`\r\n\r\nParse document from URL. When the URL points to a text file containing a list of URLs (one per line), batch mode is activated.\r\n\r\n| Option | Type | Required | Default | Description |\r\n|--------|------|----------|---------|-------------|\r\n| `--app-id` | string | **Yes** | — | Application ID |\r\n| `--async` | boolean | No | false | Enable asynchronous processing |\r\n| `--no-wait` | boolean | No | false | Submit async task and return immediately (use with `--async`) |\r\n| `--export` | string | No | — | Export results to specified path |\r\n| `--timeout` | integer | No | 900 | Timeout in seconds |\r\n| `--concurrency` | integer | No | 1 | Concurrent processing count |\r\n| `--retry` | integer | No | 0 | Number of retries on failure |\r\n\r\n### `adp parse base64 <base64-strings>`\r\n\r\nParse base64-encoded document content.\r\n\r\n| Option | Type | Required | Default | Description |\r\n|--------|------|----------|---------|-------------|\r\n| `--app-id` | string | **Yes** | — | Application ID |\r\n| `--async` | boolean | No | false | Enable asynchronous processing |\r\n| `--no-wait` | boolean | No | false | Submit async task and return immediately |\r\n| `--export` | string | No | — | Export results to specified path |\r\n| `--timeout` | integer | No | 900 | Timeout in seconds |\r\n| `--file-name` | string | No | \"document\" | File name for the base64 content |\r\n| `--concurrency` | integer | No | 1 | Concurrent processing count |\r\n| `--retry` | integer | No | 0 | Number of retries on failure |\r\n\r\n### `adp parse query <task-ids...>`\r\n\r\nQuery async parse task status and results. Supports multiple task IDs as arguments.\r\n\r\n| Option | Type | Required | Default | Description |\r\n|--------|------|----------|---------|-------------|\r\n| `--watch` | boolean | No | false | Continuously poll until task completes |\r\n| `--file` | string | No | — | Read task IDs from a JSON file (produced by `--no-wait`) |\r\n| `--export` | string | No | — | Export results to specified path |\r\n| `--timeout` | integer | No | 900 | Watch mode timeout in seconds |\r\n| `--concurrency` | integer | No | 1 | Concurrent query count |\r\n\r\n---\r\n\r\n## extract — Document Extraction\r\n\r\nExtracts specific structured fields from documents (amount, date, company name, etc.).\r\n\r\n### `adp extract local <file-path>`\r\n\r\nExtract from local file or folder (batch mode when path is a folder).\r\n\r\n| Option | Type | Required | Default | Description |\r\n|--------|------|----------|---------|-------------|\r\n| `--app-id` | string | **Yes** | — | Application ID |\r\n| `--async` | boolean | No | false | Enable asynchronous processing |\r\n| `--no-wait` | boolean | No | false | Submit async task and return immediately |\r\n| `--export` | string | No | — | Export results to specified path |\r\n| `--timeout` | integer | No | 900 | Timeout in seconds |\r\n| `--concurrency` | integer | No | 1 | Concurrent processing count |\r\n| `--retry` | integer | No | 0 | Number of retries on failure |\r\n\r\n### `adp extract url <url>`\r\n\r\nExtract from URL document. Supports URL list file for batch mode.\r\n\r\n| Option | Type | Required | Default | Description |\r\n|--------|------|----------|---------|-------------|\r\n| `--app-id` | string | **Yes** | — | Application ID |\r\n| `--async` | boolean | No | false | Enable asynchronous processing |\r\n| `--no-wait` | boolean | No | false | Submit async task and return immediately |\r\n| `--export` | string | No | — | Export results to specified path |\r\n| `--timeout` | integer | No | 900 | Timeout in seconds |\r\n| `--concurrency` | integer | No | 1 | Concurrent processing count |\r\n| `--retry` | integer | No | 0 | Number of retries on failure |\r\n\r\n### `adp extract base64 <base64-strings>`\r\n\r\nExtract from base64-encoded document content.\r\n\r\n| Option | Type | Required | Default | Description |\r\n|--------|------|----------|---------|-------------|\r\n| `--app-id` | string | **Yes** | — | Application ID |\r\n| `--async` | boolean | No | false | Enable asynchronous processing |\r\n| `--no-wait` | boolean | No | false | Submit async task and return immediately |\r\n| `--export` | string | No | — | Export results to specified path |\r\n| `--timeout` | integer | No | 900 | Timeout in seconds |\r\n| `--file-name` | string | No | \"document\" | File name for the base64 content |\r\n| `--concurrency` | integer | No | 1 | Concurrent processing count |\r\n| `--retry` | integer | No | 0 | Number of retries on failure |\r\n\r\n### `adp extract query <task-ids...>`\r\n\r\nQuery async extract task status and results. Supports multiple task IDs.\r\n\r\n| Option | Type | Required | Default | Description |\r\n|--------|------|----------|---------|-------------|\r\n| `--watch` | boolean | No | false | Continuously poll until task completes |\r\n| `--file` | string | No | — | Read task IDs from a JSON file (produced by `--no-wait`) |\r\n| `--export` | string | No | — | Export results to specified path |\r\n| `--timeout` | integer | No | 900 | Watch mode timeout in seconds |\r\n| `--concurrency` | integer | No | 1 | Concurrent query count |\r\n\r\n---\r\n\r\n## custom-app — Custom Extraction Application Management\r\n\r\n### `adp custom-app create`\r\n\r\nCreate a custom extraction application.\r\n\r\n| Option | Type | Required | Description |\r\n|--------|------|----------|-------------|\r\n| `--api-key` | string | No | Override configured API Key |\r\n| `--app-name` | string | **Yes** | Application name |\r\n| `--app-label` | string | No | Application labels (up to 5) |\r\n| `--extract-fields` | string (JSON) | **Yes** | Field definitions in JSON format |\r\n| `--parse-mode` | string | **Yes** | Parsing mode: `advance`, `standard`, or `agentic` |\r\n| `--enable-long-doc` | string | **Yes** | Enable long document processing (`true`/`false`) |\r\n| `--long-doc-config` | string (JSON) | No | Long document type configuration |\r\n\r\n### `adp custom-app update`\r\n\r\nUpdate an existing custom extraction application.\r\n\r\n| Option | Type | Required | Description |\r\n|--------|------|----------|-------------|\r\n| `--api-key` | string | No | Override configured API Key |\r\n| `--app-id` | string | **Yes** | Application ID to update |\r\n| `--app-name` | string | No | New application name |\r\n| `--app-label` | string | No | New application labels |\r\n| `--extract-fields` | string (JSON) | **Yes** | Updated field definitions |\r\n| `--parse-mode` | string | **Yes** | Parsing mode: `advance`, `standard`, or `agentic` |\r\n| `--enable-long-doc` | string | **Yes** | Enable long document processing |\r\n| `--long-doc-config` | string (JSON) | No | Long document type configuration |\r\n\r\n### `adp custom-app get-config`\r\n\r\nView custom application configuration.\r\n\r\n| Option | Type | Required | Description |\r\n|--------|------|----------|-------------|\r\n| `--api-key` | string | No | Override configured API Key |\r\n| `--app-id` | string | **Yes** | Application ID |\r\n| `--config-version` | string | No | Configuration version (e.g., `v1`) |\r\n\r\n### `adp custom-app delete`\r\n\r\nDelete a custom application.\r\n\r\n| Option | Type | Required | Description |\r\n|--------|------|----------|-------------|\r\n| `--api-key` | string | No | Override configured API Key |\r\n| `--app-id` | string | **Yes** | Application ID to delete |\r\n\r\n### `adp custom-app delete-version`\r\n\r\nDelete a specific version of a custom application.\r\n\r\n| Option | Type | Required | Description |\r\n|--------|------|----------|-------------|\r\n| `--api-key` | string | No | Override configured API Key |\r\n| `--app-id` | string | **Yes** | Application ID |\r\n| `--config-version` | string | **Yes** | Version to delete (e.g., `v2`) |\r\n\r\n### `adp custom-app ai-generate`\r\n\r\nAI-powered field recommendation based on a sample document.\r\n\r\n| Option | Type | Required | Description |\r\n|--------|------|----------|-------------|\r\n| `--api-key` | string | No | Override configured API Key |\r\n| `--app-id` | string | **Yes** | Application ID |\r\n| `--file-url` | string | No | Sample document URL |\r\n| `--file-local` | string | No | Sample document local path |\r\n| `--base64` | string | No | Sample document base64 content |\r\n\r\n> Note: Provide exactly one of `--file-url`, `--file-local`, or `--base64`.\r\n\r\n---\r\n\r\n## schema — Machine-Readable Command Spec\r\n\r\n### `adp schema`\r\n\r\nOutput the complete command schema in JSON format. Designed for Agent introspection — Agent can call this command at startup to dynamically discover all available commands, parameters, types, and defaults.\r\n\r\n---\r\n\r\n## help — Help\r\n\r\n### `adp --help`\r\n\r\nView the complete list of commands and usage instructions.\r\n\r\n---\r\n\r\n## ADP Error Codes\r\n\r\nSee [error-handling.md](error-handling.md) for the complete error code reference and Agent recovery strategies.\n\nFile v1.10.0:references/error-handling.md\n\n# ADP CLI Error Handling Guide for Agent\r\n\r\n> This document defines all error types, exit codes, and recommended Agent recovery strategies.\r\n\r\n## Error Output Format\r\n\r\nErrors are output to **stderr**. In JSON mode (`--json` or non-TTY), the format is:\r\n\r\n```json\r\n{\r\n  \"type\": \"ERROR_TYPE\",\r\n  \"message\": \"Human-readable error description\",\r\n  \"fix\": \"Suggested fix action\",\r\n  \"retryable\": true,\r\n  \"details\": {\"context\": \"command_name\"}\r\n}\r\n```\r\n\r\nKey field for Agent: **`retryable`** — if `true`, the Agent should retry with exponential backoff.\r\n\r\n---\r\n\r\n## Error Types and Agent Recovery Strategies\r\n\r\n### AUTH_ERROR (Exit Code: 4)\r\n\r\n**Triggers:** Invalid API Key, expired API Key, authentication failed, 401/403 HTTP status.\r\n\r\n**Agent strategy:**\r\n1. Run `adp config get` to check if API Key is configured\r\n2. If not configured → prompt user to provide API Key\r\n3. If configured but invalid → prompt user to verify/update API Key\r\n4. Do NOT retry automatically — authentication errors are not transient\r\n\r\n### PARAM_ERROR (Exit Code: 2)\r\n\r\n**Triggers:** Invalid JSON format, unsupported file type, invalid parameter value, missing required parameter.\r\n\r\n**Agent strategy:**\r\n1. Read the `message` field to identify which parameter is wrong\r\n2. Fix the parameter and retry\r\n3. Common fixes:\r\n   - JSON parse error → validate JSON syntax in `--extract-fields` or `--long-doc-config`\r\n   - Unsupported file type → check file extension is one of: .jpg, .jpeg, .png, .bmp, .tiff, .tif, .pdf, .doc, .docx, .xls, .xlsx, .ppt, .pptx\r\n   - Invalid enum value → check `--parse-mode` is one of: `advance`, `standard`, `agentic`\r\n\r\n### RESOURCE_ERROR (Exit Code: 3)\r\n\r\n**Triggers:** app-id not found, file not found, task not found, version not found, 404 HTTP status.\r\n\r\n**Agent strategy:**\r\n1. If app-id not found → run `adp app-id list` to refresh, then retry with correct app-id\r\n2. If local file not found → verify file path exists\r\n3. If task not found → the task_id may be incorrect or expired\r\n4. Do NOT retry with same parameters\r\n\r\n### NETWORK_ERROR (Exit Code: 1)\r\n\r\n**Triggers:** Connection refused, DNS lookup failure, timeout, TLS handshake error.\r\n\r\n**Agent strategy:**\r\n1. This is retryable — retry with exponential backoff (2s, 4s, 8s)\r\n2. Max 3 retries\r\n3. If still failing → check network connectivity, verify `--api-base-url` is correct\r\n4. Consider using `--timeout` with a larger value for slow networks\r\n\r\n### API_ERROR (Exit Code: 1)\r\n\r\n**Triggers:** Rate limiting (429), server error (5xx), generic API failures.\r\n\r\n**Agent strategy:**\r\n1. If 429 (rate limited) → wait 30 seconds, then retry\r\n2. If 5xx → retry with exponential backoff, max 3 attempts\r\n3. If persistent → suggest user contact support (global_product@laiye.com)\r\n\r\n### CONFLICT_ERROR (Exit Code: 5)\r\n\r\n**Triggers:** Resource already exists, duplicate app name.\r\n\r\n**Agent strategy:**\r\n1. If creating custom-app with duplicate name → use a different `--app-name`\r\n2. If updating → check current state with `custom-app get-config` first\r\n3. Do NOT retry with same parameters\r\n\r\n### SYSTEM_ERROR (Exit Code: 1)\r\n\r\n**Triggers:** Unexpected internal errors.\r\n\r\n**Agent strategy:**\r\n1. Log the error message for diagnostics\r\n2. Do NOT retry — these are typically programming errors or unexpected states\r\n3. Suggest user report the issue\r\n\r\n---\r\n\r\n## Exit Codes Quick Reference\r\n\r\n| Code | Name | Retryable | Agent Action |\r\n|------|------|-----------|--------------|\r\n| 0 | Success | — | Proceed normally |\r\n| 1 | General Error | Depends on type | Check `retryable` field in error JSON |\r\n| 2 | Parameter Error | No | Fix parameter and retry |\r\n| 3 | Resource Not Found | No | Verify resource ID/path |\r\n| 4 | Permission Denied | No | Prompt user for credentials |\r\n| 5 | Conflict | No | Change conflicting parameter |\r\n| 6 | Partial Failure | — | Check batch summary for per-file status |\r\n\r\n---\r\n\r\n## Batch Processing Error Handling\r\n\r\nExit code `6` (Partial Failure) means some files succeeded and some failed in a batch.\r\n\r\n**Agent strategy:**\r\n1. Parse the stdout summary JSON\r\n2. For files with `\"status\": \"failed\"`, read the `error` field\r\n3. Decide per-file: retry failed files individually, or report to user\r\n4. Use `--retry N` flag to enable automatic retry with exponential backoff at CLI level\r\n\r\n---\r\n\r\n## Credit-Related Errors\r\n\r\nWhen credit balance is insufficient, the API returns a specific error. Agent should:\r\n1. Run `adp credit` to check remaining balance\r\n2. Report the balance to user\r\n3. Provide billing reference:\r\n   - Document parsing: 0.5 credits/page\r\n   - Invoice/receipt extraction: 1.5 credits/page\r\n   - Order extraction: 1.5 credits/page\r\n   - Custom extraction: 1 credit/page\r\n\r\n---\r\n\r\n## Timeout Handling\r\n\r\nDefault timeout is 900 seconds (15 minutes). For large documents or slow networks:\r\n\r\n**Agent strategy:**\r\n1. If timeout occurs on sync processing → retry with `--async` mode\r\n2. For files >20MB or >200 pages → always use `--async`\r\n3. Increase timeout with `--timeout 1800` if needed\n\nFile v1.10.0:references/examples.md\n\n# ADP CLI Sample code and response\r\n\r\n## 1. Install ADP CLI\r\n\r\nFirst check if ADP CLI is already installed by running `adp version`. If it succeeds, skip to step 2.\r\n\r\nIf not installed, choose the appropriate method:\r\n\r\n```bash\r\n# Method 1: npm (recommended, works on all platforms, China-friendly with npmmirror)\r\nnpm install -g @laiye-adp/agentic-doc-parse-and-extract-cli --registry=https://registry.npmmirror.com/ || npm install -g @laiye-adp/agentic-doc-parse-and-extract-cli\r\n\r\n# Method 2: Shell script (Linux / macOS, if npm is not available)\r\ncurl -fsSL https://raw.githubusercontent.com/laiye-ai/adp-cli/main/scripts/adp-init.sh | bash\r\n\r\n# Method 3: PowerShell script (Windows, if npm is not available)\r\nInvoke-WebRequest -Uri \"https://raw.githubusercontent.com/laiye-ai/adp-cli/main/scripts/adp-init.ps1\" -OutFile \"$env:TEMP\\adp-init.ps1\"; & \"$env:TEMP\\adp-init.ps1\"\r\n```\r\n\r\n### Resolving `adp` when it's not on PATH (important for Agents)\r\n\r\nAfter `npm install -g`, the npm global bin directory is often **not** on the current shell's `PATH`, so a bare `adp` call will fail with \"command not found\". Agents must resolve the absolute path to the `adp` binary instead of relying on `PATH`.\r\n\r\n**Resolution rule:**\r\n- **Windows**: `npm prefix -g` returns the directory that already contains `adp.cmd` / `adp.exe`. Use `<prefix>\\adp.cmd`.\r\n- **Linux / macOS**: `npm prefix -g` returns the prefix; the binary lives at `<prefix>/bin/adp`.\r\n\r\n**Cross-platform one-liner to locate the binary:**\r\n\r\n```bash\r\n# Linux / macOS (bash/zsh)\r\nADP_BIN=\"$(npm prefix -g)/bin/adp\"\r\n\"$ADP_BIN\" version\r\n```\r\n\r\n```powershell\r\n# Windows (PowerShell)\r\n$ADP_BIN = Join-Path (npm prefix -g) \"adp.cmd\"\r\n& $ADP_BIN version\r\n```\r\n\r\n```bash\r\n# Windows (Git Bash / MSYS in Claude Code)\r\nADP_BIN=\"$(npm prefix -g)/adp.cmd\"\r\n\"$ADP_BIN\" version\r\n```\r\n\r\n**Optional**: prepend the directory to PATH for the current shell session only (does not persist):\r\n```bash\r\n# bash/zsh\r\nexport PATH=\"$(dirname \"$ADP_BIN\"):$PATH\"\r\n```\r\n```powershell\r\n# PowerShell\r\n$env:PATH = \"$(Split-Path $ADP_BIN);$env:PATH\"\r\n```\r\n\r\n### Agent installation logic\r\n\r\n1. Run `adp version` — if it succeeds, CLI is already installed and on PATH, skip installation and use bare `adp` for all subsequent commands.\r\n2. If not installed, check if `npm` is available → use Method 1. Else detect OS: Linux / macOS → Method 2; Windows → Method 3.\r\n3. **After install, do NOT assume `adp` is on PATH.** Resolve `ADP_BIN`:\r\n   - **Method 1 (npm)**: use the platform rule above (`npm prefix -g` ± `/bin`).\r\n   - **Method 2 / 3 (shell scripts)**: parse the last line of script output — it prints `ADP_INSTALL_PATH=<absolute path>` for this exact purpose.\r\n4. Verify with `\"$ADP_BIN\" version` (or `& $ADP_BIN version` in PowerShell). If it succeeds, install is good.\r\n5. For all subsequent `adp ...` examples in this document, substitute the bare `adp` with `\"$ADP_BIN\"` (or your resolved absolute path) until the user opens a new terminal where PATH is refreshed.\r\n\r\n## 2. Configure API Key and Base URL\r\n\r\n### Verify configuration\r\n\r\n```bash\r\nadp config get\r\n```\r\n\r\n**Response example**：\r\n```json\r\n{\r\n  \"configured\": true,\r\n  \"api_key_masked\": \"9ce0...ab4f\",\r\n  \"api_base_url\": \"https://adp.laiye.com/\"\r\n}\r\n```\r\n### configuration\r\n```bash\r\n# Configure API Key\r\nadp config set --api-key YOUR_API_KEY\r\n\r\n# Configure Base URL\r\nadp config set --api-base-url https://your-api-url.com\r\n```\r\n\r\n\r\n## 3. Query the list of available applications\r\n\r\n```bash\r\n# List available applications\r\nadp app-id list \r\n\r\n# Show cached applications（The application ID cache is permanent and will not expire）\r\nadp app-id cache \r\n```\r\n\r\n\r\n**Response example**：\r\n```json\r\n  [\r\n    {\r\n      \"app_id\": \"2f74******58400\",\r\n      \"app_label\": null,\r\n      \"app_name\": \"Custom Application Name\",\r\n      \"app_type\": 1\r\n    },\r\n   {\r\n      \"app_id\": \"ootb_******c8d1\",\r\n      \"app_label\": [\r\n        \"invoice\",\r\n        \"Receipt\",\r\n        \"Bill\",\r\n        \"Financial document\",\r\n        \"Information extraction\"\r\n      ],\r\n      \"app_name\": \"Invoice\",\r\n      \"app_type\": 0\r\n    },\r\n   {\r\n      \"app_id\": \"ootb_******a2b5\",\r\n      \"app_label\": [\r\n        \"Order\",\r\n        \"E-commerce logistics\",\r\n        \"Inventory management\",\r\n        \"Information extraction\"\r\n      ],\r\n      \"app_name\": \"Purchase Order\",\r\n      \"app_type\": 0\r\n    },\r\n    {\r\n      \"app_id\": \"ootb_******y2b4\",\r\n      \"app_label\":\n\nArchive v1.4.0: 4 files, 8853 bytes\n\nFiles: _meta.json (128b), package.json (733b), README.md (9188b), SKILL.md (10835b)\n\nArchive v1.3.0: 4 files, 8820 bytes\n\nFiles: _meta.json (128b), package.json (733b), README.md (9188b), SKILL.md (10721b)\n\nArchive v1.1.1: 4 files, 8821 bytes\n\nFiles: _meta.json (128b), package.json (733b), README.md (9188b), SKILL.md (10721b)\n\nArchive v1.1.0: 4 files, 8867 bytes\n\nFiles: _meta.json (128b), package.json (732b), README.md (9240b), SKILL.md (10833b)\n\nArchive v1.0.0: 3 files, 4536 bytes\n\nFiles: _meta.json (128b), package.json (1001b), SKILL.md (10186b)","readmeExcerpt":"Skill: Laiye-OCR Owner: laiye-adp Summary: Enables AI-powered parsing and key information extraction from high-frequency documents including invoices, orders, receipts, long texts, and common Chinese... Tags: latest:1.10.3 Version history: v1.10.3 | 2026-04-24T10:44:21.260Z | user - No changes to functionality or implementation. v1.10.0 | 2026-04-24T09:11:13.996Z | user **Summary:** Major update with improved documen","codeSnippets":[],"executableExamples":[],"parameters":null,"dependencies":[],"permissions":[],"extractedFiles":[{"path":"SKILL.md","content":"---\r\nname: agentic-doc-parse-and-extract\r\ndescription: Enables AI-powered parsing and key information extraction from high-frequency documents including invoices, orders, receipts, long texts, and common Chinese identity & credential documents. Supports reusable custom templates for non-standard business files. Features batch concurrent processing to automate document workflows for finance, administration, HR data entry and other departments.\r\n---\r\n# agentic-doc-parse-and-extract Skill\r\n\r\nagentic-doc-parse-and-extract is an official command-line tool released by Laiye Technology's ADP (Agentic Document Processing) product, enabling both humans and AI agents to invoke ADP capabilities in the terminal for document parsing and extraction.\r\n\r\n## Quick Start Guide for AI Agents\r\n\r\n### Core Workflow\r\n1. **Install dependencies**: On first execution, install the ADP CLI tool and dependencies by following the instructions in [references/examples.md](references/examples.md).\r\n2. **Discover commands**: Run `adp schema` to get the machine-readable JSON spec of all commands, parameters, types, and defaults.\r\n3. **Authentication**: On first execution, run `adp config get` to verify credentials. If no valid configuration exists, prompt the user to provide an API Key.\r\n4. **Check Application**: On first execution, retrieve the application list via `adp app-id list`. For subsequent executions, prioritize `adp app-id cache` (cached in context). If the cache is unavailable, refresh it by calling `adp app-id list` again.\r\n5. **Execute**: Run `adp extract url <URL> --app-id <ID>` or `adp parse url <URL> --app-id <ID>`.\r\n6. **Query**: Check results asynchronously with `adp extract query <task_id>` or `adp parse query <task_id>`.\r\n7. **Error handling**: When a command fails, parse the stderr JSON to determine error type and recovery action. See [references/error-handling.md](references/error-handling.md).\r\n\r\n### Common Scenarios → Command Mapping\r\n| User Intent | Recommended Command | Handling Rules |\r\n| :---------- | :------------------ | :------------- |\r\n| - Read full document content<br>- Parse layout & structure<br>- Convert document to text<br>- Process / analyze full document | `adp parse` | - Sync processing for small files<br>- Async processing (`--async` parameter) for files >20MB or >200 pages |\r\n| - Extract key fields (amount, date, name, ID, etc.)<br>- Output structured results (JSON/table) | `adp extract` | - Use Extract directly, **no need to parse first**<br>- Use matched existing app<br>- Create a custom extraction app if the document type is not in the known app list |\r\n| Batch processing of local files | `adp extract local <folder path>` <br> `adp parse local <folder path> `  | Batch processing can accept files from the local folder. |\r\n| Batch processing of URL files | `adp extract url <URL list file path>` <br> `adp parse url <URL list file path> `  | If you need to process multiple URLs in a batch, you can first save the list of URLs in a text fil"},{"path":"README.md","content":"<div align=\"center\">\r\n<a id=\"agentic_doc_parse_and_extract\"></a>\r\n\r\n# 📄 Laiye Agentic Document Processing CLI (agentic_doc_parse_and_extract)\r\n\r\nagentic_doc_parse_and_extract is the official command-line tool released by Laiye Technology's ADP (Agentic Document Processing) product, enabling both humans and AI Agents to invoke ADP capabilities in the terminal for document parsing and extraction.\r\n\r\n[English](README.md) | [Simplified Chinese](README-CN.md)\r\n\r\n</div>\r\n\r\n## 🚀 About Laiye ADP\r\n\r\nADP is Laiye's **intelligent agent document processing product (Agentic Document Processing, referred to as ADP)** , based on the general understanding ability of large models, without relying on rules and annotations, with the general understanding ability of multi-language, MultiModal Machine Learning, and multi-scene; autonomous planning and execution of intelligent agents, able to understand task goals, autonomous planning steps, invoke tools, and complete complex tasks; end-to-end business automation, from document input to business decision-making to human-machine collaboration, forming a complete closed loop.\r\n\r\n**agentic-doc-parse-and-extract** is the official open-source CLI tool of ADP, supporting both manual terminal invocation and automatic invocation via AI Skill. With a single command, it can accomplish: structured document parsing + intelligent extraction of key fields, covering all scenarios including invoices, orders, certificates, bills, and general documents, outputting standard JSON, and seamlessly integrating with automation and AI workflows.\r\n\r\n---\r\n\r\n### 💡 Core Features\r\n\r\nagentic-doc-parse-and-extract focuses on intelligent processing of the entire document workflow, taking into account both manual terminal calls and automatic calls by AI Agents. Its core functions cover all scenarios of parsing, extraction, and batch processing, requiring no complex configuration, and operations can be completed with a single command:\r\n\r\n| Function Name | Function Description | Optimal Scenario |\r\n|---------|------------------|----------|\r\n| **Document Parsing** | Automatically recognize multi-format documents such as PDFs and images, convert messy unstructured content (e.g., scanned documents, handwritten text, complex layout documents) into standardized Structured Data, while preserving the original document hierarchy and key relationships | Convert unstructured documents into Structured Data for LLM reading and subsequent extraction |\r\n| **Out Of The Box Document Extraction** | Based on the native AI capabilities of the ADP large model, it comes with built-in standardized extraction models for invoices, receipts, orders, commonly used certificates in China, etc. No need to configure rules or manual annotation, one-click extraction of key fields from various types of general documentation, outputting standard JSON | Account Payable automation, expense management, procurement automation, quick entry of card and certificate information into the syst"},{"path":"_meta.json","content":"{\n  \"ownerId\": \"kn770b2vgq91s7c13mz7syttqh81xj81\",\n  \"slug\": \"laiye-ocr\",\n  \"version\": \"1.10.3\",\n  \"publishedAt\": 1777027461260\n}"},{"path":"references/commands.md","content":"# ADP CLI Complete Command Reference\r\n\r\n> This document is strictly aligned with the CLI's built-in `adp schema` output. Agent can also run `adp schema` to get the machine-readable JSON version of this spec.\r\n\r\n## Global Options\r\n\r\n| Option | Type | Description |\r\n|--------|------|-------------|\r\n| `--lang` | string | Set language (`en` or `zh`) |\r\n| `--json` | boolean | Output in JSON format (recommended for Agent) |\r\n| `--quiet` | boolean | Suppress all output except errors |\r\n\r\n---\r\n\r\n## config — Configuration Management\r\n\r\n### `adp config set`\r\n\r\nSet API Key or Base URL.\r\n\r\n| Option | Type | Required | Description |\r\n|--------|------|----------|-------------|\r\n| `--api-key` | string | No | API Key for authentication |\r\n| `--api-base-url` | string | No | API Base URL |\r\n\r\n### `adp config get`\r\n\r\nView current configuration (no options).\r\n\r\n### `adp config clear`\r\n\r\nClear all configuration.\r\n\r\n| Option | Type | Description |\r\n|--------|------|-------------|\r\n| `--force`, `-y` | boolean | Skip confirmation prompt |\r\n\r\n---\r\n\r\n## app-id — Application Management\r\n\r\n### `adp app-id list`\r\n\r\nQuery available applications.\r\n\r\n| Option | Type | Required | Default | Description |\r\n|--------|------|----------|---------|-------------|\r\n| `--app-label` | string | No | — | Filter by application label |\r\n| `--app-type` | integer | No | — | Filter by application type: `0`=system preset, `1`=custom; omit to list all |\r\n| `--limit` | integer | No | 120 | Maximum number of results |\r\n\r\n### `adp app-id cache`\r\n\r\nView cached application list (no options). Cache is permanent and does not expire.\r\n\r\n---\r\n\r\n## credit — Credit Balance\r\n\r\n### `adp credit`\r\n\r\nCheck current account credit balance.\r\n\r\n| Option | Type | Required | Description |\r\n|--------|------|----------|-------------|\r\n| `--api-key` | string | No | Override configured API Key |\r\n\r\n---\r\n\r\n## parse — Document Parsing\r\n\r\nParses the entire document to retrieve full text, layout, structure, and content.\r\n\r\n### `adp parse local <file-path>`\r\n\r\nParse local file or folder (batch mode when path is a folder).\r\n\r\n| Option | Type | Required | Default | Description |\r\n|--------|------|----------|---------|-------------|\r\n| `--app-id` | string | **Yes** | — | Application ID |\r\n| `--async` | boolean | No | false | Enable asynchronous processing |\r\n| `--no-wait` | boolean | No | false | Submit async task and return immediately (use with `--async`) |\r\n| `--export` | string | No | — | Export results to specified path |\r\n| `--timeout` | integer | No | 900 | Timeout in seconds |\r\n| `--concurrency` | integer | No | 1 | Concurrent processing count (max 1 free, max 2 paid) |\r\n| `--retry` | integer | No | 0 | Number of retries on failure (exponential backoff) |\r\n\r\n### `adp parse url <url>`\r\n\r\nParse document from URL. When the URL points to a text file containing a list of URLs (one per line), batch mode is activated.\r\n\r\n| Option | Type | Required | Default | Description |\r\n|--------|------|----------|---------|-------------|\r\n| "},{"path":"references/error-handling.md","content":"# ADP CLI Error Handling Guide for Agent\r\n\r\n> This document defines all error types, exit codes, and recommended Agent recovery strategies.\r\n\r\n## Error Output Format\r\n\r\nErrors are output to **stderr**. In JSON mode (`--json` or non-TTY), the format is:\r\n\r\n```json\r\n{\r\n  \"type\": \"ERROR_TYPE\",\r\n  \"message\": \"Human-readable error description\",\r\n  \"fix\": \"Suggested fix action\",\r\n  \"retryable\": true,\r\n  \"details\": {\"context\": \"command_name\"}\r\n}\r\n```\r\n\r\nKey field for Agent: **`retryable`** — if `true`, the Agent should retry with exponential backoff.\r\n\r\n---\r\n\r\n## Error Types and Agent Recovery Strategies\r\n\r\n### AUTH_ERROR (Exit Code: 4)\r\n\r\n**Triggers:** Invalid API Key, expired API Key, authentication failed, 401/403 HTTP status.\r\n\r\n**Agent strategy:**\r\n1. Run `adp config get` to check if API Key is configured\r\n2. If not configured → prompt user to provide API Key\r\n3. If configured but invalid → prompt user to verify/update API Key\r\n4. Do NOT retry automatically — authentication errors are not transient\r\n\r\n### PARAM_ERROR (Exit Code: 2)\r\n\r\n**Triggers:** Invalid JSON format, unsupported file type, invalid parameter value, missing required parameter.\r\n\r\n**Agent strategy:**\r\n1. Read the `message` field to identify which parameter is wrong\r\n2. Fix the parameter and retry\r\n3. Common fixes:\r\n   - JSON parse error → validate JSON syntax in `--extract-fields` or `--long-doc-config`\r\n   - Unsupported file type → check file extension is one of: .jpg, .jpeg, .png, .bmp, .tiff, .tif, .pdf, .doc, .docx, .xls, .xlsx\r\n   - Invalid enum value → check `--parse-mode` is one of: `advance`, `standard`, `agentic`\r\n\r\n### RESOURCE_ERROR (Exit Code: 3)\r\n\r\n**Triggers:** app-id not found, file not found, task not found, version not found, 404 HTTP status.\r\n\r\n**Agent strategy:**\r\n1. If app-id not found → run `adp app-id list` to refresh, then retry with correct app-id\r\n2. If local file not found → verify file path exists\r\n3. If task not found → the task_id may be incorrect or expired\r\n4. Do NOT retry with same parameters\r\n\r\n### NETWORK_ERROR (Exit Code: 1)\r\n\r\n**Triggers:** Connection refused, DNS lookup failure, timeout, TLS handshake error.\r\n\r\n**Agent strategy:**\r\n1. This is retryable — retry with exponential backoff (2s, 4s, 8s)\r\n2. Max 3 retries\r\n3. If still failing → check network connectivity, verify `--api-base-url` is correct\r\n4. Consider using `--timeout` with a larger value for slow networks\r\n\r\n### API_ERROR (Exit Code: 1)\r\n\r\n**Triggers:** Rate limiting (429), server error (5xx), generic API failures.\r\n\r\n**Agent strategy:**\r\n1. If 429 (rate limited) → wait 30 seconds, then retry\r\n2. If 5xx → retry with exponential backoff, max 3 attempts\r\n3. If persistent → suggest user contact support (global_product@laiye.com)\r\n\r\n### CONFLICT_ERROR (Exit Code: 5)\r\n\r\n**Triggers:** Resource already exists, duplicate app name.\r\n\r\n**Agent strategy:**\r\n1. If creating custom-app with duplicate name → use a different `--app-name`\r\n2. If updating → check current state with `custom-app get-conf"}],"languages":[],"docsSourceLabel":"CLAWHUB","editorialOverview":null,"editorialQuality":{"score":100,"threshold":65,"status":"thin","wordCount":2326,"uniquenessScore":38,"reasons":["uniqueness-below-45"]}},"media":{"evidence":{"source":"no-media","verified":false,"confidence":"low","updatedAt":"2026-10-10T12:13:53.287Z","emptyReason":"No screenshots, media assets, or demo links are available."},"primaryImageUrl":null,"mediaAssetCount":0,"assets":[],"demoUrl":null},"ownerResources":{"evidence":{"source":"unclaimed","verified":false,"confidence":"low","updatedAt":"2026-10-10T12:13:53.287Z","emptyReason":"This page has not been claimed by the agent owner."},"hasCustomPage":false,"customPageUpdatedAt":null,"customLinks":[],"structuredLinks":{"docsUrl":null,"demoUrl":null,"supportUrl":null,"pricingUrl":null,"statusUrl":null},"customPage":null},"relatedAgents":{"evidence":{"source":"protocol-neighbors","verified":false,"confidence":"medium","updatedAt":"2026-10-10T14:45:35.744Z","emptyReason":null},"items":[{"id":"8ebccd8e-3863-4187-8355-c3f14e1f9edf","entityType":"agent","canonicalPath":"/agent/iofficeai-aionui","slug":"iofficeai-aionui","name":"AionUi","description":"Free, local, open-source 24/7 Cowork app and OpenClaw for Gemini CLI, Claude Code, Codex, OpenCode, Qwen Code, Goose CLI, Auggie, and more | 🌟 Star if you like it!","url":"https://github.com/iOfficeAI/AionUi","homepage":"https://www.aionui.com","source":"GITHUB_REPOS","protocols":["MCP","OPENCLAW"],"capabilities":[],"safetyScore":100,"overallRank":70,"updatedAt":"2026-10-09T19:11:12.944Z","createdAt":"2026-02-25T03:38:16.584Z","downloads":null},{"id":"b917f68a-ebff-438e-84f8-3f4b2494c0bc","entityType":"agent","canonicalPath":"/agent/activepieces-activepieces","slug":"activepieces-activepieces","name":"activepieces","description":"AI Agents & MCPs & AI Workflow Automation • (~400 MCP servers for AI agents) • AI Automation / AI Agent with MCPs • AI Workflows & AI Agents • MCPs for AI Agents","url":"https://github.com/activepieces/activepieces","homepage":"https://www.activepieces.com","source":"GITHUB_REPOS","protocols":["OPENCLAW"],"capabilities":[],"safetyScore":100,"overallRank":70,"updatedAt":"2026-04-15T02:22:12.426Z","createdAt":"2026-02-25T03:38:12.412Z","downloads":null},{"id":"5cb26759-3a39-483f-94cf-276a98c13bb8","entityType":"agent","canonicalPath":"/agent/cherryhq-cherry-studio","slug":"cherryhq-cherry-studio","name":"cherry-studio","description":"AI productivity studio with smart chat, autonomous agents, and 300+ assistants. Unified access to frontier LLMs","url":"https://github.com/CherryHQ/cherry-studio","homepage":"https://cherry-ai.com","source":"GITHUB_REPOS","protocols":["MCP","OPENCLAW"],"capabilities":[],"safetyScore":100,"overallRank":70,"updatedAt":"2026-04-11T14:38:40.986Z","createdAt":"2026-02-25T03:38:19.379Z","downloads":null},{"id":"6f6582d0-5d76-4f0f-b81d-86520247950b","entityType":"agent","canonicalPath":"/agent/copilotkit-copilotkit","slug":"copilotkit-copilotkit","name":"CopilotKit","description":"The Frontend for Agents & Generative UI. React + Angular","url":"https://github.com/CopilotKit/CopilotKit","homepage":"https://docs.copilotkit.ai","source":"GITHUB_REPOS","protocols":["OPENCLAW"],"capabilities":[],"safetyScore":100,"overallRank":70,"updatedAt":"2026-03-25T09:50:57.846Z","createdAt":"2026-02-25T03:39:14.617Z","downloads":null}],"links":{"hub":"/agent","source":"/agent/source/clawhub","protocols":[{"label":"OpenClaw","href":"/agent/protocol/openclew"}]}}}