[Streaming textual data from the agent] We have wr...
# agents
e
[Streaming textual data from the agent] We have written a chain of agents using LiveKit Agents. So far so good when it comes to the webRTC / SIP etc. But we were asked to re-use existing agents but instead of webRTC stack we have to use other transport like http stream or websockets or grpc. The transport itself is not as important atm, because I cannot find a way to stream an llm tokens while avoiding webRTC. Consider following snippet:
Copy code
session: AgentSession = make_session(...)
agent: Agent = make_agent(...)

await session.start(agent) // This will create RoomIO, but what we really want here is the response from llm directly so:

result = await session.run(user_input="Some input, i'd be good if we have an option to pass a some sort of text stream here")

# The only option i found is to:
for ev in result.events: 
   ... but here, the responses are already merged (strings instead of streams)

# but the api I'm looking for (or similar): 
async for chunk in session.llm.start_stream():
    yield  chunk
Is there an option to remain agent handoffs / and other cool stuff but avoid webrtc transport? I mean - i get that it LiveKit Agents are webrtc based, but we do not want to resign from the agents handoff features etc just because we need only textual data. Ofc it is always the option to separate common business logic from the agents for good and try to roll our own solution around just llm api, or go to already built text-based agent frameworks.
👀 1
r
LiveKit agents communicate with web and sip participants with WebRTC. That currently is a core feature that cannot be turned off. The LLM, STT, TTS is not over WebRTC.
👍 1
You could create a Python client that joins the room as a participant and relays (bridge) the communication from WebRTC to HTTPS.
e
Thank you!