dataframer-journey is a small Python library. It reads the journey id off each incoming request and stamps it onto every Langfuse trace or LangSmith run your service creates, so you never pass the id around by hand. The id itself comes from the browser SDK.
Install
requests, httpx, langfuse and langsmith when they are installed.
Set up
- FastAPI / Starlette
- Django
- Read in: the journey id is taken from the request (the
X-Journey-Idheader or the SDK’s cookie) and kept in a Python context variable for the rest of that request. - Passed along: every outgoing
requestsorhttpxcall carries the id forward, so a chain of services stays connected. - Stamped on traces: every Langfuse trace and every LangSmith run created during the request gets
metadata.journey_id, plus ajourney:<id>tag.
Non-HTTP entry points
Queue consumers, scheduled jobs, rawThreadPoolExecutor or run_in_executor work and WebSocket handlers do not pass through the middleware, so hand the id over from your payload:
Without this library
For a backend in another language, or a tracing setup this library does not stamp, write the id onto the trace yourself. DataFramer needs one thing: the value of the request’sX-Journey-Id header, stored under the key journey_id in:
- Langfuse: the trace’s metadata, not only a span’s
- LangSmith: the root run’s metadata
propagateHeaderTo, so set it even when your backend shares the page’s origin, for example propagateHeaderTo: ['/api']. Work that leaves the request, such as a queue job or a call to another service, needs the id passed along with it.
CORS
This library only reads the id it is given. If your frontend and backend are on different origins, the browser SDK must send the id as a header; see Getting the journey id to your own backend.Next steps
Browser SDK
Generate the journey id in your frontend and send user events.

