Skill: laiye-adp/adp-business-license-recognition-and-extract (version 1.0.0)

--- name: business-license-recognition-and-extract description: 基于来也科技ADP平台的中国营业执照智能识别与信息抽取Skill。支持营业执照全量字段的精准抽取——注册号、名称、类型、法定代表人、成立日期、营业期限、经营范围、登记机关、发证日期，输出结构化JSON，零配置开箱即用，适用于企业资质核验、工商信息查询等场景。 --- # 营业执照识别与抽取 Skill 能力由来也科技 [ADP（Agentic Document Processing）智能体文档处理平台](https://adp.laiye.com/?utm_source=clawhub)提供，支持中国营业执照的智能识别与关键信息抽取能力。本 Skill 调用来也科技 ADP 官方 CLI 工具，一条命令即可完成营业执照图片/扫描件的结构化字段抽取，输出标准 JSON，无缝对接业务系统。 > 新用户注册即享每月 **100 免费积分**（每月刷新），相当于每月可免费抽取 **200 张营业执照**。ADP 提供标准可商用 API，**1 小时即可快速集成接入业务系统**。 <br/> 立即注册：[中国大陆](https://adp.laiye.com/?utm_source=clawhub) | [海外地区](https://adp-global.laiye.com/?utm_source=clawhub) --- ## 快速接入指南 ### 核心工作流 1. **安装依赖**：首次执行时，安装 ADP CLI 工具。 2. **认证配置**：首次执行时，运行 `adp config get` 检查凭证。若未配置，提示用户提供 API Key。 3. **获取应用列表**：首次执行时，通过 `adp app-id list --app-type 0` 获取开箱即用应用列表，找到营业执照抽取应用并记录其 `app_id`（以 `ootb_` 开头）。后续优先使用 `adp app-id cache`。 4. **执行抽取**：运行 `adp extract url <URL> --app-id <营业执照抽取应用ID>` 或 `adp extract local <文件路径> --app-id <营业执照抽取应用ID>`。 5. **结果处理**：解析返回的 JSON，提取营业执照注册号、名称、类型、法定代表人、成立日期、营业期限、经营范围、登记机关、发证日期等结构化字段。 6. **错误处理**：命令失败时，解析 stderr JSON 确定错误类型和恢复操作。 ### 场景 → 命令映射 **单张识别** | 用户意图 | 推荐命令 | | :--- | :--- | | 识别一张营业执照图片（URL） | `adp extract url <URL> --app-id <营业执照抽取应用ID>` | | 识别一张本地营业执照图片 | `adp extract local <文件路径> --app-id <营业执照抽取应用ID>` | | 识别 Base64 编码的营业执照 | `adp extract base64 <base64> --app-id <营业执照抽取应用ID> --file-name <文件名.后缀>` | **批量识别** | 用户意图 | 推荐命令 | | :--- | :--- | | 批量识别本地文件夹内的营业执照 | `adp extract local <文件夹路径> --app-id <营业执照抽取应用ID>` | | 批量识别多个 URL | `adp extract url <URL列表文件> --app-id <营业执照抽取应用ID>` | **异步处理** | 用户意图 | 推荐命令 | | :--- | :--- | | 异步提交大文件 | `adp extract url <URL> --app-id <营业执照抽取应用ID> --async` | | 异步批量处理 | `adp extract local <文件夹路径> --app-id <营业执照抽取应用ID> --async` | | 查询异步任务结果 | `adp extract query <task_id>` | > 并发限制：免费用户最大支持 2 份文档并发处理，付费用户最大支持 10 份文档并发处理。 --- ## 第一步：安装 ADP CLI ```bash # 方法 1: npm（推荐，全平台通用） npm install -g @laiye-adp/agentic-doc-parse-and-extract-cli ``` ```bash # 方法 2: Shell 脚本（Linux / macOS，无 npm 环境时使用） curl -fsSL https://raw.githubusercontent.com/laiye-ai/adp-cli/main/scripts/adp-init.sh | bash ``` ```bash # 方法 3: PowerShell 脚本（Windows，无 npm 环境时使用） irm https://raw.githubusercontent.com/laiye-ai/adp-cli/main/scripts/adp-init.ps1 | iex ``` 或从 [GitHub Releases](https://github.com/laiye-ai/adp-cli/releases) 下载预编译二进制文件包。 --- ## 第二步：获取 API Key 与认证配置 ### 1. 访问 ADP 门户获取凭证 我们为国内和海外用户提供了独立的公有云访问地址，需按地区分别配置。就近访问可更好地保障高速稳定的网络调用。 | 地区 | 登录地址 | API Base URL | |-----|----------|--------------| | 中国大陆 | [https://adp.laiye.com/](https://adp.laiye.com/?utm_source=clawhub) | `https://adp.laiye.com/` | | 海外地区 | [https://adp-global.laiye.com/](https://adp-global.laiye.com/?utm_source=clawhub) | `https://adp-global.laiye.com/` | ### 2. 注册/登录后获取 API Key 新用户需先注册 ADP 账号，注册后即可获得每月 100 免费积分。 - 登录后，点击个人头像，即可直接进入 `API_Key` 入口。 ### 3. 完成认证配置 ```bash adp config set --api-key <your-api-key> adp config set --api-base-url https://adp.laiye.com ``` ### 4. 验证配置 ```bash adp config get ``` **注意事项**： 1. 如果 API Key 和 API Base URL 已配置完成，建议将配置信息存储到环境变量中，避免每次使用时重复配置。 2. 如果 API Key 和 API Base URL 尚未配置，请按照以上步骤完成配置。 --- ## 第三步：获取营业执照抽取应用 ID ADP 为中国营业执照提供了**开箱即用**的内置抽取应用，无需额外配置。 ### 应用类型说明 ADP 应用分为两类，通过 `app_type` 字段区分： | `app_type` | 类型 | 说明 | | --- | --- | --- | | `0` | 开箱即用应用（OOTB） | 平台内置，`app_id` 以 `ootb_` 开头，无需创建，直接使用 | | `1` | 自定义应用 | 用户自行创建的抽取应用，`app_id` 为用户自定义标识 | 营业执照识别属于**开箱即用应用**，可通过 `--app-type 0` 筛选查询。 ### 查询并筛选营业执照应用 ```bash # 仅查询开箱即用应用（推荐） adp app-id list --app-type 0 # 或查询所有应用 adp app-id list ``` 从返回列表中找到 `app_label` 包含 **"营业执照"** 的应用，记录其 `app_id`： ```json [ { "app_id": "ootb_******5a8b", "app_label": ["营业执照", "企业资质", "工商凭证", "商业证件", "信息提取"], "app_name": "营业执照", "app_type": 0 } ] ``` > 上例中 `"app_id": "ootb_******5a8b"` 即为营业执照抽取应用。`app_type` 为 `0` 表示开箱即用应用，`1` 表示自定义应用。 ### 缓存应用 ID（推荐） 首次查询后，后续优先使用缓存避免重复请求： ```bash # 后续使用缓存 adp app-id cache ``` **重要提示**：每个账号下的 `app_id` 是唯一且固定的，除非用户主动删除应用，否则 `app_id` 不会变更。建议 Agent 将营业执照应用的 `app_id` 保存在上下文中，下次直接使用。 --- ## 第四步：执行营业执照抽取 ### 单张营业执照抽取（URL） ```bash adp extract url https://example.com/business-license.jpg --app-id <营业执照抽取应用ID> ``` ### 单张营业执照抽取（本地文件） ```bash adp extract local ./business-license.jpg --app-id <营业执照抽取应用ID> ``` ### 单张营业执照抽取（Base64） ```bash adp extract base64 <base64字符串> --app-id <营业执照抽取应用ID> --file-name <文件名.后缀> ``` ### 返回结果示例 ADP 营业执照抽取统一返回结构化 JSON，支持营业执照正页和副页共 **12 个**关键字段识别抽取。 > **隐私脱敏提示**：以下示例中证件号码、姓名、住址等个人敏感信息均已脱敏（使用 `*` 占位）。 ```json [ { "field_key": "unified_social_credit_code", "field_name": "统一社会信用代码", "field_values": [ { "field_value": "91110108MA01XXXXXX" } ] }, { "field_key": "is_copy", "field_name": "是否为副本", "field_values": [ { "field_value": "是" } ] }, { "field_key": "name", "field_name": "姓名", "field_values": [ { "field_value": "张三" } ] }, { "field_key": "type", "field_name": "类型", "field_values": [ { "field_value": "营业执照" } ] }, { "field_key": "business_scope", "field_name": "经营范围", "field_values": [ { "field_value": "软件开发、技术服务、技术咨询、技术交流、技术转让、技术推广；计算机系统服务；数据处理；基础软件服务；应用软件服务；信息系统集成服务；销售自行开发的软件产品。" } ] }, { "field_key": "registered_capital", "field_name": "注册资本", "field_values": [ { "field_value": "100万元人民币" } ] }, { "field_key": "business_operation_period", "field_name": "营业期限", "field_values": [ { "field_value": "2015-06-18 至 2021-06-18" } ] }, { "field_key": "business_place", "field_name": "营业场所", "field_values": [ { "field_value": "北京市朝阳区某某街道某某号院某某楼某某室" } ] }, { "field_key": "composition_form", "field_name": "组成形式", "field_values": [ { "field_value": "有限责任公司(自然人投资或控股)" } ] }, { "field_key": "operator", "field_name": "经营者", "field_values": [ { "field_value": "张三" } ] }, { "field_key": "registered_date", "field_name": "注册日期", "field_values": [ { "field_value": "2015-06-18" } ] }, { "field_key": "registration_date", "field_name": "登记日期", "field_values": [ { "field_value": "2015-06-18" } ] } ] ``` ### 抽取字段说明 ADP 营业执照抽取返回以下字段（覆盖正副页 12 个字段）： | field_key | field_name | 说明 | 敏感级别 | | --- | --- | --- | --- | | `unified_social_credit_code` | 统一社会信用代码 | 是中国给企业、事业单位、社团等法人 / 组织发的18 位唯一身份编码，相当于单位的 “身份证号” | **高（PII）** | | `is_copy` | 是否为副本 | 标识该营业执照是否为副本，值为 “是” 或 “否” | 低 | | `name` | 姓名 | 法定代表人姓名 | **高（PII）** | | `type` | 类型 | 证件类型，值为 “营业执照” | 低 | | `business_scope` | 经营范围 | 营业执照上登记的经营范围描述文本 | 中 | | `registered_capital` | 注册资本 | 营业执照上登记的注册资本金额及币种 | 中 | | `business_operation_period` | 营业期限 | 营业执照上登记的营业期限，通常格式为 “YYYY-MM-DD 至 YYYY-MM-DD” | 中 | | `business_place` | 营业场所 | 营业执照上登记的营业场所地址 | **高（PII）** | | `composition_form` | 组成形式 | 营业执照上登记的组成形式，如 “有限责任公司(自然人投资或控股)” | 低 | | `operator` | 经营者 | 营业执照上登记的经营者姓名，可能与法定代表人相同或不同 | **高（PII）** | | `registered_date` | 注册日期 | 营业执照上登记的日期，通常为企业成立日期 | 中 | | `registration_date` | 登记日期 | 营业执照上登记的日期，通常为企业成立日期或最近一次变更日期 | 中 | > **字段地区变体说明**：ADP 平台对中国大陆地区营业执照使用上述 `field_key`；如调用海外站点（`adp-global.laiye.com`），部分字段命名可能存在地区差异，请以实际返回的 `field_key` 为准。 ### 返回字段通用结构 每个字段遵循以下结构： | 字段 | 类型 | 说明 | | --- | --- | --- | | `field_key` | string | 字段标识（机器可读） | | `field_name` | string | 字段名称（人类可读） | | `field_values` | array | 抽取结果数组 | | `field_values[].field_value` | string | 抽取值，未识别到时为空字符串 | | `field_values[].confidence` | number | 置信度分值，范围 [0, 1]，数值越大表示模型对该字段的识别结果越有信心。注意：部分字段可能不返回该值，具体以实际返回为准。 | --- ## 第五步：批量处理与异步模式 ### 批量处理（本地文件夹） ```bash adp extract local ./business-licenses/ --app-id <营业执照抽取应用ID> --export ./results/ ``` 返回摘要： ```json { "total": 10, "success": 9, "failed": 1, "output_dir": "/absolute/path/to/results", "files": [ {"input": "license-001.jpg", "output": "license-001.jpg.json", "status": "success"}, {"input": "license-002.jpg", "output": "license-002.jpg.json", "status": "success"}, {"input": "damaged.jpg", "output": "damaged.jpg.error.json", "status": "failed", "error": "..."} ] } ``` ### 异步处理 ```bash # 提交异步任务 adp extract url https://example.com/business-license.jpg --app-id <营业执照抽取应用ID> --async # 查询任务结果 adp extract query <task_id> ``` --- ## 常用命令速查 ```bash # 检查安装 adp version # 查看配置 adp config get # 查询所有应用列表 adp app-id list # 仅查询开箱即用应用（app_type=0） adp app-id list --app-type 0 # 使用缓存的应用 adp app-id cache # 查询积分余额 adp credit # 营业执照抽取（URL） adp extract url <文件URL> --app-id <营业执照抽取应用ID> # 营业执照抽取（本地文件） adp extract local <文件路径> --app-id <营业执照抽取应用ID> # 营业执照抽取（Base64） adp extract base64 <base64字符串> --app-id <营业执照抽取应用ID> --file-name <文件名.后缀> # 批量抽取 adp extract local <文件夹路径> --app-id <营业执照抽取应用ID> --export <输出路径> # 异步抽取 adp extract url <文件URL> --app-id <营业执照抽取应用ID> --async # 查询异步结果 adp extract query <task_id> ``` --- ## 错误处理 当命令失败时，stderr 输出结构化 JSON: ```json { "type": "AUTH_ERROR", "message": "Authentication error: invalid API key", "fix": "Check your API key is correct and has not expired.", "retryable": false, "details": {"context": "extract"} } ``` ### 退出码说明 | 退出码 | 含义 | | --- | --- | | 0 | 成功 | | 1 | 一般错误 | | 2 | 参数错误 | | 3 | 资源未找到 | | 4 | 权限/认证错误 | | 5 | 冲突 | | 6 | 部分失败（批量处理中部分成功、部分失败） | --- ## 积分与计费 | 项目 | 说明 | | --- | --- | | 营业执照抽取费用 | **0.5 积分/张** | | 新用户免费额度 | 每月赠送 **100 积分，相当于每月可免费处理 200 张营业执照**，每月初重置 | | 查询余额 | `adp credit` | | 充值方式 | 登录 ADP 门户网站充值：[中国大陆及港澳台地区](https://adp.laiye.com/?utm_source=clawhub) \| [非中国大陆及港澳台地区](https://adp-global.laiye.com/?utm_source=clawhub) | --- ## 更多来也 ADP 文档处理能力 营业执照识别只是来也科技 ADP 平台众多开箱即用能力之一。ADP 基于大模型通用理解能力，提供覆盖全品类文档的智能处理解决方案： | 能力 | 说明 | 典型场景 | | --- | --- | --- | | **全球发票/收据抽取** | 自动识别并抽取发票号码、日期、金额、税费、明细等 10+ 关键字段，支持多语言和多币种发票抽取 | 跨国结算账款自动化、费用报销管理 | | **国内票据抽取** | 识别增值税发票、出租车票、火车票、飞机行程单、财政发票等30+常见票据，支持多页/多票识别及验真 | 国内票据识别、国内发票验真 | | **订单抽取** | 支持多种采购订单格式，抽取订单号、商品、数量、价格、物流信息等 | 采购自动化、供应链集成 | | **更多卡证抽取** | ADP支持身份证、港澳台通行证、中国护照、银行卡、户口本、驾驶证、行驶证、车辆合格证、开户许可证、营业执照等 11 种中国常用证件 | 开户审核、合规检查、证件信息批量录入 | | **文档解析** | 将 PDF、图片、Office 文档转化为结构化数据，保留排版和层级关系 | 长文档分析、合同审查、知识提取 | | **自定义抽取** | 自主创建抽取应用，配置专属字段和识别逻辑，满足非标单据需求 | 企业专属表单、行业定制单据 | 以上所有能力均可通过同一个 ADP CLI 工具调用，共享 ADP API Key 和积分体系。 如需了解完整能力，请访问： - ADP 中国大陆：[https://adp.laiye.com/](https://adp.laiye.com/?utm_source=clawhub) - ADP 非中国大陆：[https://adp-global.laiye.com/](https://adp-global.laiye.com/?utm_source=clawhub) --- ## 注意事项 1. **数据完整性**：使用 ADP 输出时，请原样呈现返回数据，不要在抽取过程中修改、添加或删除任何字段。 2. **PII 脱敏**：驾驶证证号、姓名、住址、出生日期均属个人敏感信息（PII）。在日志打印、控制台输出、二次分发、UI 展示场景中，**禁止**原样输出；建议落库/落盘前完成脱敏（如证号保留前 6 位 + 后 4 位，姓名仅保留姓氏，住址截取到市级）。 3. **API Key 安全**：妥善保管 API Key，避免泄露给未授权的第三方。 4. **文件大小限制**：单个文件最大 50MB。 5. **支持格式**：.jpg, .jpeg, .png, .bmp, .tiff, .tif, .pdf, .doc, .docx, .xls, .xlsx 6. **应用 ID 复用**：驾驶证应用的 `app_id` 在账户下唯一且固定，建议记住后直接使用，无需每次查询。 7. **空字段处理**：部分字段（如 `file_number` 档案编号）可能因驾驶证版本或图像质量原因未识别到，此时 `field_values` 返回空数组 `[]`，业务侧需做兼容处理。 --- ## 支持与联系 - **CLI 使用指南：** [ADP CLI 使用指南](https://laiye-tech.feishu.cn/wiki/Hz3Vw1IQki3YQtk33gLcSdwSndc) - **API 接口文档：** [Open API 使用指南](https://laiye-tech.feishu.cn/wiki/PO9Jw4cH3iV2ThkMPW2c539pnkc) - **ADP 产品操作手册：** [公有云操作手册](https://laiye-tech.feishu.cn/wiki/UDYIwG42pisBbFkJI39ctpeKnWh) - **问题反馈：** [GitHub Issues](https://github.com/laiye-ai/adp-cli/issues) - **邮箱：** [REDACTED_SECRET] - **官网：** [来也科技 ADP](https://laiye.com/product/adp-platform) Copyright © 2026 [来也科技（北京）有限公司] 保留所有权利。

