When using the Guest Chat API, the id for the same agent seems to change for each chat session - is there some way to consistently identify the same agent over multiple chat sessions ?
The response from /api/v2/webchat/guest/conversations/{conversationId}/members/{memberId}
The displayName will have a value if you have set an alias/nickname for your agent.
See here: https://help.mypurecloud.com/articles/add-an-agent-alias-name-and-image/
Note that a picture (for the agent) is also supported - this could help differentiate different people with same display name (I mean with same alias/nickname) if that is subject to happen in your case.
The memberId is indeed different every time a participant connects to the chat session.
This is the case if you have the same agent connects to two different sessions.
But it is also the case if you have a case like this one: Chat is first connected to Agent1, Agent1 transfers to Agent2, and Agent2 transfers to Agent1. This will result in 3 different memberIds.
The "non-disclosure" of an id to identify the agent on the Guest API side is per-design.
From authenticated side (Platform API based client connecting to PureCloud org, with credentials - implicit, code or client credentials), you can get access to the Conversation information and determine the id of the agents involved.
If you wish to ask for the support of a different behavior, you can request new features and share your use case to help with prioritization of new features at https://purecloud.ideas.aha.io/ideas.