Skip to main content
The JavaScript SDK is the package @senselab-ai/sensei. It comes with its TypeScript types.
It needs Node 18 or later. The key comes from SENSEI_API_KEY, or from the config file sensei login writes. To update, run npm install @senselab-ai/sensei@latest. VERSION says which version is installed. say needs 0.3.0 or later.

Run something

run waits until the run has finished or has a question for a person. start takes the same arguments and returns at once.

Sensei

Every option can be left out. what is read like this. For a task of one word, pass task: sensei.run(null, { task: "Summarise" }). input is the agent’s input. The rest are options of the run. sensei.runs, sensei.agents, sensei.tools, sensei.settings and sensei.schedules are the lower-level groups described under Client.

RunResult

Answer a waiting run

correct takes what to do instead, and the text is kept for the agent’s later runs. answer waits for what comes next unless you pass { wait: false }.

Record an outcome

On a run with steps, { step: "refund" } names the step that was wrong.

Many at once

A run that asks a person comes back waiting, and the others are not held up by it.

Several changes to one repository

Its other options are ref, instructions, parallel, together, deliver, limit, check and secrets. See Several changes at once.

Settings and secrets

See Services, settings and secrets.

Client

Client is the HTTP API with nothing added. Every method returns the API’s JSON.
events ends when the run is done or waiting. If the connection closes before that, it connects again from the last event it saw.

Errors

A response that is not a success throws SenseiError, with the status, code and message the service sent.
A definition file that cannot be read throws FileError, which says what is wrong with the file.