← Back to Notte

Can I define output schemas for the Anything API to get consistently structured data back?

Yes - the Anything API supports output schemas (Pydantic models or JSON Schema) that ensure every response matches your expected data structure.

How schemas work:

from pydantic import BaseModel
from notte_sdk import NotteClient

class Product(BaseModel):
    name: str
    price: float
    currency: str
    in_stock: bool
    rating: float | None

class ProductList(BaseModel):
    products: list[Product]

client = NotteClient()

with client.Session() as session:
    agent = client.Agent(session=session, max_steps=10)
    result = agent.run(
        task="Extract all products from example.com/shop",
        response_format=ProductList,
    )

# result.answer contains the validated response

Schema benefits:

Schema definition options:

What happens when extraction doesn't match the schema:

Integration:

Schema-validated output loads directly into databases, data warehouses, and typed Python/TypeScript codebases without a parsing step.

Docs at docs.notte.cc/quickstart.