assistant-ui Integration
useHarnessRuntime
useHarnessRuntime has the same API as useHarness — it accepts a transport and returns a harness. The difference is the return type: it returns an AssistantRuntime instead of a HarnessClient, similar to how useChatRuntime relates to useChat in assistant-ui.
import { useHarnessRuntime } from "@assistant-ui/react-harness-sdk";
import { HarnessWebsocketTransport } from "harness-sdk";
import { AssistantRuntimeProvider } from "@assistant-ui/react";
function App() {
const runtime = useHarnessRuntime({
transport: HarnessWebsocketTransport({ url: "ws://localhost:8787/ws" }),
});
return (
<AssistantRuntimeProvider runtime={runtime}>
<MyChat />
</AssistantRuntimeProvider>
);
}Internally, useHarnessRuntime creates a HarnessClient, converts HarnessState messages to assistant-ui's ThreadMessage[] format, and wires up command sending through the runtime.