Skip to main content
We have provided you with a form filling workflow example for testing. The agent fills out the first section of a standard form on Aetna healthcare page. Here, we will walk through how the template was built.

Create a form filling agent

Refer to the Simplex agents page to walkthrough how to create an agent on the dashboard. We have provided a template form filling agent configuration below. This prompt is quite high level and is designed to generally work across portals.
Your goal is to fill out the fields present on the page with the given <form_info>. New 
fields may appear on the page. Simply fill out the fields till no more appear. Do not click 
any buttons to save, submit, or move to the next page.

<notes>
- For dropdowns, use one step to click on the dropdown and another step to select the option.
- Close any popups that might appear.
- Only fill fields on the page. Do not click Submit, Continue, or similar buttons to move on.
- There may be info in <form_field> that are not on the current page. That is okay.
</notes>

<finish_task>
- Call done when all the fields on the page are filled out.
- If new fields appear on the page, fill those as well. Ensure no more fields appear on the 
page before finishing the task.
- Call fail_task with a message if form_info is incomplete.
</finish_task>

<form_info>
{{form_info}}
</form_info>
Add the following tool calls to the agent: wait_for_seconds, press_enter, scroll_down, scroll_up, click_element, type_text, switch_tab.

Build the workflow

There are a few ways to build this workfow. We can use a single form filling agent, and modify the prompt such that we fill out the entire form. Instead, we will use a single form filling agent per page. This way, we can handle navigating through form steps, handling terms and conditions, and verification separately. Having a single agent to handle all three of these can overload context causing the agent to repeat steps or miss steps.
// Create workflow session
const workflow = await client.createWorkflowSession({
  name: 'aetna-form-filling',
  url: 'https://www.aetna.com' // Replace with actual Aetna form URL
});

console.log('Livestream URL:', workflow.livestreamUrl);

const variables = {
  form_info: {
    first_name: 'Alice',
    last_name: 'Bob',
    role: 'Clinician',
    submitter_email: 'shreya@simplex.sh',
    phone_number: '(928) 499-1991',
    npi_number: '1287549027',
    interested_in: 'Aetna',
    applying_for: 'Behavior Health',
    joining: 'A individual provider applying under a SSN or TaxID/EIN'
  }
}

await workflow.runAgent('Form Filler', { variables });
await workflow.agentic('Click Continue button');
await workflow.runAgent('Form Filler', { variables });
await workflow.agentic(`Accept all terms and conditions, acknowledgements, and anything similar on the page. 
There may be multiple of these on the page. Accept them all. 
If an acknowledgement opens a new tab, immediately return back to the form to continue accepting terms.
Call done when all terms are accepted and new page opens after Continue is clicked.`)

// Close the workflow session
await workflow.close();