> ## Documentation Index
> Fetch the complete documentation index at: https://developer.watson-orchestrate.ibm.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Using traces with ADK CLI

Use the watsonx Orchestrate ADK CLI to search for traces from your active environment and export their observations.

## Searching traces

Use filters to search for traces and identify trace IDs.

```bash BASH theme={null}
orchestrate observability traces search --start-time <start date and time for search> --end-time <end date and time for search>
```

**command flags**

**--start-time** `datetime`

A start time for the results (ISO 8601 format). Required when `--last` is not used. Must be used together with `--end-time`. Cannot be used with `--last`.

**--end-time** `datetime`

An end time for the results (ISO 8601 format). Required when `--last` is not used. Must be used together with `--start-time`. Cannot be used with `--last`.

**--last** `string`

A shorthand for a relative time window that ends now. You can enter:

* Minutes. For example: `30m` / `30 minutes`
* Hours. For example: `3h` / `3 hours`
* Days. For example: `10d` / `10 days`

Cannot be used with `--start-time` or `--end-time`.

**--user-id / -u** `string`

A user ID to filter results. Can be specified multiple times.

**--session-id** `string`

A session ID to filter results. Can be specified multiple times.

**--limit / -l** `int`

A limit on the number of traces returned. Configure a value from 1 to 1000. Default is `100`.

**--sort-field** `SortField`

A field used for sorting results. Accepted values: `start_time`, `end_time`. Default is `start_time`.

**--sort-direction** `SortDirection`

A sort direction for the results. Accepted values: `asc`, `desc`. Default is `desc`.

**--service-name / -s** `string` *deprecated*

**Deprecated.** Service name filtering is no longer supported. Accepted for backward compatibility but ignored.

**--agent-id / -i** `string` *deprecated*

**Deprecated.** Agent ID filtering is no longer supported. Accepted for backward compatibility but ignored.

**--agent-name / -a** `string` *deprecated*

**Deprecated.** Agent name filtering is no longer supported. Accepted for backward compatibility but ignored.

**--min-spans** `int` *deprecated*

**Deprecated.** Span count filtering is no longer supported. Accepted for backward compatibility but ignored.

**--max-spans** `int` *deprecated*

**Deprecated.** Span count filtering is no longer supported. Accepted for backward compatibility but ignored.

After you identify the trace IDs, run [`orchestrate observability traces export`](#exporting-trace-observations) to export the full trace data.

## Exporting trace observations

Export observations for a trace from the watsonx Orchestrate observability platform.

The command fetches all observations for a specific trace ID and writes them to a file or to standard output in JSON format.

You must provide a time window to locate the trace. Use either `--last`, or both `--start-time` and `--end-time`. Use the same values that you used when you searched for the trace with [`orchestrate observability traces search`](#searching-traces).

> [!WARNING]
>
> In ADK version 2.20.0 and later, `orchestrate observability traces export` requires a time window. Commands that pass only `--trace-id` fail with an error. Update any scripts that use the command.

```bash BASH theme={null}
orchestrate observability traces export --trace-id <trace ID> --start-time <start date and time> --end-time <end date and time>
```

To use a relative time window instead, run:

```bash BASH theme={null}
orchestrate observability traces export --trace-id <trace ID> --last <duration>
```

**command flags**

**--trace-id / -t** `string` *required*

A trace ID to export.

**--start-time** `datetime`

The start of the time window that contains the trace (ISO 8601 format). Required when `--last` is not used. Must be used together with `--end-time`. Cannot be used with `--last`.

**--end-time** `datetime`

The end of the time window that contains the trace (ISO 8601 format). Required when `--last` is not used. Must be used together with `--start-time`. Cannot be used with `--last`.

**--last** `string`

A shorthand for a relative time window that ends now. You can enter:

* Minutes. For example: `30m` / `30 minutes`
* Hours. For example: `3h` / `3 hours`
* Days. For example: `10d` / `10 days`

Cannot be used with `--start-time` or `--end-time`.

**--output / -o** `string`

A file path for the command output. When omitted, output is displayed in the CLI.

> [!NOTE]
>
> **Note**
>
> The output file must be in JSON format. When a different file type is provided, a warning is shown.

**--pretty | --no-pretty** `bool`

Indented JSON output for easier readability. This flag is used only with the `--output` / `-o` flag. Default is `--pretty`.

### Examples

Export a trace by using the same time window that you used to search for it:

```bash BASH theme={null}
orchestrate observability traces export --trace-id 1234567890abcdef1234567890abcdef \
  --start-time 2026-09-29T23:19:00 --end-time 2026-09-30T03:19:00
```

Export a trace from the last four hours:

```bash BASH theme={null}
orchestrate observability traces export --trace-id 1234567890abcdef1234567890abcdef --last 4h
```

Save the export to a file:

```bash BASH theme={null}
orchestrate observability traces export --trace-id 1234567890abcdef1234567890abcdef \
  --last 4h --output trace.json
```
