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

export M2M_API_BASE_URL="https://4o4666j5va.execute-api.us-east-1.amazonaws.com/dev"
export M2M_CONNECTION_TOKEN="m2m_live_conn-..."

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.0.tar.gz (5.6 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.0-py3-none-any.whl (7.0 kB view details)

Uploaded Python 3

File details

Details for the file m2m_market-0.1.0.tar.gz.

File metadata

  • Download URL: m2m_market-0.1.0.tar.gz
  • Upload date:
  • Size: 5.6 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.0.tar.gz
Algorithm Hash digest
SHA256 0c5cccf1a4454f724195ea1fdcee4128bd2a40272d2ed957eee2b2b3c933fa5a
MD5 a21a51fcabd0c7e27796e81d6c18a1fd
BLAKE2b-256 0e1391eacbbb392489b5b7ef2a8534feb436d18c39369fd85f4ba03916a548dc

See more details on using hashes here.

Provenance

The following attestation bundles were made for m2m_market-0.1.0.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.0-py3-none-any.whl.

File metadata

  • Download URL: m2m_market-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 7.0 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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ad24de347a82f1bc6020d116650ed74d750f0163225409ef4e5202526d4b10a9
MD5 1906d44b608da16f88d65e2fa9349af4
BLAKE2b-256 866c0be3bc97bb59f155b798b64871c63e0bf431db1123930900bfcf427f53df

See more details on using hashes here.

Provenance

The following attestation bundles were made for m2m_market-0.1.0-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

0.1.1

2 files

This release

0.1.0 This release

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