Jinn docs Console

SDKs

Updated 2026-11-21

The Go and TypeScript SDKs contain the routes of the API for keys: functions, providers, runs, commands, machines, SSH keys, terminals, images, uploads, logs, outputs and webhook signatures. The SDKs have no dependencies. Version 0.6 and newer add persistent machines, SSH keys and ticket-based terminals. Earlier versions used terminal commands.

LanguageInstallationSource
Go 1.25+go get usejinn.com/go@latestusejinn/jinn-go
TypeScript: Node 20+, Deno, Bun, browsersnpm install github:usejinn/jinn-node. Import it as @usejinn/sdk.usejinn/jinn-node

To retry the start of a run safely, set IdempotencyKey (Go, v0.5.3 and newer) or idempotency_key (TypeScript, 0.5.3 and newer). The SDK sends it as the Idempotency-Key header. See Start a run one time.

To follow the log of a running run, use LogSince (Go, v0.5.4 and newer) or logSince (TypeScript, 0.5.4 and newer). Keep the same set of read parts between calls. Each call reads only the log parts that are not in the set, eight at a time.

Go

Start a run of an agent and download its output:

c := jinn.New(os.Getenv("JINN_KEY"))
// The support ticket example: ./in contains ticket.json and policy.md.
in, err := c.UploadFolder(ctx, "./in")
run, err := c.StartRun(ctx, "fnc_a3b59df3be29992f250c2e1e", jinn.RunRequest{Prompt: "Ticket #4812: charged twice", Input: in})
run, err = c.Wait(ctx, run.ID)
if run.State == jinn.Succeeded {
	err = c.DownloadOutput(ctx, run, "./result")
}

Control a run without an agent, and keep its disk:

run, err := c.StartRun(ctx, "fnc_09ff096ba4c6dd4c48c4f372", jinn.RunRequest{Image: lastImage})
run, err = c.WaitReady(ctx, run.ID)
err = c.Put(ctx, run.ID, "./api.tar.gz", "api.tar.gz")
res, err := c.Exec(ctx, run.ID, jinn.BashArgs{Command: "tar xzf api.tar.gz && cd api && go test ./..."})
fmt.Println(res.ExitCode, res.Output)
_, err = c.Finish(ctx, run.ID, jinn.FinishArgs{State: jinn.Succeeded})
run, err = c.Wait(ctx, run.ID)
lastImage = run.Output.Image

Create a persistent SSH machine:

m, err := c.CreateMachine(ctx, jinn.MachineRequest{Name: "dev", Size: "m", IdleMinutes: 10})
fmt.Println("ssh", m.SSH)

If the API refuses a request, the SDK returns *jinn.Error with Status, Code and Message. The Go documentation is at pkg.go.dev/usejinn.com/go.

TypeScript

Start a run of an agent and read its output:

import { Jinn, pack, unpack } from "@usejinn/sdk";

const jinn = new Jinn({ key: process.env.JINN_KEY! });
// The input of the support ticket example: the ticket and the billing policy.
const input = await jinn.upload(await pack({ "ticket.json": JSON.stringify(ticket), "policy.md": policy }));
let run = await jinn.startRun("fnc_a3b59df3be29992f250c2e1e", { prompt: "Ticket #4812: charged twice", input });
run = await jinn.wait(run.id);
if (run.state === "succeeded") {
  const files = await unpack(await jinn.output(run));
  console.log(new TextDecoder().decode(files["reply.md"]));
}

Control a run without an agent:

let box = await jinn.startRun("fnc_09ff096ba4c6dd4c48c4f372", {});
box = await jinn.waitReady(box.id);
await jinn.put(box.id, new TextEncoder().encode("print('hi')"), "hi.py");
const res = await jinn.exec(box.id, { command: "python3 hi.py" });
console.log(res.exit_code, res.output);
await jinn.finish(box.id, { state: "succeeded" });

Create a persistent SSH machine:

const machine = await jinn.createMachine({ name: "dev", size: "m", idle_minutes: 10 });
console.log("ssh", machine.ssh);

If the API refuses a request, the SDK throws JinnError with status and code.