Initialize a run: run = wandb.init(project='my-project', job_type='train')
Declare an input artifact with run.use_artifact('my-dataset:latest') — this records data lineage and returns an artifact object whose files can be downloaded with artifact.download()
Create an output artifact: artifact = wandb.Artifact('my-model', type='model'), then add files with artifact.add_file('model.pt') or a directory with artifact.add_dir('checkpoints/')
Log the artifact to the run: run.log_artifact(artifact) — W&B assigns a new version number automatically if the content hash differs from the previous version
Assign a custom alias after logging: run.log_artifact(artifact, aliases=['production', 'v2']) or later via the API with artifact.aliases.append('champion') and artifact.save()
Consume the artifact in a downstream run with run.use_artifact('my-model:production') and call artifact.download() to retrieve files
Known gotchas
W&B versions are content-addressed: logging the same files again does not create a new version — the version counter only increments when the content hash changes
The 'latest' alias always points to the most recently logged version; if you rely on 'latest' in downstream pipelines, a re-run that logs a worse checkpoint will silently update the alias
artifact.download() returns a local path to cached files; on shared machines the cache directory (by default ~/.cache/wandb) can grow large and needs periodic pruning with wandb artifact cache cleanup
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