Microsoft Entra does not provide a direct API to determine if a user is inactive or has logged out of the tenant. The reason for this is the nature of token-based authentication used by Entra. When a user signs out, it does not necessarily invalidate their token - the token will continue to be valid until it expires.
The SignIn logs from Microsoft Graph API can be used to find when a user last signed in, but it doesn't track when a user signs out or if a user is inactive.
Some suggestions to try can be using User Presence Information If you're using Teams - https://graph.microsoft.com/beta/users/{id}/presence or using Entra audit logs to check for recent activities - https://docs.microsoft.com/en-us/graph/api/resources/azure-ad-auditlog-overview?view=graph-rest-1.0
That said, I would suggest a review of the action that requires you to check if a user is active. Often times if a user should not be active, an admin can invalidate all logins. See https://learn.microsoft.com/en-us/entra/identity/users/users-revoke-access.