Skip to main content
Every business runs on documents. Invoices land in AP, contracts go to legal, claims hit operations, resumes route to recruiting. Agno turns each of those into a typed Python object you can persist, route, or hand to the next system. Define the schema, pass the PDF, get a validated object back.
from typing import List, Optional

from agno.agent import Agent
from agno.media import File
from agno.models.openai import OpenAIResponses
from pydantic import BaseModel, Field


class LineItem(BaseModel):
    description: str
    quantity: Optional[float] = None
    unit_price: Optional[float] = None
    amount: Optional[float] = None


class Invoice(BaseModel):
    invoice_number: Optional[str] = Field(None, description="As printed on the invoice")
    vendor: Optional[str] = None
    invoice_date: Optional[str] = None
    due_date: Optional[str] = None
    subtotal: Optional[float] = None
    tax: Optional[float] = None
    total: Optional[float] = None
    currency: Optional[str] = Field(None, description="ISO 4217, e.g. USD, EUR")
    lines: List[LineItem] = Field(default_factory=list)


agent = Agent(
    model=OpenAIResponses(id="gpt-5.5"),
    instructions=(
        "Extract invoice fields and line items from the attached PDF. "
        "Use exactly what the document shows. If a field is missing, "
        "leave it null. Do not guess."
    ),
    output_schema=Invoice,
)

result = agent.run(
    "Extract the invoice.",
    files=[File(url="https://example.com/invoice-1042.pdf")],
).content
# Invoice(invoice_number='1042', vendor='Acme Corp', invoice_date='2026-04-12',
#         due_date='2026-05-12', subtotal=1200.0, tax=96.0, total=1296.0,
#         currency='USD', lines=[LineItem(...), LineItem(...)])
result is a validated Invoice. The next line in your code is an INSERT, an ERP call, or a queue message. The model has done its job.

Workloads

WorkloadPage
Invoices, receipts, statementsInvoices and receipts
Contracts, MSAs, policiesContracts
Resumes, applications, KYC intakeForms and intake

Production concerns

You need toPage
Process a folder or a queue of documentsBatch and durability
Schedule a nightly run that retries on failureBatch and durability
Route low-confidence fields to a humanHuman routing and eval
Track accuracy against a labeled golden setHuman routing and eval

Explore

Invoices and receipts

Header fields, line items, and the path from PDF to a database row.

Contracts

Parties, dates, and a clause-level breakdown for review queues.

Forms and intake

Resumes, applications, KYC. Lists inside lists, same File() plumbing.

Batch and durability

Workflows over a folder, background runs, scheduled jobs with retries.

Human routing and eval

Confidence-gated approval and accuracy tracking against a golden set.

Developer Resources