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.

Project details


Release history Release notifications | RSS feed

This version

0.1.0

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

Uploaded Python 3

File details

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

File metadata

  • Download URL: marona-0.1.0.tar.gz
  • Upload date:
  • Size: 12.0 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.0.tar.gz
Algorithm Hash digest
SHA256 b601bc75b93db62ba267c4e770eaf227192200db1ed3326a61dd12752fb11549
MD5 91df63560cb4684297c835acf3ebaa66
BLAKE2b-256 203692f9710a4c2165b67aa302f15ee30dad48761abdda7026c71e482bb8e468

See more details on using hashes here.

File details

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

File metadata

  • Download URL: marona-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 11.1 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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3e6db42fd7a5001d40130173df2f65eea4e472bdd1c2735101746f02e5439b0d
MD5 659a4f257f2981260c7aa19ebe56df32
BLAKE2b-256 eeb45527cc6bb6de6be38567ce1034f9f55373bf9135df143bc8a331ab36d26a

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