machine-sdk
Python SDK for the Machine AI platform — projects,
agent sessions, and Machine Apps, driven from Python or the bundled
machine-cli.
pip install machine-sdk
Authentication
Create a personal access token in the Machine app (Settings → API keys), then:
export MACHINE_API_KEY=kortix_pat_...
# self-hosted deployments only:
export MACHINE_API_URL=https://your-machine-api.example.com
Python
from machine import MachineClient
client = MachineClient() # reads MACHINE_API_KEY / MACHINE_API_URL
for project in client.list_projects():
print(project["project_id"], project.get("name"))
# Start an agent working on a prompt
session = client.create_session(project_id, prompt="Audit the repo's README files")
print(session["session_id"], session["status"])
# Poll it
session = client.get_session(project_id, session["session_id"])
# Stop it
client.stop_session(project_id, session["session_id"])
CLI
machine-cli projects
machine-cli sessions <project-id>
machine-cli new <project-id> "Fix the failing tests" --model anthropic/claude-sonnet-5
machine-cli session <project-id> <session-id>
machine-cli stop <project-id> <session-id>
machine-cli apps <project-id>
Output is JSON, so it pipes cleanly into jq.
Surface
| Python | CLI | Route |
|---|---|---|
list_projects() |
projects |
GET /v1/projects |
get_project(id) |
— | GET /v1/projects/{id} |
list_sessions(id) |
sessions |
GET /v1/projects/{id}/sessions |
create_session(id, prompt) |
new |
POST /v1/projects/{id}/sessions |
get_session(id, sid) |
session |
GET /v1/projects/{id}/sessions/{sid} |
stop_session(id, sid) |
stop |
POST /v1/projects/{id}/sessions/{sid}/stop |
restart_session(id, sid) |
restart |
POST /v1/projects/{id}/sessions/{sid}/restart |
delete_session(id, sid) |
— | DELETE /v1/projects/{id}/sessions/{sid} |
list_apps(id) |
apps |
GET /v1/projects/{id}/apps |
Versioning
0.2.x is a ground-up rewrite against the current Machine API. The 0.1.x
releases targeted a retired API surface and additionally shipped without any
Python code due to a packaging defect — do not use them.
Metadata
Release files for machine-sdk 0.2.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 | |
|---|---|---|---|
| machine_sdk-0.2.0.tar.gz | 5.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| machine_sdk-0.2.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 12.1 kB
Release files / machine_sdk-0.2.0.tar.gz
| Download URL | machine_sdk-0.2.0.tar.gz |
|---|---|
| Size | 5.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
276235896b46285cc4f6a5532fb47ef2626ef4f7d6c3cbbc991ab7bb0b620f9c
|
|
BLAKE2b-256 checksum How to use checksums |
0eaa73ce9753b13180e9cd07650322d36454320d7f14d2f572165b2fdc747d36
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.9.6
|
Release files / machine_sdk-0.2.0-py3-none-any.whl
| Download URL | machine_sdk-0.2.0-py3-none-any.whl |
|---|---|
| Size | 6.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
7ec3187a94af44c73700e61f534386e12ab1e1189ce7b65e86e27647488922e7
|
|
BLAKE2b-256 checksum How to use checksums |
b6cc8334adddcacd4c2a1a037a2435306357c7f61863d514f3d3b609a698d872
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.9.6
|