What is CoUI
People and agents work in the same interface. Three hooks declare what an agent may touch; one store hands them to any agent framework.
One state, two writers
Today chat and GUI are two worlds: an agent either works the interface through screenshots, or leaves its results in a chat bubble. CoUI keeps React's idea and changes one thing:
UI = f(state)
state = human ?? agent ?? initialThe state has two writers, the person and the agent. Each key keeps one layer per writer, and the person's shows on top: an agent can never cover what a person set, its value waits underneath. See Two writers.
Three hooks
| CoUI | React | Does |
|---|---|---|
useCoState | useState | State both the person and the agent read and write |
useCoRef | useRef | Makes an element something to point at |
useCoCallback | useCallback | A callback the person can click and the agent can call |
<CoUIProvider>, useCoUI | Context | The scope; what waits for approval, who points where, the history |
function PriceFilter() {
const [maxPrice, setMaxPrice] = useCoState('maxPrice', 100, 'Price limit in dollars');
return <input type="range" max={500} value={maxPrice} onChange={(e) => setMaxPrice(Number(e.target.value))} />;
}Ignore the third return value and it reads like useState. See the API.
What the agent gets
Three fixed tools, set, call and point, that never change as components mount and unmount, so the prompt cache survives; and a context, the declarations on screen as text, sent in full once and then as deltas. Any agent framework that can attach text to a message, declare client-side tools and send back a tool result can take it. The AI SDK takes about ten lines.
What CoUI is not
- Not a framework. No server of its own: the route that calls the model is your agent framework's.
- Not a protocol. The output is plain data; an integration compiles it to AG-UI, MCP or WebMCP.
- Not a chat UI. Messages, streaming and the input box come from
useChator whatever you use. - Not persistence. The state lives in the browser; an unmounted component's keys are not in the context.
The design is a draft: the API is not implemented yet, and will change.