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

# Update existing traces

> Learn how to update traces previously published to the Openlayer platform

Sometimes the data you want to monitor isn’t available at inference time.
Openlayer lets you **update existing traces** after they were streamed to the platform.

Common use cases:

* Adding **ground truths** that only became available later.
* Logging **human feedback** (e.g., thumbs up/down, ratings).
* Attaching **business signals** such as conversions or revenue impact.

## How updates work

Every trace streamed to Openlayer has an **`inference_id`**, which is a unique identifier.

* If you provide your own inference IDs, you can easily reference and update those traces later.
* If you don’t, Openlayer auto-generates them for you.

<Tip>
  For maximum flexibility, set **custom inference IDs** when tracing. This makes
  it simple to tie traces to feedback, business outcomes, or other systems.
</Tip>

## Example: Add a ground truth

Let’s say you want to add a `ground_truth` column for a previously logged trace.

```python theme={null}
from openlayer import Openlayer
from openlayer.types.inference_pipelines import row_update_params

row_updates = {
    "ground_truth": "The sun is 94.471 million miles from the earth."
}

config = row_update_params.Config(
    ground_truth_column_name="ground_truth"
)

client = Openlayer()
client.inference_pipelines.rows.update(
    inference_pipeline_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
    inference_id="832y98d3",
    row=row_updates,
    config=config,
)
```

This updates the trace with `inference_id="832y98d3"` by attaching a ground truth.

### Using custom inference IDs

When tracing with the `@trace` decorator, you can set your own inference IDs.
This makes it easy to correlate requests with later feedback or business signals.

```python theme={null}
from openlayer.lib import trace, update_current_trace

@trace()
def process_chat_message(user_id: str, message: str, conversation_id: str):
    custom_id = f"chat_{conversation_id}_{user_id}"
    update_current_trace(inference_id=custom_id)

    response = generate_ai_response(message)

    # Store custom_id in your DB for later updates
    store_for_feedback(custom_id, user_id, message, response)

    return response
```

Later, use that custom ID (`chat_{conversation_id}_{user_id}`) in your update calls.
