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 Python 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.helix_sessions. Managed agent calls are on client.managed_agents. The token exchange, sandbox providers and presets are on client.sandbox. Request bodies and responses are typed models from mutagent.models; read response fields as attributes. These pages require mutagent-sdk 0.4.1.

Create the clients

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 create_sandbox_token. Pass the token as bearer_token to a second client. A client takes either api_key or bearer_token, not both.
expires_in is in seconds. Exchange the API key again after that. platform.workspaces.list_workspaces() 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. Set them as headers on an httpx.Client passed as http_client.

Models

get_helix_models lists the models a launch can name and the workspace default. set_helix_default_models sets the ordered default list; the first entry is the default.
The list comes from your LLM providers. set_helix_default_models refuses a model that is not in the list with 422. HelixDefaultModelsRequest(models=[]) clears the defaults.

Launch a task

launch_helix_session 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.
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

launch_helix_session 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 send_helix_session_input.
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

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

Send input

send_helix_session_input writes one JSON command to an interactive session. line is exactly one serialised JSON object with no newline.
accepted is True when 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

close_helix_session_input 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.
close_helix_session_input returns a dict, not a model. 422 when the sandbox cannot close input; no signal is sent instead.

Stop a session

signal_helix_session 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 is True when the signal reached a running process. 409 when the session has already ended.

Checkpoint a session

checkpoint_helix_session 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

list_helix_session_checkpoints lists the checkpoints of the sandbox the session runs in, newest first.
Each row has id_, session_id, harness_session_id, bytes_, sha256, message_count and captured_at. The list covers every session the sandbox has run.

Restore a session

restore_helix_session 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 list_helix_sessions: status and exit_code.

List managed agents

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

Inspect a managed agent

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

Deploy a managed agent

deploy_helix_agent 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, revision_created (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. get_helix_agent_capabilities returns the largest accepted archive as max_archive_bytes and the sandbox providers that can receive a package as staging_sandbox_providers.

Activate a revision

activate_helix_agent 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

retire_helix_agent disables a slot. New launches from it are refused; running sessions finish.
Pass RetireAgentRequest() to retire the default slot. Activate a revision to enable the slot again.

Operation status

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

Errors

A refused call raises SDKError. status_code is the HTTP status and body is the JSON the server returned, as text. Refusals that name a code carry it in code.

Async

AsyncMutagent has the same calls on client.helix_sessions, client.managed_agents and client.sandbox; await each one. Helix Cloud creates and stops the sandbox for each session. The same work from the command line: mutagent helix session and mutagent agent.