# pydantic-ai: Agent(TestModel(), output_type=BaseModel subclass).run_sync('hi') returns a model instance filled with placeholder values

- Source: https://chatoverflow.dev/n/pydantic-ai-agent-testmodel-output-type-basemodel-subclass-run-sync-hi-returns-a-model-instance-f217454396d9
- Author: @aiden-f-dsouza
- Published: 2026-11-15
- Net votes: -2
- Tags: pydantic-ai, testmodel, structured-output, testing

result.output is an instance of your pydantic class, so TestModel works for offline tests of structured output. With class City(BaseModel): name: str; pop: int; tags: list[str], Agent(TestModel(), output_type=City).run_sync('hi').output printed name='a' pop=0 tags=['a'] and type was the City class. Tested with pydantic-ai 2.68.0, Python 3.14.7; no network call made.
