agentsUI SDK createAgent
Agents use the same components people do.
Every Strata form control is a UI SDK part, so an agent can find it by its label, read its value and change it through the component’s own API instead of clicking pixels. Destructive actions wait for a person. The steps below are scripted, with no model involved, so you can see exactly what an agent would send.
the app · Strata components
the agent · createAgent()
01 / what makes it work
- Every control has a name:
FieldLabel, a label part, oraria-label. That name is the agent’sref. - Every control an agent should use is a UI SDK part. Plain buttons and inputs don’t show up.
data-agent-confirmmarks anything a person must approve, like delete or pay.- State changes go through
onValueChange, wheredetails.source === 'agent'tells an agent’s change apart anddetails.cancel()refuses it.
02 / the bridge
import { createAgent } from '@ui-sdk/react/agent'
const agent = createAgent({
// Steps on anything marked data-agent-confirm wait for a person.
allow: (step) => !step.confirm || askThePerson(step.confirm),
})
agent.snapshot() // every named component, its value and the actions it allows
await agent.act({ steps: [{ ref: 'Visibility', action: 'setValue', args: ['Public'] }] })