TestProject Forum

Is there a way to retrieve agent id of a newly registered agent?

I have built an app that is using agent's id to trigger tests via your API. I run my containerised app together with containerised agent and chrome. I use persistent volume so I can always use the same agent.

However each time when I deploy my app (first time deployment) and a new agent is registered I have to go to check agent's id on your website. Then I need to update k8s deployment. I run my app in many different environments so I have to repeat that process quite often. Additionally each update to infrastructure is an additional PR.

Is there a way that I could retrieve id of a newly registered agent? Maybe via API or any other way? That way I could deploy only once. Make my app wait for agent to run, then query agent’s id, then trigger tests with my app, all in one go.

Hello @mkulik,

You could make a request to this endpoint:
And then search for your agent by it’s alias (if it is known to you) or by the “lastHeartBeat” field in the response(and then just look for the most latest HeartBeat), then from that object you can extract the agentID.

brilliant, thank you @artem.kuznetsov