path: license.md
content: Commercial License Agreement

Effective Date: [March 30, 2026]
Copyright © 2026 [Laiye Technology (Beijing) Co., Ltd.] All rights reserved.

This "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.

1. Licensing

1.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:
Personal learning, research, teaching, and evaluation.
Technical exchanges within academic institutions or open-source communities, non-profit projects.
Integration or demonstration in non-commercial products or services.
1.2 Commercial License:	Any 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:
Distributing the Product or derivative works thereof in forms such as sales, resale, licensing fees, subscription fees, or other charges.
Providing the Product or derivative works thereof as a SaaS (Software as a Service) to third parties.
Integrating the Product or derivative works thereof, as a core function, into software, hardware, or services intended for sale or lease.
Any for-profit activity that utilizes the functionality or content of the Product to provide services to third parties.

2. Reserved Rights and Ownership

2.1	Ownership, 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.
2.2	The 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.
3. Distribution Conditions

When the Licensee distributes or provides the Product, all of the following conditions must be met:
Retention of Notices:	Prominently retain all copyright notices of the Product, the text of this License Agreement, and the disclaimer on distributed copies.
No Misrepresentation:	Should not imply that the Licensor endorses your distribution version.

4. Disclaimer of Warranties

THE 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.

5. Termination

5.1	This Agreement becomes effective from the Licensee's first use of the Product and continues until terminated.
5.2	If 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.
5.3	Upon termination, the Licensee must immediately cease using the Product and destroy all copies of the Product in its possession.

