glab orbit remote query

Execute a GitLab Knowledge Graph query. (EXPERIMENTAL)

Synopsis

Calls POST /api/v4/orbit/query with a JSON request body and prints the server response verbatim. The body is read from a file path or from standard input when the argument is - or omitted.

The request body must be a full Orbit query envelope:

{
  "query": { "query_type": "...", ... },
  "response_format": "llm" | "raw"
}

--format overrides the body’s response_format value, or sets it if absent. If neither the body nor --format specifies a format, llm is used by default. The llm format is compact GOON/TOON text intended for agents; raw returns structured JSON suitable for jq. The server’s response body is written to stdout verbatim regardless of format — no client-side decoding or re-encoding is performed.

Compatibility note: prior to this change, --format raw output was re-marshalled through the SDK’s typed OrbitQueryResult struct (producing indented JSON). It is now the server’s bytes verbatim (compact JSON). Pipe into jq . if you need indented output.

The graph DSL JSON Schema is served by glab orbit remote tools and is the source of truth for the body shape. See also glab orbit remote schema for the graph ontology.

For the full query language reference with examples, fetch the docs from the Knowledge Graph repository:

glab api "projects/gitlab-org%2Forbit%2Fknowledge-graph/repository/files/docs%2Fsource%2Fqueries%2Fquery_language.md?ref=main" | jq -r .content | base64 -d

This feature is an experiment and is not ready for production use. It might be unstable or removed at any time. For more information, see https://docs.gitlab.com/policy/development_stages_support/.

glab orbit remote query [file|-] [flags]

Examples

# Run a query from a file
$ glab orbit remote query ./query.json

# Run a query from stdin
$ cat ./query.json | glab orbit remote query -

# Force raw output (pipeable into jq)
$ glab orbit remote query --format raw ./query.json

Options

  -f, --format llm            Response format: llm (compact, intended for agents) or `raw` (structured JSON). (default "llm")
      --hostname gitlab.com   GitLab hostname to query. Defaults to the current repository's host or gitlab.com.

Options inherited from parent commands

  -h, --help   Show help for this command.