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

# Manage a human review queue with your AI agent

> Use an MCP-connected AI agent to list documents awaiting review, inspect extractions, and bulk-confirm, reject, archive, or reassign queue items in Affinda.

This workflow walks through using an MCP-connected AI agent to manage the document review queue — listing documents waiting for a human decision, inspecting their extracted data, and applying verdicts in bulk.

**Trigger phrases that start this workflow:**

* "Review my documents"
* "What's in my review queue?"
* "Confirm the invoices I just uploaded"
* "I want to validate my extractions"

<Note>
  Before starting, your AI client must be connected to the Affinda MCP server. See [MCP Connector and Plugin](/integrations/mcp-connector) for setup instructions.
</Note>

***

## Document states

Documents move through the following states:

```
pending → processing → review → validated
```

| State                    | Meaning                                                                                         |
| ------------------------ | ----------------------------------------------------------------------------------------------- |
| `pending` / `processing` | Document is still being extracted. Nothing to review yet.                                       |
| `review`                 | Extraction complete; waiting for a human decision. This is the queue this workflow operates on. |
| `validated`              | Confirmed by a human or by auto-confirmation rules.                                             |
| `archived`               | Removed from the active queue; no longer needs action.                                          |

***

## Steps

<Steps>
  <Step title="Show the review queue">
    The agent calls `list_documents` with `state=review` and returns up to 20 documents waiting for a decision. If the queue is empty, there is nothing to review.

    You can narrow the queue by workspace or document type: *"Show me the invoice review queue."*
  </Step>

  <Step title="Inspect individual documents">
    For any document you want to examine in detail, ask: *"Show me the extraction for document \[ID or name]."*

    The agent calls `get_document` (for status and metadata) and `get_document_extraction` (for field values and confidence scores), then surfaces the results with low-confidence fields highlighted so you know where to look first.
  </Step>

  <Step title="Apply your verdict">
    Tell the agent your decision in plain language. It will identify the relevant tool and batch the operation:

    | What you say                      | Tool called                                                     |
    | --------------------------------- | --------------------------------------------------------------- |
    | "These look right — confirm them" | `confirm_documents(document_ids=[...])`                         |
    | "These are wrong — reject them"   | `reject_documents(document_ids=[...])`                          |
    | "I don't need these any more"     | `archive_documents(document_ids=[...])`                         |
    | "This is the wrong document type" | `reassign_document_type(document_id=..., document_type_id=...)` |

    <Tip>
      You can refer to multiple documents at once: *"Confirm all of these."* The agent batches them into a single call rather than looping per document.
    </Tip>
  </Step>
</Steps>

***

## Model memory and confirmation

`confirm_documents` does more than mark a document as validated — it feeds the extraction into the workspace's model memory, directly improving future accuracy. The effect depends on the workspace's `model_memory_strategy`:

| Strategy         | Behaviour                                                                            |
| ---------------- | ------------------------------------------------------------------------------------ |
| `auto` (default) | The system selects which confirmed documents become training examples automatically. |
| `manual`         | Only documents you explicitly mark as training examples are used.                    |
| `always`         | Every confirmed document is added as a training example.                             |

When you confirm a document for the first time, the agent will mention this so you understand that confirmation is not just "approve and forget" — it is also "approve and teach the model".

***

## Rejection vs archiving

These two operations are distinct:

* **Reject** (`reject_documents`) — marks an extraction as incorrect. Rejection participates in model memory: the system learns to avoid repeating the same mistake on similar documents.
* **Archive** (`archive_documents`) — removes a document from the active queue because it is no longer needed. Archiving does not signal to the model that the extraction was wrong.

Use rejection for bad extractions. Use archiving for documents that were processed correctly but are no longer relevant.

***

## Document reassignment

If a document was routed to the wrong document type (for example, a receipt was classified as an invoice), use `reassign_document_type`. The agent will:

1. Verify that the target document type is assigned to the workspace.
2. Call `assign_document_type_to_workspace` first if it is not.
3. Call `reassign_document_type`, which triggers a reparse under the new schema.

The document briefly returns to `processing` state during the reparse. Tell the agent you are expecting this and it will confirm once the new extraction is ready.

***

## Related

* [Debug low-confidence results](/integrations/mcp-workflows/debug-low-confidence-results) — if users are repeatedly correcting the same field, this is the next step.
* [Configuration guide: User Validation](/configuration/user-validation) — details of the Affinda validation interface for human reviewers.
* [Configuration guide: Machine Validation](/configuration/machine-validation) — setting up auto-confirmation rules so clean documents bypass the review queue.