6. Miscellaneous

6.1	The formation, execution, interpretation, and dispute resolution of this Agreement shall be governed by the laws of the People's Republic of China.
6.2	The Licensee shall not assign or transfer any of its rights or obligations under this Agreement without the Licensor's prior written consent.
6.3	This 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.
6.4	Any 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.

For obtaining a Commercial License or if you have any questions, please contact:
[[REDACTED_SECRET]]


The Product is licensed under the Commercial License Agreement.  For commercial use, please contact us to obtain authorization.

path: README-CN.md
content: ## 🚀 关于来也ADP

ADP是来也科技公司**智能体文档处理产品 (Agentic Document Processing，简称 ADP)**， 基于大模型的通用理解能力，不依赖规则与标注，具备对多语言、多模态、多场景的通用理解能力；智能体的自主规划与执行，能够理解任务目标、自主规划步骤、调用工具、完成复杂任务；端到端的业务自动化，从文档输入到业务决策再到人机协同，形成完整闭环。

**agentic-doc-parse-and-extract** 是 ADP 官方开源 CLI 工具，同时支持人工终端调用 + AI Skill 自动调用。一条命令即可完成：文档结构化解析 + 关键字段智能抽取，覆盖发票、订单、证件、票据、通用文档全场景，输出标准 JSON，无缝对接自动化与 AI 流程。

