Skip to main content

Official Python client SDK for Marona-compatible AI runtimes and Hub integrations.

Project description

marona

Official Python client SDK for Marona-compatible AI runtimes and Hub integrations.

Marona provides a simple interface for messaging, discovering apps, managing permissions, connecting service accounts, receiving inbound events, and using tools from any compatible runtime.

You can use it with Marona Cloud or with your own self-hosted Marona-compatible runtime.

marona has two separate surfaces:

  • client.hub.connect(...): free Hub integration for developers using their own agents.
  • client.runtime.message(...): paid Marona Runtime usage billed from Marona Balance.

Install

pip install marona

Send a message

import asyncio

from marona import Marona


async def main() -> None:
    client = Marona(
        base_url="https://edge.marona.ai",
        api_key="mrn_live_...",
    )
    response = await client.message(
        "Create a PowerPoint about AI introduction",
        interface="api",
        conversation_id="demo",
    )
    print(response.reply)
    for artifact in response.artifacts:
        print(artifact.get("filename"))


asyncio.run(main())

Connect Hub Apps

Use Hub integration when your own agent framework will execute the model and you only need approved app connections from Marona Hub.

import asyncio

from marona import Marona


async def main() -> None:
    marona = Marona(api_key="mrn_live_...")
    servers = await marona.hub.connect(
        ["gmail", "calendar"],
        adapter="openai_mcp",
    )
    print(servers)


asyncio.run(main())

For frameworks that need tool descriptors instead of MCP server configs:

tools = await marona.hub.connect(["billing-mcp"], adapter="tools")

Hub integration does not call Marona Runtime and does not use Marona Balance.

Edge runtimes

Device runtimes can activate and sync against Marona Hub with the same official package:

from marona import EdgeHubClient

edge = EdgeHubClient(hub_url="https://hub.marona.ai")
activation = await edge.start_activation(
    device_name="Office runtime",
    device_public_key="...",
)

Add balance

Developers add balance by paying a money amount. The runtime metering unit stays internal so your application does not depend on any provider token pricing.

payment = await marona.hub.create_payment_intent(
    amount_cents=1000,
    payment_method="ecocash",
    ecocash_number="0771234567",
)
print(payment["payment_intent"]["amount_cents"])

Runtime targets

Marona Cloud:

from marona import Marona

client = Marona(
    base_url="https://edge.marona.ai",
    api_key="mrn_live_...",
)

Self-hosted:

from marona import Marona

client = Marona(
    base_url="https://my-company-edge.example.com",
    api_key="mrn_live_...",
)

List available apps

import asyncio

from marona import Marona


async def main() -> None:
    client = Marona("https://edge.marona.ai")
    apps = await client.list_apps(limit=20, search="slides")

    for app in apps.apps:
        print(app["slug"], app["name"])


asyncio.run(main())

Pair an interface with WhatsApp

import asyncio

from marona import Marona


async def main() -> None:
    client = Marona("https://edge.marona.ai")
    pairing = await client.start_pairing(interface="web", device_name="My web app")

    print(pairing.display_code)
    print(pairing.whatsapp_url)


asyncio.run(main())

After the user sends the pairing code from WhatsApp, poll for completion:

status = await client.pairing_status(pairing.pairing_id)

if status.identity:
    identity_token = status.identity.access_token

Use the identity token on future requests:

response = await client.message(
    "What is on my calendar today?",
    identity_token=identity_token,
)

Connect an app account

Some apps need a user service connection, such as Gmail, Google Calendar, or Google Slides.

import asyncio

from marona import Marona


async def main() -> None:
    client = Marona("https://edge.marona.ai")
    identity_token = "mrn_identity_token_from_pairing"
    connection = await client.connect_app(
        "slides",
        provider="google",
        identity_token=identity_token,
        return_url="https://example.com/connected",
    )

    print(connection.authorization_url)


asyncio.run(main())

Open authorization_url in a browser so the user can authorize the provider.

Attach files

import asyncio

from marona import Marona, RuntimeAttachment


async def main() -> None:
    identity_token = "mrn_identity_token_from_pairing"
    attachment = RuntimeAttachment.from_bytes(
        b"hello",
        filename="note.txt",
        mime_type="text/plain",
        kind="document",
    )

    client = Marona("https://edge.marona.ai")
    response = await client.message(
        "Summarize this file",
        attachments=[attachment],
        identity_token=identity_token,
    )
    print(response.reply)


asyncio.run(main())

Advanced

EdgeRuntimeClient is kept as a compatibility class for existing integrations. New integrations should import Marona.

Release

Build and verify the package before uploading:

rm -rf dist build marona.egg-info
python3 -m build
python3 -m twine check dist/*

Upload with the project-scoped PyPI token for marona:

TWINE_USERNAME=__token__ TWINE_PASSWORD='PROJECT_SCOPED_TOKEN' python3 -m twine upload dist/*

Use a project-scoped token for normal releases. Account-wide tokens should only be used for the first upload of a new PyPI project.

Project details


Release history Release notifications | RSS feed

This version

0.1.3

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

marona-0.1.3.tar.gz (17.3 kB view details)

Uploaded Source

Built Distribution

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

marona-0.1.3-py3-none-any.whl (14.6 kB view details)

Uploaded Python 3

File details

Details for the file marona-0.1.3.tar.gz.

File metadata

  • Download URL: marona-0.1.3.tar.gz
  • Upload date:
  • Size: 17.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.6

File hashes

Hashes for marona-0.1.3.tar.gz
Algorithm Hash digest
SHA256 96b871e7feaf42ae0a1354dafbe955cd8c1440d45f5115d6cf2f4660b5d5cbff
MD5 350c1fc1414bc3b5e1c362a80685448b
BLAKE2b-256 387c006d19d7a3cab99f127f5f80dddc5ec065bd66efed7b24b08b919e01ee6d

See more details on using hashes here.

File details

Details for the file marona-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: marona-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 14.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.6

File hashes

Hashes for marona-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 b233ec36bb410782c8decfb06cd0f763461a977be367733250da7cb0c8027b06
MD5 2d3fc8d6175e089a5dec69590314c515
BLAKE2b-256 2f136a7fcced4b7fde21b5928d5f37cb2cbffccc67b53695ae782e8a1d71bf1e

See more details on using hashes here.

Supported by

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