Examples / Workflows
Agent-only form fields
Mark a field as the agent's, and any value a person submits for it is thrown away, so only the agent can set it.
Some fields must come from the agent and nobody else: a priority that routes work, a flag that holds something for review, a score. uagAuthoritative: "true" marks them. Whenever a submission is created or updated through the UAG, any value the browser sent for those fields is thrown away first, so the only value saved is the agent's.
This form leaves the two fields open so you can try. Type a summary, choose a priority, and submit: the saved submission comes back without your values, and the agent's appear a few seconds later.
This applies to submissions sent through the UAG. To also protect the fields from someone who sends a submission straight to Form.io, the action can act with an agent role of its own; see the developer docs.
Turn it on
{
"title": "Example: Agent-only form fields",
"name": "exampleAgentOnlyFields",
"path": "example-agent-only-fields",
"type": "form",
"display": "form",
"tags": [
"uag"
],
"properties": {
"description": "A message whose priority and summary only the reviewing agent may set."
},
"components": [
{
"type": "textarea",
"key": "message",
"label": "Message",
"input": true,
"rows": 4,
"validate": {
"required": true
}
},
{
"type": "content",
"key": "reviewCriteria",
"label": "Criteria",
"input": false,
"html": "<p>You review messages sent to a team. Read <code>message</code>. Write <code>summary</code>: one sentence, under 20 words, saying what the sender wants. Set <code>priority</code> to <code>urgent</code> if work is stopped or a deadline is within two days, <code>low</code> if nothing is blocked, and <code>normal</code> otherwise.</p>",
"properties": {
"uag": "review",
"uagField": "criteria",
"uagEngine": "agent"
}
},
{
"type": "panel",
"key": "review",
"title": "Only the agent's values are kept",
"input": false,
"components": [
{
"type": "radio",
"key": "priority",
"label": "Priority",
"input": true,
"values": [
{
"label": "Low",
"value": "low"
},
{
"label": "Normal",
"value": "normal"
},
{
"label": "Urgent",
"value": "urgent"
}
],
"properties": {
"uag": "review",
"uagAuthoritative": "true",
"uagAgentDecides": "true"
}
},
{
"type": "textfield",
"key": "summary",
"label": "Summary",
"input": true,
"properties": {
"uag": "review",
"uagAuthoritative": "true"
}
}
]
},
{
"type": "button",
"key": "submit",
"label": "Submit",
"action": "submit",
"input": true
}
]
}<link rel="stylesheet" href="https://ai.form.io/uag-js/uag-js.css">
<script src="https://cdn.jsdelivr.net/npm/@formio/js@5.6.1/dist/formio.full.min.js"></script>
<!-- Registers @formio/uag-js with this UAG: forms tagged uag save through it, and get Agent Input and the chat. -->
<script src="https://ai.form.io/uag-js/uag.use.js"></script>
<div id="form"></div>
<script>
Formio.createForm(document.getElementById('form'), 'https://uag.form.io/example-agent-only-fields');
</script>{
"title": "Agent: Run task (review)",
"name": "agentRunTask",
"priority": 20,
"handler": [
"before",
"after"
],
"method": [
"create"
],
"settings": {
"task": "review",
"answer": "task",
"when": "after"
}
}Try it
Start the live examples
The examples call real models. Starting them signs you in as a temporary guest of the examples' project, for every example; what you enter is deleted after a day.
Not supported without a license
This demo needs a license (LICENSE_KEY) that includes the UAG, or a 30-day free trial project on portal.form.io. This deployment has neither: it serves an Open Source project, or its UAG is unlicensed.
The chat widget examples work everywhere, with no license.