Overview
Form tools let you turn any HTML form on your page into a tool the AI agent can use — without writing a single line of JavaScript. Just add a fewzephlo-* attributes to your existing form markup and the agent can fill in fields, select options, and optionally submit the form on behalf of the visitor.
This is perfect for lead capture forms, contact forms, search filters, booking forms, and any other form-based interaction.
Quick start
Addzephlo-tool-name to any <form> element:
Form attributes
On the <form> element
On <input>, <select>, and <textarea> elements
Fill-only vs auto-submit
By default, the agent fills in the form fields but does not submit. The visitor sees the filled form and can review or modify the values before clicking submit themselves. To let the agent submit automatically, addzephlo-auto-submit:
Handling auto-submit events
When auto-submit is enabled, the form dispatches a standardsubmit event with an extra agentInvoked flag. Use respondWith to return a result to the agent:
If you don’t call
e.respondWith(), the agent receives a default “Form submitted successfully” confirmation.Returning a result without JavaScript
If your form posts on its own and you just want to hand a specific message back to the agent, set azephlo-result attribute on the form. The widget reads it after submission and clears it:
Auto-mapped constraints
The widget automatically converts your HTML validation attributes into JSON Schema constraints that the agent understands:
This means your existing validation logic doubles as instructions for the agent.
Supported input types
Only fields with a
name attribute become tool parameters. A file input is always skipped — the agent can’t set files programmatically — so keep file uploads for the visitor to fill in themselves.Examples
Lead capture form
Booking form
Search / filter form
Dynamic forms
The widget uses aMutationObserver to automatically detect forms added to the page after initial load. If you dynamically insert a form with zephlo-tool-name, it’s picked up automatically.
If you ever need to force an immediate re-scan — for example, right after rendering a form in a framework that updates the DOM asynchronously — call:
Auto-detection watches the main document. Forms rendered inside another component’s Shadow DOM are isolated and won’t be seen, so keep your
zephlo-tool-name form markup in the regular (light) DOM.Next steps
Register tools
Register tools programmatically for custom logic.
Widget integration
Learn about embedding and customization options.