strata

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

General settings live here.

the agent · createAgent()

    01 / what makes it work

    • Every control has a name: FieldLabel, a label part, or aria-label. That name is the agent’s ref.
    • Every control an agent should use is a UI SDK part. Plain buttons and inputs don’t show up.
    • data-agent-confirm marks anything a person must approve, like delete or pay.
    • State changes go through onValueChange, where details.source === 'agent' tells an agent’s change apart and details.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'] }] })