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.1
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.1.tar.gz | 5.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| machine_sdk-0.2.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 12.1 kB
Release files / machine_sdk-0.2.1.tar.gz
| Download URL | machine_sdk-0.2.1.tar.gz |
|---|---|
| Size | 5.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
904f1cb492a6566cc922d1a9d2cb82ec667093018f08c0cdb8090a6b2d78fdc1
|
|
BLAKE2b-256 checksum How to use checksums |
109fc6be88e42d0601921ca3c022ef1378a3cd809c893e6cb3153991f86fdd3a
|
| 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.1-py3-none-any.whl
| Download URL | machine_sdk-0.2.1-py3-none-any.whl |
|---|---|
| Size | 6.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
0faf777f9d13681c164a1770c672c10977a0035e948cd4440f41f921d3662c21
|
|
BLAKE2b-256 checksum How to use checksums |
4bbd9fa0a895326fdc10ee17fca61df7add9b2ab7ff6f37ded5830cc8d9fab94
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.9.6
|