Skip to main content

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

m2m_market-0.1.1.tar.gz (6.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

m2m_market-0.1.1-py3-none-any.whl (7.3 kB view details)

Uploaded Python 3

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

Hashes for m2m_market-0.1.1.tar.gz
Algorithm Hash digest
SHA256 5dd9b6ddc2b028bc22cbedc5f382cafcc8b596b6d2dc4d35b471520fbbb85653
MD5 ff6caa4da15c436206727d2d91dc345a
BLAKE2b-256 c33112a3ad7fa598221f58d382a0dc8939d0f5884a9b21d8ae1695fe9379b972

See more details on using hashes here.

Provenance

The following attestation bundles were made for m2m_market-0.1.1.tar.gz:

Publisher: release-sdk.yml on castronyabola/m2m-marketplace-mvp

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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

Hashes for m2m_market-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 8f2448dc9d1c6f9b1c80ea9457855767ee19255746e2141e50c27c5abf2d68f8
MD5 b2f72b74abc2762dee0dbf252550d46e
BLAKE2b-256 184548a7f8e08079ad67372e21c3ef3814e1da573ec1d4d2077e9bbc2ca145dc

See more details on using hashes here.

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

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 files

0.1.0

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page