Skip to main content
gateway traces reads the project’s traces over the public API (GET /api/public/traces, /observations, /sessions) and imports OTLP/JSON exports. Everything except import is read-only. Timestamps and ids print exactly as the API returns them.

List

no traces match prints on standard error with exit 0.

Get one trace

GET /traces/{traceId} returns the trace with its observations (input and output included) and scores. Without --observations, --json prints the trace with observationCount in place of the array. --type keeps one observation type: TOOL, GENERATION, SPAN, EVENT, AGENT, CHAIN, RETRIEVER, EVALUATOR, EMBEDDING, GUARDRAIL. A missing trace exits 1 with the API’s message.

Export

One JSON object per line. <out> is a file, - for standard output, or drive:<path> to land it in the drive. The filters are the same as list; --limit stops after that many traces (default: every match). The summary — wrote N traces (M observations) to <out> — prints on standard error. An export in the drive is an input to gateway worlds data ingest <world> drive:<path> --transform shape.py and gateway worlds data calls pull.

Trace sessions

sessions list reads GET /sessions (--from, --to, --environment, --limit, --json). sessions get reads GET /sessions/{id}; --io adds includeIO=true, the same payload gateway worlds data calls pull --from traces --session <id> reads.

Import OTLP/JSON

import posts OTLP/JSON trace exports (one request, a bare resourceSpans array, an array of requests, or JSONL with one request per line) to POST /api/public/otel/v1/traces. The platform normalizes Braintrust, OpenInference (Arize, Phoenix, Galileo), OpenTelemetry GenAI, Langfuse and LangSmith conventions on ingest. Flags only add resource attributes; a span’s own attribute wins. The output is { status, batches, spans, resourceAttributes, endpoint }. Input with no spans exits 2; a rejected request exits 1 with the status code.

From code

TypeScript: import { traces } from "@withgateway/sdk" (or @withgateway/sdk/traces) — listTraces, iterateTraces, getTrace, listObservations, iterateObservations, listSessions, iterateSessions, getSession, exportTraces. Python: from gatewaysdk.traces import TracesClient — list, iter, get, observations, iter_observations, sessions, iter_sessions, get_session, export. Both read GATEWAY_HOST, GATEWAY_PUBLIC_KEY and GATEWAY_SECRET_KEY.