---

## 💡 核心功能

agentic-doc-parse-and-extract 聚焦文档全流程智能处理，兼顾人工终端调用与 AI Agent 自动调用，核心功能覆盖解析、抽取、批量处理全场景，无需复杂配置，一条命令即可完成操作：

| 功能名称 | 功能描述 | 最佳场景 |
|---------|------------------|----------|
| **文档解析** | 自动识别 PDF、图片等多格式文档，将杂乱的非结构化内容（如扫描件、手写体、复杂排版文档）转化为标准化结构化数据，保留原始文档层级与关键关联关系 | 将非结构化文档转换为结构化数据，供 LLM 阅读和后续抽取使用 |
| **开箱即用文档抽取** | 基于 ADP 大模型原生 AI 能力，内置发票、收据、订单、中国地区常用证件等标准化抽取模型，无需配置规则、无需人工标注，一键提取各类通用单据关键字段，输出标准 JSON | 应付账款自动化、费用管理、采购自动化、卡证信息快速录入系统 |
| **自定义文档抽取** | 支持自主创建、编辑与管理个性化抽取应用，可针对企业专属单据、行业定制表单配置专属抽取字段与识别逻辑 | 企业专属单据、行业定制表单、非标准化文档的私有化抽取需求 |
| **任务查询** | 支持异步任务提交与状态查询，可快速查看任务执行进度、成功/失败状态，以及任务最终处理结果 | 批量任务处理、异步文档处理、问题排查与处理记录追溯 |
| **应用管理** | 提供完整的应用管理能力，可查看所有可用的抽取应用（系统内置 + 自定义）、查询应用详情、应用标签 | 多场景业务切换、应用全生命周期管控、自定义应用管理 |

