# Correlating Traces with External IDs

Enterprises usually maintain comprehensive logs in multiple places. For instance, workflow APIs could log the same LLM traces on an internal cloud service as well as on RagaAI Catalyst (if enabled) for observability. Using trace correlation as outlined below, users can now assign an external ID for each trace uploaded to Catalyst, for better maintainability and direct URL access.

```python
query_list = [
    "Summarize the document in 10 words",
    "Summarize the document in 20 words",
    "Summarize the document in 30 words",
]
for i, external_id in enumerate(['exid_1', 'exid_2', 'exid_3']):
    tracer.set_external_id(external_id)
    main(query_list[i])
```

As shown, the `set_external_id` method can help assign new alphanumeric IDs programatically before calling your main function (assumed as a proxy for your LLM call). This will assign the last passed ID to the next trace that is uploaded.

Note that the ID should be updated before each call to avoid ambiguity. In the above example, the mapping would be something like:

| External ID | Prompt                               |
| ----------- | ------------------------------------ |
| 'exid\_1'   | "Summarize the document in 10 words" |
| 'exid\_2'   | "Summarize the document in 20 words" |
| 'exid\_3'   | "Summarize the document in 30 words" |

Eventually, users can access the specific trace on RagaAI Catalyst directly from their central logs using a URL that would be something like:

`https://catalyst.raga.ai/<project-name>/<dataset-name>/<external-id>/`&#x20;


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.raga.ai/ragaai-catalyst/concepts/uploading-data/correlating-traces-with-external-ids.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
