Connect eve
useLoomEve connects Loom's components to an eve agent and returns the LoomChat they render.
useLoomEve wraps eve’s useEveAgent and returns a LoomChat: the conversation, what the agent is doing, and the commands to change it. Pass the chat to a thread or any layout.
"use client";
import { LoomWidget } from "@/components/loom/widget";
import { useLoomEve } from "@/lib/loom/eve";
export function Assistant() {
const chat = useLoomEve({ agent: "support" });
return <LoomWidget chat={chat} />;
}
It comes with the eve item:
npx shadcn@latest add https://loom.mkhonta.com/r/eve.json
Options
useLoomEve takes exactly the options of useEveAgent from eve/react, such as agent for a named agent, baseUrl for an eve server elsewhere, auth and headers, resume with initialSession, and the onEvent, onFinish and onError callbacks. See eve’s documentation for each one.
What it returns
messages?readonly LoomMessage[]
The conversation. Each message has a role and its parts: text, reasoning, files, tool calls and interactions. eve's messages pass through as they are.
readonly LoomMessage[]status?"idle" | "busy" | "resuming"
Busy while a send, an answer or the agent's work is pending. Resuming while an attached session catches up; the composer disables sending.
"idle" | "busy" | "resuming"activity?LoomActivity
What the agent is doing right now: thinking, calling tools by name, waiting on a person, compacting, or idle.
LoomActivityerror?Error | undefined
The latest failure.
Error | undefinedcanCancel?boolean
A turn is running or waiting on a person, so it can be cancelled.
booleansend?(message, options?) => Promise
Sends text, or text and files. While a turn runs, `{ turnPolicy: "queue" }` waits for it and `"steer"` redirects it. `clientContext` adds context the model sees for this turn only; the composer sends mentions and slash commands this way.
(message, options?) => Promiserespond?(answers) => Promise
Answers open interactions: `{ interactionId, optionId?, text? }`.
(answers) => Promisecancel?() => Promise
Cancels the active turn.
() => PromisenewSession?() => void
Starts a fresh conversation.
() => voidagent?UseEveAgentReturn
eve's full binding, for anything the kit doesn't cover: `events`, `view`, `resume`, `compact`, `end`.
UseEveAgentReturnWithout eve
Components only ever see a LoomChat, so anything that produces one can drive them: a test, a preview, a scripted demo, or another backend. The types live in @/lib/loom/types.
import type { LoomChat } from "@/lib/loom/types";
const preview: LoomChat = {
messages: [{ id: "1", role: "user", parts: [{ type: "text", text: "Hi" }] }],
status: "idle",
activity: { kind: "idle" },
error: undefined,
canCancel: false,
send: async () => undefined,
respond: async () => undefined,
cancel: async () => undefined,
newSession: () => {},
};

