Giter Club home page Giter Club logo

agents-playground's Introduction

The LiveKit icon, the name of the repository and some sample code in the background.

LiveKit: Real-time video, audio and data for developers

LiveKit is an open source project that provides scalable, multi-user conferencing based on WebRTC. It's designed to provide everything you need to build real-time video audio data capabilities in your applications.

LiveKit's server is written in Go, using the awesome Pion WebRTC implementation.

GitHub stars Slack community Twitter Follow GitHub release (latest SemVer) GitHub Workflow Status License

Features

Documentation & Guides

https://docs.livekit.io

Live Demos

Ecosystem

  • Agents: build real-time multimodal AI applications with programmable backend participants
  • Egress: record or multi-stream rooms and export individual tracks
  • Ingress: ingest streams from external sources like RTMP, WHIP, HLS, or OBS Studio

SDKs & Tools

Client SDKs

Client SDKs enable your frontend to include interactive, multi-user experiences.

Language Repo Declarative UI Links
JavaScript (TypeScript) client-sdk-js React docs | JS example | React example
Swift (iOS / MacOS) client-sdk-swift Swift UI docs | example
Kotlin (Android) client-sdk-android Compose docs | example | Compose example
Flutter (all platforms) client-sdk-flutter native docs | example
Unity WebGL client-sdk-unity-web docs
React Native (beta) client-sdk-react-native native
Rust client-sdk-rust

Server SDKs

Server SDKs enable your backend to generate access tokens, call server APIs, and receive webhooks. In addition, the Go SDK includes client capabilities, enabling you to build automations that behave like end-users.

Language Repo Docs
Go server-sdk-go docs
JavaScript (TypeScript) server-sdk-js docs
Ruby server-sdk-ruby
Java (Kotlin) server-sdk-kotlin
Python (community) python-sdks
PHP (community) agence104/livekit-server-sdk-php

Tools

Install

Tip

We recommend installing LiveKit CLI along with the server. It lets you access server APIs, create tokens, and generate test traffic.

The following will install LiveKit's media server:

MacOS

brew install livekit

Linux

curl -sSL https://get.livekit.io | bash

Windows

Download the latest release here

Getting Started

Starting LiveKit

Start LiveKit in development mode by running livekit-server --dev. It'll use a placeholder API key/secret pair.

API Key: devkey
API Secret: secret

To customize your setup for production, refer to our deployment docs

Creating access token

A user connecting to a LiveKit room requires an access token. Access tokens (JWT) encode the user's identity and the room permissions they've been granted. You can generate a token with our CLI:

livekit-cli create-token \
    --api-key devkey --api-secret secret \
    --join --room my-first-room --identity user1 \
    --valid-for 24h

Test with example app

Head over to our example app and enter a generated token to connect to your LiveKit server. This app is built with our React SDK.

Once connected, your video and audio are now being published to your new LiveKit instance!

Simulating a test publisher

livekit-cli join-room \
    --url ws://localhost:7880 \
    --api-key devkey --api-secret secret \
    --room my-first-room --identity bot-user1 \
    --publish-demo

This command publishes a looped demo video to a room. Due to how the video clip was encoded (keyframes every 3s), there's a slight delay before the browser has sufficient data to begin rendering frames. This is an artifact of the simulation.

Deployment

Use LiveKit Cloud

LiveKit Cloud is the fastest and most reliable way to run LiveKit. Every project gets free monthly bandwidth and transcoding credits.

Sign up for LiveKit Cloud.

Self-host

Read our deployment docs for more information.

Building from source

Pre-requisites:

  • Go 1.22+ is installed
  • GOPATH/bin is in your PATH

Then run

git clone https://github.com/livekit/livekit
cd livekit
./bootstrap.sh
mage

Contributing

We welcome your contributions toward improving LiveKit! Please join us on Slack to discuss your ideas and/or PRs.

License

LiveKit server is licensed under Apache License v2.0.


LiveKit Ecosystem
Realtime SDKsReact Components · Browser · Swift Components · iOS/macOS/visionOS · Android · Flutter · React Native · Rust · Node.js · Python · Unity (web) · Unity (beta)
Server APIsNode.js · Golang · Ruby · Java/Kotlin · Python · Rust · PHP (community)
Agents FrameworksPython · Playground
ServicesLiveKit server · Egress · Ingress · SIP
ResourcesDocs · Example apps · Cloud · Self-hosting · CLI

agents-playground's People

Contributors

arsenstorm avatar davidzhao avatar dsa avatar keepingitneil avatar lukasio avatar mattherzog avatar ocupe avatar renovate[bot] avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

agents-playground's Issues

Action Required: Fix Renovate Configuration

There is an error with this repository's Renovate configuration that needs to be fixed. As a precaution, Renovate will stop PRs until it is resolved.

