Skip to main content
This page walks through your first Engine call from Node. We use the built-in fetch (Node 18+) and read the response body as a stream.

Set up

You need Node 18 or newer. No npm packages required — fetch and ReadableStream are built in. If you prefer TypeScript, the snippets below work as .ts files with tsx or ts-node.

A minimal client

Save this as engine-quickstart.mjs:
Run it:
You should see the agent’s response stream into your terminal.

Handling other event types

The example above only prints text. A real client should route on event type:

TypeScript signatures

If you’re writing in TypeScript, here’s a minimal type for the events:
The full event catalog is at Streaming events reference.

Where to go next