> ## Documentation Index
> Fetch the complete documentation index at: https://docs.anyformat.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Agentic parse to markdown

> Parse a document on the Agentic tier, pick an effort preset, and read the markdown, tables and per-block confidence it returns

The Agentic tier is the same [Parse](/guides/nodes/parse) node with `mode` set to `agentic`. It parses in several steps and spends the most work on dense tables, so it is the tier to reach for when the Standard output on a complex layout is not good enough.

<div className="af-payoff">
  <div className="af-payoff-pane">
    <div className="af-payoff-cap">The document</div>
    <div className="af-payoff-line"><b>INVOICE</b></div>

    <div className="af-payoff-line">
      {'Description   Qty   Unit price   Amount'}
    </div>

    <div className="af-payoff-line">
      <span className="af-mark">
        {'Matrix Extensible Action-Items  8  $246.87  $1,974.96'}
      </span>
    </div>

    <div className="af-payoff-line">
      {'…'}
    </div>

    <div className="af-payoff-line">
      {'Subtotal   Tax   TOTAL'}
    </div>
  </div>

  <div className="af-payoff-arrow">→</div>

  <div className="af-payoff-pane">
    <div className="af-payoff-cap">What comes back</div>
    <div className="af-payoff-line"><span className="af-payoff-key">p1\_b0</span><b>{'header · INVOICE'}</b>{'  '}<span className="af-cite">100</span></div>
    <div className="af-payoff-line"><span className="af-payoff-key">p1\_b5</span><b>{'table · 4 columns'}</b>{'  '}<span className="af-cite">86</span></div>
    <div className="af-payoff-line"><span className="af-payoff-key">p1\_b6</span><b>{'table · the totals'}</b>{'  '}<span className="af-cite">31</span></div>
    <div className="af-payoff-line"><span className="af-payoff-key">document</span><b>{'75.0'}</b></div>

    <div className="af-payoff-line">
      <span className="af-cite">
        {'↳ the block that scored 31 is the one to review'}
      </span>
    </div>
  </div>
</div>

<div className="af-cost">
  <span><b>Nodes</b><strong>{'Parse (agentic)'}</strong></span>
  <span><b>Credits</b><strong>100 per page</strong>{' (Parse agentic, four times the standard 25)'}</span>
  <span><b>You get</b>{' markdown, plus rows and a confidence per block'}</span>
</div>

## The graph

<CodeGroup>
  ```json Graph theme={null}
  {
    "name": "Agentic parser",
    "nodes": [{ "id": "parse_1", "type": "parse", "mode": "agentic", "effort": "mid" }],
    "edges": []
  }
  ```

  ```python Python theme={null}
  import os
  from anyformat.sdk import Client

  client = Client(api_key=os.environ["ANYFORMAT_API_KEY"])

  workflow = client.workflow("Agentic parser").parse(mode="agentic", effort="mid").create()
  ```

  ```typescript TypeScript theme={null}
  import { Anyformat } from "@anyformat/sdk";

  const af = new Anyformat({ apiKey: process.env.ANYFORMAT_API_KEY! });

  const workflow = await af.workflow("Agentic parser").parse({ mode: "agentic", effort: "mid" }).create();
  ```
</CodeGroup>

`effort` is an Agentic-only knob:

| `effort` | Trade-off |
| - | - |
| `low` | Several times cheaper. More errors on dense or low-contrast tables. |
| `mid` | The default. Balanced. |
| `accurate` | Highest fidelity. Slowest and most expensive. |

`prompt_hint` also applies, for example `"the second column is a date"`. `figure_enhancement` is ignored on this tier.

## Run and read

Agentic runs are slower than Standard: 37 s for a one-page invoice against 28 s, and minutes for a long document. Give `wait()` a bigger budget.

