feat: one tools to interact with F0Form#3683
Merged
sauldom102 merged 18 commits intomainfrom Mar 23, 2026
Merged
Conversation
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
AI tools to interact with F0 Forms
Enables the One AI assistant to discover, fill, submit, and present F0 forms on the current page — bridging the gap between conversational AI and structured data entry.
Screen.Recording.2026-03-19.at.17.21.42.mov
What changed
AI Form Registry — New central registry (
F0AiFormRegistry) that tracks all mounted F0 forms. Each form auto-registers its ref, schema, sections, current values, errors, and dirty state. The registry also supports virtual form definitions — forms the AI can present even when they're not yet rendered.Four new CopilotKit tools:
formFill— Sets field values on a form by name, with full Zod validation and per-field error reportingformSubmit— Submits a form programmatically, returning success/error statusformGetState— Reads current values, errors, dirty state, and schema for any registered formpresentForm— Opens a form (viaF0AiFormPresenter) from a virtual definition, optionally passing params to asyncdefaultValuesForm context in co-agent shared state — Form descriptions are pushed into CopilotKit's co-agent state via
useCoAgent+setState, giving the backend agent structured access to what forms are active and their current state.Async
defaultValueswithdefaultValuesParamsSchema—useF0FormDefinitionnow supports async default values ((signal) => Promise<T>) with skeleton loading placeholders. WhendefaultValuesParamsSchemais provided, the callback receives typed params instead (({ employeeId }) => Promise<T>), enabling the AI to present a form pre-filled with entity-specific data.customFieldNameon all field types — Any field (not justfieldType: "custom") can now declare acustomFieldName. The form-levelrenderCustomFieldcallback dispatches on it, allowing consuming apps to inject custom data sources or rendering into standard fields (e.g. a select that gets its options from an external source).useF0Formhook — New hook for external programmatic control:submit(),reset(),isDirty(),isSubmitting,hasErrors, plus aformRefto wire into<F0Form>.Why it matters
Until now, the AI assistant couldn't interact with forms — the most common data-entry surface in Factorial. This unlocks workflows like "fill out a time-off request for next Monday" or "update this employee's role to Staff Engineer and save", going from multi-click manual processes to single-turn conversational actions.