Skip to main content

applooma-bot

Join an AppLooma RTC channel from Python as a regular participant (a bot): a voice agent, a transcription listener, a media relay, a moderation bot. Publish raw 16-bit PCM audio and raw I420/RGBA video, receive everyone else's media as raw frames, and exchange messages with the client SDKs.

pip install applooma applooma-bot

Python 3.9+. Prebuilt for Linux x86_64/aarch64 (glibc 2.28+), macOS arm64/x86_64 and Windows x64; no compiler needed. Beta (0.1.0): the API may change before 1.0.

import asyncio
from applooma import AppServerClient
from applooma_bot import AppBot, AppBotError

async def main():
    t = AppServerClient(api_key="...", api_secret="...").create_token(
        room_name="room1", identity="echo-bot", role="host")
    bot = await AppBot.join(url=t["wsUrl"], token=t["token"])

    @bot.on("user_joined")
    def joined(user):
        print(user.uid, "joined")

    @bot.on("audio_frame")            # frame.data: interleaved int16 PCM bytes
    async def echo(frame, user):
        await bot.publish_audio(frame)

    @bot.on("message")
    async def on_message(msg):
        if msg.text == "!bye":
            await bot.leave()
        else:
            await bot.send_message(f"echo: {msg.text}")

    await asyncio.sleep(3600)

asyncio.run(main())

API

  • await AppBot.join(url, token, *, auto_subscribe=True, receive_sample_rate=48000, receive_channels=1, receive_video_format="rgba")
  • await bot.publish_audio(AppAudioFrame(data, sample_rate, channels)) or publish_audio(pcm_bytes, sample_rate=48000, channels=1). The first call publishes the microphone; awaiting each call paces you to real time.
  • bot.publish_video(AppVideoFrame(data, width, height, "i420" | "rgba")). The first call publishes the camera.
  • await bot.send_message("text" | {...}): arrives on the client SDKs' message event.
  • await bot.leave(); AppBot is also an async context manager.
  • Events (bot.on(name, handler) or @bot.on(name), sync or async handlers): audio_frame(frame, user), video_frame(frame, user), message(msg), user_joined(user), user_left(user), disconnected(reason), error(err). Register frame handlers right after joining: frames are decoded only for tracks subscribed while a handler is attached.
  • Errors: AppBotError with .code one of unsupported_platform, join_failed, not_joined, invalid_frame, send_failed.

Docs: https://docs.applooma.dev/sdk/server-participant

Metadata

Release files for applooma-bot 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for applooma-bot 0.1.1
File Size Uploaded
applooma_bot-0.1.1.tar.gz 9.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for applooma-bot 0.1.1
File Interpreter ABI Platform
applooma_bot-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 19.8 kB

Release files / applooma_bot-0.1.1.tar.gz

Download URL applooma_bot-0.1.1.tar.gz
Size 9.9 kB
Tags Source
SHA-256 checksum
How to use checksums
97aa66e87ae52f661ed88a8975e430429e1db8a89b418e83ee0358b3b6bacdf9
BLAKE2b-256 checksum
How to use checksums
1acbc1fe9bf4ff61c0f42053a764ceb1d17aef9b1de97103913a5b7749efe6c9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.11

Release files / applooma_bot-0.1.1-py3-none-any.whl

Download URL applooma_bot-0.1.1-py3-none-any.whl
Size 9.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7ec27a36d75e701276e7fbb0f64637fbccd5ead7cd712ece5a8247234c9ebb4f
BLAKE2b-256 checksum
How to use checksums
68679d163e6035e5b8f751f237efebcbc8c595437123ab032912898d8de4fd03
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.11

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page