Skip to main content
The Agent Platform JavaScript SDK (AgP JS SDK) lets you automate filling out web forms using the fillForms() function. You can execute a number of web-based workflows, including completing multiple forms with user-provided data, tracking submissions in real time, and eliminating repetitive manual work. Here’s a summary of what the AgP JS SDK empowers you to do when automating web form submissions:
  • Find and fill multiple web forms automatically.
  • Add user-provided data efficiently and accurately.
  • Track the status of each submission in real time.
  • Complete all tasks without manual intervention.

Automate web form submissions

Situation: You need to fill out multiple online forms (for example, job applications, surveys, or customer feedback forms) but manually entering the same data repeatedly is slow, error-prone, and tedious. Problem: How can you automatically fill out multiple web forms accurately and efficiently, while tracking submission progress, without building complex scripts or integrations from scratch? Solution: The AgP JS SDK lets you automate web form submissions using the fillForms() function. It enables you to define the forms to fill, provide the necessary data, and monitor progress in real time. With automated form completion and event tracking, you can save time, reduce errors, and handle repetitive tasks without manual intervention.

Fill and automate forms

The steps below show you how to fill and automate forms using the AgP JS SDK:

Step 1: Define the forms

Create an array of forms with the URL and data you want to submit.
const forms = [
  {
    url: 'https://example1.com/contact',
    fields: {
      name: 'John Doe',
      email: 'john@example.com',
      message: 'Hello!'
    }
  },
  {
    url: 'https://example2.com/signup',
    fields: {
      username: 'johndoe',
      email: 'john@example.com'
    }
  }
];

Step 2: Start a form-filling task

For each form, call agent.fillForm(url, data) to let the agent fill the form automatically.
const task = await agent.fillForm(form);

Step 3: Track task status

Use task.onStatusChange to monitor updates and see progress in real time.
task.onStatusChange((status) => {
  console.log(`Form ${form.url}: ${status}`);
});

Step 4: Wait for completion

Call await task.waitForCompletion() to ensure the agent finishes before moving on to the next form.
await task.waitForCompletion();

Step 5: Run your code

Now that your forms and event listeners are defined, you can execute the full workflow. This example loops through multiple forms, fills each one automatically, and logs progress in real time.
// npm install agp-js-sdk
import { WebAgent } from 'agp-js-sdk';

(async () => {
  // Initialize the agent using your API key
  const agent = WebAgent.fromApiKey(process.env.AGENT_API_KEY);

  // Define the forms to fill
  const forms = [
    {
      url: 'https://example1.com/contact',
      fields: {
        name: 'John Doe',
        email: 'john@example.com',
        message: 'Hello!'
      }
    },
    {
      url: 'https://example2.com/signup',
      fields: {
        username: 'johndoe',
        email: 'john@example.com'
      }
    }
  ];

  // Loop through each form and run the task
  for (const form of forms) {
    const task = await agent.fillForm(form.url, form.fields);

    // Track status updates
    task.onStatusChange((status) => {
      console.log(`Form ${form.url}: ${status}`);
    });

    // Wait for the form-filling task to finish
    await task.waitForCompletion();
    console.log(`Completed form: ${form.url}`);
  }

  console.log('All forms processed successfully!');
})();
Reminder: Run your commands wrapped in an async () function so they work in sequence.

Outcome

The AgP JS SDK, running the above code asyncronously, will follow a sequence that:
  • Initializes the SDK and authenticates through Portal-H.
  • Provides real-time updates.
  • Generates an accurate and detailed response, for example:
Navigation Task: Fill Out Example Online Form
Status: Success

Target: https://www.jotform.com/build/253003837549157?s=templates&salesforceTemplate=1#preview (Jotform Contact Information Collection Form)

Evidence of Task Completion:

All fields in the Contact Form are filled with example data:
First Name: John
Middle Name: Smith
Last Name: Smith
Date of Birth: 10-28-2025
E-mail: john@example.com [blocked]
Street Address: 123 Main St
Street Address Line 2: Apt 4B
City: Springfield
State / Province: IL

Key Steps:

Navigated to Jotform's form template page via Bing search.
Selected a Contact Information Collection Form template.
Entered example data into all visible fields in the preview/fillable form mode.
Resulting State:

The form is completely filled out and visible in the preview mode, demonstrating a successful completion of the navigation and data entry task.
Next Steps:

If required to submit the form, locate and use the submit button. Otherwise, the filling process is demonstrated and complete.

Screenshot example

Screenshot2025 10 28at14 35 50 Pn