Rebyte Agent SDK
Use the official OpenAI client with Rebyte extensions, React packages, CLI and runnable examples.
On this page
Shared EnvironmentsReact application templatesRun the Node templateVerify the flowRestore an existing SessionServer integrationApplication function resultsThe Rebyte Agent SDK combines the official openai API client with Rebyte-specific
Workflow, Schedule, Scenario and feedback resources, React hooks, UI components, a server adapter,
the CLI and runnable examples. Rebyte runs the Agent Loop and persists Sessions.
The React templates were previously called AppKit. They are one part of the SDK.
The GitHub repository is now named
rebyte-agent-sdk. Existing npm package names are unchanged.
The retired @rebyteai/agent-sdk client fork is not the package to install.
| Component | Install or open | Purpose |
|---|---|---|
| Official API client | openai@7.15.0 | Agents, Sessions, streaming, Files and Artifacts |
| Rebyte extensions | @rebyteai/agent-extensions | Workflow Agents, Schedules and Rebyte Loop (Preview) |
| React hooks | @rebyteai/agent-react | Conversation state, history, function waits and result submission |
| Chat components | @rebyteai/agent-ui | Optional React chat interface |
| Server adapter | @rebyteai/agent-server | Node/Cloudflare proxy that keeps the organization key on your server |
| CLI | @rebyteai/cli | Manage saved Agents from a manifest |
| Examples | Example catalog | API recipes and complete Node/Cloudflare applications |
Standard backend integrations need only openai. Add the extension package for
Rebyte resources, or the React packages for a browser application. These packages
do not run the separate @openai/agents execution framework.
SDK 0.8.0 is published on npm. All five Rebyte packages use version 0.8.0. Matching archives are available in the GitHub release.
SDK 0.8.0 adds keyed Agent and Session creation and metadata list filters:
rebyte.agents.create() and rebyte.sessions.create() take an 'Idempotency-Key', and
rebyte.agents.list() and rebyte.sessions.list() take a metadata filter. See
Retry creation safely.
Version 0.6.0 includes Rebyte Loop (Preview): Scenario
binding, Turn review and feedback, explicit training runs and model publication.
Use rebyte.scenarios, rebyte.sessions, rebyte.feedback and rebyte.models
with the same official client. The Loop quickstart
shows a complete task-to-training flow.
Shared Environments
SDK 0.6.0 adds rebyte.environments.create/delete and
rebyte.sessions.create({ environment: { type: 'reference', environment_id }, ... }).
The public HTTP API supports these operations. Install
@rebyteai/agent-extensions@0.6.0 for the typed methods. See the HTTP and SDK
examples in Shared environments.
Ordinary Session operations remain available through the official client.
React application templates
React UI → your application server → official openai client → Rebyte Agents API
Versions 0.3.0 and later use the official client. Existing 0.2.x npm releases still depend on the old client fork. Install the components your application uses:
pnpm add @rebyteai/agent-react@0.8.0 @rebyteai/agent-ui@0.8.0 @rebyteai/agent-server@0.8.0
pnpm add -D @rebyteai/cli@0.8.0
Run the Node template
Use Node.js 22+ and pnpm 10:
git clone https://github.com/ReByteAI/rebyte-agent-sdk.git
cd rebyte-agent-sdk
pnpm install --frozen-lockfile
pnpm build
cp examples/react-chat/.env.example examples/react-chat/.env.local
Put your organization key in .env.local. It needs tasks:read, tasks:write,
files:read and files:write, and the organization needs credit. The key stays
on the application server; do not put it in a VITE_ variable.
REBYTE_API_KEY=rbk_replace_me
REBYTE_AGENT_ID=
REBYTE_API_URL=https://api.rebyte.ai/v1
Create one saved Agent with the official client, using the template's setup script:
cd examples/react-chat
pnpm exec tsx scripts/create-agent.ts
Copy the printed REBYTE_AGENT_ID into .env.local, then run pnpm dev.
Open http://127.0.0.1:4100. The application server is on 4101.
Verify the flow
- Send a message and watch the response stream.
- Ask for a file in
/workspace/outputsand download its Artifact. - Upload a file and ask the Agent to read it.
- Send a follow-up or reload; the same Session retains its history and files.
- Start a new conversation for a separate Session.
The event inspector shows native agent.session.* events. Stop submits a
cancellation event. New conversation preserves the previous Session; delete it
explicitly when finished to release its environment and Artifacts.
Restore an existing Session
Save the Session ID reported by onSession and pass it as initialSessionId
when mounting useAgentSession again. The React hook loads saved Items, Turns and
Artifacts through your application server and reconstructs the conversation.
The server adapter retrieves all history pages from Rebyte's
client.beta.agents.sessions.items.list() endpoint. For an active or waiting recovered
Session, the React hook polls persisted state until the work settles.
See Retrieve conversation history for the API and curl examples. Persist your user-to-Session association and authorize access on your server; an organization API key is not per-user authorization. The history can be restored without saving every streamed delta in the browser.
Server integration
The shared @rebyteai/agent-server adapter creates an official client with the
Rebyte endpoint explicitly configured. Its Node and Cloudflare templates share
the same Session, upload, download and event routes. Add application login and
user-to-Session authorization on every route before serving other users.
The frontend subscribes to live events before submitting input. It uses the
official event types and SSE parser, and keeps UI state in useAgentSession.
The React templates use native Agents events.
Application function results
In SDK 0.6.0, chat.status === 'requires_action' is a normal waiting
state. chat.requiredActions exposes the pending calls after live events or
Session restoration. Execute them in your application's authorized handler; a
function_call Item alone does not authorize execution.
await chat.submitToolResult({
turn_id: action.turn_id,
call_id: action.call_id,
success: true,
output: JSON.stringify(result),
});
The hook submits one result per request with a stable per-call idempotency key.
Use success: false and error for failures. Your application must persist its
operation/result by call_id to avoid repeating external effects on reload.
The hook never runs handlers automatically. It also observes results submitted
by a backend worker, supports Dynamic Workflow handoffs, and keeps Stop available
while waiting. send() completes when the Turn settles.
These function-wait improvements are included in the 0.6.0 npm packages. See the function guide and Workflow function recipe.
See Upgrade to 0.3.0 for replacing the old client and moving Workflow and Schedule calls to the optional extension.
See the Node template and Cloudflare template.