<CodeGroup>
  ```bash curl theme={null}
  curl -X POST "https://api.anyformat.ai/v3/workflows/$WORKFLOW_ID/upload/run/" \
    -H "Authorization: Bearer $ANYFORMAT_API_KEY" \
    -F 'files=@report.pdf'
  # -> 202 {"run_id": "...", "status": "queued"}

  # Read the run. Repeat until "status" is "processed".
  curl "https://api.anyformat.ai/v3/runs/$RUN_ID/" \
    -H "Authorization: Bearer $ANYFORMAT_API_KEY"
  ```

  ```python Python theme={null}
  result = workflow.run("report.pdf").wait(timeout=600)

  print(result.parse.parse_confidence)
  for block in result.parse.blocks:
      if block.type == "table":
          print(block.id, block.parse_confidence, len(block.rows or []), "rows")
  ```

  ```typescript TypeScript theme={null}
  import { readFile } from "node:fs/promises";

  const file = new File([await readFile("report.pdf")], "report.pdf", { type: "application/pdf" });
  const run = await workflow.run(file);
  const result = await run.wait({ timeoutMs: 600_000 });

  console.log(result.parse?.parseConfidence);
  for (const block of result.parse?.blocks ?? []) {
    if (block.type === "table") console.log(block.id, block.parse_confidence, block.rows?.length ?? 0, "rows");
  }
  ```
</CodeGroup>

## What comes back

The Agentic tier on a one-page invoice, trimmed. The shape is the same as every other tier; only the work behind it differs.

```json Response highlight={7,8} theme={null}
{
  "results": {
    "parse": {
      "parse_confidence": 75.0,
      "blocks": [
        { "id": "p1_b0", "type": "header", "page": 1, "parse_confidence": 100.0, "content": "INVOICE", "rows": null },
        { "id": "p1_b5", "type": "table", "page": 1, "parse_confidence": 85.9, "rows": [[{ "cell_id": "r0c0", "text": "Description" }, { "cell_id": "r0c1", "text": "Qty" }]] },
        { "id": "p1_b6", "type": "table", "page": 1, "parse_confidence": 31.0, "rows": ["…"] }
      ]
    }
  }
}
```

`classifications`, `splits`, `extractions` and `edits` all come back empty, because only Parse ran. [Runs and results](/concepts/runs-and-results) has the full envelope, section by section.

## Reading the confidence

* `blocks[].parse_confidence` is the number to act on. It is 0 to 100 per block. In the sample above the line-item table scored 86 and the totals block, which the tier read as a second table, scored 31. That is the block to send to review.
* `parse.parse_confidence` is the document roll-up, weighted by the characters in each block. A long low-scoring table pulls it down more than a short heading pulls it up.
* A block that no model scored comes back with `parse_confidence: null`. Treat `null` as "not scored", not as zero.

## When it goes wrong

**Every document type is on Agentic.** Agentic costs 100 credits a page against 25 on Standard, four times the price for the same graph. Try Standard first, and move a document type up only when its tables come back wrong.

**One table came back as two.** In the sample run the tier read the totals as a second table and scored it 31, next to 86 for the line items. That is the block to send to review, and `blocks[].parse_confidence` is what tells you so. Read the block's `rows` for the cells as a grid rather than parsing its `<table>` HTML.

**The document score disagrees with the blocks.** `parse.parse_confidence` is a roll-up weighted by the characters in each block, so one long low-scoring table drags it down further than a short clean heading lifts it. Judge a run on the per-block numbers. A block that no model scored comes back with `parse_confidence: null`, which means "not scored", not zero, so test for `null` before you compare.

**The run times out.** Agentic takes about 37 s on a one-page invoice against 28 s on Standard, and minutes on a long document. Raise the budget you hand to `wait()`: `timeout=600` in Python, `{ timeoutMs: 600_000 }` in TypeScript.

**A dense table is still wrong at `effort: "mid"`.** Move to `accurate` for scanned, low-contrast or very wide tables. Drop to `low` on clean digital documents where you want the multi-step pass at a lower price. `prompt_hint` takes a sentence about the page, for example `"the second column is a date"`. `figure_enhancement` is ignored on this tier, so it will not help here.

To turn the same tables into typed fields, add an Extract node after the Parse node. [Bank statement processing](/examples/bank-statement-processing) does exactly that.

## Next steps

<CardGroup cols={2}>
  <Card title="Parse node" icon="file-lines" href="/guides/nodes/parse">
    Every knob on the node
  </Card>

  <Card title="Parse-only workflow" icon="layer-group" href="/examples/parse-only-workflow">
    The same graph on Flash, Fast and Standard
  </Card>

  <Card title="Get run" icon="reply" href="/api-reference-v3/runs/get">
    The full run envelope
  </Card>

  <Card title="Coding assistant" icon="robot" href="/guides/coding-assistant">
    The anyformat skill for Claude Code and other agents
  </Card>
</CardGroup>


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.