Skip to main content
Early access. Cloud sessions and managed agent runs are not open to every account yet: we are letting accounts in gradually while we test. They run in a cloud sandbox operated by Mutagent, so there is nothing to host. A sandbox with nothing to do for 15 minutes stops; send the session a message and it wakes up, delivers your message and carries on in the same conversation.
The TypeScript SDK starts Helix on Helix Cloud. It launches a task or an interactive session, runs a managed agent, sends input to a running session, stops it, checkpoints it and restores it. It also lists, inspects, deploys, activates and retires managed agents. To follow a session’s output, see Read session output. Session and model calls are on client.helixSessions. Managed agent calls are on client.managedAgents. The token exchange, sandbox providers and presets are on client.sandbox.

Create the client

Session and model calls take a short-lived sandbox token. Managed agent calls take your API key. Exchange the API key for a token with createSandboxToken, then create a client that holds both. Each call sends the credential it needs.
expiresIn is in seconds. Exchange the API key again after that. client.workspaces.listWorkspaces() returns the workspace ID as workspaces[].id. See Get a sandbox token for the refusals. Managed agent calls act in the workspace of a workspace API key. With an organization API key, also send the x-workspace-id header; with a personal API key, send x-organization-id and x-workspace-id. Every call takes request options as its last argument, for example { headers: { 'x-workspace-id': '<workspace-id>' } }.

Models

getHelixModels lists the models a launch can name and the workspace default. setHelixDefaultModels sets the ordered default list; the first entry is the default.
The list comes from your LLM providers. setHelixDefaultModels refuses a model that is not in the list with 422. models: [] clears the defaults.

Launch a task

launchHelixSession allocates a sandbox and starts Helix in it. For a task, the same as mutagent helix -p "<task>", pass mode: Mode.Headless and the task as -p in args. The session ends when the task is done.
Mode and HelixArm are exported by @mutagent/sdk/models. Refusals: 404 for an unknown Environment, 422 for a model outside the list (the body names the list), 422 when model and a --model in args disagree, 428 NO_PROVIDER_CONFIGURED when no model is given and the workspace has no default.

The launch receipt

launchHelixSession returns the receipt as soon as the session starts. The reference points at one session in one sandbox. After a restore, the session has a new reference.

Start an interactive session

With mode: Mode.Interactive the session keeps running and reads one JSON command per line. Send the task as a prompt command with sendHelixSessionInput.
A sandbox stops after 15 minutes with no activity. An interactive session is checkpointed before it stops. See Sessions.

Run a managed agent

Pass agent to run a managed agent. environment selects the slot and loads that Environment. Without revision, the slot’s active revision runs.
The agent’s package sets the prompt, tools, skills and model. With agent:
  • mode omitted runs headless when args has a -p task, and otherwise the package’s mode.
  • arm other than agent, model, cwd, and any args other than ['-p', '<task>'] are refused with 422.
All refusals happen before a sandbox starts.

List sessions

listHelixSessions lists the workspace’s sessions, live and ended, newest activity first.
limit is 1 to 500 (default 100). Pass nextCursor back as cursor; it is absent on the last page.

Send input

sendHelixSessionInput writes one JSON command to an interactive session. line is exactly one serialised JSON object with no newline.
accepted: true means the line reached the session. Whether the agent accepted the command appears in the session’s output. Refusals: 400 when line is not one JSON object, 409 when the session is not running.

Close input

closeHelixSessionInput closes the session’s input, as end-of-file on stdin. It is not a signal: the agent finishes and its remaining output still arrives. Calling it twice is safe.
422 when the sandbox cannot close input; no signal is sent instead.

Stop a session

signalHelixSession signals the session’s process. The sandbox keeps running.
signal is HelixSignal.Sigterm (the default) or HelixSignal.Sigint. Both stop the session’s Helix process. signalled: true means the signal reached a running process. 409 when the session has already ended.

Checkpoint a session

checkpointHelixSession saves an interactive session’s conversation, and its working directory when that can be captured. A headless session is not checkpointed.
Refusals: 409 when there is nothing to save yet (the session has not completed a turn), 422 when the sandbox cannot be checkpointed.

List checkpoints

listHelixSessionCheckpoints lists the checkpoints of the sandbox the session runs in, newest first.
Each row has id, sessionId, harnessSessionId, bytes, sha256, messageCount and capturedAt. The list covers every session the sandbox has run.

Restore a session

restoreHelixSession starts a new sandbox from a checkpoint and continues the conversation. The old sandbox does not need to exist.
Refusals: 404 when the checkpoint is not in the workspace or the Environment does not exist, 409 MANAGED_AGENT_RESTORE_UNSUPPORTED for a session that ran a managed agent, 422 when the restored conversation does not match the checkpoint.

Read session output

To follow a session’s output, use the CLI with the reference from the receipt:
The session’s result also shows in listHelixSessions: status and exitCode.

List managed agents

listHelixAgents lists the workspace’s managed agents and their slots. The API key authenticates it.

Inspect a managed agent

getHelixAgent returns an agent’s revisions, slots and the sessions launched from it.

Deploy a managed agent

deployHelixAgent uploads a package as a revision and, by default, activates it in the slot. The package is the archive that mutagent agent pack writes; pack also prints its archiveDigest, artifactDigest and archiveSize. The slug must be the name in the agent’s agent.md.
The response has agent, revision, revisionCreated (false when the same package was already a revision), deployment (the slot) and operation. Nothing is stored when a deploy is refused: Deploying the slug of an archived agent un-archives it. getHelixAgentCapabilities returns the largest accepted archive as maxArchiveBytes and the sandbox providers that can receive a package as stagingSandboxProviders.

Activate a revision

activateHelixAgent makes a revision the slot’s active revision. An older revision is a rollback. It also re-enables a retired slot. Running sessions keep the revision they started with.
revision is the revision number: v2 is 2. The same model, Environment, secret binding and sandbox provider checks as deploy apply. 404 when the slot or revision does not exist. 409 MANAGED_AGENT_ARCHIVED for an archived agent; only deploy brings it back.

Retire a slot

retireHelixAgent disables a slot. New launches from it are refused; running sessions finish.
Omit environment to retire the default slot. Activate a revision to enable the slot again.

Operation status

Deploy and activate return an operation. getHelixAgentOperation reads it again by ID.

Errors

A refused call throws a subclass of MutagentError. statusCode is the HTTP status and body is the JSON the server returned. Refusals that name a code carry it in code.
Helix Cloud creates and stops the sandbox for each session. The same work from the command line: mutagent helix session and mutagent agent.