compute

What runs on NoClick for you now: your machines (with the conversations on each), every agent's sandbox that's up, and your live sandboxes, each with its price an hour.

running = noclick.compute(user_filter="all")
per_hour = sum(c.usd_per_hour or 0 for c in running if c.status == "running")
function compute(options?: ReadOptions): Promise<ComputeItem[]>

Your machines (any status, with the conversations on each), every agent's sandbox up now and every live Sandbox, each with its price an hour. Each part needs its area's scope (machines, agents, sandboxes); a key with only some gets those. Your own computers aren't in it.

Parameters
options.userFilterUserFilter

Which users the read covers (user_id query), instead of acting as one (user).

options.userUserOption

undefined = the ambient user (asUser), null = the account itself.

(defaults to the current user)
options.clientNoClick

The client to send with; defaults to the module client built from NOCLICK_API_KEY.

Returns

Each machine or sandbox: its kind, status, size, price an hour and what runs on it.

Types
/**
 * Which users a read covers: `ALL_USERS`, `NO_USER`, a `User` or your id for one. Sent as the
 * `user_id` query parameter, never as the `NoClick-User` header, so it filters without acting as the user.
 */
type UserFilter = typeof ALL_USERS | typeof NO_USER | UserRef;

/** A `User` or your own id for the user. */
type UserRef = string | UserLike;

/** Anything that can name a user lazily (a `User`). */
interface UserLike {
  _userId(): Promise<string>;
}

/** `undefined` = the ambient user (from `asUser`), `null` = the account itself. */
type UserOption = UserRef | null | undefined;

ComputeItem

interface ComputeItem

A machine, an agent's sandbox or a sandbox, as it runs now.

Attributes
kind"machine" | "agent_sandbox" | "sandbox"

machine (a NoClick machine, any status), agent_sandbox (an agent's warm sandbox) or sandbox (Sandbox).

idstring

Its id (an agent's sandbox: its name).

namestring | null

The machine's name, the agent's, or a sandbox's image.

statusstring | null
userIdstring | null
regionstring | null
cpunumber | null
memoryGbnumber | null
startedAtDate | null
usdPerHournumber | null

What an hour of it costs (a machine: its month's price over 730 hours).

usdPerMonthnumber | null

A machine's price a month.

spentUsdTodaynumber | null

What an agent's sandbox charged since midnight UTC.

runningComputeRun[]
rawJsonObject

The response JSON exactly as the API sent it.

Types
type JsonObject = { [key: string]: unknown };

ComputeRun

interface ComputeRun

A conversation running on a machine or in an agent's sandbox.

Attributes
agentIdstring | null
agentNamestring | null
conversationstring | null

The agent's conversation (as agent.message({ conversation }) names it).

harnessstring | null
statestring

starting, live or running.