README_EN.md

August 13, 2026 · View on GitHub

SwanLab

SwanLab.skill

Teach agents to write SwanLab tracking code and query experiment data correctly.

SwanLab Website SwanLab Docs ModelScope Skill Agent Skill Skill Version SkillHub License

This skill covers two usage patterns: writing training tracking code with the Python SDK (swanlab.init / swanlab.log / swanlab.finish + multimedia logging), and querying experiment metrics, logs, summaries, and media with the swanlab api CLI. The agent first reads the capability reference routed by task, then generates code or runs queries — avoiding API misuse.

中文 · Installation · Contents · Capabilities · Run Modes · Packaging


Installation

If you're using coding agent like Claude Code or Codex, just send it the following prompt to install automatically:

Fetch the installation guide and follow it: https://raw.githubusercontent.com/SwanHubX/SwanLab-Skill/main/README.md

For manual installation, the recommended way is a global install:

npx skills add SwanHubX/SwanLab-Skill -g -y

You can also view the skill page on ModelScope or SkillHub.

Note: -g installs at user level and -y skips interactive confirmation. Nothing is written into the current project — the skill is downloaded to .agents/skills under your home directory, with symlinks created for Claude Code, Codex, and other CLIs that support Agent Skills. Multiple agent CLIs under the same user can share this single copy.

Then log in to SwanLab:

pip install swanlab
swanlab login          # paste your API key from https://swanlab.cn
swanlab ping           # (optional) check connectivity
swanlab verify         # (optional) validate credentials

To update the skill later:

npx skills update swanlab-skill -g -y

Contents

skills/
└── swanlab-skill/
    ├── SKILL.md
    ├── references/
    │   ├── SDK_QUICKSTART.md
    │   ├── CLI_REFERENCE.md
    │   └── SWANLAB_CONCEPTS.md
    └── scripts/
        ├── plot_metrics.py
        └── runs_benchmark.py
FilePurpose
SKILL.mdLightweight entry point and task router — tells the agent whether to read the SDK or CLI reference
references/SDK_QUICKSTART.mdTracking code quickstart: swanlab.init / log / finish and media logging (image / audio / text)
references/CLI_REFERENCE.mdQuery metrics, logs, summaries, columns, and media, and filter experiments via swanlab api
references/SWANLAB_CONCEPTS.mdData model, terminology, and path convention (user/project/run_id)
scripts/plot_metrics.pyLine chart of a single experiment's scalar metrics
scripts/runs_benchmark.pyCompare the same metric across experiments (normalization + best-run ranking)

Capabilities

CapabilityHowEntry point
Log metrics & rich media (image / audio / text) during training and fine-tuningPython SDKreferences/SDK_QUICKSTART.md
Inspect a run's metrics, logs, summaries, columns, and mediaswanlab api run ... CLIreferences/CLI_REFERENCE.md
List / filter experiments by config or summary conditionsswanlab api run filter CLIreferences/CLI_REFERENCE.md
Manage projects, self-hosted users, and other resourcesswanlab api project / user CLIreferences/CLI_REFERENCE.md
Understand the data model & terminology before queryingreferences/SWANLAB_CONCEPTS.md
Plot a single experiment's scalar metrics as a line chartHelper scriptscripts/plot_metrics.py user/proj/run -k loss,acc -o chart.png
Compare the same metric across multiple experiments (normalization + best-run ranking)Helper scriptscripts/runs_benchmark.py user/proj/r1 user/proj/r2 -k loss --direction lower

Both helper scripts accept --data file.json to render from previously saved query output, and require swanlab login (or --api-key / --host).

Run Modes

swanlab.init(mode=...) controls where data goes:

ModeLocal StorageCloud UploadUse Case
onlineYesYesNormal cloud usage. Requires login.
localYesNoAir-gapped / no account needed.
offlineYesNoSave locally, upload to cloud later via swanlab sync.
disabledNoNoCompletely disable all logging.

Packaging

Build the release archive:

make package

The generated dist/swanlab-skill.zip extracts to:

SKILL.md
references/
scripts/

So it can be extracted directly into a skill directory such as .claude/skills/swanlab-skill/.

License

MIT License.

Copyright (c) 2026 Emotion Machine (Beijing) Technology Co., Ltd.