How do you remove specific element from array?

You can use this method to find the index of the agent (since agent is comparable)

    # Returns the first index whose element in `Input` equals `ElementToFind`.
    # Fails if ElementToFind does not exist in the array.
    (Input:[]t where t:subtype(comparable)).Find<public>(ElementToFind:t)<computes><decides>:int = external {}

Then in your example just replace 0 with the found index :+1: