Skip to main content

A2UI

What it is

SensitiveFormRouter is a client-side helper. Agents can emit interactive forms via A2UI instead of going back and forth over chat. When a form’s metadata marks it as sensitive, the user’s values (passwords, API keys, PII, payment details) must never flow back through the agent or the LLM. SensitiveFormRouter is the single call your UI makes to do the right thing:
  • For sensitive forms: POST the values directly to the submit_url the platform included on the form, and produce a sanitized agent_message you can show the agent (“user submitted login_form with fields: email, password (redacted)”) so the conversation stays coherent.
  • For non-sensitive forms: pass the values back as action_data for the agent to consume normally.
The agent side never sees sensitive values — they go directly from the user’s device to the sensitive-endpoint the platform prepared.

When to use it

You’re building any of:
  • A web chat UI for Svantic agents.
  • The terminal CLI (the built-in terminal uses this internally).
  • A custom embed (Slack, Teams, a mobile app).
If you’re writing an agent, you don’t use this class at all — the platform decides when forms are sensitive based on your A2UI output.

Functional usage

See the Sensitive forms guide for the full UX walkthrough.

SensitiveFormRouter.route(options)

  • When sensitive === true and submit_url is set, POSTs { values, action } to submit_url and returns a sanitized agent_message describing the outcome (values redacted).
  • Otherwise returns { routed_to: 'agent', action_data: values, agent_message } so the client can send the values to the agent normally.
Throws when the POST to a submit_url fails. The agent never sees secret values either way.

FormRouteOptions

FormRouteResult

Example