Location: renovate.json
Error type: The renovate configuration file contains some invalid settings
Message: packageRules[0]: packageRules cannot combine both matchUpdateTypes and rangeStrategy. Rule: {"matchSourceUrlPrefixes":["https://github.com/livekit/"],"rangeStrategy":"replace","matchUpdateTypes":["patch","minor"],"groupName":"LiveKit dependencies (non-major)","automerge":true}

Microphone issue on GCP VM

When clicking on connect button in playground , it should ideally ask for microphone permission from user . I am deploying this app in GCP virtual machine , it works great on localmachine (my laptop)

Instead it directly giving me this below error

Unhandled Runtime Error
TypeError: Cannot read properties of undefined (reading 'getUserMedia')
Source
src/components/playground/Playground.tsx (73:24) @ setMicrophoneEnabled

at this line

  71 |     if (roomState === ConnectionState.Connected) {
  72 |       localParticipant.setCameraEnabled(config.settings.inputs.camera);
> 73 |       localParticipant.setMicrophoneEnabled(config.settings.inputs.mic);
     |                        ^
  74 |     }
  75 |   }, [config, localParticipant, roomState]);
  76 |

error livekit playground

Reproduction

Deploying this app in GCP vm
Perfromed Initial setup like setting up .env ,

Here is the config that i used

NEXT_PUBLIC_APP_CONFIG="
title: 'LiveKit Agent Playground'
description: 'LiveKit Agent Playground allows you to test your LiveKit Agent integration by connecting to your LiveKit Cloud or self-hosted instance.'
github_link: 'https://github.com/livekit/agents-playground'
video_fit: 'cover' # 'contain' or 'cover'
settings:
  editable: true # Should the user be able to edit settings in-app
  theme_color: 'cyan'
  chat: true  # Enable or disable chat feature
  outputs:
    audio: true # Enable or disable audio output
    video: false # Enable or disable video output
  inputs:
    mic: true    # Enable or disable microphone input
    camera: false # Enable or disable camera input
    sip: true    # Enable or disable SIP input
"

Logs

No response

System Info

System:
  OS: Linux 6.5 Ubuntu 22.04.4 LTS 22.04.4 LTS (Jammy Jellyfish)
  CPU: (2) x64 Intel(R) Xeon(R) CPU @ 2.20GHz
  Memory: 1.49 GB / 1.91 GB
  Container: Yes
  Shell: 5.1.16 - /bin/bash
 Binaries:
  Node: 18.20.3 - /usr/bin/node
  npm: 10.7.0 - /usr/bin/npm
 npmPackages:
  livekit-client: ^2.1.5 => 2.2.0

Severity

blocking all usage of LiveKit

Additional Information

Feel Free to correct me if i made any mistakes

VisualizerState In Voice UI

Describe the problem

How can I call this functions on the playground app? On the agent side it works very well, but I can not access at the agents client? What can I do, I need it urgent :-/ .. or what do I have to change get it done?

Do I have to add it to the protocol code if yes, where?

I want to fill the <AgentMultibandAudioVisualizer with the state for

type VisualizerState = "listening" | "idle" | "speaking" | "thinking";

- user_started_speaking: the user started speaking
- user_stopped_speaking: the user stopped speaking
- agent_started_speaking: the agent started speaking
- agent_stopped_speaking: the agent stopped speaking
- user_speech_committed: the user speech was committed to the chat context
- agent_speech_committed: the agent speech was committed to the chat context
- agent_speech_interrupted: the agent speech was interrupted
- function_calls_collected: received the complete set of functions to be executed
- function_calls_finished: all function calls have been completed

https://github.com/livekit/agents/blob/39a59595c870d8822fdbf4e271b352b0521a573a/livekit-agents/livekit/agents/voice_assistant/assistant.py#L90

Describe the proposed solution

Adding VisualizerState to the Voice UI like Chat GPT App. How can I receive this State on the playground code from the Agent?

Alternatives considered

No response

Importance

I cannot use LiveKit without it

Additional Information

No response

App config does not work for building on soruce

Describe the bug

What I expect

when the appConfig is set the the app will build without issue for the example config

What happened

I got This build error

...
Compiled successfully
   Collecting page data ...
   Generating static pages (0/3) ...
parsedConfig:  title: 'LiveKit Agent Playground' description: 'LiveKit Agent Playground allows you to test your LiveKit Agent integration by connecting to your LiveKit Cloud or self-hosted instance.' github_link: 'https://github.com/livekit/agents-playground' theme_color: 'cyan' video_fit: 'cover' # 'contain' or 'cover' outputs: audio: true # Enable or disable audio output video: true # Enable or disable video output chat: true  # Enable or disable chat feature inputs: mic: true    # Enable or disable microphone input camera: true # Enable or disable camera input sip: true    # Enable or disable SIP input 

 ✓ Generating static pages (3/3) 
