Official Python client SDK for Marona-compatible AI runtimes and Hub integrations.
Project description
marona
Official Python client for Marona-compatible AI runtimes and Hub integrations.
Use marona to build web apps, mobile backends, WhatsApp bots, desktop apps,
devices, smart glasses, and agents that need one API for online, offline, and
hybrid AI execution.
Install
pip install marona
Complete Example
This example shows the normal flow for a developer application:
- Create a Marona client.
- Sync Hub metadata into the local cache.
- Connect approved Hub apps by app ID.
- Send a user message through the runtime.
- Print the final assistant response.
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": "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())
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
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.
Interface Names
interface identifies the client surface making the request. Standard values:
apiwebmobile_appdesktopwhatsapp
Future devices can use custom lowercase slugs such as smart_glasses,
vehicle_console, or kiosk.
Related Packages
- Python client:
marona, importmarona - Dart client:
marona, importpackage:marona/marona.dart - TypeScript client:
marona, importMaronafrom"marona" - Developer SDK for building apps:
marona-sdk, importmarona_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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file marona-0.2.11.tar.gz.
File metadata
- Download URL: marona-0.2.11.tar.gz
- Upload date:
- Size: 31.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4e2e5274e1f0fad98aac5561f91852b096c60bf9f683a2efd029ef7e15c8213f
|
|
| MD5 |
a4bb4704c7ef5685776fa98bf0053221
|
|
| BLAKE2b-256 |
dc65221e824230715298b8b5d02432c9181ff1429bf0ef9bb283341f9bc9cd5e
|
File details
Details for the file marona-0.2.11-py3-none-any.whl.
File metadata
- Download URL: marona-0.2.11-py3-none-any.whl
- Upload date:
- Size: 26.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2eb78ec66cc997a2f763309e1b20919ff5331b6258173e8211779507c78a8493
|
|
| MD5 |
280478d8d7fcc72df59acab2af359a5b
|
|
| BLAKE2b-256 |
7c6e2c6a13722edd2636fe3bbaa67065239d48b02ce98d4ee5225c90842fafb3
|