Image Transcribe Document Agent

Transcribe a document image with a Ministral 14B agent.

The source-fidelity code uses deprecated pixtral-12b-2409. Replace it with ministral-14b-2512 before running the example.

image_transcribe_document_agent.py
"""
This agent transcribes an old written document from an image.
"""

from agno.agent import Agent
from agno.media import Image
from agno.models.mistral.mistral import MistralChat

# ---------------------------------------------------------------------------
# Create Agent
# ---------------------------------------------------------------------------

agent = Agent(
    model=MistralChat(id="pixtral-12b-2409"),
    markdown=True,
)

agent.print_response(
    "Transcribe this document.",
    images=[
        Image(url="https://ciir.cs.umass.edu/irdemo/hw-demo/page_example.jpg"),
    ],
)

# ---------------------------------------------------------------------------
# Run Agent
# ---------------------------------------------------------------------------

if __name__ == "__main__":
    pass

Run the Example

Set up your virtual environment

uv venv --python 3.12
source .venv/bin/activate

Install dependencies

uv pip install -U agno mistralai

Export your Mistral API key

export MISTRAL_API_KEY="your_mistral_api_key_here"

Update the model

When saving the code, replace pixtral-12b-2409 with ministral-14b-2512.

Run the example

Save the code above as image_transcribe_document_agent.py, then run:

python image_transcribe_document_agent.py

Full source: cookbook/90_models/mistral/image_transcribe_document_agent.py