@hastekit/react supplies headless hooks; @hastekit/copilotkit adapts the server to CopilotKit components. The embedded pkg/agui/web UI uses CopilotKit and is already bundled into the Go binary.
Mount AG-UI before connecting either client. These examples use /api/agui as the base URL.
Headless React
Build the package frompackages/react in the SDK checkout with npm ci and npm pack, then install the resulting tarball in your application. The package supports React 18.3 and 19, emits ESM and TypeScript declarations, and supplies no markup or CSS.
Use one
ChatProvider with useChatContext to share state across a sidebar, transcript, and composer. Separate useChat calls create separate controllers. Unmounting or changing threads disconnects observation without stopping server work.
CopilotKit
Install@hastekit/copilotkit with @copilotkit/react-core, @ag-ui/client, @ag-ui/core, and rxjs, using compatible versions from the SDK package manifests. No separate CopilotKit runtime server is required.
fetchThreadMessages(connection, threadId) and initialMessages when opening existing history. Prepend older pages with agent.prependMessages. The returned page.run contains pending interrupts, client tool call IDs, and background tasks; page.context reports saved context usage.
useHastekitInterrupt provides the approval/form/URL interaction adapter. useHastekitClientTools connects CopilotKit frontend tools to live and paused runs. See frontend tools.
Background activity
HastekitAgent.steer(content) sends a message to an active run. watchRuns observes thread lifecycle events, and joinIfIdle() lets the client join a newly started run. Skill and MCP selections use { disable: string[] }.
Async child tasks can expose their own pending interrupts through page.run.backgroundTasks. Resume using that task’s agentName and agentThreadId; the decision belongs to the child conversation.
For schedules, the headless package provides useRoutines and useRoutineThreads. Enable agui.WithRoutines on the server; see Routines.