Skip to main content

Agent Framework plugin for Spatius Avatar

Project description

LiveKit Agents Plugin for Spatius Avatar

LiveKit Agents plugin for Spatius avatar sessions. It forwards TTS audio from a LiveKit agent session to Spatius and lets the avatar publish synchronized audio/video back into the same room.

Installation

pip install livekit-plugins-spatius

Quick Start

Set credentials:

export SPATIUS_API_KEY=your-api-key
export SPATIUS_APP_ID=your-app-id
export SPATIUS_AVATAR_ID=your-avatar-id

export LIVEKIT_URL=wss://your-livekit-host
export LIVEKIT_API_KEY=your-livekit-api-key
export LIVEKIT_API_SECRET=your-livekit-api-secret

Use plugin in your LiveKit agent:

from livekit.agents import Agent, AgentSession, JobContext, WorkerOptions, cli
from livekit.plugins import spatius


class VoiceAssistant(Agent):
    def __init__(self) -> None:
        super().__init__(instructions="You are a helpful voice assistant.")


async def entrypoint(ctx: JobContext) -> None:
    await ctx.connect()

    session = AgentSession(
        vad=vad,
        stt=stt,
        llm=llm,
        tts=tts,
    )

    avatar = spatius.AvatarSession()
    await avatar.start(session, room=ctx.room)

    await session.start(agent=VoiceAssistant(), room=ctx.room)


if __name__ == "__main__":
    cli.run_app(WorkerOptions(entrypoint_fnc=entrypoint))

AvatarSession defaults to region="us-west" and composes Spatius endpoints from that region. To use another region:

avatar = spatius.AvatarSession(region="us-east")

Explicit endpoint URLs still override region:

avatar = spatius.AvatarSession(
    console_endpoint_url="https://console.example.com/v1/console",
    ingress_endpoint_url="wss://api.example.com/v2/driveningress",
)

For detailed usage, see Spatius docs.

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

livekit_plugins_spatius-1.4.5rc1.tar.gz (11.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

livekit_plugins_spatius-1.4.5rc1-py3-none-any.whl (10.6 kB view details)

Uploaded Python 3

File details

Details for the file livekit_plugins_spatius-1.4.5rc1.tar.gz.

File metadata

File hashes

Hashes for livekit_plugins_spatius-1.4.5rc1.tar.gz
Algorithm Hash digest
SHA256 51ab2c51673b51fbc6ecb7dbad496a7d59d0763cc19a58042ef5706dec449273
MD5 c8516c6473c4c7567b6657d28500df0a
BLAKE2b-256 0157456464030b7a91d89b5704be3af4fa3e05a627dad7ac0b24b60b076f5038

See more details on using hashes here.

Provenance

The following attestation bundles were made for livekit_plugins_spatius-1.4.5rc1.tar.gz:

Publisher: publish.yml on spatius-ai/livekit-plugins-spatius

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file livekit_plugins_spatius-1.4.5rc1-py3-none-any.whl.

File metadata

File hashes

Hashes for livekit_plugins_spatius-1.4.5rc1-py3-none-any.whl
Algorithm Hash digest
SHA256 978742d99e0e17c2729bcbdbc0635237fd79ba2338f5baad58570477ad108cb7
MD5 f8c0fe6e777ee14bd3dcedcff2da1c3c
BLAKE2b-256 448b8b4e420ca476ca7dd238434ed4a2480b294a43fd507798285d238fe93098

See more details on using hashes here.

Provenance

The following attestation bundles were made for livekit_plugins_spatius-1.4.5rc1-py3-none-any.whl:

Publisher: publish.yml on spatius-ai/livekit-plugins-spatius

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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