SAGEA LogoDocs & API
CookbooksCursus Cookbooks

Track a Training Run

Log a complete training run to Cursus with metrics, config, and a clean finish.

  • Initialize a run with project name and hyperparameters
  • Log scalar metrics at each training step
  • Mid-run config updates synced back to the server
  • Clean finish with crash handling

Time to complete: ~5 minutes

Prerequisites

  • pip install sagea-cursus
  • CURSUS_API_KEY and CURSUS_BASE_URL set in your environment
  • A Cursus server instance (hosted or self-hosted)

Step 1: Set up credentials

export CURSUS_API_KEY="cursus_..."
export CURSUS_BASE_URL="https://your-cursus-instance.example.com"

Step 2: Write the training script

# train.py
import sagea_cursus as cursus
 
run = cursus.init(
    project="my-experiment",
    config={"lr": 1e-3, "epochs": 50, "batch_size": 32},
    name="baseline-run",
    tags=["v1", "baseline"],
)
print("view at:", run.url)
 
try:
    for epoch in range(50):
        # simulate training
        loss = 1.0 / (epoch + 1)
        acc = epoch / 50
 
        cursus.log({"train/loss": loss, "train/acc": acc}, step=epoch)
 
        # mid-run config update (debounced, synced back)
        if epoch == 25:
            cursus.config.update({"lr": 1e-4})
 
    cursus.finish()
except Exception:
    cursus.finish("crashed")
    raise

Step 3: Run it

python train.py

The script prints a dashboard URL. Open it to see metrics streaming in real time.

Step 4: Verify on the dashboard

After finish(), the dashboard shows:

  • Metrics tab: loss and accuracy curves over 50 steps
  • Config tab: initial config + the mid-run lr update at step 25
  • Overview: status finished, project my-experiment, tags v1, baseline

What's next

On this page