agent: Write out the meta data before a potential 404