One of our engineers did something similar.....you could try this
# PEER NAME
:local peer "HE"
# PREFIXES - SET A COMMENT TO KNOW WHICH ONES SHOULD BE ENABLE
:local peerOutFilterIdentifier "HE-OUT-PREFIXES"
# UPTIME IN MKT FORMAT
:local enoughUptime 10m
# GET CURRENT UPTIME
:local currentUptime [:routing bgp peer get value-name=uptime [:routing bgp peer find where name=$peer]]
# IS IT ENOUGH?
:if ($currentUptime > $enoughUptime) do={
# ENABLE THE FILTER
/routing filter enable [:routing filter find where comment=$peerOutFilterIdentifier]
} else={
# DISABLE THE FILTER
/routing filter disable [:routing filter find where chain=$peerOutFilterIdentifier]
}
You can put that into a scheduler every 1min or so.
There may be more efficient ways to do it, but this should work.