|
1 | 1 |  |
2 | 2 |
|
3 | | -# Langfuse Python SDK |
| 3 | +# Langfuse Python SDK (legacy v3) |
4 | 4 |
|
5 | 5 | [](https://opensource.org/licenses/MIT) |
6 | 6 | [](https://github.com/langfuse/langfuse-python/actions/workflows/ci.yml?query=branch%3Amain) |
|
9 | 9 | [](https://discord.gg/7NXusRtqYU) |
10 | 10 | [](https://www.ycombinator.com/companies/langfuse) |
11 | 11 |
|
12 | | -## Installation |
13 | | - |
14 | 12 | > [!IMPORTANT] |
15 | | -> The SDK was rewritten in v3 and released in June 2025. Refer to the [v3 migration guide](https://langfuse.com/docs/sdk/python/sdk-v3#upgrade-from-v2) for instructions on updating your code. |
| 13 | +> The SDK was rewritten in v3 and released in June 2025. Refer to the [v3 to v4 migration guide](https://langfuse.com/docs/observability/sdk/upgrade-path/python-v3-to-v4) for instructions on updating your code. |
| 14 | +> |
| 15 | +> **`langfuse` v3 is not the latest Langfuse Python SDK.** This branch publishes the **legacy** v3 client. Unpinned `pip install langfuse` installs the current v4. Do **not** use v3, or the older v2 client API (`trace()`, `span()`, `generation()`, `api.trace.list`), for new instrumentation. |
| 16 | +> |
| 17 | +> **Latest Python SDK (OpenTelemetry)**, developed on [`main`](https://github.com/langfuse/langfuse-python/tree/main): `pip install langfuse`. Use `get_client()` + `start_as_current_observation` / `@observe`. Docs: https://langfuse.com/docs/observability/sdk/overview. Upgrade: [v3 to v4](https://langfuse.com/docs/observability/sdk/upgrade-path/python-v3-to-v4). |
| 18 | +> |
| 19 | +> Query traces with [Observations API v2](https://langfuse.com/docs/api-and-data-platform/features/observations-api) (`GET /api/public/v2/observations`, [API reference](https://api.reference.langfuse.com/#tag/observationsv2)), not `GET /api/public/traces` / `api.trace.list`. |
| 20 | +> |
| 21 | +> **Data freshness:** the only real-time path is OpenTelemetry ingestion (`langfuse` >= 4.7.0, or any OTel exporter sending `x-langfuse-ingestion-version: 4`) combined with the [Observations API v2](https://langfuse.com/docs/api-and-data-platform/features/observations-api) and [Metrics API v2](https://langfuse.com/docs/metrics/features/metrics-api). All other GET APIs from all SDK versions can be up to 10 minutes behind. |
16 | 22 |
|
17 | | -``` |
18 | | -pip install langfuse |
19 | | -``` |
| 23 | +## Installation |
| 24 | + |
| 25 | +This branch is the **legacy v3** SDK, in maintenance mode with critical bug fixes only. For new work, install the current v4 (`pip install langfuse`). |
20 | 26 |
|
21 | 27 | ## Docs |
22 | 28 |
|
23 | | -Please [see our docs](https://langfuse.com/docs/sdk/python/sdk-v3) for detailed information on this SDK. |
| 29 | +- Current SDK guide: https://langfuse.com/docs/observability/sdk/overview |
| 30 | +- v3 to v4 upgrade: https://langfuse.com/docs/observability/sdk/upgrade-path/python-v3-to-v4 |
| 31 | +- Machine-readable docs index (for AI agents): https://langfuse.com/llms.txt |
| 32 | +- REST API reference (Observations API v2, Metrics API v2, Scores API v3): https://api.reference.langfuse.com |
| 33 | +- Data freshness and real-time ingestion: https://langfuse.com/docs/compatibility#faq-delay |
| 34 | + |
0 commit comments