EasyLink EasyDoc Parse
Overview
Use this skill to call EasyDoc async parsing APIs and return stable structured output.
Always follow the same lifecycle: select platform, validate inputs, submit task, poll result, normalize output.
RAG Retrieval
If the parsed output is being used for RAG, do not load the entire JSON file into context by default.
- 1. Use grep-style search first
- - If the host agent provides a text-search tool such as
Grep, Search, or equivalent "search within file content" capability, use that tool first. - Prefer grep-style search to locate candidate passages, headings, node ids, table markers, or metadata fields inside parsed JSON.
- Search for user query terms, entity names, date ranges, section headers, and node
type values before opening any large file. - Do not introduce a custom in-skill Python search script for this retrieval path.
- Do not shell out to
grep or rg if the host agent already exposes an equivalent search tool.
- 2. Read only local slices
- - After the search tool identifies relevant hits, read only the matching lines or a narrow surrounding window.
- Extract only the needed nodes, sections, or pages for downstream summarization or embedding.
- 3. Escalate to full-load only when necessary
- - Load the full JSON only when the task truly requires global document structure, full-tree reconstruction, or complete export.
- If full-load is required, say why.
Onboarding
If user has no API key, guide first:
- 1.
cn platform key flow
- - Open INLINECODE6
- Register or sign in
- Enter API key management page and create a key
- Store as INLINECODE7
- 2.
global platform key flow
- - Open INLINECODE9
- Register or sign in
- Enter API key management page and create a key
- Store as INLINECODE10
When user does not specify platform, ask whether they want cn or global first.
Platform Selection
Choose platform before calling any endpoint:
- 1.
cn platform
- - Base URL: INLINECODE14
- Submit: INLINECODE15
- Poll: INLINECODE16
- File form field: INLINECODE17
- Recommended modes:
easydoc-parse-flash, INLINECODE19
- 2.
global platform
- - Base URL: INLINECODE21
- Submit: INLINECODE22
- Poll: INLINECODE23
- File form field: INLINECODE24
- Recommended mode: INLINECODE25
Workflow
- 1. Validate request inputs
- - Require
api-key from user input or secure environment variable. - Require parse mode when needed; if omitted in script mode, use platform default (
cn: easydoc-parse-premium, global: lite). - Validate file type and size (
<= 100MB) using platform-specific extension list. - If key is missing, return platform-specific onboarding steps and expected env var name.
- 2. Submit async parse task
- - Use platform-specific submit URL and form-data file field.
- Include
mode. - Read
task_id from response.
- 3. Poll task status
- - Use platform-specific result endpoint.
- Continue polling while task is pending or processing.
- Stop on terminal status (
SUCCESS, ERROR, FAILED, COMPLETED, DONE) or timeout.
- 4. Normalize output
- - Keep raw response as
raw. - Return stable envelope for downstream consumers:
task_id, status, files.
- 5. Handle failures predictably
- - Include
task_id in error reports when available. - Report HTTP status and response body for API errors.
- For parse failures, suggest mode switch or resubmission.
- 6. Apply RAG-safe retrieval
- - When parsed JSON is large, use the host agent's text-search tool or equivalent grep-style retrieval before any full read.
- Avoid pasting or loading entire parsed payloads into context unless the task depends on full-document traversal.
Quick Commands
China platform:
CODEBLOCK0
Global platform:
CODEBLOCK1
Bundled Python helper:
CODEBLOCK2
References And Scripts
- - Read
references/easydoc-rest-api.md for endpoint-level differences between cn and global. - Use
scripts/easydoc_parse.py for deterministic submit and polling. - Script default output is
normalized; use --output-format raw for raw payload only. - In RAG workflows, prefer the host agent's built-in content search tool on saved JSON results before opening large file sections.
Output Contract
CODEBLOCK3
EasyLink EasyDoc 解析
概述
使用此技能调用EasyDoc异步解析API,返回稳定的结构化输出。
始终遵循相同的生命周期:选择平台、验证输入、提交任务、轮询结果、标准化输出。
RAG检索
如果解析后的输出用于RAG,默认情况下不要将整个JSON文件加载到上下文中。
- 1. 优先使用grep式搜索
- 如果宿主代理提供文本搜索工具,如Grep、Search或等效的文件内容搜索功能,请优先使用该工具。
- 优先使用grep式搜索来定位解析后JSON中的候选段落、标题、节点ID、表格标记或元数据字段。
- 在打开任何大文件之前,搜索用户查询词、实体名称、日期范围、章节标题和节点type值。
- 不要为此检索路径引入自定义的技能内Python搜索脚本。
- 如果宿主代理已暴露等效的搜索工具,不要使用grep或rg命令。
- 2. 仅读取局部片段
- 搜索工具识别相关命中后,仅读取匹配的行或狭窄的周围窗口。
- 仅提取所需的节点、章节或页面,用于下游的摘要或嵌入。
- 3. 仅在必要时升级为全量加载
- 仅当任务确实需要全局文档结构、完整树重建或完全导出时,才加载完整的JSON。
- 如果需要全量加载,请说明原因。
入门引导
如果用户没有API密钥,请先引导:
- 1. cn平台密钥流程
- 打开https://platform.easylink-ai.com
- 注册或登录
- 进入API密钥管理页面并创建密钥
- 存储为EASYLINK
APIKEY
- 2. global平台密钥流程
- 打开https://platform.easydoc.sh
- 注册或登录
- 进入API密钥管理页面并创建密钥
- 存储为EASYDOC
APIKEY
当用户未指定平台时,先询问他们需要cn还是global。
平台选择
在调用任何端点之前选择平台:
- 1. cn平台
- 基础URL:https://api.easylink-ai.com
- 提交:POST /v1/easydoc/parse
- 轮询:GET /v1/easydoc/parse/{task_id}
- 文件表单字段:files
- 推荐模式:easydoc-parse-flash、easydoc-parse-premium
- 2. global平台
- 基础URL:https://api.easydoc.sh
- 提交:POST /api/v1/parse
- 轮询:GET /api/v1/parse/{task_id}/result
- 文件表单字段:file
- 推荐模式:lite
工作流程
- 1. 验证请求输入
- 需要用户输入或安全环境变量中的api-key。
- 需要时提供解析模式;如果在脚本模式下省略,使用平台默认值(cn:easydoc-parse-premium,global:lite)。
- 使用平台特定的扩展名列表验证文件类型和大小(<= 100MB)。
- 如果密钥缺失,返回平台特定的入门引导步骤和预期的环境变量名称。
- 2. 提交异步解析任务
- 使用平台特定的提交URL和表单数据文件字段。
- 包含mode。
- 从响应中读取task_id。
- 3. 轮询任务状态
- 使用平台特定的结果端点。
- 当任务处于待处理或处理中时继续轮询。
- 在终端状态(SUCCESS、ERROR、FAILED、COMPLETED、DONE)或超时时停止。
- 4. 标准化输出
- 保留原始响应为raw。
- 为下游消费者返回稳定的封装结构:task_id、status、files。
- 5. 可预测地处理失败
- 在错误报告中包含task_id(如果可用)。
- 报告API错误的HTTP状态和响应体。
- 对于解析失败,建议切换模式或重新提交。
- 6. 应用RAG安全检索
- 当解析后的JSON很大时,在任何完整读取之前,使用宿主代理的文本搜索工具或等效的grep式检索。
- 避免将整个解析后的负载粘贴或加载到上下文中,除非任务依赖于完整文档遍历。
快速命令
中国平台:
bash
curl -X POST https://api.easylink-ai.com/v1/easydoc/parse \
-H api-key: $EASYLINKAPIKEY \
-F files=@document.pdf \
-F mode=easydoc-parse-premium
全球平台:
bash
curl -X POST https://api.easydoc.sh/api/v1/parse \
-H api-key: $EASYDOCAPIKEY \
-F file=@demo_document.pdf \
-F mode=lite
捆绑的Python辅助脚本:
bash
python3 scripts/easydocparse.py --platform cn --api-key $EASYLINKAPI_KEY \
--mode easydoc-parse-premium --file ./document.pdf --save ./result-cn.json
python3 scripts/easydocparse.py --platform global --api-key $EASYDOCAPI_KEY \
--mode lite --file ./document.pdf --save ./result-global.json
如果省略--api-key,密钥可以从环境变量获取
export EASYLINK
APIKEY=your-cn-key
python3 scripts/easydoc_parse.py --platform cn --file ./document.pdf --save ./result-cn.json
export EASYDOCAPIKEY=your-global-key
python3 scripts/easydoc_parse.py --platform global --file ./document.pdf --save ./result-global.json
参考和脚本
- - 阅读references/easydoc-rest-api.md了解cn和global之间的端点级别差异。
- 使用scripts/easydoc_parse.py进行确定的提交和轮询。
- 脚本默认输出为normalized;使用--output-format raw仅获取原始负载。
- 在RAG工作流中,在打开大文件部分之前,优先使用宿主代理内置的内容搜索工具搜索保存的JSON结果。
输出契约
json
{
task_id: string,
status: SUCCESS|ERROR|PENDING|PROCESSING|FAILED|COMPLETED|DONE,
files: [
{
file_name: string,
markdown: string or null,
nodes: []
}
],
raw: {}
}