agent.extract() shines: it reads the current screen and maps what it
sees onto a JSON schema you provide, giving you structured, schema-validated
data instead of free-form text. Combining agent.extract() with a Pydantic
Result model means the runtime validates the returned values for you before
the workflow finishes.
This example follows a four-phase pattern:
Verify
agent.verify() confirms the correct profile is on screen before
attempting any extraction — preventing silent mis-reads on the wrong page.Extract demographics & visits
Two
agent.extract() calls, each with a tailored JSON schema, pull
the demographic fields and the visit history as typed objects
rather than raw strings.workflow.py