minimax-code-sdk 0.1.0b1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,6 @@
1
+ .venv/
2
+ __pycache__/
3
+ .pytest_cache/
4
+ .mypy_cache/
5
+ .ruff_cache/
6
+ dist/
@@ -0,0 +1,32 @@
1
+ # `minimax-code-sdk` Changelog
2
+
3
+ All notable changes to the `minimax-code-sdk` Python package are documented here. The SDK is
4
+ versioned independently of the MiniMax Code CLI and of the TypeScript SDK. The first
5
+ `## X.Y.Z · YYYY-MM-DD` heading is the version being released; see [RELEASING.md](RELEASING.md).
6
+
7
+ ## 0.1.0b1 · 2026-11-03
8
+
9
+ First public beta. Install it with `pip install --pre minimax-code-sdk`; the API may still
10
+ change before `0.1.0`.
11
+
12
+ ### Added
13
+
14
+ - `MCode`, `start_thread()`, `resume_thread()`, `thread.run()` and `thread.run_streamed()` drive
15
+ `mcode exec --output-format=stream-json`, one CLI process per Turn, continuing the Session with
16
+ `--session`.
17
+ - `SyncMCode` and `SyncThread`, a blocking API for scripts and notebooks without an event loop.
18
+ - CLI resolution: explicit `MCodeOptions(bin=...)`, then `$MCODE_BIN`, then `mcode` on `PATH`.
19
+ Requires MiniMax Code CLI `0.6.3` or later and Python `3.10` or later.
20
+ - Stream events are passed through unchanged as typed dicts (event `schemaVersion` 1), including
21
+ unknown event types; `thread.run()` folds them into `Turn.items`.
22
+ - Typed errors for invocation, run, cancellation, protocol, missing CLI, version and busy Thread
23
+ failures, mapped from the CLI exit codes.
24
+ - Cancellation through `StreamedTurn.cancel()`, early loop exit or task cancellation (`SIGINT`,
25
+ then `SIGKILL` after 10 seconds) and a `timeout_ms` backstop of `timeout_ms + 30s`.
26
+ - `system_prompt` and `append_system_prompt` are passed through private temporary files.
27
+ - Ships `py.typed`; the only runtime dependency is `typing_extensions`.
28
+
29
+ ### Not yet available
30
+
31
+ - Interactive permission prompts (`permission="ask"`), custom in-process tools and a long-lived
32
+ ACP transport.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 MiniMax Code
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,139 @@
1
+ Metadata-Version: 2.5
2
+ Name: minimax-code-sdk
3
+ Version: 0.1.0b1
4
+ Summary: Python SDK for driving the local MiniMax Code (mcode) agent.
5
+ Project-URL: Homepage, https://agent.minimax.io
6
+ Project-URL: Repository, https://github.com/MiniMax-AI/minimax-code
7
+ Project-URL: Issues, https://github.com/MiniMax-AI/minimax-code/issues
8
+ License-Expression: MIT
9
+ License-File: LICENSE
10
+ Keywords: agent,coding-agent,mcode,minimax,minimax-code,sdk
11
+ Classifier: Development Status :: 4 - Beta
12
+ Classifier: Operating System :: OS Independent
13
+ Classifier: Programming Language :: Python :: 3
14
+ Classifier: Typing :: Typed
15
+ Requires-Python: >=3.10
16
+ Requires-Dist: typing-extensions>=4.7
17
+ Description-Content-Type: text/markdown
18
+
19
+ # minimax-code-sdk
20
+
21
+ Python SDK for driving the local [MiniMax Code](https://agent.minimax.io) agent (`mcode`).
22
+
23
+ It mirrors the TypeScript SDK
24
+ [`@minimax-ai/code-sdk`](https://github.com/MiniMax-AI/minimax-code/tree/main/packages/code-sdk): every Turn runs
25
+ `mcode exec --output-format=stream-json` and continues the Session with `--session`.
26
+
27
+ ## Requirements
28
+
29
+ - Python 3.10+
30
+ - The `mcode` CLI (0.6.3 or newer): `npm install -g @minimax-ai/code`
31
+
32
+ ## Install
33
+
34
+ ```bash
35
+ pip install --pre minimax-code-sdk # or: uv add --prerelease=allow minimax-code-sdk
36
+ ```
37
+
38
+ The SDK is in beta, so installers need `--pre` (or an exact version such as
39
+ `minimax-code-sdk==0.1.0b1`) until `0.1.0` is released. Import it as `minimax_code`.
40
+
41
+ The CLI is found from `MCodeOptions(bin=...)`, then the `MCODE_BIN` environment variable,
42
+ then `PATH`.
43
+
44
+ ## Quick start
45
+
46
+ ```python
47
+ import asyncio
48
+ from minimax_code import MCode, ThreadOptions
49
+
50
+
51
+ async def main() -> None:
52
+ client = MCode()
53
+ thread = client.start_thread(ThreadOptions(cwd=".", permission="smart"))
54
+
55
+ turn = await thread.run("Summarize this repository in one sentence.")
56
+ print(turn.final_response, turn.usage)
57
+
58
+ # Same Session, next Turn.
59
+ turn = await thread.run("Now list its top-level directories.")
60
+
61
+ # Persist thread.id and continue later.
62
+ later = client.resume_thread(thread.id)
63
+ print((await later.run("What did I ask first?")).final_response)
64
+
65
+
66
+ asyncio.run(main())
67
+ ```
68
+
69
+ ### Streaming
70
+
71
+ ```python
72
+ streamed = await thread.run_streamed("Fix the failing test.")
73
+ async for event in streamed:
74
+ if event["type"] == "item.updated" and event["item"]["type"] == "agent_message":
75
+ print(event["item"].get("contentDelta", ""), end="")
76
+ elif event["type"] == "turn.failed":
77
+ print("failed:", event.get("error"))
78
+ ```
79
+
80
+ Events are the CLI's stream-json events, passed through unchanged (unknown types included).
81
+ `turn.failed` is an ordinary event; iteration raises only for process or protocol failures.
82
+
83
+ ### Cancellation
84
+
85
+ - `streamed.cancel()` sends SIGINT; the stream ends with the CLI's final events.
86
+ - Leaving the `async for` early, or cancelling the task running `thread.run()`, stops the CLI
87
+ (SIGINT, then SIGKILL after a grace period).
88
+ - `RunOptions(timeout_ms=...)` is enforced by the CLI.
89
+
90
+ ### Blocking API
91
+
92
+ ```python
93
+ from minimax_code import SyncMCode
94
+
95
+ with SyncMCode() as client:
96
+ thread = client.start_thread()
97
+ print(thread.run("hello").final_response)
98
+ for event in thread.run_streamed("again"):
99
+ print(event["type"])
100
+ ```
101
+
102
+ ## Options
103
+
104
+ | Object | Fields |
105
+ | --- | --- |
106
+ | `MCodeOptions` | `bin`, `data_dir` (`MINIMAX_DATA_DIR`), `env` (replaces `os.environ`), `config_path` |
107
+ | `ThreadOptions` | `cwd`, `model` (`provider/model`), `effort`, `permission` (`smart`/`full`/`off`), `mode`, `prompt_mode`, `system_prompt`, `append_system_prompt` |
108
+ | `RunOptions` | `files`, `timeout_ms`, `max_steps` |
109
+
110
+ ## Errors
111
+
112
+ All errors subclass `MCodeError` (with `exit_code`, `stderr`, `session_id`, `result`, `items`):
113
+ `MCodeNotFoundError`, `MCodeVersionError`, `MCodeInvocationError`, `MCodeRunError`
114
+ (`status`, `category`), `MCodeAbortError`, `MCodeProtocolError`, `ThreadBusyError`.
115
+
116
+ ## Limitations
117
+
118
+ Each Turn is a separate process, so interactive permission prompts (`permission="ask"`) and
119
+ custom in-process tools are not supported yet. A long-lived ACP transport is planned.
120
+
121
+ ## Development
122
+
123
+ ```bash
124
+ uv sync
125
+ uv run pytest
126
+ uv run ruff check . && uv run ruff format --check . && uv run mypy
127
+ ```
128
+
129
+ End-to-end tests against a real CLI and model are opt-in:
130
+ `MCODE_SDK_E2E=1 MCODE_BIN=/path/to/mcode uv run pytest -m e2e`.
131
+
132
+ Release notes are in
133
+ [CHANGELOG.md](https://github.com/MiniMax-AI/minimax-code/blob/main/packages/code-sdk-python/CHANGELOG.md);
134
+ maintainers publish with
135
+ [RELEASING.md](https://github.com/MiniMax-AI/minimax-code/blob/main/packages/code-sdk-python/RELEASING.md).
136
+
137
+ ## License
138
+
139
+ MIT
@@ -0,0 +1,121 @@
1
+ # minimax-code-sdk
2
+
3
+ Python SDK for driving the local [MiniMax Code](https://agent.minimax.io) agent (`mcode`).
4
+
5
+ It mirrors the TypeScript SDK
6
+ [`@minimax-ai/code-sdk`](https://github.com/MiniMax-AI/minimax-code/tree/main/packages/code-sdk): every Turn runs
7
+ `mcode exec --output-format=stream-json` and continues the Session with `--session`.
8
+
9
+ ## Requirements
10
+
11
+ - Python 3.10+
12
+ - The `mcode` CLI (0.6.3 or newer): `npm install -g @minimax-ai/code`
13
+
14
+ ## Install
15
+
16
+ ```bash
17
+ pip install --pre minimax-code-sdk # or: uv add --prerelease=allow minimax-code-sdk
18
+ ```
19
+
20
+ The SDK is in beta, so installers need `--pre` (or an exact version such as
21
+ `minimax-code-sdk==0.1.0b1`) until `0.1.0` is released. Import it as `minimax_code`.
22
+
23
+ The CLI is found from `MCodeOptions(bin=...)`, then the `MCODE_BIN` environment variable,
24
+ then `PATH`.
25
+
26
+ ## Quick start
27
+
28
+ ```python
29
+ import asyncio
30
+ from minimax_code import MCode, ThreadOptions
31
+
32
+
33
+ async def main() -> None:
34
+ client = MCode()
35
+ thread = client.start_thread(ThreadOptions(cwd=".", permission="smart"))
36
+
37
+ turn = await thread.run("Summarize this repository in one sentence.")
38
+ print(turn.final_response, turn.usage)
39
+
40
+ # Same Session, next Turn.
41
+ turn = await thread.run("Now list its top-level directories.")
42
+
43
+ # Persist thread.id and continue later.
44
+ later = client.resume_thread(thread.id)
45
+ print((await later.run("What did I ask first?")).final_response)
46
+
47
+
48
+ asyncio.run(main())
49
+ ```
50
+
51
+ ### Streaming
52
+
53
+ ```python
54
+ streamed = await thread.run_streamed("Fix the failing test.")
55
+ async for event in streamed:
56
+ if event["type"] == "item.updated" and event["item"]["type"] == "agent_message":
57
+ print(event["item"].get("contentDelta", ""), end="")
58
+ elif event["type"] == "turn.failed":
59
+ print("failed:", event.get("error"))
60
+ ```
61
+
62
+ Events are the CLI's stream-json events, passed through unchanged (unknown types included).
63
+ `turn.failed` is an ordinary event; iteration raises only for process or protocol failures.
64
+
65
+ ### Cancellation
66
+
67
+ - `streamed.cancel()` sends SIGINT; the stream ends with the CLI's final events.
68
+ - Leaving the `async for` early, or cancelling the task running `thread.run()`, stops the CLI
69
+ (SIGINT, then SIGKILL after a grace period).
70
+ - `RunOptions(timeout_ms=...)` is enforced by the CLI.
71
+
72
+ ### Blocking API
73
+
74
+ ```python
75
+ from minimax_code import SyncMCode
76
+
77
+ with SyncMCode() as client:
78
+ thread = client.start_thread()
79
+ print(thread.run("hello").final_response)
80
+ for event in thread.run_streamed("again"):
81
+ print(event["type"])
82
+ ```
83
+
84
+ ## Options
85
+
86
+ | Object | Fields |
87
+ | --- | --- |
88
+ | `MCodeOptions` | `bin`, `data_dir` (`MINIMAX_DATA_DIR`), `env` (replaces `os.environ`), `config_path` |
89
+ | `ThreadOptions` | `cwd`, `model` (`provider/model`), `effort`, `permission` (`smart`/`full`/`off`), `mode`, `prompt_mode`, `system_prompt`, `append_system_prompt` |
90
+ | `RunOptions` | `files`, `timeout_ms`, `max_steps` |
91
+
92
+ ## Errors
93
+
94
+ All errors subclass `MCodeError` (with `exit_code`, `stderr`, `session_id`, `result`, `items`):
95
+ `MCodeNotFoundError`, `MCodeVersionError`, `MCodeInvocationError`, `MCodeRunError`
96
+ (`status`, `category`), `MCodeAbortError`, `MCodeProtocolError`, `ThreadBusyError`.
97
+
98
+ ## Limitations
99
+
100
+ Each Turn is a separate process, so interactive permission prompts (`permission="ask"`) and
101
+ custom in-process tools are not supported yet. A long-lived ACP transport is planned.
102
+
103
+ ## Development
104
+
105
+ ```bash
106
+ uv sync
107
+ uv run pytest
108
+ uv run ruff check . && uv run ruff format --check . && uv run mypy
109
+ ```
110
+
111
+ End-to-end tests against a real CLI and model are opt-in:
112
+ `MCODE_SDK_E2E=1 MCODE_BIN=/path/to/mcode uv run pytest -m e2e`.
113
+
114
+ Release notes are in
115
+ [CHANGELOG.md](https://github.com/MiniMax-AI/minimax-code/blob/main/packages/code-sdk-python/CHANGELOG.md);
116
+ maintainers publish with
117
+ [RELEASING.md](https://github.com/MiniMax-AI/minimax-code/blob/main/packages/code-sdk-python/RELEASING.md).
118
+
119
+ ## License
120
+
121
+ MIT
@@ -0,0 +1,135 @@
1
+ # Releasing `minimax-code-sdk`
2
+
3
+ The Python SDK is published to the public PyPI index as `minimax-code-sdk` by the
4
+ `Python SDK release` workflow (`.github/workflows/python-sdk-release.yml`) using PyPI Trusted
5
+ Publishing. No PyPI token is stored in the repository or in GitHub secrets. It is versioned
6
+ independently of the CLI and of `@minimax-ai/code-sdk`.
7
+
8
+ ## Rules
9
+
10
+ - Publish only from a commit on `main` that went through a reviewed pull request. The workflow
11
+ rejects a tag whose commit is not contained in `origin/main`.
12
+ - A published version is immutable. PyPI never accepts the same file name twice, even after a
13
+ release is deleted. Fix problems in a new version; prefer **yanking** a broken release over
14
+ deleting it.
15
+ - Versions are stable `X.Y.Z` or PEP 440 pre-releases `X.Y.ZaN`, `X.Y.ZbN` and `X.Y.ZrcN` (for
16
+ example `0.1.0b1`), written in canonical form. Never use npm-style `0.1.0-beta.1`. See
17
+ [Pre-releases](#pre-releases).
18
+ - Release tags are `code-sdk-python-v<version>`, for example `code-sdk-python-v0.1.0b1`. They are separate from CLI tags (`vX.Y.Z`) and
19
+ TypeScript SDK tags (`code-sdk-vX.Y.Z`). Never move or delete a pushed release tag.
20
+ - Do not upload from a workstation. If the workflow is unavailable, fix the workflow.
21
+
22
+ ## One-time setup
23
+
24
+ 1. The PyPI project `minimax-code-sdk` belongs to the `minimax-ai` PyPI organization. Every
25
+ owner and maintainer account uses two-factor authentication.
26
+ 2. On PyPI, add a Trusted Publisher (a *pending* publisher before the first upload) with:
27
+
28
+ | Field | Value |
29
+ | --- | --- |
30
+ | PyPI project name | `minimax-code-sdk` |
31
+ | Owner | `MiniMax-AI` |
32
+ | Repository | `minimax-code` |
33
+ | Workflow | `python-sdk-release.yml` |
34
+ | Environment | `pypi` |
35
+
36
+ 3. For rehearsals, add the same publisher on TestPyPI with environment `testpypi`. TestPyPI
37
+ accounts and projects are separate from PyPI.
38
+ 4. In the GitHub repository settings, create the environments `pypi` and `testpypi`. Give
39
+ `pypi` required reviewers and restrict its deployment refs to `code-sdk-python-v*` tags.
40
+
41
+ ## 1. Prepare the release in a pull request
42
+
43
+ 1. Update `version` in `packages/code-sdk-python/pyproject.toml` and `__version__` in
44
+ `src/minimax_code/__init__.py`.
45
+ 2. Add a section at the top of `CHANGELOG.md`: `## X.Y.Z · YYYY-MM-DD` with the user-visible
46
+ changes.
47
+ 3. If the minimum supported CLI, the Python range or the event `schemaVersion` changes, update the
48
+ README and `MIN_CLI_VERSION` in `src/minimax_code/_cli.py`.
49
+ 4. Run the local checks:
50
+
51
+ ```bash
52
+ cd packages/code-sdk-python
53
+ uv sync --locked
54
+ uv run ruff check . && uv run ruff format --check . && uv run mypy && uv run pytest -W error
55
+ uv run python scripts/release_check.py metadata --index pypi
56
+ ```
57
+
58
+ 5. Merge the pull request into `main` after the usual review and checks.
59
+
60
+ ## 2. Optional: rehearse on TestPyPI
61
+
62
+ Run the `Python SDK release` workflow manually with `repository: testpypi`. It runs every
63
+ check below and uploads to TestPyPI. Each version can be uploaded to TestPyPI only once, so
64
+ rehearse only versions you intend to release. A manual run with `repository: none` builds and
65
+ checks without uploading anywhere.
66
+
67
+ ## 3. Tag and publish
68
+
69
+ ```bash
70
+ git switch main
71
+ git pull --ff-only
72
+ git tag -a code-sdk-python-vX.Y.Z -m "minimax-code-sdk X.Y.Z"
73
+ git push origin code-sdk-python-vX.Y.Z
74
+ ```
75
+
76
+ The tag push starts the workflow. Its `build` job:
77
+
78
+ 1. checks that the tag matches `pyproject.toml`, `__version__` and the first CHANGELOG heading,
79
+ that the tagged commit is on `origin/main`, and that the version is not on PyPI yet;
80
+ 2. runs ruff, mypy and the test suite;
81
+ 3. builds the wheel and sdist with `uv build` and runs `twine check --strict`;
82
+ 4. runs `scripts/release_check.py dist`, which rejects unexpected wheel entries, local or
83
+ generated files and unsafe paths in the sdist, and prints the sha256 of both files;
84
+ 5. scans the extracted archives with the repository's public text policy
85
+ (`scripts/lib/public-text-policy.mjs`) and Gitleaks;
86
+ 6. installs the wheel into an empty virtual environment and checks `minimax_code.__version__`.
87
+
88
+ The `publish-pypi` job then waits for approval on the `pypi` environment and uploads exactly the
89
+ checked files with `pypa/gh-action-pypi-publish`, which also attaches PyPI attestations.
90
+
91
+ ## Pre-releases
92
+
93
+ Pre-releases go to the real PyPI index through the same workflow and checks; only the version
94
+ differs. Installers skip them unless the user passes `--pre` (pip), `--prerelease=allow` (uv) or
95
+ pins the exact version, so `pip install minimax-code-sdk` keeps resolving to the newest stable
96
+ release once one exists. Keep the README install instructions in line with the latest release.
97
+
98
+ - Fix a broken pre-release with the next number (`0.1.0b2`), not by reusing a version.
99
+ - Promote by releasing `0.1.0` with its own CHANGELOG section; earlier pre-releases stay in the
100
+ history and need no cleanup.
101
+ - When the first stable release ships, drop `--pre` from the README install instructions and
102
+ replace `Development Status :: 4 - Beta` in `pyproject.toml` as appropriate.
103
+
104
+ ## 4. Read back
105
+
106
+ ```bash
107
+ curl -fsS https://pypi.org/pypi/minimax-code-sdk/X.Y.Z/json \
108
+ | python3 -c 'import json,sys; [print(u["digests"]["sha256"], u["filename"]) for u in json.load(sys.stdin)["urls"]]'
109
+ ```
110
+
111
+ Both digests must equal the `sha256` lines printed by the `Check distribution contents` step. If
112
+ they differ, stop: the index holds different bytes than the checked files.
113
+
114
+ ## 5. Smoke test the published package
115
+
116
+ ```bash
117
+ smoke="$(mktemp -d)" && cd "$smoke"
118
+ uv venv -q && uv pip install -q "minimax-code-sdk==X.Y.Z"
119
+ .venv/bin/python -c "import minimax_code; print(minimax_code.__version__, minimax_code.MCode)"
120
+ ```
121
+
122
+ It must print `X.Y.Z` and the `MCode` class. PyPI's CDN can take a few minutes to serve a new
123
+ version.
124
+
125
+ ## Failure handling
126
+
127
+ - **The `build` job fails**: nothing was published. Fix it in a pull request, merge, and tag a new
128
+ commit. If the version number itself was wrong, use a new version; do not reuse the tag.
129
+ - **`publish-pypi` fails before upload** (Trusted Publisher mismatch, network): fix the cause and
130
+ re-run the failed job of the same workflow run. The artifact is the already checked build.
131
+ - **Upload accepted but read-back fails**: wait and repeat the read-back. Do not re-run the upload
132
+ unless PyPI confirms the version does not exist.
133
+ - **Digests differ or the smoke test fails**: the version is published and cannot be replaced.
134
+ Release a fixed version and yank the broken one on PyPI (*Manage project → Releases → Options →
135
+ Yank*) with a reason.
@@ -0,0 +1,22 @@
1
+ """Run one Turn, a follow-up Turn, and resume the Session from its id."""
2
+
3
+ import asyncio
4
+ import sys
5
+
6
+ from minimax_code import MCode, ThreadOptions
7
+
8
+
9
+ async def main() -> None:
10
+ client = MCode()
11
+ thread = client.start_thread(ThreadOptions(cwd=".", permission="smart"))
12
+ turn = await thread.run(sys.argv[1] if len(sys.argv) > 1 else "Say hello in one sentence.")
13
+ print(turn.final_response)
14
+ print("session:", thread.id, "usage:", turn.usage)
15
+
16
+ assert thread.id is not None
17
+ resumed = client.resume_thread(thread.id)
18
+ print((await resumed.run("Repeat your previous answer in five words.")).final_response)
19
+
20
+
21
+ if __name__ == "__main__":
22
+ asyncio.run(main())
@@ -0,0 +1,24 @@
1
+ """Print the agent's answer as it streams, and tool calls as they finish."""
2
+
3
+ import asyncio
4
+ import sys
5
+
6
+ from minimax_code import MCode
7
+
8
+
9
+ async def main() -> None:
10
+ thread = MCode().start_thread()
11
+ streamed = await thread.run_streamed(sys.argv[1] if len(sys.argv) > 1 else "List files here.")
12
+ async for event in streamed:
13
+ item = event.get("item")
14
+ if item and item["type"] == "agent_message":
15
+ print(item.get("contentDelta", ""), end="", flush=True)
16
+ elif item and item["type"] == "tool_call" and event["type"] == "item.completed":
17
+ print(f"\n[tool] {item.get('toolCall', {}).get('name')}")
18
+ elif event["type"] == "turn.failed":
19
+ print("\nturn failed:", event.get("error"))
20
+ print()
21
+
22
+
23
+ if __name__ == "__main__":
24
+ asyncio.run(main())
@@ -0,0 +1,49 @@
1
+ [build-system]
2
+ requires = ["hatchling>=1.27"]
3
+ build-backend = "hatchling.build"
4
+
5
+ [project]
6
+ name = "minimax-code-sdk"
7
+ version = "0.1.0b1"
8
+ description = "Python SDK for driving the local MiniMax Code (mcode) agent."
9
+ readme = "README.md"
10
+ license = "MIT"
11
+ license-files = ["LICENSE"]
12
+ requires-python = ">=3.10"
13
+ dependencies = ["typing_extensions>=4.7"]
14
+ keywords = ["minimax", "minimax-code", "mcode", "agent", "coding-agent", "sdk"]
15
+ classifiers = [
16
+ "Development Status :: 4 - Beta",
17
+ "Programming Language :: Python :: 3",
18
+ "Operating System :: OS Independent",
19
+ "Typing :: Typed",
20
+ ]
21
+
22
+ [project.urls]
23
+ Homepage = "https://agent.minimax.io"
24
+ Repository = "https://github.com/MiniMax-AI/minimax-code"
25
+ Issues = "https://github.com/MiniMax-AI/minimax-code/issues"
26
+
27
+ [dependency-groups]
28
+ dev = ["pytest>=8", "pytest-asyncio>=0.24", "ruff>=0.6", "mypy>=1.11"]
29
+
30
+ [tool.hatch.build.targets.wheel]
31
+ packages = ["src/minimax_code"]
32
+
33
+ [tool.pytest.ini_options]
34
+ asyncio_mode = "auto"
35
+ asyncio_default_fixture_loop_scope = "function"
36
+ testpaths = ["tests"]
37
+ markers = ["e2e: runs a real mcode CLI against a real model (opt-in via MCODE_SDK_E2E=1)"]
38
+
39
+ [tool.ruff]
40
+ line-length = 100
41
+ target-version = "py310"
42
+
43
+ [tool.ruff.lint]
44
+ select = ["E", "F", "W", "I", "B", "UP", "SIM", "RUF"]
45
+
46
+ [tool.mypy]
47
+ strict = true
48
+ python_version = "3.10"
49
+ files = ["src", "tests"]