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

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.0
File Size Uploaded
applooma_bot-0.1.0.tar.gz 9.6 kB Details

Built distribution (wheel)

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

Total release size: 19.2 kB

Release files / applooma_bot-0.1.0.tar.gz

Download URL applooma_bot-0.1.0.tar.gz
Size 9.6 kB
Tags Source
SHA-256 checksum
How to use checksums
01e787eb4a90e891598c49cda83d327b78472d96b1906131d5caff4faa8474d4
BLAKE2b-256 checksum
How to use checksums
9211ad00eb90769c7a0f38e1a3c31ae90167f4a225e0a1acf18880d24c7585a9
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.0-py3-none-any.whl

Download URL applooma_bot-0.1.0-py3-none-any.whl
Size 9.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b97e16f201d4f60b6989f76e508332a4772cafc45c34f0c306fe57d89f85d4b9
BLAKE2b-256 checksum
How to use checksums
3784a4aa9a34a4a061b9de17acbd6aea83af8d68e938e2d0815f76dd6bf7f457
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

0.1.1

2 release files

This release

0.1.0 This release

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