Requirements
- Node.js 20.11+
- A Zero Runtime auth token from the dashboard
- API keys for the providers you use
Install
tsx, JavaScript needs no build step at all. Every
provider ships with the SDK; most need no extra package, because their credential is a string
you set in the environment.
Connect to the Runtime
Point the worker at your runtime address, and set your auth token, using the values from the dashboard:.env from the working directory if you add import 'dotenv/config'; at the
top of your entrypoint.
Conventions
- Extend
Agentand implementon_enter()andon_exit(). - Use
Pipeline()and provider functions directly. - Use
function_tool()to define tools. - Access the current session with
this.session!inside agents. - Import core APIs from
@zeroruntime/js-sdkand providers from@zeroruntime/js-sdk/plugins.
Example
main.ts
npx tsx main.ts. The playground URL is printed once, on stdout — open it to talk
to the agent.
Pass the agent class to
serve(), not an instance. serve() builds a fresh agent and
pipeline per call, which is what keeps per-call state correct under concurrent calls.API reference
Node JS SDK API reference
Every export, type, and option in the Node JS SDK.