## 安装
```bash
# 方法 1: npm（推荐，全平台通用）
npm install -g @laiye-adp/agentic-doc-parse-and-extract-cli
```

```bash
# 方法 2: Shell 脚本（Linux / macOS，无 npm 环境时使用）
curl -fsSL https://raw.githubusercontent.com/laiye-ai/adp-cli/main/scripts/adp-init.sh | bash
```

```bash
# 方法 3: PowerShell 脚本（Windows，无 npm 环境时使用）
irm https://raw.githubusercontent.com/laiye-ai/adp-cli/main/scripts/adp-init.ps1 | iex
```

或从 [GitHub Releases](https://github.com/laiye-ai/adp-cli/releases) 下载预编译二进制文件包。

## 配置
### 1. 访问 ADP 门户获取凭证
我们为国内和海外用户提供了独立的公有云访问地址，需按地区分别配置。就近访问可更好地保障高速稳定的网络调用。

| 地区 | 登录地址 | API Base URL |
|-----|----------|--------------|
| 中国大陆 | [https://adp.laiye.com/](https://adp.laiye.com/?utm_source=clawhub) | `https://adp.laiye.com/` |
| 海外地区 | [https://adp-global.laiye.com/](https://adp-global.laiye.com/?utm_source=clawhub) | `https://adp-global.laiye.com/` |

### 2. 注册/登录后获取 API Key
新用户需先注册 ADP 账号，注册后即可获得每月 100 免费积分。
- 登录后，点击个人头像，即可直接进入 `API_Key` 入口。

### 3. 完成认证配置
```bash
adp config set --api-key <your-api-key>
adp config set --api-base-url https://adp.laiye.com
```

### 4. 验证配置
```bash
adp config get
```

**注意事项**：
1. 如果 API Key 和 API Base URL 已配置完成，建议将配置信息存储到环境变量中，避免每次使用时重复配置。
2. 如果 API Key 和 API Base URL 尚未配置，请按照以上步骤完成配置。


## 快速示例

```bash
# 查看可用应用
adp app-id list

# 解析本地文档
adp parse local ./invoice.pdf --app-id <app-id>

# 抽取关键字段
adp extract local ./invoice.pdf --app-id <app-id>

# 异步解析目录
adp parse local ./documents/ --app-id <app-id> --async

# 处理远程 URL
adp extract url https://example.com/file.pdf --app-id <app-id>

# 查询异步任务
adp parse query <task-id>

# 两阶段异步（分开提交和查询，支持断点续传）
adp extract local ./documents/ --app-id <app-id> --async --no-wait --export tasks.json
adp extract query --watch --file tasks.json

# 失败自动重试（最多 2 次）
adp parse local ./documents/ --app-id <app-id> --retry 2

# 查看剩余积分
adp credit
```

## 命令

> AI Agent 应调用 `adp schema` 获取机器可读的权威命令规格。下表仅供人类速查。

| 命令 | 说明 |
|---|---|
| `adp version` | 显示版本号 |
| `adp config set` | 设置 API Key / 服务地址 |
| `adp config get` | 查看当前配置 |
| `adp config clear` | 清除配置 |
| `adp app-id list` | 列出可用应用 |
| `adp app-id cache` | 从本地缓存读取应用列表 |
| `adp parse local <path>` | 解析本地文件/目录 |
| `adp parse url <url>` | 解析远程文件（支持 URL 列表文件） |
| `adp parse base64 <data>` | 解析 Base64 编码内容 |
| `adp parse query <task-id...>` | 查询异步解析任务（支持多个 ID 或 `--file`） |
| `adp extract local <path>` | 抽取本地文件/目录 |
| `adp extract url <url>` | 抽取远程文件 |
| `adp extract base64 <data>` | 抽取 Base64 编码内容 |
| `adp extract query <task-id...>` | 查询异步抽取任务（支持多个 ID 或 `--file`） |
| `adp custom-app create` | 创建自定义抽取应用 |
| `adp custom-app update` | 更新自定义应用配置 |
| `adp custom-app get-config` | 查看应用配置 |
| `adp custom-app delete` | 删除自定义应用 |
| `adp custom-app delete-version` | 删除指定配置版本 |
| `adp custom-app ai-generate` | AI 推荐抽取字段 |
| `adp credit` | 查看剩余积分 |
| `adp schema` | 输出命令 Schema（供 AI Agent 使用） |

## 参数

| 参数 | 说明 |
|---|---|
| `--json` | 以 JSON 格式输出 |
| `--quiet` | 静默模式，仅输出结果 |
| `--lang <en\|zh>` | 指定界面语言 |
| `--app-id` | 应用 ID（parse / extract 必填） |
| `--async` | 异步模式 |
| `--no-wait` | 仅提交任务，不等待结果（与 `--async` 配合使用） |
| `--export <path>` | 导出结果到文件（单文件）或目录（批量） |
| `--timeout <seconds>` | 超时时间（默认 900 秒） |
| `--retry <n>` | 可重试错误的重试次数（默认 0） |
| `--file <path>` | 从 JSON 文件读取任务 ID（`--no-wait` 的输出文件，仅 query 可用） |

## 异步工作流

处理大文件或批量任务时，使用 `--async` 提交任务，CLI 返回 `task-id`，再用 `parse query` / `extract query` 轮询结果：

```bash
adp parse local ./big.pdf --app-id <app-id> --async
# 返回一个 task-id

adp parse query <task-id>
```

### 两阶段异步（`--no-wait`）

默认情况下，`--async` 会提交并轮询直到完成——适合 AI Agent 使用。对于可恢复的工作流，使用两阶段模式：

**第一阶段：提交任务**

```bash
adp extract local ./documents/ --app-id <app-id> --async --no-wait --export tasks.json
```

输出为包含任务 ID 的 JSON 数组：

```json
[
  {"path": "invoice.pdf", "task_id": "task_abc123"},
  {"path": "contract.pdf", "task_id": "task_def456"}
]
```

**第二阶段：查询结果**

```bash
adp extract query --watch --file tasks.json
adp extract query --watch --file tasks.json --export ./results/
```

即使 CLI 中途崩溃，`tasks.json` 中的任务 ID 也会被保留——随时可用 `query --file` 恢复查询。

## 批量处理

处理多个文件/URL 时，CLI 会将每个结果写入单独的文件：

```
adp_results_20250417_153020/
├── _summary.json              # 汇总（总数、成功、失败、每文件状态）
├── invoice_01.pdf.json        # 成功结果
├── contract_02.docx.json
└── report_03.pdf.error.json   # 错误详情
```

- `--export <dir>` — 指定输出目录
- 不加 `--export` — 自动创建 `adp_results_<timestamp>/`
- 单文件 — 输出到 stdout 或 `--export` 指定的文件路径

## 退出码

| 退出码 | 含义 |
|------|---------|
| `0` | 全部成功 |
| `1` | 全部失败 / 系统错误 |
| `2` | 参数错误 |
| `3` | 资源未找到 |
| `4` | 权限不足 |
| `5` | 冲突 |
| `6` | 部分失败（批量中部分任务失败） |

## 环境变量

| 变量 | 说明 |
|---|---|
| `ADP_API_KEY` | API Key（优先于配置文件） |
| `ADP_API_BASE_URL` | 服务地址 |
| `ADP_LANG` | 界面语言（`en` / `zh`） |
| `ADP_LOG_LEVEL` | 日志级别（`debug` / `info` / `warn` / `error`） |

## 配置存储

- 配置目录：`~/.adp/`
- 配置文件：`~/.adp/config.json`
- 加密的 API Key：`~/.adp/key.enc`（AES-256-GCM）
- 应用缓存：`~/.adp/app_cache.json`
- 版本检查缓存：`~/.adp/version_check.json`（每 24 小时刷新）

## 📜 授权许可

我们采用 开源工具 + 付费服务 的组合模式：CLI 工具完全免费开源，方便大家快速接入；而核心的 ADP 智能解析能力为公有云商业服务，按实际使用量计费，旨在为用户提供高精准、高稳定的文档处理体验。

- **CLI 工具**：MIT License 开源许可，可自由使用、修改和分发
- **ADP 服务**：基于公有云的 AI 文档处理服务，按使用量计费

免费额度：新用户注册后每月可获得 **100 免费积分**，可体验完整功能


## 📞 支持与联系
- **CLI 使用指南：** [ADP CLI 使用指南](https://laiye-tech.feishu.cn/wiki/Hz3Vw1IQki3YQtk33gLcSdwSndc)
- **API 接口文档：** [Open API 使用指南](https://laiye-tech.feishu.cn/wiki/PO9Jw4cH3iV2ThkMPW2c539pnkc)
- **ADP 产品操作手册：** [公有云操作手册](https://laiye-tech.feishu.cn/wiki/UDYIwG42pisBbFkJI39ctpeKnWh)
- **问题反馈：** [GitHub Issues](https://github.com/laiye-ai/adp-cli/issues)
- **邮箱：** [REDACTED_SECRET]
- **官网：** [来也科技 ADP](https://laiye.com/product/adp-platform)

Copyright © 2026 [来也科技（北京）有限公司] 保留所有权利。


path: README.md
content: ## 🚀 About Laiye ADP

ADP 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.

**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.

---

## 💡 Core Features

agentic-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:

| Function Name | Function Description | Optimal Scenario |
|---------|------------------|----------|
| **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 |
| **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 |
| **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 |
| **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 |
| **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 |

## Install

```bash
# Method 1: npm (recommended, cross-platform)
npm install -g @laiye-adp/agentic-doc-parse-and-extract-cli
```

```bash
# Method 2: Shell script (Linux / macOS, when npm is not available)
curl -fsSL https://raw.githubusercontent.com/laiye-ai/adp-cli/main/scripts/adp-init.sh | bash
```

```bash
# Method 3: PowerShell script (Windows, when npm is not available)
irm https://raw.githubusercontent.com/laiye-ai/adp-cli/main/scripts/adp-init.ps1 | iex
```

Or download a prebuilt binary from [GitHub Releases](https://github.com/laiye-ai/adp-cli/releases).

## Configure

Get an API key at [https://adp-global.laiye.com/](https://adp-global.laiye.com/?utm_source=clawhub) (new users get 100 free credits per month).

```bash
adp config set --api-key <your-api-key>
adp config set --api-base-url https://adp-global.laiye.com
adp config get
```

## Quick Examples

```bash
# List available apps
adp app-id list

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

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

# Parse a directory in async mode
adp parse local ./documents/ --app-id <app-id> --async

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

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

# Two-phase async (submit + query separately, resumable)
adp extract local ./documents/ --app-id <app-id> --async --no-wait --export tasks.json
adp extract query --watch --file tasks.json

# Auto retry on failure (up to 2 retries)
adp parse local ./documents/ --app-id <app-id> --retry 2

# Check remaining credits
adp credit
```

## Commands

> AI agents should call `adp schema` for the machine-readable, authoritative command spec. The table below is a human-friendly summary.

| Command | Description |
|---|---|
| `adp version` | Print version |
| `adp config set` | Set API key / base URL |
| `adp config get` | Show current config |
| `adp config clear` | Clear config |
| `adp app-id list` | List available apps |
| `adp app-id cache` | Read app list from local cache |
| `adp parse local <path>` | Parse local file/directory |
| `adp parse url <url>` | Parse remote file (URL list file supported) |
| `adp parse base64 <data>` | Parse Base64-encoded content |
| `adp parse query <task-id...>` | Query async parse tasks (supports multiple IDs or `--file`) |
| `adp extract local <path>` | Extract from local file/directory |
| `adp extract url <url>` | Extract from remote file |
| `adp extract base64 <data>` | Extract from Base64-encoded content |
| `adp extract query <task-id...>` | Query async extract tasks (supports multiple IDs or `--file`) |
| `adp custom-app create` | Create a custom extraction app |
| `adp custom-app update` | Update custom app config |
| `adp custom-app get-config` | Show app config |
| `adp custom-app delete` | Delete a custom app |
| `adp custom-app delete-version` | Delete a specific config version |
| `adp custom-app ai-generate` | AI-recommend extraction fields |
| `adp credit` | Show remaining credits |
| `adp schema` | Output command schema (for AI agents) |

## Flags

| Flag | Description |
|---|---|
| `--json` | Output JSON |
| `--quiet` | Quiet mode, output result only |
| `--lang <en\|zh>` | Interface language |
| `--app-id` | App ID (required for parse / extract) |
| `--async` | Async mode |
| `--no-wait` | Submit tasks only, do not wait for results (use with `--async`) |
| `--export <path>` | Export result to file (single file) or directory (batch) |
| `--timeout <seconds>` | Timeout (default 900s) |
| `--retry <n>` | Retries for retryable errors (default 0) |
| `--file <path>` | Read task IDs from JSON file (output of `--no-wait`, query only) |

## Async Workflow

For large files or batch jobs, submit with `--async` and the CLI returns a `task-id`. Poll for results with `parse query` / `extract query`:

```bash
adp parse local ./big.pdf --app-id <app-id> --async
# returns a task-id

adp parse query <task-id>
```

### Two-Phase Async (`--no-wait`)

By default, `--async` submits and polls until completion — ideal for AI agents. For resumable workflows, use two-phase mode:

**Phase 1: Submit tasks**

```bash
adp extract local ./documents/ --app-id <app-id> --async --no-wait --export tasks.json
```

Output is a JSON array with task IDs:

```json
[
  {"path": "invoice.pdf", "task_id": "task_abc123"},
  {"path": "contract.pdf", "task_id": "task_def456"}
]
```

**Phase 2: Query results**

```bash
adp extract query --watch --file tasks.json
adp extract query --watch --file tasks.json --export ./results/
```

Even if the CLI crashes mid-way, task IDs in `tasks.json` are preserved — resume anytime with `query --file`.

## Batch Processing

When processing multiple files/URLs, the CLI writes each result to a separate file:

```
adp_results_20250417_153020/
├── _summary.json              # Summary (total, success, failed, per-file status)
├── invoice_01.pdf.json        # Successful result
├── contract_02.docx.json
└── report_03.pdf.error.json   # Error details
```

- `--export <dir>` — specify output directory
- Without `--export` — auto-creates `adp_results_<timestamp>/`
- Single file — outputs to stdout or the `--export` file path

## Exit Codes

| Code | Meaning |
|------|---------|
| `0` | All success |
| `1` | All failed / system error |
| `2` | Parameter error |
| `3` | Resource not found |
| `4` | Permission denied |
| `5` | Conflict |
| `6` | Partial failure (some tasks failed in batch) |

## Environment Variables

| Variable | Description |
|---|---|
| `ADP_API_KEY` | API key (overrides config file) |
| `ADP_API_BASE_URL` | Service URL |
| `ADP_LANG` | Interface language (`en` / `zh`) |
| `ADP_LOG_LEVEL` | Log level (`debug` / `info` / `warn` / `error`) |

## Config Storage

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

## 📜 License

We 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.

- **CLI Tool**: Open source under the MIT License, freely available for use, modification, and distribution
- **ADP Service**: AI document processing service based on Public Cloud, billed by usage, Billing Rules

Free Quota: New users can receive **100 free credits** per month after registration, allowing them to experience full functionality

## 📞 Support and Contact
- **CLI Documentation**: [ADP CLI User Guide](https://laiye-tech.feishu.cn/wiki/YIaawiK2DimisZk5KfDc8a8cnLh)
- **API Documentation**: [OpenAPI User Guide](https://laiye-tech.feishu.cn/wiki/S1t2wYR04ivndKkMDxxcp2SFnKd?from=from_copylink)
- **User Guide**: [Public Cloud Operation Manual](https://laiye-tech.feishu.cn/wiki/OfexwgVUQiOpEek4kO7c7NEJnAe)
- **Problem Feedback**: [GitHub Issues](https://github.com/laiye-ai/adp-cli/issues) | [REDACTED_SECRET]
- **Official Website**: [Laiye ADP](https://laiye.com/en/product/agentic-document-processing)

Copyright © 2026 Laiye Technology (Beijing) Co., Ltd. All rights reserved.


Security scan verdicts — ClawScan: suspicious | static analysis: clean | VirusTotal:  | SkillSpector: suspicious (CRITICAL)