Does livekit agent session minutes count when both...
# ask-ai
a
Does livekit agent session minutes count when both the agent and the user is in active in a session that is not yet disconnected or it is always counting from when the user starts to when they disconnected regardless of activity or inactivity
t
Thanks for reaching out, David. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
Thank you for reaching out! Just to clarify, LiveKit calculates agent session minutes by tracking the active time an agent is connected to a WebRTC or Telephony session. Every minute that an agent is actively helping a user counts towards this, and this wonderful service also includes hosting, unlimited data transfer, and access to observability features. If you have any more questions or need further help, feel free to ask—we're here for you! Sources: Deploy and scale agents on LiveKit Cloud | Quotas and limits | LiveKit Docs
a
If the user and agent don’t say anything to 10 minutes would livekit cloud still charge 0.01per min for those 10 minutes of in activity in that session?
t
Thank you for reaching out! I want to reassure you that LiveKit doesn’t charge for any inactive time during a session. Billing is based on active agent session minutes, which means the time when the agent is actively engaged with a user—like speaking, listening, or processing input. So, if both the user and agent are silent for 10 minutes, you won’t be billed for those quiet moments. I hope this helps clarify things for you! Sources: Quotas and limits | LiveKit Docs | Deploy and scale agents on LiveKit Cloud | tests/test_agent_session.py
a
How can i calculate how much active time was spent every session
t
Thanks for reaching out! Could you please let me know if you're trying to calculate active time using LiveKit's built-in analytics, API, or logs? That way, I can guide you with the best steps tailored to your setup.
a
Im yes i am. I am building a agent using react sdk and i want to have a analytic section for users to see how long they use the agent session for. I also need it to know how to charge their subscriptions. I want to count their time spent based one what livekit counts as minutes and not just when they start and join a room
t
I'd be happy to help you calculate active session time for analytics and subscription billing in your React SDK-based agent. Here's a simple approach you can follow: 1. Client-Side Tracking: You can listen to the
connected
and
disconnected
events from the LiveKit Room to track the session duration right on the client side. This is great for real-time insights, though it’s a good idea to double-check this data on the server for billing accuracy. 2. Server-Side Validation: To make sure everything is spot-on, you can use the LiveKit Analytics API. It provides session start and end times reported by the server, which helps keep your billing data accurate and secure. 3. Backend Integration: A helpful step is to send session metadata from the client to your backend. Then, you can query the Analytics API daily to get verified session durations. This way, you can confidently generate invoices or show usage analytics to your users. If you’d like, I can share some implementation examples or go into more detail—just let me know! I’m here to help. Sources: Voice Assistant Applications | livekit/livekit_composite | DeepWiki | Example Applications | livekit/livekit_composite | DeepWiki | Analytics API | LiveKit Docs | pkg/telemetry/events_test.go | observability/sessiontimer.go