← Blog

How to embed a live AI agent computer in your app (and why it shows a black screen)

Put a computer's live screen in your product with noVNC, and read the close code when it stays black.

Updated

To embed an AI agent's computer in your app, connect a browser VNC client to wss://www.orgo.ai/desktops/{id}/ws/websockify?token={password}. Every Orgo computer streams over that one URL, and any websockify-compatible client such as noVNC works, so you need no Orgo package (Embed computers). Your server holds the sk_ API key, reads the computer's password with it, and gives only that password to the page. If the screen stays black, read the WebSocket close code; it says why the connection was refused.

An embed is the live, two-way screen of the computer your agent is driving, inside your own product, so your user can watch the agent, take over the mouse, or approve something. The HTTP API is how the agent acts (screenshot, click, type, bash). VNC is how a person sees and uses the same screen.

The URL

Plain text
wss://www.orgo.ai/desktops/{id}/ws/websockify?token={password}
ValueWhere it comes from
idThe computer's UUID, as POST /computers and GET /computers/{id} return it. Its instance_id also works, but it changes when a sleeping computer wakes on a new host, so use the id.
passwordGET /computers/{id} returns it as vnc_password, and GET /computers/{id}/vnc-password returns it as password. It can change, so fetch it for each session.

Both endpoints need your API key, so call them from your server (Embed computers). A key whose owner has Can chat access to the computer's workspace gets no password: vnc_password is null, and the password endpoint refuses the request.

Which credential goes in the browser

Only the computer's password, never the API key.

CredentialLivesOpens
API key (sk_...)Your server onlyAn account-wide key opens your whole Orgo account: every computer, billing, and making more keys. Keys are never asked for MFA.
Computer passwordSent only to people allowed to control that computerOne computer

Orgo enforces this: an sk_ key sent as ?token= from a browser closes the socket with 4001.

Treat the computer password as root on that machine. The same value opens the terminal WebSocket and the bash proxy, not only the screen. Fetch it per session from your backend, put that route behind your own auth, keep it out of your client bundle (in Next.js, never a NEXT_PUBLIC_* variable), and point public embeds at a disposable computer rather than one holding real work.

Embedding with noVNC

First, a server route trades your API key for the two values the browser needs:

ts
// app/api/computer/route.ts runs on your server. The API key never leaves it.
// Check your own user's session here first: anyone who can call this route can drive the computer.
export async function GET() {
  const res = await fetch(
    `https://www.orgo.ai/api/computers/${process.env.ORGO_COMPUTER_ID}`,
    {
      headers: { Authorization: `Bearer ${process.env.ORGO_API_KEY}` },
      cache: 'no-store',
    },
  );
  if (!res.ok) return Response.json({ error: 'lookup_failed' }, { status: 502 });
  const computer = await res.json();
  return Response.json(
    { id: computer.id, password: computer.vnc_password },
    { headers: { 'Cache-Control': 'no-store' } },
  );
}

Then the page. Install noVNC 1.7.0 or later with npm install @novnc/novnc; earlier versions have no package-root export, so this import fails on them.

js
import RFB from '@novnc/novnc';
 
const { id, password } = await fetch('/api/computer').then((r) => r.json());
 
// Open the WebSocket yourself so you can read its close code.
const ws = new WebSocket(
  `wss://www.orgo.ai/desktops/${id}/ws/websockify?token=${encodeURIComponent(password)}`,
);
ws.addEventListener('close', (e) => console.log('closed', e.code, e.reason));
 
const rfb = new RFB(document.getElementById('screen'), ws, {
  credentials: { password },
});
 
rfb.viewOnly = false;      // true stops this client sending input (see view-only below)
rfb.scaleViewport = true;  // fit the screen to its container
rfb.addEventListener('credentialsrequired', () => rfb.sendCredentials({ password }));

noVNC accepts a WebSocket object in place of a URL (noVNC API). Passing your own is how you get the close code, which noVNC's disconnect event does not carry. There is no origin allowlist and nothing to register: you can embed from any domain, and the computer's password alone decides access.

Why the screen is black

The proxy rejects a bad connection by accepting the WebSocket upgrade and then closing it. noVNC tells your code only that it disconnected (it prints the close code to the browser console and nowhere else), and the canvas stays black. Log the close code and look it up here (Embed computers). The close reason also carries a short description, such as Computer not found.

CodeWhat happenedFix
4001Authentication rejectedSend the computer password, not an sk_ key. Fetch it again, since it may have changed
4003The computer is not available: stopped, asleep, not ready yet, or its trial or subscription endedStart or resume it, then reconnect once its status is running
4004No such computerCheck the computer id
4006An API key scoped to another workspaceUse a key for this workspace, or an account-wide key. Only clients that connect with a key see this
4007An Orgo sign-in that has not passed MFAComplete MFA, then reconnect. A page that connects with the password does not see this
4008Idle for 30 minutesExpected. Reconnect on the next user action
4500Proxy errorRetry
4502The proxy has no host address on record for the computerRetry after a short wait
4503The proxy could not look up the computerRetry

1000 means the proxy's own connection to the computer failed or ended, and 1001 means the Orgo server restarted; reconnect after either. A URL outside /desktops/{id}/ws/ fails the handshake, and the browser reports 1006.

The 30-minute disconnect

An embed nobody uses for 30 minutes gets 4008. The proxy closes the connection after 30 minutes with no keyboard, pointer or clipboard input from a viewer and no terminal activity on the computer. It ignores pixels, so a screen an agent is redrawing while nobody watches still counts as idle; a terminal streaming output keeps it open (Embed computers). Treat 4008 as a clean close and reconnect when the user comes back.

View-only screens

In Orgo, invite people to the workspace with Can chat access and Orgo's proxy drops their input. They watch the screens and can talk to the workspace's agents, but they do it in Orgo, not in your product.

In your app, rfb.viewOnly = true only disables that one client's controls. The password in the page still grants full control, and a visitor can turn the setting off (Embed computers).

Showing what the agent is doing

Pair the screen with the Events WebSocket at wss://www.orgo.ai/desktops/{id}/ws/events?token={password}. It takes the computer password too; an API key does not work on this socket.

After a subscribe message, a Linux computer sends window focus, open and close, clipboard, process start and stop, screen resolution, audio stream, and idle or active events. File change events are defined but not delivered on Linux. A Windows computer sends only window_focus, clipboard and file_change (Events WebSocket). That is enough for an activity strip ("Focus moved to Google Chrome") beside the live screen. Event names are not validated, so a typo subscribes and then delivers nothing.

Embedding, screenshots and Orgo's viewer

ApproachLiveViewer can take overWhere it runsFits
Embedded VNC (noVNC)YesYes. The password always grants controlYour productWatch-and-approve flows, human takeover
Screenshot endpoint (GET /computers/{id}/screenshot)No, one image per requestNoYour backend or UIAudit trail, thumbnails, the agent's own loop
Orgo workspace with Can chat accessYesNo. Orgo's proxy drops their inputOrgoTeammates or clients watching runs

One computer per user

Give every user their own computer, so one user's password never opens another user's screen. A paid plan holds 50 computers, and past 50 more run by the hour from credit, up to 999 an account; without enough credit a create answers 403 VM_SLOT_ADDON with credit_usd_needed (Scale to thousands). How to scale AI agent computers to thousands covers sizes and capacity.

The orgo-vnc React package

Any websockify-compatible client works, so no SDK is needed. If you want a React component, use orgo-vnc 0.3.0 or later. Version 0.3.0, published in October 2026, connects to the current URL with ?token= and reports every close through onClose (the raw code) and onError (a decoded reason). The 0.2.x versions connect to a per-computer hostname that no longer exists, so they cannot connect.