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

# IMPORT OBSERVABILITY LOGS

> Turn Langfuse or LangSmith traces into a Conversation dataset you can train, evaluate, and synthesize with

Oumi rebuilds each conversation in a trace export, with its system prompt, turns, tool definitions, and tool calls.

Import traces when you want training or evaluation data that reflects how real users talk to your agent. Real traces carry the tool calls, system prompts, and multi-turn structure your agent actually produced, which synthetic data only approximates. Use [synthesis](https://docs.oumi.ai/guides/synthesis.md) instead when you have no traffic yet, or need cases your users have not hit.

## TRACES OUMI CAN READ

Oumi rebuilds a conversation from the model calls in a trace. It reads model calls logged in the OpenAI chat-completions shape:

* **Langfuse:** A `GENERATION` observation whose `input` and `output` hold the request and the response as JSON strings.
* **LangSmith:** An `llm` run whose `inputs.messages` holds OpenAI or LangChain messages.

Traces in other shapes, such as another provider's message format or steps that aren't model calls, can import with missing content or be skipped. Import a small part of your traces first to confirm that Oumi reads them correctly.

Oumi reads raw trace exports in JSONL, one record per line. A raw trace export keeps the links between the steps of a trace, which Oumi needs to rebuild the conversation. Langfuse's JSON export and LangSmith's dataset export drop those links, so Oumi rejects them.

## EXPORT FROM LANGFUSE

In Langfuse, open the project's **Tracing** tab, and filter to the traces you want. Open **Export**, and choose **As JSONL**. See Langfuse's [Export from UI guide](https://langfuse.com/docs/api-and-data-platform/features/export-from-ui).

![Langfuse Export menu with the As JSONL option](https://mintcdn.com/oumi/o1PAnk9WO9W5UcL5/images/datasets-trace-import-1-langfuse-export.png?fit=max\&auto=format\&n=o1PAnk9WO9W5UcL5\&q=85\&s=565c0ee5b22e3346dec95ba7e433195f)

Each line is one observation, which is a single step that Langfuse recorded, such as a span, a generation, or a tool call. Observations from the same trace share a `traceId`, and Oumi groups them into one conversation. Oumi builds the turns from the `GENERATION` lines and keeps the other lines as metadata. This example is one trace with a span and a generation whose response is a tool call:

```jsonl theme={null}
{"id":"obs_001","traceId":"trace_abc","traceName":"weather-agent","type":"SPAN","parentObservationId":null,"startTime":"2026-05-19T10:00:00.000Z","sessionId":null,"input":null,"output":null}
{"id":"obs_002","traceId":"trace_abc","traceName":"weather-agent","type":"GENERATION","parentObservationId":"obs_001","startTime":"2026-05-19T10:00:01.500Z","sessionId":null,"input":"{\"model\":\"gpt-4o\",\"messages\":[{\"role\":\"system\",\"content\":\"You are a weather assistant.\"},{\"role\":\"user\",\"content\":\"Will it rain in Paris tomorrow?\"}],\"tools\":[{\"type\":\"function\",\"function\":{\"name\":\"get_forecast\",\"parameters\":{\"type\":\"object\",\"properties\":{\"city\":{\"type\":\"string\"}}}}}]}","output":"{\"role\":\"assistant\",\"content\":null,\"tool_calls\":[{\"id\":\"call_1\",\"type\":\"function\",\"function\":{\"name\":\"get_forecast\",\"arguments\":\"{\\\"city\\\":\\\"Paris\\\"}\"}}]}"}
```

## EXPORT FROM LANGSMITH

The LangSmith UI has no export for raw traces, so you export them with the LangSmith SDK. You need a LangSmith API key with read access to the project, which you create in LangSmith under **Settings** > **API Keys**.

Install the SDK, and set the key in your environment:

```bash theme={null}
pip install 'langsmith>=0.1'
export LANGSMITH_API_KEY=<your-langsmith-api-key>
```

Then run a script like this one. To export only part of the project, add [run filters](https://docs.smith.langchain.com/observability/how_to_guides/export_traces) or the `start_time` and `end_time` parameters to `list_runs`. A large project exports faster in date ranges.

```python theme={null}
import json
from langsmith import Client

PROJECT_NAME = "oumi-langsmith-project"
OUTPUT_PATH = "oumi-langsmith-export.jsonl"

client = Client()  # reads LANGSMITH_API_KEY from env

runs = client.list_runs(project_name=PROJECT_NAME)

with open(OUTPUT_PATH, "w") as f:
    for run in runs:
        # model_dump() on pydantic v2 SDKs, dict() on older v1 ones
        data = run.model_dump() if hasattr(run, "model_dump") else run.dict()
        f.write(json.dumps(data, default=str) + "\n")
```

Each line is one run, such as a `chain`, `llm`, or `tool` run. Runs from the same trace share a `trace_id`, and Oumi groups them into one conversation. Oumi picks the `llm` run with the most messages and rebuilds the conversation from its `inputs.messages` and `outputs`. Tool results already appear in those messages as `tool` turns. For session grouping, Oumi reads `extra.metadata.session_id`, because the top-level `session_id` is the ID of the LangSmith project. This example is one trace with a chain run and an `llm` run:

```jsonl theme={null}
{"id":"run_root","trace_id":"trace_abc","parent_run_id":null,"dotted_order":"20260519T100000000000Zrun_root","run_type":"chain","name":"weather-agent","start_time":"2026-05-19 10:00:00.000000","inputs":{},"outputs":{}}
{"id":"run_llm","trace_id":"trace_abc","parent_run_id":"run_root","dotted_order":"20260519T100000000000Zrun_root.20260519T100001500000Zrun_llm","run_type":"llm","name":"final-answer","start_time":"2026-05-19 10:00:01.500000","inputs":{"messages":[{"role":"system","content":"You are a weather assistant."},{"role":"user","content":"Will it rain in Paris tomorrow?"}],"tools":[{"type":"function","function":{"name":"get_forecast","parameters":{"type":"object","properties":{"city":{"type":"string"}}}}}]},"outputs":{"role":"assistant","content":null,"tool_calls":[{"id":"call_1","type":"function","function":{"name":"get_forecast","arguments":"{\"city\":\"Paris\"}"}}]}}
```

## IMPORT THE FILE

You can import a trace export in two ways:

* **Upload it like any other file.** Oumi recognizes Langfuse and LangSmith exports, and it always removes duplicate traces. See [Upload datasets](https://docs.oumi.ai/guides/datasets/upload.md).
* **Use `Import Observability Logs`.** Choose it under `Create Dataset` when you want to name the dataset, state the platform yourself, or keep duplicate traces.

The import runs in the background. The new dataset appears on the **Datasets** page when it finishes.

## DUPLICATE TRACES

Many agents log a trace after every turn. A three-turn conversation then appears as three traces, and each trace repeats the turns before it. Without deduplication, the dataset would contain the same conversation three times at different lengths.

Deduplication finds traces whose turns begin another, longer trace, and keeps only the longest one. It is on by default. Turn it off in `Import Observability Logs` only when you want the partial conversations as separate examples. Deduplication compares the traces within one import, so importing overlapping traces twice creates two datasets with the same conversations.

## WHAT THE DATASET CONTAINS

Each row of the new Conversation dataset is one trace that Oumi could read. The row holds the `system`, `user`, `assistant`, and `tool` turns in trace order, with each turn's `tool_calls` and `tool_call_id`, and the trace's `tools` array when it has one.

Each row also keeps these metadata fields:

| Field | Value |
| - | - |
| `source_platform` | Langfuse or LangSmith |
| `source_trace_id` | The trace ID in the source platform |
| `source_trace_name` | The trace name |
| `source_session_id` | The session ID, when the trace has one |
| `source_sequence_key` | The start time of the trace, which orders traces within a session |
| `source_raw` | The whole original trace, as a JSON string |

`source_raw` keeps every field Oumi doesn't use, such as timings, costs, model names, and user IDs. Remove sensitive data from your traces before you export them, because the dataset keeps everything in the export.

The dataset works like any other Conversation dataset. You can [train](https://docs.oumi.ai/guides/training.md) on it, [evaluate](https://docs.oumi.ai/guides/evaluations.md) a model against it, or use it as input to [synthesis](https://docs.oumi.ai/guides/synthesis.md).

## LIMITATIONS

* Oumi imports only Langfuse and LangSmith traces.
* Each import reads one platform's export. To combine Langfuse and LangSmith traces, import them separately and combine the datasets.
* Each import creates a new dataset. It can't add rows to an existing dataset.
* Oumi skips conversations that are too long, and imports the rest of the file.

## TROUBLESHOOTING

| What you see | What it means | What to do |
| - | - | - |
| "... import only supports `.jsonl` files", or the file picker rejects your file | The file isn't JSONL. It is often Langfuse's JSON export or a CSV. | Export again as JSONL. See [Export from Langfuse](#export-from-langfuse) or [Export from LangSmith](#export-from-langsmith). |
| "This file looks like a LangSmith dataset export" | You used **Add to Dataset** > **Download JSONL** in LangSmith, which drops the links between runs. | Export with the SDK script. See [Export from LangSmith](#export-from-langsmith). |
| "File too large" | The export exceeds your project's dataset quota. | Export a smaller date range, session, or tag, and import each part. |
| "No convertible conversations found in the uploaded file" | The export has no model calls in a shape Oumi reads, or no trace has an assistant turn. | Export the model calls, not only spans or tool events. See [Traces Oumi can read](#traces-oumi-can-read). |
| Fewer conversations than expected | Deduplication removed partial traces. Oumi also skips traces with no assistant turn and conversations that are too long. | To keep partial traces, import with `Import Observability Logs` and turn deduplication off. |
| The file appears under **Files**, or imports as the wrong type | Oumi didn't recognize the file as a trace export. | Confirm that the file is a raw trace export, or use `Import Observability Logs` and choose the platform. |
| "Upload timed out" | The upload link expired before the upload finished. | Try again. If it keeps timing out, split the file. |
| The LangSmith script returns no runs | `LANGSMITH_API_KEY` is unset or belongs to another workspace, or `PROJECT_NAME` is wrong. | Check the key, the workspace in LangSmith **Settings**, and the exact project name. |

Importing only reads your export file. It doesn't change your traces in Langfuse or LangSmith.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.