Skip to content
SynthGraph

Command line

CLI overview

Read back and export provenance from a terminal or a script.

The synthgraph command reads back what the SDK recorded. It is a query and export tool: you use it to look at provenance, compare it, and export manifests and documentation from a terminal or a script.

It installs with the SDK. See Installation and configuration.

synthgraph --version
synthgraph auth whoami

Configure it#

The CLI reads the same environment variables as the SDK:

export SYNTHGRAPH_API_KEY="sg_..."
export SYNTHGRAPH_API_URL="https://your-synthgraph-backend"

There is deliberately no --api-key option, because a key on the command line ends up in your shell history and in process listings. --api-url and --timeout exist as global options, placed before the command.

Commands#

CommandWhat it does
auth whoamiShows which account your key belongs to. The key is never printed.
projects, experiments, generations, training-runs, evaluations, datasets, assetsList and show records.
experiments searchSearches experiments in a project by name or description.
training-runs metricsLists a run's metric points, ordered by step.
compareCompares two or more generations.
manifestExports a generation's reproduction manifest.
docsExports a generation's generated Markdown documentation.
metricsLists, declares and corrects metric directions.

See the command reference for every option.

Reading and writing#

The CLI is mainly a read surface. Creating projects, generations, runs, evaluations and datasets is the SDK's job, so there is one place that writes your research data.

Three commands do write, because they record small facts about records that already exist:

  • metrics set-direction and metrics correct-direction, which declare and correct a metric direction.
  • training-runs link-generation, which records that a run used a generation. A link cannot be changed or removed afterwards, and linking the same pair again changes nothing.

Output formats#

Commands print a table by default. Add --json to any command for machine-readable output:

synthgraph --json projects list
synthgraph generations list --experiment <experiment-id> --json

--json works both before the command and as an option of the command. manifest and docs can write to a file with --output.

You do not have to know the id#

In an interactive terminal, the id arguments are optional. If you leave one out, the CLI offers the last id of that kind you used on this machine, or lists your resources and asks you to pick one. It remembers the last ids in ~/.synthgraph/cli-state.json. That file only changes which lookup runs by default. It never affects what is written to the backend.

None of this happens in a script or a pipeline. When standard input is not a terminal, a missing id is an immediate usage error, so scripts behave the same every time.

A mistyped command gets a suggestion, for example "No such command 'trainig-runs'. Did you mean 'training-runs'?". synthgraph --install-completion sets up tab completion for command and option names.

Exit codes#

CodeMeaning
0Success.
1General failure, including a failed export.
2Invalid usage or configuration.
3Authentication failed.
4Not authorized.
5Not found.
6Validation error or conflict.
7Transport or backend failure.

There is no synthgraph reproduce#

A manifest records what would be needed to reconstruct an experiment. It is a record, not a runnable script. Running your tools again stays your decision, in your environment.