Typed output
Pass a type asoutput_model_schema. Read the instance from result.structured_output.
list[Model], Literal['yes', 'no']. For a JSON-schema dict, wrap it in pydantic_ai.StructuredDict(schema). Anything else raises a TypeError in Agent(...).
The result
run() returns an AgentHistoryList.
Methods kept from 0.x:
final_result(), structured_output, is_done(), is_successful(), errors(), has_errors(), number_of_steps(), total_duration_seconds(). print(result) omits messages, which can be large.
Status and success
A run that reachesmax_steps or the timeout gets one forced delivery turn. If the agent delivers, status is still 'completed', and success is False when it reports the task unfinished. 'max_steps' and 'timeout' mean nothing was delivered; read result.partial.
is_done()isTruewhenstatus == 'completed'.is_successful()is the agent’s verdict:True,False, orNonewhen it gave none. It is the agent’s own claim; verify important actions independently.errors()lists only the error that ended the run. Cell errors the agent recovered from are inmessages.
result.is_done() and result.success is not False.
Removed from 0.x
There are no per-step actions in 1.0, sohistory, urls(), screenshots(), action_names(), model_thoughts(), extracted_content(), save_to_file(), load_from_file(), judgement() and similar raise an AttributeError that points to the replacement. Use final_result(), structured_output, messages, partial and the files in agent.workspace.