As I cannot simply upload infinitely many weights using artifacts, I also want to store some locally.
For naming, I would like to use the sweep id and/or the run id.
Can I access that somehow in the train function I hand over to the agent?
The wandb.Run object that is returned from wandb.init contains this information as properties. You should be able to access run.id and run.sweep_id in the train function after calling run = wandb.init(...).