Skip to main content
Extract text from PDFs and images with OCRAgent — pass a URL or base64 source and get markdown-ready text back.
The user supplies a document URL; OCR extracts text and the agent summarises it.
Source must be a URL (https://) or base64-encoded document. Local file paths are not supported. Currently only Mistral (mistral/mistral-ocr-latest) is supported.

Quick Start

1

Extract text from a PDF

2

Configure with OCRConfig

3

Async extraction

How It Works

Configuration Options

OCRAgent

Agent class reference

OCRConfig

Configuration dataclass

Common Patterns

Providers

Mistral OCR

Provider setup and model options

Best Practices

Local file paths are not supported — upload to a reachable URL or encode as base64 before calling OCRAgent.
Use pages=[0, 1, 2] via OCRConfig or method kwargs to limit cost and latency on multi-hundred-page documents.
Default timeout is 600 seconds. Lower it for quick image OCR; raise it for large scanned PDFs.
Pass api_key on OCRConfig, on OCRAgent(...), or set MISTRAL_API_KEY in the environment — instance config wins over env vars.

Knowledge

Index extracted text for retrieval

Toolsets

Bundle document-processing tools for agents