Skip to main content
The SDK repository includes two frontend integrations. @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 from packages/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.
This renders text only. Add rendering for tool calls, tool results, reasoning, and multipart content as needed. Keep the transport stable—create it outside the component or memoize it. In Next.js, put hooks in a client component. 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.
Use 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.