Programmatically querying persisted workflow instances