TypeScript SDK
The public SDK separates protocol, React state, and presentation:
| Package | Responsibility |
|---|---|
@rebyte/agent-sdk | Framework-free Responses client, Conversation helpers, SSE parsing, and response accumulation. |
@rebyte/agent-react | Headless React chat state and browser/server transports. |
@rebyte/agent-ui | Optional App Kit-style chat UI and execution inspector. |
The packages require Node.js 22 or later and are distributed as token-free
.tgz files on
GitHub Releases.
They are not published to an npm registry.
The stable asset URLs below always resolve to the latest Release. Use a versioned Release URL when the dependency must remain pinned.
Core SDK
pnpm add https://github.com/ReByteAI/rebyte-agent-sdk/releases/latest/download/rebyte-agent-sdk.tgz
import { Rebyte } from "@rebyte/agent-sdk";
const client = new Rebyte({
apiKey: process.env.REBYTE_API_KEY!,
});
const stream = await client.responses.create({
model: process.env.REBYTE_AGENT_ID!,
input: "Inspect this repository and summarize it.",
stream: true,
});
for await (const event of stream) {
if (event.type === "response.output_text.delta") {
process.stdout.write(event.delta);
}
}
const response = await stream.finalResponse();
console.log(response.conversation.id);
The default base URL is https://api.rebyte.ai/v1. The constructor also
accepts baseURL, fetch, defaultHeaders, and dangerouslyAllowBrowser.
Core exports:
| API | Purpose |
|---|---|
client.responses.create() | Create a synchronous Response or ResponseStream. |
client.responses.retrieve() | Read durable Response state. |
client.conversation() | Bind multiple turns to one Conversation. |
client.conversations.* | Create, retrieve, list, interrupt, and delete Conversations. |
ResponseStream.tap() | Observe each event without replacing async iteration. |
ResponseStream.finalResponse() | Consume or await the terminal Response. |
parseResponseEventStream() | Parse a raw Responses SSE body. |
createResponseState() and reduceResponseState() | Accumulate text, tool calls, events, and terminal state. |
RebyteAPIError | Exposes HTTP status, API code, and parsed body. |
Conversation helper
const conversation = client.conversation({
model: process.env.REBYTE_AGENT_ID!,
});
await conversation.send("Remember that the deployment color is blue.");
await conversation.send("What is the deployment color?");
console.log(conversation.id);
The helper binds the first returned Conversation ID and reuses it. To resume a
known Conversation, pass id with model.
The resource client provides direct lifecycle methods:
const created = await client.conversations.create({
model: process.env.REBYTE_AGENT_ID!,
title: "Competitive research",
});
await client.conversations.retrieve(created.id);
await client.conversations.list({ model: process.env.REBYTE_AGENT_ID! });
await client.conversations.interrupt(created.id);
await client.conversations.delete(created.id);
Headless React
Install Core and React from the same Release:
pnpm add \
https://github.com/ReByteAI/rebyte-agent-sdk/releases/latest/download/rebyte-agent-sdk.tgz \
https://github.com/ReByteAI/rebyte-agent-sdk/releases/latest/download/rebyte-agent-react.tgz
useRebyteChat owns state, not markup:
import { useMemo } from "react";
import { createFetchTransport, useRebyteChat } from "@rebyte/agent-react";
export function Chat() {
const transport = useMemo(
() => createFetchTransport({
url: "/api/responses",
interruptUrl: "/api/conversations/interrupt",
}),
[],
);
const chat = useRebyteChat({ transport });
return (
<form onSubmit={(event) => {
event.preventDefault();
void chat.send("Hello");
}}>
{chat.messages.map((message) => (
<p key={message.id}>{message.content}</p>
))}
<button disabled={chat.status === "streaming"}>Send</button>
</form>
);
}
The hook returns messages, status, error, conversationId, send,
stop, and reset.
createRebyteTransport({ client, model }) connects the hook directly to a
Core client in a trusted server runtime or test. Do not use it in a browser
bundle with an organization key.
Optional UI
Install the UI with its two runtime layers:
pnpm add \
https://github.com/ReByteAI/rebyte-agent-sdk/releases/latest/download/rebyte-agent-sdk.tgz \
https://github.com/ReByteAI/rebyte-agent-sdk/releases/latest/download/rebyte-agent-react.tgz \
https://github.com/ReByteAI/rebyte-agent-sdk/releases/latest/download/rebyte-agent-ui.tgz
import { createFetchTransport } from "@rebyte/agent-react";
import { AgentChat } from "@rebyte/agent-ui";
import "@rebyte/agent-ui/styles.css";
const transport = createFetchTransport({
url: "/api/responses",
interruptUrl: "/api/conversations/interrupt",
});
export function App() {
return <AgentChat transport={transport} agentName="Research Agent" inspector />;
}
Use AgentChatView with useRebyteChat for a controlled component.
Browser boundary
The browser sends only input and an optional Conversation ID to your server:
{
"input": "Compare it with the previous company.",
"conversation": "conv_..."
}
Your server authenticates its user, adds the fixed Agent ID, calls Rebyte, and
forwards the SSE body without buffering. The Core SDK refuses browser
construction by default. Never expose REBYTE_API_KEY in browser JavaScript,
local storage, or a public environment variable.