> ## 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>
```

<Expandable title="command flags">
  <ResponseField name="--start-time" type="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`.
  </ResponseField>

  <ResponseField name="--end-time" type="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`.
  </ResponseField>

  <ResponseField name="--last" type="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`.
  </ResponseField>

  <ResponseField name="--user-id / -u" type="string">
    A user ID to filter results. Can be specified multiple times.
  </ResponseField>

  <ResponseField name="--session-id" type="string">
    A session ID to filter results. Can be specified multiple times.
  </ResponseField>

  <ResponseField name="--limit / -l" type="int">
    A limit on the number of traces returned. Configure a value from 1 to 1000. Default is `100`.
  </ResponseField>

  <ResponseField name="--sort-field" type="SortField">
    A field used for sorting results. Accepted values: `start_time`, `end_time`. Default is `start_time`.
  </ResponseField>

  <ResponseField name="--sort-direction" type="SortDirection">
    A sort direction for the results. Accepted values: `asc`, `desc`. Default is `desc`.
  </ResponseField>

  <ResponseField name="--service-name / -s" type="string" deprecated="true">
    **Deprecated.** Service name filtering is no longer supported. Accepted for backward compatibility but ignored.
  </ResponseField>

  <ResponseField name="--agent-id / -i" type="string" deprecated="true">
    **Deprecated.** Agent ID filtering is no longer supported. Accepted for backward compatibility but ignored.
  </ResponseField>

  <ResponseField name="--agent-name / -a" type="string" deprecated="true">
    **Deprecated.** Agent name filtering is no longer supported. Accepted for backward compatibility but ignored.
  </ResponseField>

  <ResponseField name="--min-spans" type="int" deprecated="true">
    **Deprecated.** Span count filtering is no longer supported. Accepted for backward compatibility but ignored.
  </ResponseField>

  <ResponseField name="--max-spans" type="int" deprecated="true">
    **Deprecated.** Span count filtering is no longer supported. Accepted for backward compatibility but ignored.
  </ResponseField>
</Expandable>

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.

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

<Expandable title="command flags">
  <ResponseField name="--trace-id / -t" type="string" required>
    A trace ID to export.
  </ResponseField>

  <ResponseField name="--output / -o" type="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.
    </Note>
  </ResponseField>

  <ResponseField name="--pretty | --no-pretty" type="bool">
    Indented JSON output for easier readability. This flag is used only with the `--output` / `-o` flag. Default is `--pretty`.
  </ResponseField>
</Expandable>
