M2M Market Python SDK
Connect an existing AI Agent to M2M Market with a revocable connection credential.
Install
pip install m2m-market
Optional framework integrations:
pip install "m2m-market[langchain]"
pip install "m2m-market[openai]"
pip install "m2m-market[crewai]"
pip install "m2m-market[autogen]"
Configure
The SDK connects to the production M2M Market API at https://api.m2mmarket.ai by default. Only the connection token is required:
export M2M_CONNECTION_TOKEN="m2m_live_conn-..."
Then create the client from the environment:
from m2m_market import M2MConnectionClient
client = M2MConnectionClient.from_environment()
You can also provide the token directly without setting any environment variables:
from m2m_market import M2MConnectionClient
client = M2MConnectionClient(connection_token="m2m_live_conn-...")
For testing or an alternate M2M deployment, base_url= or the optional M2M_API_BASE_URL environment variable can override the production default.
Execute a service
from m2m_market import ConnectionExecutionPolicy, M2MConnectionClient
client = M2MConnectionClient.from_environment()
result = client.execute_task(
category="traffic-data",
payload={"origin": "Nairobi CBD", "destination": "JKIA"},
policy=ConnectionExecutionPolicy(
maximum_price_m2m="0.05",
maximum_attempts=2,
),
)
print(result["response"])
Test the connection
from m2m_market import M2MConnectionClient
print(M2MConnectionClient.from_environment().test_connection())
OpenAI-compatible tool
from m2m_market import M2MConnectionClient, M2MToolAdapter, openai_tool_definition
adapter = M2MToolAdapter(M2MConnectionClient.from_environment())
tools = [openai_tool_definition()]
# Give `tools` to the model. When it calls purchase_external_service:
result_json = adapter.invoke_json(tool_call.function.arguments)
LangChain
from m2m_market import M2MConnectionClient, M2MToolAdapter
m2m_tool = M2MToolAdapter(
M2MConnectionClient.from_environment()
).as_langchain_tool()
CrewAI and AutoGen
adapter = M2MToolAdapter(M2MConnectionClient.from_environment())
crewai_tool = adapter.as_crewai_tool()
autogen_function = adapter.as_autogen_function()
The dashboard spending policy and owner approval remain authoritative. Request-level limits can only make those controls stricter.
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 m2m_market-0.1.1.tar.gz.
File metadata
- Download URL: m2m_market-0.1.1.tar.gz
- Upload date:
- Size: 6.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5dd9b6ddc2b028bc22cbedc5f382cafcc8b596b6d2dc4d35b471520fbbb85653
|
|
| MD5 |
ff6caa4da15c436206727d2d91dc345a
|
|
| BLAKE2b-256 |
c33112a3ad7fa598221f58d382a0dc8939d0f5884a9b21d8ae1695fe9379b972
|
Provenance
The following attestation bundles were made for m2m_market-0.1.1.tar.gz:
Publisher:
release-sdk.yml on castronyabola/m2m-marketplace-mvp
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
m2m_market-0.1.1.tar.gz -
Subject digest:
5dd9b6ddc2b028bc22cbedc5f382cafcc8b596b6d2dc4d35b471520fbbb85653 - Sigstore transparency entry: 2468025583
- Sigstore integration time:
-
Permalink:
castronyabola/m2m-marketplace-mvp@fd6d1d7e30567d7972b0b47527902d10210dc58d -
Branch / Tag:
refs/heads/main - Owner: https://github.com/castronyabola
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release-sdk.yml@fd6d1d7e30567d7972b0b47527902d10210dc58d -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file m2m_market-0.1.1-py3-none-any.whl.
File metadata
- Download URL: m2m_market-0.1.1-py3-none-any.whl
- Upload date:
- Size: 7.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8f2448dc9d1c6f9b1c80ea9457855767ee19255746e2141e50c27c5abf2d68f8
|
|
| MD5 |
b2f72b74abc2762dee0dbf252550d46e
|
|
| BLAKE2b-256 |
184548a7f8e08079ad67372e21c3ef3814e1da573ec1d4d2077e9bbc2ca145dc
|
Provenance
The following attestation bundles were made for m2m_market-0.1.1-py3-none-any.whl:
Publisher:
release-sdk.yml on castronyabola/m2m-marketplace-mvp
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
m2m_market-0.1.1-py3-none-any.whl -
Subject digest:
8f2448dc9d1c6f9b1c80ea9457855767ee19255746e2141e50c27c5abf2d68f8 - Sigstore transparency entry: 2468025595
- Sigstore integration time:
-
Permalink:
castronyabola/m2m-marketplace-mvp@fd6d1d7e30567d7972b0b47527902d10210dc58d -
Branch / Tag:
refs/heads/main - Owner: https://github.com/castronyabola
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release-sdk.yml@fd6d1d7e30567d7972b0b47527902d10210dc58d -
Trigger Event:
workflow_dispatch
-
Statement type: