Installation and setup
To start from a complete app, scaffold the example project:- npm
- pnpm
@reactor-models/abot-world-halo.
To add ABot World Halo to your own app, install the typed SDK. The snippets below build on one
connected AbotWorldHaloModel instance. Provide your own page elements and token route.
- npm
- pnpm
How ABot World Halo works
A session moves through three states:idle, running, and paused. In idle you set the
inputs. start begins the world, and it streams on two tracks until you call reset or leave:
The world is made one chunk at a time. Movement, looking, actions, and scene changes are held
values: the model reads them as each chunk starts, so a change shows from the next chunk.
After every accepted command, the model sends a
state_update with the whole session state. Render
from the latest one instead of tracking each command.
Authentication
Issue a session token on your server, scoped toreactor/abot-world-halo. The browser’s
fetchToken() helper calls that server route. Do not put an rk_ API key in browser code. See
Authentication for the token exchange.
1. Connect and attach the tracks
Add a<video> element with autoplay, playsinline, and muted, and an <audio> element with
controls so the user can start the sound. Then connect:
ready status before sending commands. The first state_update arrives on
connect, in idle.
2. Set the first frame, character, and scene
Upload the first frame and the character pictures withuploadFile(), then pass the references to
the commands. Send the character pictures in the order head, left, right, front, back, as far as
you have them. The prompt guide covers how to
choose each input.
state_update. settings.first_frame_set, settings.references,
and settings.prompt confirm what the model holds.
3. Start the world
running at once. The first chunk takes longer, because the session is built
from your inputs first. Then generation_started arrives and video and sound stream.
If the session cannot be built, a state_update returns to idle with error set and your inputs
kept. Fix the input and call start again.
4. Walk and look with the keyboard
set_move and set_look each take one held key per direction, -1, 0, or 1. Track the keys
that are down, and send the new values whenever one changes:
0 on that axis, and the character stops. Clear the keys when the window
loses focus, or the character keeps walking.
5. Hold an action
Actions are held like keys too. Send one when the player presses its key, andnone on release:
custom with a description:
chunk_complete reports the action it
ran with in action and action_text, which you can show in the UI.
6. Change the scene live
Send a new scene prompt while the world plays. It applies from the next chunk, or from the first chunk after the new text is ready:not_ready until the first chunk is out, and with prompt_too_long
when it needs more room than applied.scene_max_tokens.
7. Pause and reset
set_paused holds the world on its last frame and keeps everything else:
reset ends the session and clears every input. The connection stays open in idle, ready for new
inputs:
start. A session also ends when the
client disconnects.
Handle refusals
When the model refuses a command, the call resolvesundefined and only your client is told. The
error event carries the model’s code:
set_first_frame and set_references, are refused
with locked_while_running during a session. Call reset first. The
schema lists every code.