Skip to main content

Official Python client SDK for Marona-compatible AI runtimes.

Project description

marona

Official Python client SDK for Marona-compatible AI runtimes.

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.

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())

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.1

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.1.tar.gz (13.2 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.1-py3-none-any.whl (11.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: marona-0.1.1.tar.gz
  • Upload date:
  • Size: 13.2 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.1.tar.gz
Algorithm Hash digest
SHA256 ef569be40bec06597ee988817e68045a6850a9d57b8aafef66d945079ce4759b
MD5 541e314f16b934a95e9c81e82b149910
BLAKE2b-256 b23d8c1330b95bc90deb77cc1c4546d8ea372d72a947a7b23ed8d3409a386338

See more details on using hashes here.

File details

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

File metadata

  • Download URL: marona-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 11.7 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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 4ebc68aa7689fe00672d2564e517dd1d605112c84785cc6e6dbd74b92fd58d84
MD5 82633e91a5f9d0682a6fa4055ac3c254
BLAKE2b-256 da060eb0d5644f7107191f8ea8f9636890fd21f840a75a4fe2b88ded1a5d8043

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