cold-yacht-71881
10/05/2025, 11:12 AMclass Assistant(Agent):
def __init__(self) -> None:
super().__init__(
instructions="""You are a helpful assistant.""",
)
async def entrypoint(ctx: agents.JobContext):
session = AgentSession(
llm=groq.LLM(
model="openai/gpt-oss-120b",
temperature=0.3,
api_key=os.getenv("GROQ_API_KEY"),
),
)
usage_collector = metrics.UsageCollector()
@session.on("metrics_collected")
def _on_metrics_collected(ev: MetricsCollectedEvent):
metrics.log_metrics(ev.metrics)
usage_collector.collect(ev.metrics)
await session.start(
room=ctx.room,
agent=Assistant(),
room_output_options=RoomOutputOptions(
audio_enabled=False,
transcription_enabled=True,
),
room_input_options=RoomInputOptions(
audio_enabled=False,
text_enabled=True,
),
)
await ctx.connect()
if __name__ == "__main__":
agents.cli.run_app(agents.WorkerOptions(entrypoint_fnc=entrypoint))
I want to run a chat only agent, but it is not working
2025-10-05 160709,464 - INFO livekit.agents - registered worker {"id": "AW_XfuyP3ss9oY7", "url": "wss://testing-almyka57.livekit.cloud", "region": "India West", "protocol": 16}
2025-10-05 160710,198 - DEBUG livekit.agents - using audio io: (none) -> AgentSession -> (none) {"pid": 504810, "job_id": "AJ_6cBwLdowwjCR"}
2025-10-05 160710,199 - DEBUG livekit.agents - using transcript io: AgentSession -> RoomIO {"pid": 504810, "job_id": "AJ_6cBwLdowwjCR"}
2025-10-05 160713,773 - INFO livekit.agents - LLM metrics {"model_name": "openai/gpt-oss-120b", "model_provider": "api.groq.com", "ttft": 0.59, "prompt_tokens": 81, "prompt_cached_tokens": 0, "completion_tokens": 23, "tokens_per_second": 38.83, "pid": 504810, "job_id": "AJ_6cBwLdowwjCR"}
2025-10-05 160723,587 - INFO livekit.agents - LLM metrics {"model_name": "openai/gpt-oss-120b", "model_provider": "api.groq.com", "ttft": 0.28, "prompt_tokens": 105, "prompt_cached_tokens": 0, "completion_tokens": 38, "tokens_per_second": 120.68, "pid": 504810, "job_id": "AJ_6cBwLdowwjCR"}tall-airline-16756
10/05/2025, 11:12 AMtall-airline-16756
10/05/2025, 11:13 AMuseTextStreamLogger can really help you follow the message flow and spot where things might be going off track.
• Connection Monitoring: Keep an eye on the agent’s connection state. If there are brief disconnections, it’s a good idea to wait a moment before disconnecting to keep things smooth.
• Configuration Consistency: Double-check that the agent name in WorkerOptions matches the agent_name in the RoomAgentDispatch rule. This little detail is key to making sure your agent works just right.
• Operational Best Practices: Running multiple servers for each agent name can help you avoid single points of failure and keep your service reliable and available.
• Frontend User Experience: Consider adding visual cues to let users know when the agent is ready, and make sure the UI updates smoothly as the session state changes.
If you’d like to see everything in action, the Agents Chatbot example is a fantastic resource showing a full server-side agent setup along with frontend integration. I hope this helps you get everything running smoothly! Sources: complex-agents/role-playing/role_playing_frontend/components/session-view.t... | components/session-view.tsx | web/src/components/chat.tsx | SIP troubleshooting guide | LiveKit Docs | Operational Guidance & Best Practices | livekit/livekit_composite | DeepWik...