How to correlate dispatched agent with participant joined event

This question originally came up in our Slack community and the thread has been consolidated here for long-term reference.

Is there any easy way to determine the identity of an agent you dispatch?

For example, if I dispatch agent A by name (explicit dispatch), I don’t have a way to correlate the next participant_joined event with the dispatch I made. None of the attributes in participant_joined tell me if the agent that joined is the one I dispatched.

Include the agent name in the dispatch metadata (as JSON). The metadata will then be available through the JobContext on the agent side.

However, the server that handles dispatches and processes webhooks still won’t automatically know which identity to correlate with the dispatch. You would need to have the agent communicate this information back to your server.