# uip traces

> Syntax and options for `uip traces`, which fetches LLM Observability spans for UiPath jobs from the shell or CI pipeline.

`uip traces` fetches **LLM Observability** spans for UiPath jobs — the OpenTelemetry-style traces emitted by coded agents and other AI-backed workflows. Use it to pull a full trace for an Orchestrator job so you can inspect prompts, tool calls, and response times from the shell or a CI pipeline.

This tool also registers a `feedback` command group (`create`, `get`, `list`, `list detailed`, `update`, `delete`) for managing LLM Observability feedback attached to a trace or span — see [`uip traces feedback`](./uip-traces-feedback.md).

See [Tools (plugins)](./concepts-tools.md) for how this tool integrates with the CLI.

## Synopsis

```
uip traces spans get [<trace-id>] [--job-key <guid>]
                     [--folder-path <path>] [--folder-key <guid>]
```

All subcommands honor the [global options](./global-options.md) and [exit codes](./exit-codes.md).

## uip traces spans get

Return all spans for a trace. You can address the trace directly by its ID, or indirectly by the Orchestrator job key — the tool resolves the job's trace ID for you.

### Arguments
- `[trace-id]` *(optional)* — Trace ID in 32-character hex or GUID format.

### Options

- `--job-key <guid>` — Orchestrator job key. Alternative to `<trace-id>`; the tool fetches the job's metadata and extracts its trace ID.
- `--folder-path <path>` — Orchestrator folder path (used when resolving the job).
- `--folder-key <guid>` — Orchestrator folder key (used when resolving the job).

Exactly one of `<trace-id>` or `--job-key` must be supplied. Omitting both fails with `Failure: "Missing required argument"`.

### Examples

```bash
# By trace ID
uip traces spans get 4bf92f3577b34da6a3ce929d0e0e4736

# By job key — the tool resolves the trace ID first
uip traces spans get --job-key a1b2c3d4-0000-0000-0000-000000000001

# By job key within a specific folder
uip traces spans get --job-key a1b2c3d4-0000-0000-0000-000000000001 \
  --folder-key f0f0f0f0-0000-0000-0000-000000000001
```

### Data shape (`--output json`)

```json
{
  "Code": "TraceSpans",
  "Data": [
    {
      "spanId": "00f067aa0ba902b7",
      "traceId": "4bf92f3577b34da6a3ce929d0e0e4736",
      "name": "llm.completion",
      "startTime": "2025-04-15T10:30:00.123Z",
      "endTime": "2025-04-15T10:30:01.456Z"
    }
  ]
}
```

The `Data` array contains one object per span, in the order the backend returns them. The exact span fields (attributes, events, parent/child links) depend on what the emitting runtime captured — the CLI does not normalize them.

## Error behavior

- Neither `<trace-id>` nor `--job-key` provided: `Failure` with `Instructions: "Provide either a trace-id argument or --job-key option"`, exit 1.
- `--job-key` points at an unknown or trace-less job: `Failure: "Error retrieving trace ID for job"` with the backend error message in `Instructions`.
- Trace exists but spans cannot be fetched: `Failure: "Error retrieving spans for trace"`.

## Related

- [`uip traces feedback`](./uip-traces-feedback.md) — create, read, and manage LLM Observability feedback on a trace or span.
- [Tools (plugins)](./concepts-tools.md) — install, update, uninstall the `traces-tool` package.
- [`uip login`](./uip-login.md) — session used for both the job lookup and the span fetch.
- [`uip insights`](./uip-insights.md) — job execution metrics; orthogonal to trace data.
