Agent Pointer
See an agent act in your UI. Follow its UI SDK actions, approve sensitive steps, or take over to stop the rest.
See it as an AI agent does.See this component the way an AI agent does.
Connect the pointer to your agent
Create one controller for the mounted view. Pass pointer.wrapAllow({ authorize, approvals }) to createAgent({ allow }) and send planned mutations to pointer.run(agent, { steps }). Give authorize your app's permission policy. It runs before the pointer moves or asks the person. Pass createApprovals() from Approval to let the person answer marked steps. A step marked data-agent-confirm fails with “Needs a person: no approval handler is configured.” when the handler is missing.
Wrap one model turn in pointer.session(() => runModel(...)) to keep the status and Take over available while the model works between tool calls. For one-off calls to pointer.run, the control stays available briefly in case another call follows. Only one pointer run can be active per document.
Take over cancels remaining steps and puts the controller on hold across later calls. Changes already applied stay in place, and an action already executing can finish. If a tool result says the person took over, return it to the model and end the current tool loop. The person can choose Let Claude continue, or your app can call pointer.resume() on their behalf before starting a new turn. The status and approval controls are for the person using the app and are hidden from UI SDK's agent tools.
Send the model the schemas in agent.tools. Use snapshot and plain query to discover controls, and route each act through pointer.run. For dialogs, send an open step and a separate press step. Add this sentence to the model's system prompt.
You may press buttons marked for confirmation, and the app will ask the person before carrying out those actions.
The pointer follows agents acting through UI SDK's bridge. It works with app-driven act and can show visible mutations from WebMCP tools published with registerTools. Screenshot and computer-use agents bypass this bridge. When registering WebMCP tools, give registerTools a separate caller policy and keep the human decision in createAgent. The native WebMCP registration owns its own call lifecycle in UI SDK beta.17. Use pointer.run for the full presentation and the Take over control.
See WebMCP in React with approval for a browser tool that calls pointer.run and waits for the person's answer.
The bridge reports a component ref. The pointer lands on the component unless the default button lookup or your resolveTarget(action) finds the exact element. If there is no visible target, the pointer shows status instead. Put data-agent-pointer-scope on the surrounding view to limit which scroll containers the pointer moves. It highlights changes reported for the same ref with source agent. An asynchronous outcome can arrive later as a programmatic change.
Values are hidden by default. Use previewValue(action) to return a display string for non-sensitive setValue steps. The typing effect is a visual treatment. UI SDK commits the whole value at once. Passwords, redacted values and controls marked data-agent-secret stay hidden. With reduced motion, the target is highlighted in place and the run skips the arrival wait.
Installation
npx shadcn@latest add @keyframery/agent-pointer @keyframery/input @keyframery/form @keyframery/selectThis adds components/keyframery/agent-pointer.tsx and its primitive to your project, and installs UI SDK, along with approval, which it builds on. The motion tokens are added to your global CSS the first time you install a component. The install command also adds input, form, select for the preview and examples.
Usage
"use client"
import { createAgent } from "@ui-sdk/react/agent"
import * as React from "react"
import { AgentPointer, createAgentPointer } from "@/components/keyframery/agent-pointer"
import { Button } from "@/components/keyframery/button"
import { Input } from "@/components/keyframery/input"
export default function Usage() {
const [pointer] = React.useState(createAgentPointer)
const [agent] = React.useState(() => typeof window === "undefined" ? undefined : createAgent({
allow: pointer.wrapAllow({ authorize: (step) => step.label === "Booking name" && step.action === "setValue" }),
}))
return (
<div className="flex w-full max-w-sm flex-col gap-3">
<Input aria-label="Booking name" />
<Button data-agent-hidden onClick={() => agent && pointer.run(agent, {
steps: [{ ref: "Booking name", action: "setValue", args: ["Maya Okafor"] }],
})}>Enter booking name</Button>
<AgentPointer controller={pointer} label="Claude" />
</div>
)
}Examples
Basic
A planned step sets a value through the bridge. Values are hidden from the cursor by default.
With approvals
The human decision runs once in the bridge. Approving the marked action archives the draft.
Resolve a target
Point to the submit button when the bridge reports the form itself.
Route a model's tool calls
Give your model adapter the UI SDK tool schemas and handlers. This demo uses scripted calls.
Motion
| Move | What you see |
|---|---|
| Glide | The pointer travels to the control before the bridge applies the step. |
| Press | A ripple marks a press. A target outline appears when a matching change is observed. |
| Fade | With reduced motion, the target is outlined in place and there is no arrival wait. |
Timing and springiness follow the motion style you set. To change how fast this agent pointer moves, pass speed:
<AgentPointer controller={pointer} speed="fast" />"fast" is 0.6×, "slow" 1.4×, and a number sets the multiplier. With reduced motion turned on, nothing moves: changes happen at once or with a short fade.
Theming
Set these CSS variables on the component or a parent. Leave them unset to follow the light and dark theme. The open Customize panel below the preview lets you try these settings.
| Variable | What it changes | Default |
|---|---|---|
--agent-pointer-accent | Cursor, target outline and ripple | --primary |
--agent-pointer-ink | Label text colour | --primary-foreground |
--agent-pointer-preview | Value preview surface | --popover |
--agent-pointer-preview-ink | Value preview text colour | --popover-foreground |
--agent-pointer-size | Cursor size | 25px |
--agent-pointer-radius | Label and preview corners | 6px |
--agent-pointer-font | Label text size | 12px |
--agent-pointer-ring | Target outline thickness | 2px |
API reference
Every part takes className and children, along with the props of the element it renders. The parts are rendered by UI SDK, so they also take render, to draw your own element, and a function of their state for className and style.
AgentPointer
Renders a <div>, and takes its props too.
Prop
Type
Keyboard
| Key | What it does |
|---|---|
| Tab or Shift+Tab | Moves between the person's controls. When the Approval card opens, it focuses Deny for a high-risk action. |
| Enter or Space | Activates Approve, Deny, or Take over. |
Accessibility
Roles, keyboard and focus are declared on the component's UI SDK primitive, and state is announced through the matching ARIA attributes. More in Accessibility.
Built on UI SDK's core
UI SDK doesn't ship a agent pointer, so this one is defined with its core: one definePrimitive in components/keyframery/core/agent-pointer-core.ts, with no React in it. UI SDK's adapters can render that same definition in Vue, Svelte, Solid and web components. To keep your own styling and take only the motion, import from @/components/keyframery/primitives/agent-pointer.
Questions
How does the animated Agent Pointer for UI SDK move?
Glide: The pointer travels to the control before the bridge applies the step. Press: A ripple marks a press. A target outline appears when a matching change is observed. Fade: With reduced motion, the target is outlined in place and there is no arrival wait.
Do I need Motion or Framer Motion for the animated Agent Pointer?
No. Every move is plain CSS, so there is nothing to install besides the component and UI SDK.
UI SDK has no agent pointer. How is this one built on UI SDK?
Its behaviour is one definition written with UI SDK's core (definePrimitive), in components/keyframery/core/agent-pointer-core.ts. Its parts are rendered by UI SDK's adapter, so they take render, state-based class names and data-slot, like every UI SDK component.
What happens to the Agent Pointer when someone turns on reduced motion?
Nothing moves. State changes happen at once, or with a short fade.
More in AI
All componentsWaterfall
Request bars grow from their start time one row after another, and nested spans cascade in.
Approval
A person says yes or no to something an AI agent wants to do. The card shows the action, the control the agent would press, details and a risk level, with Approve and Deny; once answered it closes to one line. createApprovals() wires it to UI SDK's agent bridge, whose allow callback waits for the answer. The buttons sit inside data-agent-hidden, so an agent can read the card but can never approve its own request. createApprovals' allow also refuses any step aimed inside an approval card, and while it waits UI SDK holds the waiting agent's later act and query calls.