Calculating Service Level % from Analytics API interval data in Python

Hey everyone,

I’m trying to calculate our real-time Service Level percentage using the Genesys Cloud Analytics API. I’ve been pulling interval data via the Python SDK, but the math isn’t matching what I see in the UI.

Here is the snippet I’m using to fetch the data:

from genesyscloud import analytics_api

analytics = analytics_api.AnalyticsApi(configuration)
response = analytics.get_routing_offers_intervals(
 interval="PT5M",
 query_filter="id:my-queue-id",
 view="realtime"
)

for interval in response.entities:
 # Trying to calc SL here
 offered = interval.offer_stats.offer_count
 answered = interval.answer_stats.answer_count
 sl_pct = (answered / offered) * 100

The issue is that offer_stats.offer_count seems to include abandoned calls, which skews the percentage way down. The documentation mentions answer_stats and offer_stats but doesn’t explicitly say how to filter out abandonments for the SL calculation in the interval payload.

Is there a specific field in the interval object that gives me the count of answers within the threshold time? I’m just looking for a simple percentage calculation for my WFM dashboard script. The current output is way off compared to the queue monitor.

Any pointers on the correct fields to use?