MutagenT Python SDK
The Python client for the MutagenT platform API.
Status: mutagent-sdk is 0.4.1 on PyPI, generated from openapi.json via mutagent-xgen. Mutagent (sync) and AsyncMutagent (async) expose the same 13 groups. Streaming (sandbox.stream_sandbox, helix_sessions.stream_helix_session) is known-limited — see Reference § Known limitations.
Context
mutagent-sdk is the official Python client for the MutagenT platform API, generated from the platform's OpenAPI document by mutagent-xgen, MutagenT's in-house SDK generator. A Pydantic v2 model covers every request/response body in the API spec. See the root README for where this SDK sits relative to the platform API and the other clients (TypeScript SDK, CLI).
Concepts
- Groups — one namespace per API tag (
client.agents,client.sandbox, …), each with a sync method onMutagentand an async form onAsyncMutagent. See the table in Components. - Models — a Pydantic v2 model for every request/response body; a
...TypedDictcounterpart accepts the same fields as a plaindict. - Two-credential model — a platform
api_keyfor most groups, versus a short-lived sandbox bearer token forsandbox,environmentsandhelix_sessions; see Cloud Sandboxes, Environments and Helix Sessions. - HTTPS by default — a plain-HTTP
server_urlis refused for a non-local host unlessallow_insecure_http=True. - Request bodies — a method that sends a body accepts either a model instance or a plain
dictwith the API's camelCase wire names. SDKError— the uniform exception for any non-2xx response, carryingstatus_code,bodyand the rawhttpx.Response.
Components
mutagent-sdk-python/
├── openapi.json # fetched from a running server via scripts/dump-spec.sh
├── .mutagen/ # mutagent-xgen config (gen.yaml, gen.lock)
├── src/mutagent/
│ ├── client.py # Mutagent (sync)
│ ├── async_client.py # AsyncMutagent
│ ├── <group>.py # one file per group (agents.py, sandbox.py, …)
│ ├── models/ # [generated] Pydantic models
│ ├── lib/ # [generated] security, HTTP helpers
│ └── _funcs/ # [generated] per-operation implementations
├── docs/sdks/ # [generated] one page per group
├── tests/ # pytest suite
└── README.md, CHANGELOG.md, CLAUDE.md # hand-maintained (safe to edit; see CLAUDE.md)
| Command | What it does |
|---|---|
pip install mutagent-sdk |
Install from PyPI (import path is mutagent) |
pip install -e ".[dev]" |
Install with the dev extras group: pytest, pytest-asyncio, pytest-httpx, ruff, mypy |
pytest tests/ |
Run the test suite |
bash scripts/dump-spec.sh |
Fetch the latest OpenAPI spec from a running server (see the provenance warning in CLAUDE.md) |
mutagent-xgen run |
Regenerate the SDK from openapi.json |
Quick start
from mutagent import Mutagent
client = Mutagent(api_key="YOUR_API_KEY")
agents = client.agents.list_agents(limit=10)
print(f"Found {len(agents['data'])} agents")
server_url defaults to MUTAGENT_SERVER_URL, and to https://api.mutagent.io when that is unset (see Configuration); pass server_url="http://localhost:3003" for a local server. Set MUTAGENT_API_KEY in your environment to omit api_key entirely:
from mutagent import Mutagent
client = Mutagent() # reads MUTAGENT_API_KEY
Async client:
import asyncio
from mutagent import AsyncMutagent
async def main():
async with AsyncMutagent(api_key="YOUR_API_KEY") as client:
profile = await client.user_profile.get_profile()
print(profile)
print(await client.workspaces.list_workspaces())
asyncio.run(main())
A dict request body is sent as written (camelCase keys); a model instance accepts either the snake_case field name or the camelCase alias:
agent = client.agents.create_agent({
"name": "Support Agent",
"slug": "support-agent",
"systemPrompt": "You answer customer support questions.",
})
A non-2xx response raises SDKError:
from mutagent import Mutagent, SDKError
client = Mutagent()
try:
client.agents.get_agent(404)
except SDKError as e:
print(f"HTTP {e.status_code}: {e.body}")
Groups
Per-method reference lives in docs/sdks/, one page per group:
| Group | Reference |
|---|---|
client.user_profile |
docs/sdks/user_profile.md |
client.organizations |
docs/sdks/organizations.md |
client.organization_members |
docs/sdks/organization_members.md |
client.workspaces |
docs/sdks/workspaces.md |
client.workspace_members |
docs/sdks/workspace_members.md |
client.invitations |
docs/sdks/invitations.md |
client.agents |
docs/sdks/agents.md |
client.llm_providers |
docs/sdks/llm_providers.md |
client.managed_agents |
docs/sdks/managed_agents.md |
client.traces |
docs/sdks/traces.md |
client.sandbox |
docs/sdks/sandbox.md |
client.environments |
docs/sdks/environments.md |
client.helix_sessions |
docs/sdks/helix_sessions.md |
# Organizations, members and invitations
members = client.organization_members.list_organization_members("<org-id>")
invitation = client.invitations.create_invitation("<org-id>", {"email": "dev@example.com", "role": "editor"})
# LLM providers
provider = client.llm_providers.create_provider_config({"name": "Anthropic", "provider": "anthropic", "apiKey": "<provider-key>"})
print(client.llm_providers.test_provider_config(provider["id"]))
Cloud Sandboxes, Environments and Helix Sessions
sandbox, environments and helix_sessions call routes that accept only a short-lived sandbox token, sent as Authorization: Bearer. Exchange your API key for one via sandbox.create_sandbox_token, then pass the result to a second client as bearer_token. An explicit bearer_token wins over MUTAGENT_API_KEY; passing both api_key and bearer_token raises ValueError.
from mutagent import Mutagent
from mutagent.models import HelixSignal, Mode
platform = Mutagent(api_key="YOUR_API_KEY")
token = platform.sandbox.create_sandbox_token({"workspaceId": "<workspace-id>"})
client = Mutagent(bearer_token=token["token"])
session = client.helix_sessions.launch_helix_session(body={"mode": Mode.INTERACTIVE})
client.helix_sessions.send_helix_session_input(
session["reference"],
{"line": '{"type": "prompt", "id": "p1", "message": "List the files"}'},
)
client.helix_sessions.signal_helix_session(session["reference"], {"signal": HelixSignal.SIGINT})
| Operation | Method | Route |
|---|---|---|
| List sandbox providers | sandbox.list_sandbox_providers |
GET /api/sandbox/providers |
| Spawn a sandbox | sandbox.create_sandbox |
POST /api/sandbox |
| Run a command in a sandbox | sandbox.exec_sandbox_command |
POST /api/sandbox/{id}/exec |
| Watch a sandbox's output | sandbox.stream_sandbox |
GET /api/sandbox/{id}/stream |
| Exchange an API key for a sandbox token | sandbox.create_sandbox_token |
POST /api/sandbox/token |
| List workspace Environments | environments.list_environments |
GET /api/sandbox/environments |
| Launch a Helix session | helix_sessions.launch_helix_session |
POST /api/sandbox/helix/sessions |
| Send a JSON command to a session | helix_sessions.send_helix_session_input |
POST /api/sandbox/helix/sessions/{reference}/input |
| Stream a session's output | helix_sessions.stream_helix_session |
GET /api/sandbox/helix/sessions/{reference}/stream |
Full route list per group: the Groups reference pages above.
Configuration
| Variable | Required | Default | Read at | Secret | Purpose |
|---|---|---|---|---|---|
MUTAGENT_API_KEY |
No (or pass api_key=) |
none | src/mutagent/lib/security.py:13,22,28 |
Yes | Platform API key sent as x-api-key or Authorization: Bearer |
MUTAGENT_SERVER_URL |
No | https://api.mutagent.io |
src/mutagent/client.py:57, src/mutagent/async_client.py:45 |
No | Base URL for platform API requests |
Both are user-set (this package owns no platform infrastructure). See .env.example for placeholder values.
Reference
0.4.0 breaking changes
0.4.0 is the first published release to carry these changes. Code written against 0.1.1 needs the following (two versions sit between them on PyPI — 0.2.0 and 0.3.0 — both later builds of the same pre-rename client, so every rename here applies when upgrading from either; #2028 reset the repository's version to 0.2.0, a number PyPI already held, so no Python release could publish until 0.4.0).
Client groups
sandboxholds sandbox providers, presets, the sandbox lifecycle, commands, the token exchange (create_sandbox_token) and the session routes addressed by sandbox id.- New group
helix_sessions:launch_helix_session,list_helix_sessions,send_helix_session_input,close_helix_session_input,signal_helix_session,checkpoint_helix_session,list_helix_session_checkpoints,restore_helix_session,stream_helix_session,get_helix_models,set_helix_default_models. These existed assandboxmethods in0.1.1. - New group
environments. In0.1.1its operations were methods ofsandbox. helix_agent_deploymentsis renamedmanaged_agents; method names are unchanged.provider_configsis renamedllm_providers; its methods are renamed too (table below).user_profilekeeps its name; two of its methods are renamed (table below).
39 renamed operations
| 0.1.1 | 0.4.0 |
|---|---|
sandbox.get_api_sandbox_providers |
sandbox.list_sandbox_providers |
sandbox.post_api_sandbox_preflight |
sandbox.preflight_sandbox |
sandbox.get_api_sandbox_presets |
sandbox.list_sandbox_presets |
sandbox.post_api_sandbox_run |
sandbox.run_sandbox_command |
sandbox.post_api_sandbox |
sandbox.create_sandbox |
sandbox.get_api_sandbox |
sandbox.list_sandboxes |
sandbox.get_api_sandbox_by_id |
sandbox.get_sandbox |
sandbox.delete_api_sandbox_by_id |
sandbox.delete_sandbox |
sandbox.get_api_sandbox_by_id_stream |
sandbox.stream_sandbox |
sandbox.post_api_sandbox_by_id_exec |
sandbox.exec_sandbox_command |
sandbox.post_api_sandbox_telemetry_v1_traces |
sandbox.ingest_sandbox_traces |
sandbox.get_api_sandbox_by_id_traces |
sandbox.list_sandbox_spans |
sandbox.post_api_sandbox_by_id_session |
sandbox.start_sandbox_helix_session |
sandbox.get_api_sandbox_helix_defaults |
helix_sessions.get_helix_models |
sandbox.put_api_sandbox_helix_defaults |
helix_sessions.set_helix_default_models |
sandbox.get_api_sandbox_by_id_sessions |
sandbox.list_sandbox_helix_sessions |
sandbox.post_api_sandbox_by_id_input |
sandbox.send_sandbox_helix_session_input |
sandbox.post_api_sandbox_by_id_signal |
sandbox.signal_sandbox_helix_session |
sandbox.post_api_sandbox_by_id_checkpoint |
sandbox.checkpoint_sandbox_helix_session |
sandbox.get_api_sandbox_by_id_checkpoints |
sandbox.list_sandbox_checkpoints |
sandbox.post_api_sandbox_by_id_restore |
sandbox.restore_sandbox |
sandbox.post_api_sandbox_token |
sandbox.create_sandbox_token |
sandbox.get_api_sandbox_environments |
environments.list_environments |
sandbox.get_api_sandbox_environments_by_name |
environments.get_environment |
sandbox.put_api_sandbox_environments_by_name |
environments.replace_environment |
sandbox.patch_api_sandbox_environments_by_name |
environments.update_environment |
sandbox.delete_api_sandbox_environments_by_name |
environments.delete_environment |
user_profile.list_sessions |
user_profile.list_user_sessions |
user_profile.delete_session |
user_profile.revoke_user_session |
sandbox.list_helix_workspace_sessions |
helix_sessions.list_helix_sessions |
sandbox.input_helix_session |
helix_sessions.send_helix_session_input |
provider_configs.list_providers |
llm_providers.list_provider_configs |
provider_configs.create_provider |
llm_providers.create_provider_config |
provider_configs.get_provider |
llm_providers.get_provider_config |
provider_configs.update_provider |
llm_providers.update_provider_config |
provider_configs.delete_provider |
llm_providers.delete_provider_config |
provider_configs.get_models_catalog |
llm_providers.get_model_catalog |
provider_configs.list_provider_models |
llm_providers.list_provider_config_models |
provider_configs.test_provider |
llm_providers.test_provider_config |
- Model and enum names in
mutagent.modelscome from the schema names in the API document (Mode,HelixArm,HelixSignal,HelixLaunchRequest,LlmProviderType,ErrorResponse). Generator-invented names from0.1.1(Schemadefaul7,ModeArmModel,NameSlugDescription5) no longer exist. String enums (Mode,HelixArm,HelixSignal,QueryFlag,WorkspaceDriftPolicy) subclassstr, so a member compares equal to its value (Mode.HEADLESS == "headless"). - Session mode values:
"headless"or"interactive"(Mode.HEADLESS,Mode.INTERACTIVE). The0.1.1values"oneshot"and"rpc"are gone. - Default server:
https://api.mutagent.iowhenserver_urlandMUTAGENT_SERVER_URLare both unset; washttp://localhost:3003in0.1.1. - Stream methods:
sandbox.stream_sandboxandhelix_sessions.stream_helix_sessionchanged — see Known limitations below.
Known limitations
- A field whose wire name is a Python keyword or builtin is escaped on the model (
Workspace.idis read asworkspace.id_); the alias keeps the wire name, so both directions still send and receiveid. - Streaming in
0.4.1: the syncstream_sandboxandstream_helix_sessionsendAccept: application/json, read the whole response, and returnNone— the event data is discarded. The async versions raiseTypeErrorbefore a request is sent.
Generated by mutagent-xgen
This package is generated by mutagent-xgen. To regenerate after API changes:
bash scripts/dump-spec.sh # fetch latest spec from a running server
mutagent-xgen run # regenerate the SDK
README.md is emitted once and never rewritten by a regeneration, so hand-written content here is safe.
License
This SDK is released under the Apache License 2.0.
Copyright 2026 MutagenT. All rights reserved.
Built with care by the MutagenT Team • mutagent.io
Metadata
Release files for mutagent-sdk 0.5.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| mutagent_sdk-0.5.0.tar.gz | 402.5 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| mutagent_sdk-0.5.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 768.4 kB
Release files / mutagent_sdk-0.5.0.tar.gz
| Download URL | mutagent_sdk-0.5.0.tar.gz |
|---|---|
| Size | 402.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
29602fef3746fbd9e4914f9dd1864b324cf3f07873bb72b05c2760b470c6aed5
|
|
BLAKE2b-256 checksum How to use checksums |
dfb6267c72e4ce5db3b03cbf2542f7ba2ff28795a9cb2215df5f1c2639d6b202
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.12.21 {"installer":{"name":"uv","version":"0.12.21","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / mutagent_sdk-0.5.0-py3-none-any.whl
| Download URL | mutagent_sdk-0.5.0-py3-none-any.whl |
|---|---|
| Size | 365.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
907e13b26b77d2ffa7ef015cae4d7bb3c9440736445fae1504fffd57e917fa87
|
|
BLAKE2b-256 checksum How to use checksums |
3c0f35694b4b06a89b1b091d53237455d36691b3dae3ad53893facd5e6d8ee2b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.12.21 {"installer":{"name":"uv","version":"0.12.21","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Security for mutagent-sdk 0.5.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.