Record your actions in the browser and let your agent turn them into automation code.
1Use the Libretto skill. I'm going to show you a workflow in eClinicalWorks to look up a patient's primary insurance ID. Turn it into a script that takes patient name and DOB as input and returns the insurance ID. URL is https://your-ehr.example.com
I'm done. I searched by patient name, opened their chart, and clicked the Insurance tab. The primary insurance ID is visible in the Patient Info section on screen.
I clicked the second search result because the first row is always a header. Also, the insurance tab sometimes takes a few seconds to load.
1tail -n 20 .libretto/sessions/interactive-flow/actions.jsonl | jq .
workflow(). Things to check:startUrl is set to the workflow's entry pagewaitForSelector or similarThe patient name is hardcoded. It should come from the input parameter. Also, the insurance tab selector looks fragile, can you use the tab's text instead?
123# What the agent runs npx libretto run ./get-insurance-id.ts --headless \ --params '{"patientName": "Jane Smith", "dob": "1985-04-12"}'
It returned an empty string for the insurance ID. I think the tab content hadn't loaded yet when it tried to read the value.
npx libretto save.
Future runs can restore your login state so you don't have to authenticate
every time.