Command Line Interface

The AI Platform command line interface (CLI) is how you create entities, run evaluations, and pull results. It is distributed as a lightweight Python package โ€” we recommend installing it locally in a virtual environment.

Component Requirement
Python Version 3.10, 3.11, 3.12, 3.13
Operating System Linux, Windows, macOS

Install CLI

Note

Compatibility

The CLI and the AI Platform application must run the same version to remain compatible.

uv pip install latticeflow-go-sdk
pip install latticeflow-go-sdk

Find the application version in the UI by following:

  1. Click your user icon in the top right corner.
  2. Click About.
  3. Click Copy Version.

Configure CLI

The fastest way: select the CLI Reference icon in the left navigation menu, then copy the pre-filled lf configure command from the pop-up.

You can also run lf configure without arguments and answer the prompts, or set individual values non-interactively:

lf configure --url https://app.latticeflow.cloud --api-key <your-api-key> --app my-app

The command tests the connection before saving. Useful flags:

Flag Purpose
--url URL of your AI Platform deployment.
--api-key Your AI Platform API key.
--verify-ssl / --no-verify-ssl Whether to verify SSL certificates โ€” relevant for self-signed appliance certificates.
--app AI app key to set as the active context.
--global, -g Write to the home-directory configuration instead of the nearest one.

The Context Model

Every command runs against a context: a deployment (URL and API key) plus one active AI app. Two commands manage it:

lf switch my-app   # set the active AI app (interactive picker if the key is omitted)
lf status          # show the resolved context and where each value came from
$ lf status
                              CLI configuration (4 rows)
โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”ณโ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”ณโ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”“
โ”ƒ Name         โ”ƒ Value                                     โ”ƒ Source                   โ”ƒ
โ”กโ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ•‡โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ•‡โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”ฉ
โ”‚ URL          โ”‚ https://app.latticeflow.cloud             โ”‚ '~/.latticeflow.yaml'    โ”‚
โ”‚ API Key      โ”‚ ****61c1                                  โ”‚ '~/.latticeflow.yaml'    โ”‚
โ”‚ Verify SSL   โ”‚ True                                      โ”‚ '~/.latticeflow.yaml'    โ”‚
โ”‚ AI App Key   โ”‚ my-app                                    โ”‚ '~/.latticeflow.yaml'    โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

Because an AI app is an isolated workspace, lf switch is the equivalent of checking out a branch: everything you add or run afterwards lands in that app. See Core Concepts.

Where Configuration Comes From

Configuration is stored in .latticeflow.yaml files. The CLI walks up from the current directory towards your home directory and uses the nearest file it finds, so a per-project configuration can override your global one. lf configure and lf switch write to that nearest file; lf configure --global always writes to ~/.latticeflow.yaml.

Values resolve in this order, highest priority first:

  1. Command-line flags.
  2. Environment variables: LF_AIGO_URL, LF_API_KEY, LF_AI_APP_KEY, LF_VERIFY_SSL, LF_API_TIMEOUT.
  3. The nearest .latticeflow.yaml, then the ones above it, up to ~/.latticeflow.yaml.

The Source column of lf status tells you which one won โ€” check it first when a command targets the wrong deployment or app.

Credentials and .env Files

Provider API keys and other secrets belong in environment variables, never in a YAML spec. The CLI automatically loads .env from the current directory, and --env <path> loads an additional file whose values take precedence:

lf --env harmful_content/config.env run -f harmful_content/run.yaml
.env
OPENAI_API_KEY=sk-...
MODEL_KEY=openai$gpt-4o
JUDGE_MODEL_KEY=openai$gpt-4o

Reference these values from a spec as $OPENAI_API_KEY. For credentials you would rather keep on the server, see Manage secrets.

Next Steps