Open meetakshay99 opened 5 days ago
@meetakshay99 we just made our own API that connects the agents instead of using the livekit job scheduling to accomplish this. You can manually connect to the room and manually create an agent in a python function.
I have multiple agents manually created and being used. But how do I "connect" to an agent? Can you pls share more details on what and how was it exactly done?
I have multiple agents manually created and being used. But how do I "connect" to an agent? Can you pls share more details on what and how was it exactly done?
That connects with the room. I am already doing that. However, it does not allow me to specify which agent to connect to, which is what I am looking for.
I have multiple agents manually created and being used. But how do I "connect" to an agent? Can you pls share more details on what and how was it exactly done?
Let's say you have a http service somewhere:
At a high level:
will connect it to a room that you've created:
utils.http_context._new_session_ctx()
try:
room_options = rtc.RoomOptions()
room = rtc.Room()
url = os.getenv('LIVEKIT_URL')
api_key = os.getenv('LIVEKIT_API_KEY')
api_secret = os.getenv('LIVEKIT_API_SECRET')
token = api.AccessToken(api_key=api_key, api_secret=api_secret) \
.with_identity(os.getenv('AGENT_IDENTITY')) \
.with_name("Your agent name") \
.with_kind("agent") \
.with_grants(api.VideoGrants(
can_update_own_metadata=True,
room_join=True,
room=room_name,
agent=True
))
jwt = token.to_jwt()
await room.connect(url=url, token=jwt, options=room_options)
assistant = // initialize your agent
assistant.start(room)
await some_close_condition_you_decide
await assistant.aclose()
await room.disconnect()
finally:
await utils.http_context._close_http_ctx()
That's the basic idea. That will work with a simple aiohttp server to spawn the agent to get started.
I have a Livekit server deployed to which there are 3 different LiveKit agents connected. I want a way to allow user to specify which one of those 3 to be connected to. I tried following:
I would appreciate any suggestions or ideas to achieve the desired result. Thank you.