Skip to main content

mthds

The Python implementation of the MTHDS Protocol — a typed client for any MTHDS runner, plus the base structures that methods are defined in.

Learn more at mthds.ai and browse the Hub at mthds.sh.

Looking for the command line? The mthds CLI ships as the npm package (mthds-js). This Python package is a library — it has no CLI.

Installation

pip install mthds

What's in the box

  • The protocol (mthds.protocol) — MTHDSProtocol, the five-route interface every runner implements (execute, start, validate, models, version); the wire models (RunResult, ModelDeck, ValidationReport, VersionInfo); and the domain shapes methods are built from (concept, stuff, working_memory, pipe_output, pipeline_inputs).
  • Runners (mthds.runners) — MthdsAPIClient (mthds.runners.api.client), the HTTP client for any MTHDS-Protocol server plus the hosted run-lifecycle (polling) extension; and PipelexRunner (mthds.runners.pipelex.runner), which shells out to a locally installed pipelex CLI.
  • Package management (mthds.package) — read, lock, and resolve METHODS.toml manifests.

See docs/runners.md for the protocol + runners reference. See docs/inputs-template.md for the inputs-template projection.

Quick start

Run a method against any MTHDS-Protocol server with the API runner, MthdsAPIClient:

import asyncio

from mthds.runners.api.client import MthdsAPIClient


async def main() -> None:
    async with MthdsAPIClient() as client:
        # Discovery handshake
        version = await client.version()
        print(version.protocol_version)

        # Run a method and wait for the result — start → poll → result in one call
        result = await client.start_and_wait(pipe_code="my_pipe", inputs={"topic": "owls"})
        print(result.main_stuff)


asyncio.run(main())

execute runs synchronously; start returns immediately with a pipeline_run_id; start_and_wait does the whole async lifecycle in one call. validate, models, and version round out the protocol surface.

Need local execution instead of an API? PipelexRunner (mthds.runners.pipelex.runner) implements the same MTHDSProtocol by shelling out to an installed pipelex CLI — no API key.

Configuration

MthdsAPIClient() reads its config from ~/.mthds/config — the same file the mthds CLI (npm) reads and writes, so configuring either configures both. Environment variables take precedence:

Variable Description Default
MTHDS_API_KEY API authentication key (empty)
MTHDS_BASE_URL API base URL — any MTHDS Protocol server http://localhost:8081

This client targets the open-source pipelex-api runner, so it defaults to a local instance (http://localhost:8081, pipelex-api's default port). Point MTHDS_BASE_URL at any other MTHDS-Protocol server to use it instead. You can also pass api_key / base_url straight to MthdsAPIClient(...).

To set the config from a terminal, use the npm CLI (mthds config set api-key …) or edit ~/.mthds/config directly.

Related packages

  • mthds (npm) — the mthds CLI (install methods, run, configure) + TypeScript client.
  • Pipelex — the reference full-featured runner.

Release files for mthds 0.13.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for mthds 0.13.0
File Size Uploaded
mthds-0.13.0.tar.gz 216.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for mthds 0.13.0
File Interpreter ABI Platform
mthds-0.13.0-py3-none-any.whl Python 3 none any Details

Total release size: 302.1 kB

Release files / mthds-0.13.0.tar.gz

Download URL mthds-0.13.0.tar.gz
Size 216.1 kB
Tags Source
SHA-256 checksum
How to use checksums
ef59ffa94902da72371390cc39d8c0d85dfd2a524dbca2a8909a0a1ba6255607
BLAKE2b-256 checksum
How to use checksums
e4b66c67b86693d01d473444523db0aeadc1afdffaa1748a264dfab9c1c77b1c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 2, 2026.

Transparency log

Release files / mthds-0.13.0-py3-none-any.whl

Download URL mthds-0.13.0-py3-none-any.whl
Size 86.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
606fef7978bbc8a5b249882c0b9377fed37123f618f8183f29e89b71a4eadac0
BLAKE2b-256 checksum
How to use checksums
8926f73e625b54cfba2e09a29df5e7173e508c25d3f7ce106be69fae6065d76c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 2, 2026.

Transparency log

Release history Release notifications | RSS feed

0.16.1

2 release files

0.16.0

2 release files

0.15.0

2 release files

This release

0.13.0 This release

2 release files

0.12.0

2 release files

0.11.1

2 release files

0.11.0

2 release files

0.10.0

2 release files

0.9.0

2 release files

0.8.2

2 release files

0.8.1

2 release files

0.8.0

2 release files

0.7.1

2 release files

0.7.0

2 release files

0.6.1

2 release files

0.6.0

2 release files

0.5.0

2 release files

0.4.1

2 release files

0.4.0

2 release files

0.3.0

2 release files

0.2.0

2 release files

0.1.1

2 release files

0.1.0

2 release files

0.0.7

2 release files

0.0.6

2 release files

0.0.5

2 release files

0.0.4

2 release files

0.0.3

2 release files

0.0.2

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page