Skip to main content

Use Marona to build AI apps for any AI interface, edge device, or intelligent agent. Build once and deploy online, offline, or in hybrid environments through a unified runtime.

Project description

marona

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

Use Marona to build AI apps for any AI interface, edge device, or intelligent agent. Build once and deploy online, offline, or in hybrid environments through a unified runtime.

Install

pip install marona

Complete Example

This example shows the normal flow for a developer application:

  1. Create a Marona client.
  2. Sync Hub metadata into the local cache.
  3. Connect approved Hub apps by app ID.
  4. Send a user message through the runtime.
  5. Print the final assistant response.

The optional developer role controls app behavior.

import asyncio
import os

from marona import Marona


async def main() -> None:
    api_key = os.environ["MARONA_API_KEY"]
    identity_token = os.getenv("MARONA_IDENTITY_TOKEN")  # Optional

    async with Marona(api_key=api_key, mode="online") as marona:
        await marona.sync(
            interface="api",
            identity_token=identity_token,
        )

        tools = await marona.hub.connect(
            ["sda-books", "zimsec"],
            adapter="tools",
        )

        response = await marona.client(
            input=[
                {
                    "role": "developer",
                    "content": "Keep answers clear and concise.",
                },
                {
                    "role": "user",
                    "content": [
                        {
                            "type": "input_text",
                            "text": "What teams are playing in this image?",
                        },
                        {
                            "type": "input_image",
                            "image_url": "https://api.nga.gov/iiif/a2e6da57-3cd1-4235-b20e-95dcaefed6c8/full/!800,800/0/default.jpg",
                        },
                        {
                            "type": "input_file",
                            "filename": "document.pdf",
                            "file_data": "data:application/pdf;base64,...",
                            "detail": "high",
                        },
                    ],
                }
            ],
            interface="api",
            identity_token=identity_token,
            tools=tools,
        )

        print(response.text)


asyncio.run(main())

Build And Publish Skills

Skills define reusable, ordered workflows over Apps. Publishing validates step IDs, references, required Apps, exact capabilities, and the immutable version.

import os

from marona import Marona
from marona.skills import skill, step


@skill(
    name="create-group-fund",
    description="Create a group fund after explicit user approval.",
    governs=["group-fund.create_group"],
)
def create_group_fund():
    request = step(
        id="understand-request",
        type="reasoning",
        instruction="Extract the group name and currency.",
        inputs={"message": "{{ context.user_message }}"},
        outputs={"name": "string", "currency": "string"},
    )
    permission = step(
        id="confirm-create",
        type="approval",
        message=f"Create '{request.name}' in {request.currency}?",
        outputs={"approved": "boolean"},
    )
    return step(
        id="create-group",
        type="app",
        app="group-fund",
        capability="group-fund.create_group",
        instruction="Create the approved group.",
        condition=permission.approved,
        inputs={"name": request.name, "currency": request.currency},
        outputs={"group_id": "string", "name": "string"},
    )


marona = Marona(api_key=os.environ["MARONA_API_KEY"])
marona.skills.publish(create_group_fund, version="1.0.0")

marona.sync() synchronizes published Apps and Skills. Users still call marona.client(...); the model discovers a matching Skill and the runtime enforces its ordered steps and approvals. There is no separate Skill run API. governs declares raw capabilities that must only run through that workflow. Every workflow entry uses step(); its type selects reasoning, approval, or App execution. There are no separate type-specific step builders.

The model selects the best matching Skill from the synced catalog. Marona, not the model provider, executes its ordered step() values, persists approval gates, and invokes each exact MCP capability. Offline exposes only Skills whose required Apps have installed offline/hybrid targets; governed capabilities are never exposed as raw tools. Hybrid falls back to Edge when the local route cannot produce a valid result.

Run it:

export MARONA_API_KEY="mrn_live_..."
python app.py

Pair A User

Use pairing when an interface needs to become the same user across web, mobile, WhatsApp, wearables, or another client surface.

async with Marona(api_key=os.environ["MARONA_API_KEY"]) as marona:
    pairing = await marona.start_pairing(
        interface="web",
        device_name="Customer web chat",
    )

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

    status = await marona.pairing_status(pairing.pairing_id)
    print(status.status)

After the user confirms pairing, store the returned identity token and pass it to marona.client(...).

Online, Offline, And Hybrid Modes

Choose one runtime mode for the client:

  • online: use online runtime and online app routes.
  • offline: use only local cache, local/private models, and installed offline-capable app targets.
  • hybrid: try local/private execution first, then use online runtime when allowed.

Apps also declare one availability mode:

  • online: online only.
  • offline: offline only.
  • hybrid: online and offline capable.

Hybrid is a single mode. Do not declare online + offline + hybrid; declare hybrid.

Hybrid Or Offline With A Local/Private Model

Marona uses one provider-neutral runtime flow. Registering a model changes the inference provider; App/Skill discovery, MCP execution, context, permissions, and hybrid fallback remain unchanged.

Register a local or private model endpoint once, then use it as the default for hybrid or offline execution.

async with Marona(api_key=os.environ["MARONA_API_KEY"], mode="hybrid") as marona:
    await marona.sync(interface="api")

    marona.models.register(
        name="office-model",
        endpoint="http://localhost:9379",
    )
    marona.models.use("office-model")

    tools = await marona.hub.connect(["sda-books", "zimsec"], adapter="tools")

    response = await marona.client(
        input=[
            {
                "role": "user",
                "content": [
                    {
                        "type": "input_text",
                        "text": "Summarize the chapter about faith.",
                    }
                ],
            }
        ],
        interface="desktop",
        tools=tools,
    )

    print(response.text)

In offline mode, Marona never calls public cloud runtime. If a model or an offline-capable app target is missing, the client returns a clear offline error. Only installed offline/hybrid Apps and Skills whose required Apps are available are discoverable. Skill-managed capabilities are not exposed as raw App tools.

Synced conversation context and connected tool schemas are supplied to the configured model on every turn. The current user prompt remains the active task, and the model decides whether to answer directly or call an available tool.

Interface Names

interface identifies the client surface making the request. Standard values:

  • api
  • web
  • mobile_app
  • desktop
  • whatsapp

Future devices can use custom lowercase slugs such as smart_glasses, vehicle_console, or kiosk.

Related Packages

  • Python client: marona, import marona
  • Dart client: marona, import package:marona/marona.dart
  • TypeScript client: marona, import Marona from "marona"
  • Developer SDK for building apps: marona-sdk, import marona_sdk

Project details


Release history Release notifications | RSS feed

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.4.1.tar.gz (47.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.4.1-py3-none-any.whl (38.4 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for marona-0.4.1.tar.gz
Algorithm Hash digest
SHA256 e95c8ecf755e4eb075705556630067b0a0a2c299c9b8cb72ce2885b7774132c1
MD5 129ea02d4984cf0cd7907f0b0bee902f
BLAKE2b-256 b19822078d09d4f1ca7952a1c4153830404a8507e3529ceab0f04a39959d0e13

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for marona-0.4.1-py3-none-any.whl
Algorithm Hash digest
SHA256 d3d5cebfc49f28e4491ee0c124d40e743f7b4660ebfb91a7e16781e371599a11
MD5 0a2893c48b804ce540f953e0cdac3856
BLAKE2b-256 e7cc0c68a99f8da5f14ca48dbb90ed9e4e137d99d615d50342f227e48a9d6e34

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