Realtime API: is it possible to track with event triggered a response?

Typically we trigger a response by submitting a `response.create` event. In case of multiple `response.create` events have been sent, it would be great to be able to know which events actually triggered the current response (e.g., for debugging purpose).

Does anybody know how to obtain this information?

Thank you in advance for your replies!

I don’t think the Realtime API currently exposes a direct “triggering client event ID” field on server events.

response.create can include an optional client-side event_id, but the later response.created event has its own server-side event_id and the new response.id. It does not appear to echo the original response.create.event_id.

For debugging, the best workaround is to include
your own correlation ID in response.metadata:

{
  "type": "response.create",
  "event_id": "client_event_123",
  "response": {
    "metadata": {
      "client_event_id": "client_event_123",
      "debug_reason": "manual_retry"
    }
  }
}

Then inspect response.metadata on response.created or response.done and map it to the returned response.id.

One related detail: only one Response can write to the default Conversation at a time, but out-of-band responses can run in parallel. The docs specifically call out metadata as a useful way to disambiguate simultaneous Responses.

Using metadata is a very nice trick. Thanks a lot @VeitB !