Skip to content

Guide · Agent skill

How to use the SwanLab experiment tracking agent skill

Updated · written with AI from the project's own documentation and checked against our catalogue data

The SwanLab experiment tracking skill teaches an AI agent to instrument machine learning training code with SwanLab, an open-source experiment tracker. It is written for ML engineers and researchers who want to log metrics, configs and media for each training run and view them in a browser. After following this guide you will know how to install the skill, ask the agent for logging code, and run the result with the required packages.

SwanLab Experiment TrackingOrchestra-Research/AI-Research-SKILLs · MIT

Quick start

  1. 1Download and unzip the skill. Download the ZIP from this page and unzip it into ~/.claude/skills/ or a project's .claude/skills/ folder.
  2. 2Or upload it in the Claude apps. In the Claude apps, open Settings → Capabilities → Skills and upload the skill.
  3. 3Install the packages. Install swanlab, pillow and soundfile at the versions listed, plus swanlab[dashboard] if you want the local dashboard.
  4. 4Log in if needed. Run swanlab login for cloud or self-hosted use, and set SWANLAB_API_KEY as an environment variable.
  5. 5Ask the agent for logging code. Describe your training script and ask for SwanLab logging, naming the framework if you use one.
  6. 6Run the training script. Execute the generated script in your environment and check the run in the SwanLab dashboard.
  7. 7View local logs. For local runs, use swanlab watch -l on your log directory to open the dashboard.

What an agent skill is and what this one does

An agent skill is a folder of instructions and reference files that an AI agent loads when a task matches the skill's description. This skill is named experiment-tracking-swanlab and its SKILL.md file is the entry point, with references/integrations.md and references/visualization.md holding more detailed patterns.

Once installed, the agent knows how to add code that records scalar metrics, hyperparameter configs, images, audio, text, GIFs, point clouds, molecules and custom charts for each run. It can also set up a local or self-hosted dashboard so results are viewed in a browser instead of only in a managed cloud service.

Install the skill from the ZIP or the Claude apps

Download the ZIP of this skill from this page and unzip it. For a personal setup, place the unzipped folder in ~/.claude/skills/. For a single project, place it in that project's .claude/skills/ folder.

If you use the Claude apps, you can instead upload the skill under Settings → Capabilities → Skills.

  • Personal: ~/.claude/skills/
  • Project: .claude/skills/ inside your project
  • Claude apps: Settings → Capabilities → Skills

Install the Python packages the skill needs

The skill requires Python and the packages below. The source lists these install commands; run them in the environment where your training code runs.

The local dashboard needs the swanlab[dashboard] extra, and the framework integrations are optional. Run swanlab login only if you use cloud or self-hosted SwanLab.

  • Required: swanlab>=0.7.11, pillow>=9.0.0, soundfile>=0.12.0
  • Optional for local dashboard: swanlab[dashboard]
  • Optional frameworks: transformers, pytorch-lightning, fastai
pip install "swanlab>=0.7.11" "pillow>=9.0.0" "soundfile>=0.12.0" pip install "swanlab[dashboard]>=0.7.11" pip install transformers pytorch-lightning fastai swanlab login

Trigger the skill with a natural request

You do not need special syntax. Describe the job in plain language and mention SwanLab or the kind of tracking you want. The agent matches your request against the skill description, which mentions open-source run tracking, local or self-hosted dashboards and lightweight media logging.

Give the agent your training script or framework so it can add logging in the right place.

  • "Add SwanLab logging to my PyTorch training loop in train.py."
  • "Set up a local SwanLab dashboard so I can view runs offline."
  • "Log validation images and a loss curve to SwanLab for my Transformers fine-tune."

Examples of what the agent writes

For a plain PyTorch loop, the agent typically calls swanlab.init with a project, an experiment name and a config dictionary, then calls swanlab.log every few batches with names such as train/loss. For HuggingFace Transformers, it sets report_to="swanlab" in TrainingArguments. For PyTorch Lightning it uses SwanLabLogger, and for Fastai it uses SwanLabCallback.

For local-only work, the skill uses mode="local" with a logdir, then swanlab watch to view the logs and swanlab sync to upload them later.

swanlab watch -l ./swanlog swanlab sync ./swanlog

Check the network and script safety notes

This skill runs scripts and uses the network. The code it writes is Python that you run yourself, so review it before execution. Cloud and self-hosted use need a SwanLab account or self-hosted server and an API key, which the source says is read from SWANLAB_API_KEY.

Local mode with the dashboard extra does not need an account, but the skill's network use depends on whether you log to the cloud or a server. Check the host value before running code that sends data.

  • Review generated scripts before running them.
  • Keep API keys in environment variables such as SWANLAB_API_KEY, not in source files.
  • Use mode="local" when data must stay on your machine.

Tips for getting good results

Use stable, grouped metric names such as train/loss and val/loss so runs line up in charts. Store hyperparameters in config so each run records what produced it. Ask the agent to include run.finish() so runs close cleanly.

If you compare several runs, give each one a clear experiment_name, such as resnet18-seed42.

  • Use prefixes like train/ and val/ for metric names.
  • Put every hyperparameter in the config dictionary.
  • Name experiments by the variable you changed.

What people use it for

  • Track loss and accuracy curves for a PyTorch MNIST MLP and compare learning rates across runs.
  • Log sample images, audio clips or GIF predictions from a validation step for visual inspection.
  • Enable SwanLab reporting in a HuggingFace Transformers fine-tune with report_to="swanlab".
  • Keep private or offline experiments in a local log directory and view them with swanlab watch.
  • Add a Fastai or PyTorch Lightning callback to an existing training pipeline.

Frequently asked questions

How do I install the SwanLab agent skill?

Download the ZIP from this page and unzip it into ~/.claude/skills/ for personal use or into a project's .claude/skills/ folder. In the Claude apps you can upload it under Settings → Capabilities → Skills.

What are the requirements for this skill?

You need Python and the packages swanlab>=0.7.11, pillow>=9.0.0 and soundfile>=0.12.0. The local dashboard needs swanlab[dashboard], and transformers, pytorch-lightning or fastai are optional depending on your framework.

Is SwanLab free and open source?

The skill is listed under the MIT licence, and the source describes SwanLab as an open-source experiment tracker. Check the SwanLab project for its own terms before relying on any hosted service.

Do I need an account to use it?

Not for local logging with mode="local". Cloud or self-hosted use requires a SwanLab account or self-hosted server and an API key, which the source reads from SWANLAB_API_KEY.

Can I use SwanLab without sending data to the cloud?

Yes. The skill shows local logging with a logdir and viewing it with swanlab watch, and you can upload later with swanlab sync when you choose.

How does SwanLab compare with Weights & Biases or MLflow?

This skill covers SwanLab only and does not compare it with other trackers. It fits best if you want open-source run tracking with local or self-hosted dashboards, and if your team already uses another tracker, that tool's own skill or docs are the better fit.

New agent skills, repos and AI tools — every week

The best new skills and open-source projects, the fastest-growing repos, and one free prompt. Five minutes to read. Unsubscribe anytime.

Our verdict

Use this skill if you write PyTorch, Transformers, Lightning or Fastai training code and want an agent to add SwanLab logging and a local or self-hosted dashboard. Pick something else if your team has standardised on another tracker, or if you have no training code to instrument, since the skill is about writing and running Python logging code.

Download the skill