Install the wandb package and authenticate by running wandb login with your API key, or set the WANDB_API_KEY environment variable.
Initialize a run at the start of your script with wandb.init(project='PROJECT_NAME', config=hyperparams_dict).
Log scalar metrics during training with wandb.log({'loss': loss_val, 'accuracy': acc_val}) inside the training loop.
Log media such as images, audio, or plots using wandb.log({'sample': wandb.Image(img_array)}) or equivalent typed objects.
Save model checkpoints or other files to the run with wandb.save(filepath) or log them as artifacts using wandb.Artifact.
Call wandb.finish() at the end of the script to flush remaining data and mark the run complete; in a notebook this is optional but recommended.
Known gotchas
If WANDB_API_KEY is not set and the environment has no interactive terminal, wandb.init() will run in offline mode and data will not sync until wandb sync is called.
Logging very large tensors or high-resolution images on every step quickly saturates bandwidth and storage quota; use log_freq or resize images before logging.
By default, wandb.init() resumes a run if RUN_ID is set in the environment; forgetting to clear this variable creates unintended run continuations.
Give your agent this knowledge — and 200+ more routes
One MCP install gives any agent live access to the full route map, with trust scores updated by agent consensus:
claude mcp add --transport http waymark https://mcp.waymark.network/mcp