> ## Documentation Index
> Fetch the complete documentation index at: https://docs.withmethod.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# JavaScript and Python SDKs

> Load Method files and run the public executor from code.

The full SDK is distributed as a [downloadable npm package](https://app.withmethod.ai/downloads/withmethod-sdk-latest.tgz), with its MIT source included. It contains the JavaScript API and full `method` CLI. Python uses a separate wheel and calls the same Node runtime.

The full SDK source is public at [method-ai-hq/method-sdk](https://github.com/method-ai-hq/method-sdk), including JavaScript, Python, the CLI, examples, tests, and build instructions. The separate [method-spec](https://github.com/method-ai-hq/method-spec) repo contains the format, validator, and executor dependency. See [Source and downloads](/sdk/source) for the package contents and source locations.

## JavaScript

Use Node.js 22 or later. Install the full SDK in your project:

```sh theme={null}
npm install https://app.withmethod.ai/downloads/withmethod-sdk-latest.tgz
```

```js theme={null}
import { readFileSync } from 'node:fs';
import { loadMethod, runMethod } from '@withmethod/sdk';

const method = loadMethod(readFileSync('task.method', 'utf8'));
const config = JSON.parse(readFileSync('runtime.json', 'utf8'));
const result = await runMethod('task.method', config, {
  inputs: { text: 'Hello\n' },
  runDir: 'runs/example',
});
console.log(method.name, result.status);
```

`loadMethod` parses and validates a YAML/JSON string or object. `runMethod(file, config, options)` runs a current Method. Pass an explicit configuration object; `{allow_local_processes: true}` enables the default local Codex path. A script needs its runtime profile. Direct SDK calls do not perform the CLI's automatic runtime.json discovery or account sync.

Options include `inputs`, `state`, `runDir`, `sourceRoot`, `resume`, `retry`, `human`, `signal`, `onStart`, and `onEvent`. `sourceRoot` selects the helper folder. `human` is an object in JavaScript; the CLI reads that object from a file. Use the original inputs and configuration when resuming.

The package also exports `methodSchema` and `configSchema`. SDK 0.7.0 removes `runWorkflow`, Executor/Verifier callbacks, and execution of `method/2` and `workflow/2`. These calls fail; there is no compatibility executor. Use `method migrate` to convert an old document, then review and validate the result.

## Python

Python 3.11+ is required, along with Node.js 22+ and the full JavaScript SDK:

```sh theme={null}
npm install -g https://app.withmethod.ai/downloads/withmethod-sdk-latest.tgz
pip install https://app.withmethod.ai/downloads/withmethod-0.5.0-py3-none-any.whl
withmethod authoring
```

```python theme={null}
import json
from pathlib import Path
from withmethod import load_method, run_method

method = load_method(Path("task.method"))
config = json.loads(Path("runtime.json").read_text())
result = run_method("task.method", config, inputs={"text": "Hello\n"}, directory="runs/example")
print(method["name"], result["status"])
```

Python calls the same Node runtime through a local bridge. It is not a separate executor. `withmethod` forwards CLI commands; `run_method` accepts `resume`, `retry`, `state`, and `human` for recovery. The wheel is served by Method; do not assume a PyPI release exists.

## Source and version checks

The full SDK archive includes MIT source under `source/`, compiled code, and public examples. Its current runtime comes from a pinned Git commit of [method-spec](https://github.com/method-ai-hq/method-spec). The hosted application repository is private.

Use `method --version` to identify the SDK, runtime, and format. Use the [download manifest](https://app.withmethod.ai/downloads/manifest.json) to check package names and SHA-256 hashes. The `latest` alias can change. Use an exact version URL when a project needs a fixed release.
