← Back to changelog
November 3, 2026

Continue observations queries that would otherwise time out

Picture Valeriy MeleshkinValeriy Meleshkin

Short or empty pages can include a continuation cursor so expensive observations queries can make progress across requests.

We're improving Observations API v2 reliability so the small percentage of queries that currently time out can make progress across multiple requests.

A page may contain fewer observations than limit, including none, while meta.cursor is present. Keep requesting pages until meta.cursor is absent.

With the Python SDK configured for your project, this fetches generation observations from the last seven days:

from datetime import datetime, timedelta, timezone
from langfuse import get_client

langfuse = get_client()
end_time = datetime.now(timezone.utc)
start_time = end_time - timedelta(days=7)
cursor = None

while True:
    page = langfuse.api.observations.get_many(
        type="GENERATION",
        from_start_time=start_time,
        to_start_time=end_time,
        limit=100,
        cursor=cursor,
    )
    for observation in page.data:
        print(observation.id)

    cursor = getattr(page.meta, "cursor", None)
    if not cursor:
        break

Some of our documentation examples incorrectly stopped pagination when a page was empty. If you copied one of those examples, update your loop to check meta.cursor instead of the number of returned observations. Otherwise, it may stop before retrieving all results.

Updated examples:

See the cursor pagination guide for the response contract.


Was this page helpful?