The Python interface for methods — base structures for structured outputs and the base runner for executing methods via API.
Project description
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
mthdsCLI 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; andPipelexRunner(mthds.runners.pipelex.runner), which shells out to a locally installedpipelexCLI. - Package management (
mthds.package) — read, lock, and resolveMETHODS.tomlmanifests.
See docs/runners.md for the protocol + runners reference.
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() resolves credentials 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_API_URL |
API base URL — any MTHDS Protocol server | https://api.pipelex.com |
The reference server is Pipelex (https://api.pipelex.com) — get a key at app.pipelex.com, or point MTHDS_API_URL at your own MTHDS-Protocol server. You can also pass api_token / api_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
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file mthds-0.6.1.tar.gz.
File metadata
- Download URL: mthds-0.6.1.tar.gz
- Upload date:
- Size: 132.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3d6b93306708f0ef8971285cfab4d9a488fca364e5db7e63a7dba2d065070eef
|
|
| MD5 |
0640f6d3ef4947f966157544a8215d88
|
|
| BLAKE2b-256 |
a733c274de1115b6cbe8ac3475327a622893070f1ca40d9f2d0172d6fcae62b9
|
Provenance
The following attestation bundles were made for mthds-0.6.1.tar.gz:
Publisher:
publish.yml on mthds-ai/mthds-python
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
mthds-0.6.1.tar.gz -
Subject digest:
3d6b93306708f0ef8971285cfab4d9a488fca364e5db7e63a7dba2d065070eef - Sigstore transparency entry: 2032572502
- Sigstore integration time:
-
Permalink:
mthds-ai/mthds-python@9c55edff40daca3cdf437f4676314484fa2c150f -
Branch / Tag:
refs/heads/main - Owner: https://github.com/mthds-ai
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@9c55edff40daca3cdf437f4676314484fa2c150f -
Trigger Event:
push
-
Statement type:
File details
Details for the file mthds-0.6.1-py3-none-any.whl.
File metadata
- Download URL: mthds-0.6.1-py3-none-any.whl
- Upload date:
- Size: 57.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5cd39d2b6fc5b43c5967162d80178b050748502515eda26916c2b80e8f3f1f42
|
|
| MD5 |
139d370c00db0ab440d8d59fdeede077
|
|
| BLAKE2b-256 |
ff520538d1bd11067f60f86ad74dc4d36bcad81ff3b549f71b3290aebd3a9aeb
|
Provenance
The following attestation bundles were made for mthds-0.6.1-py3-none-any.whl:
Publisher:
publish.yml on mthds-ai/mthds-python
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
mthds-0.6.1-py3-none-any.whl -
Subject digest:
5cd39d2b6fc5b43c5967162d80178b050748502515eda26916c2b80e8f3f1f42 - Sigstore transparency entry: 2032572673
- Sigstore integration time:
-
Permalink:
mthds-ai/mthds-python@9c55edff40daca3cdf437f4676314484fa2c150f -
Branch / Tag:
refs/heads/main - Owner: https://github.com/mthds-ai
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@9c55edff40daca3cdf437f4676314484fa2c150f -
Trigger Event:
push
-
Statement type: