Syvain Metrics API Client
Python client for the Syvain Metrics v2 API. Use it to find and organize folders and experiments and to read one experiment's record, catalog, annotations, and series from code.
Pick the right tool:
- Analysis across experiments: the
syvain-metrics-duckdbextension attaches Metrics as a database with an on-disk cache. Use it for plots, tables, joins, and anything spanning a folder. - Recording training or evaluation jobs:
syvain-metrics-collectorqueues, batches, and delivers metrics in the background. This client's write session exists for API completeness, tests, and backfills. - Programmatic control and one-experiment reads: this client.
Install
uv add syvain-metrics-api-client
Connect
from syvain_metrics_api_client import Metrics
metrics = Metrics()
The client resolves credentials the same way as the syvain-metrics CLI. The
API key comes from api_key=, then SYVAIN_METRICS_API_KEY, then the login
saved by syvain-metrics auth login. The host comes from host=, then
SYVAIN_METRICS_HOST, then that login, then https://metrics.syvain.com.
Metrics is also a context manager that closes its HTTP session.
Folders and experiments
Address a folder by absolute path or id; / is the root. Address an experiment
by id or slug.
mamba = metrics.make_folder("/models/mamba") # creates missing parents
mamba = metrics.folder("/models/mamba") # MetricsNotFound when missing
mamba.folders() # direct children
mamba.experiments() # direct members
mamba.experiments("run-*", recursive=True) # slug glob, whole subtree
metrics.experiments("syv-2039-*") # every experiment matching a glob
exp = metrics.experiment("mamba-run-001")
exp.move("/archive")
mamba.rename("mamba-v2")
mamba.move("/")
Lookups use a snapshot of the folder tree, read on first use. Changes made
through the client refresh it. A folder() or experiment() lookup that
misses reads the tree again once before raising. Listings such as
folders() and experiments() use the snapshot as is, so call
metrics.refresh() to list what was created elsewhere. Folder and
Experiment are immutable values. A rename or move returns a new handle.
Read one experiment
info = exp.info() # status, description, meta, error, lifecycle datetimes
catalog = exp.catalog() # series names with their metadata keys and values
notes = exp.annotations() # every annotation, newest first
for series in exp.series("loss", where={"split": "valid"}):
print(series.metadata, series.steps, series.values)
series() returns one Series per metadata partition. Its steps,
timestamps_ms, and values are aligned. Pass one name, several names, or
none to read every series in the catalog. where matches exact metadata
values, has=("rank",) requires a key, and x="timestamp" orders points by
time instead of step. The client returns a series only after the stream
completes, so partial data is never returned.
Write session
with metrics.open_experiment(
"backfill-001", description="Imported run", meta={"seed": 7}, folder="/imports"
) as run:
run.start()
run.metric("loss", 0.25, step=1, metadata={"split": "train"})
run.done()
Each call is one acknowledged request. metrics() takes many MetricPoints
and sends up to 1000 per request. The session refreshes its experiment token
before it expires and revokes the token when the block exits. Reopening an
existing slug replaces its description and meta. An experiment already in
another folder stays there. A token left idle past its 24 hour expiry cannot be
refreshed, so reopen the experiment instead. For real training jobs use
syvain-metrics-collector.
Other events
metrics.send(event, data) sends any v2 organization event to
/api/v2/events and returns the reply data. The API reference is at
https://metrics.syvain.com/api/openapi.json.
Errors and retries
Every failure is a MetricsError with code, message, status, and
retryable. MetricsNotFound (also a LookupError) reports an unresolved
reference. MetricsAuthError reports missing credentials.
Reads and metric writes retry transient failures with backoff. A retried
metric keeps its original message id, which the API deduplicates. Every other
write never retries, because repeating it can have side effects: folder
creation, moves, renames, open_experiment, lifecycle events (a replayed
done would move done_at), annotations, and send().
Release files for syvain-metrics-api-client 0.0.371
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| syvain_metrics_api_client-0.0.371.tar.gz | 13.8 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| syvain_metrics_api_client-0.0.371-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 31.1 kB
Release files / syvain_metrics_api_client-0.0.371.tar.gz
| Download URL | syvain_metrics_api_client-0.0.371.tar.gz |
|---|---|
| Size | 13.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f65007896a5312f9957714ae5f3429fea04bee4ec3d2b5290358423b11d5e151
|
|
BLAKE2b-256 checksum How to use checksums |
6e53d0f8f455719e11c4de2eff6ae44e05402895062d329a9c5f34cc24f2b48c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.12.18 {"installer":{"name":"uv","version":"0.12.18","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / syvain_metrics_api_client-0.0.371-py3-none-any.whl
| Download URL | syvain_metrics_api_client-0.0.371-py3-none-any.whl |
|---|---|
| Size | 17.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e2e087bbebbeb5f1fea2339208e6939a6849e98024565d30bede60e639af05b7
|
|
BLAKE2b-256 checksum How to use checksums |
de2d69aaa202aea29fc3fffe7c73b67f3dfd937a2efd62d3f63c95b8b44df68f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.12.18 {"installer":{"name":"uv","version":"0.12.18","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|