TypeError: Cannot read properties of undefined (reading 'audio')
    at m (/vercel/path0/.next/server/pages/index.js:1:26966)
    at Wc (/vercel/path0/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:68:44)
    at Zc (/vercel/path0/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:70:253)
    at Z (/vercel/path0/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:76:89)
    at Zc (/vercel/path0/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:70:481)
    at Z (/vercel/path0/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:76:89)
    at $c (/vercel/path0/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:78:98)
    at bd (/vercel/path0/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:77:404)
    at Z (/vercel/path0/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:76:217)
    at Zc (/vercel/path0/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:71:479)
Error occurred prerendering page "/". Read more: https://nextjs.org/docs/messages/prerender-error
TypeError: Cannot read properties of undefined (reading 'audio')
    at m (/vercel/path0/.next/server/pages/index.js:1:26966)
    at Wc (/vercel/path0/node_modules/react-dom/cjs/react-do
 ...

Reproduction

  1. Fork the repo.
  2. attempt to deploy on Vercel with the proper environmental variables

Logs

No response

System Info

I deployed on Vercel by using a fresh fork of the repo

Severity

serious, but I can work around it

Additional Information

This makes the config unuseable.

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Open

These updates have all been created already. Click a checkbox below to force a retry/rebase of any.

Detected dependencies

npm
package.json
  • @livekit/components-react ^2.3.1
  • @radix-ui/react-dropdown-menu ^2.0.6
  • cookies-next ^4.1.1
  • framer-motion ^10.16.16
  • js-yaml ^4.1.0
  • livekit-client ^2.1.5
  • livekit-server-sdk ^2.1.2
  • lodash ^4.17.21
  • next ^14.0.4
  • qrcode.react ^3.1.0
  • react ^18
  • react-dom ^18
  • @types/js-yaml ^4.0.9
  • @types/lodash ^4.17.0
  • @types/node ^20.10.4
  • @types/react ^18.2.43
  • @types/react-dom ^18
  • autoprefixer ^10.4.16
  • eslint ^8
  • eslint-config-next 14.2.4
  • postcss ^8.4.31
  • tailwindcss ^3.3.5
  • typescript ^5.3.3

  • Check this box to trigger a request for Renovate to run again on this repository

Each sentence is repeated

Describe the bug

image

Reproduction

Each sentence is repeated

Logs

No response

System Info

latest version 2024.6.6 clone the repo


### Severity

blocking all usage of LiveKit

### Additional Information

_No response_

There could be a feature button to export the chat record of the conversation.

Describe the problem

Chat Txet was peffect displayed in realtime, but still need a method to save & export the record of the conversation

Describe the proposed solution

that's would be nice adding a feature button inthe setting tab to export the chat record of the conversation.

Alternatives considered

No response

Importance

nice to have

Additional Information

No response

Video Frame Not Appearing in Livekit Playground on Mac M3 - Agent Status Stuck at "Starting"

Describe the bug

Hi I'm trying to test the playground with agent but the video frame doesn't appear somehow. It shows dark green color on the video section. And Agent connection True but agent status is "starting" forever.

Here is my code for agent. I'm using mac M3.
import logging
from livekit import rtc
from livekit.agents import JobContext, JobRequest, WorkerOptions, cli

WIDTH = 640
HEIGHT = 480

async def entrypoint(job: JobContext):
    room = job.room
    source = rtc.VideoSource(WIDTH, HEIGHT)
    track = rtc.LocalVideoTrack.create_video_track("video", source)
    options = rtc.TrackPublishOptions(source=rtc.TrackSource.SOURCE_CAMERA)
    publication = await room.local_participant.publish_track(track, options)
    logging.info("published track", extra={"track_sid": publication.sid})

async def request_fnc(req: JobRequest) -> None:
    logging.info("received request %s", req)
    await req.accept(entrypoint)

if __name__ == "__main__":
    from dotenv import load_dotenv
    import os

    load_dotenv()

    LIVEKIT_API_KEY = os.getenv("LIVEKIT_API_KEY")
    LIVEKIT_API_SECRET = os.getenv("LIVEKIT_API_SECRET")
    LIVEKIT_URL = os.getenv("NEXT_PUBLIC_LIVEKIT_URL")
    cli.run_app(WorkerOptions(request_fnc=request_fnc, api_key=LIVEKIT_API_KEY, api_secret=LIVEKIT_API_SECRET,ws_url=LIVEKIT_URL))

Could someone help?

Reproduction

Run the above code

Logs

No response

System Info

Mac m3, chrome

Severity

blocking all usage of LiveKit

Additional Information

No response

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.