Skip to content

Docs

Pydantic AI: TypeSafe (Jev) Model

Run a Pydantic AI agent on Jev: each field of the output type becomes one question, the prompt is the state, and confidence comes back per field.
Format
Docs
Reading time
3 min
Published by
Community
Last verified
Sep 2026

Highlights

  • Each field of output_type becomes one question, the prompt is the state, and versioned ids like typesafe:jev-1.13.0 are accepted.
  • Confidence is per field in provider_details['confidence']; for a boolean it is the distance from the decision threshold, scaled 0 to 1.
  • typesafe_boolean_threshold defaults to 0.5 and applies to every bool field and each option of a fanned-out list.
  • A rubric is whole numbers from 0 upward, at least 2 and at most 10 levels, each needing a description; a half rounds up.
  • Jev picks from at most 255 options in one question, so a run-time candidate set needs a ceiling of 253 plus abstain and reobserve.

Quickstart

python
from enum import Enum
from pydantic import BaseModel, Field
from pydantic_ai import Agent

class Verdict(str, Enum):
    run = 'run'
    reject = 'reject'
    ask = 'ask'

class Handling(BaseModel):
    verdict: Verdict
    irreversible: bool = Field(description='Would running this destroy data or leak secrets?')

agent = Agent('typesafe:jev-latest', output_type=Handling)
result = agent.run_sync('rm -rf ./build')
print(result.output)

Watch out

Jev cannot fill plain strings, unbounded numbers, datetimes, or unions of models, and those fields raise UserError before a request is sent, so questions belong on field descriptions.

Questions about this entry

Short answers drawn from the linked project or page.

From the Jev guides

Original write-ups on what this entry is for.

From the Jev AI model community

Posts from builders shipping with Jev right now.

Follow @typesafeai