Skip to main content
This walkthrough runs a script that reads a GitHub repository through the built-in http tool and calls one function of your own. The complete program is examples/quickstart.
1

Get an API key

Sign in to the dashboard at app.rewind.codes, open the account menu at the bottom of the sidebar, then Organization → API keys → New key. Give it the harness role. The secret is shown once: copy it.
A new API key, shown once after its creationA new API key, shown once after its creation
Running your own server instead? See Self-hosting: the steps below are the same with its URL.
2

Install the SDK

Node 22.12 or later. The package is ESM only and depends on no model SDK.
The client reads its server and key from the environment:
3

Register a toolset

A toolset is what scripts may call. This one enables the http tool for api.github.com only, and declares a host tool, notify, that your own code executes.
index.ts
Rewind answers with the declarations of the toolset, in a compact form for the model’s prompt:
4

Serve the host tool

A worker long-polls the calls to your host tools, runs the handler and answers. It runs in your infrastructure: the handler can reach your database, your users, another model.
index.ts
5

Run a script

In a harness, the model writes the script. Here it is a file:
scripts/repo-report.ts
Start it in the namespace of the end user it acts for, and wait up to 30 seconds for its result:
index.ts
6

Read the result

The script was type-checked against the toolset, ran in the sandbox, sent its request through the http tool and its notify call to your worker. Each of these is an entry in the run’s journal.
7

Look at the run

Open Observability in the dashboard and click the run. The debugger shows the script with each call next to the line that made it, a timeline, and a cursor that steps through the run’s history.
The debugger of a run: the source with each call beside its line, and the timelineThe debugger of a run: the source with each call beside its line, and the timeline

Next steps

Give it to your model

Plug run_script and the other agent tools into Claude or an OpenAI model.

Wait for a human

Signals, approvals, and runs that wait for days.

Connect your MCP servers

Toolsets, policies and credentials.

All the examples

Runnable programs for every part of the SDK.