Skip to main content
For the complete documentation index for agents and LLMs, see llms.txt.

Generate a Dataset from a Pipeline's Sessions with the REST APIBeta

Beta
This is coming — this page describes a feature that's still being rolled out and may not be available to you yet.

To build a new Dataset from a pipeline's recorded traffic, let the platform sample Sessions from a time window and convert them into test cases.


About This Task​

The sample is spread across the whole window, so a long window isn't represented by its newest days only. It keeps the pipeline's mix of easy, medium, and hard Sessions by feedback, duration, user turns, and tokens.

The conversion follows a blueprint. By default, the blueprint removes sensitive data, writes the goals the user needed as expected data, and shortens redundant data so the test case fits the size limits. For how a blueprint works when you choose the Sessions yourself, see Convert Chosen Sessions into Test Cases with the REST API.

The generation runs in the background. The request returns a transfer that you check until the generation ends. A Dataset holds at most 100 test cases.

Prerequisites​

  • The pipeline recorded Sessions in the window you want to sample.
  • This instance can generate test cases.
  • You need an API key. For details, see Generate API Keys.
  • You need the workspace ID and the pipeline ID. For details, see Workspace ID and Pipeline ID.

Generate the Dataset​

Send a POST request to /api/v2/workspaces/{workspace_id}/evaluation/datasets/generations. Replace <WORKSPACE_ID> and <PIPELINE_ID> with your IDs, and <YOUR_API_KEY> with your Haystack Platform API key:

curl --request POST \
--url https://api.cloud.deepset.ai/api/v2/workspaces/<WORKSPACE_ID>/evaluation/datasets/generations \
--header 'accept: application/json' \
--header 'authorization: Bearer <YOUR_API_KEY>' \
--header 'content-type: application/json' \
--data '
{
"pipeline_id": "<PIPELINE_ID>",
"size": 20,
"from": "2026-10-01T00:00:00Z",
"to": "2026-10-31T00:00:00Z"
}
'

The body has these fields:

  • pipeline_id: The pipeline whose Sessions to sample.
  • size: How many test cases to create.
  • from and to: Optional. The window to sample from, as timestamps with a timezone. Give both or neither. from must be before to, to can't be in the future, and the window can span at most 90 days.
  • window_days: Optional. How many days of traffic, up to now, to sample from. Defaults to seven. The platform ignores it when you give from and to.
  • blueprint: Optional. Markdown instructions for turning a Session into a test case. Leave it out to use the default blueprint.
  • name: Optional. The new Dataset's name. By default, it's the pipeline's name followed by the window, for example <pipeline> traffic 2026-10-01–2026-10-31.

The platform fixes the window when it accepts the request, so a job that waits in the queue still samples the window you asked for.

Check the Transfer​

The response is a transfer. Send a GET request to /api/v2/workspaces/{workspace_id}/evaluation/datasets/transfers/{transfer_id} until the generation has ended. Use the transfer ID from the response as <TRANSFER_ID>:

curl --request GET \
--url https://api.cloud.deepset.ai/api/v2/workspaces/<WORKSPACE_ID>/evaluation/datasets/transfers/<TRANSFER_ID> \
--header 'accept: application/json' \
--header 'authorization: Bearer <YOUR_API_KEY>'

The transfer's generation.start and generation.end fields show the window. A generation leaves generation.session_ids empty and sets seed. A conversion of Sessions you chose lists those Sessions in generation.session_ids instead.

The transfer fails if the pipeline has no Sessions in the window.

When a Request Is Rejected​

If the request is rejected, check the status code:

  • 422: You gave only one of from and to, a timestamp has no timezone, from isn't before to, to is in the future, or the window is longer than 90 days.
  • 503: This instance can't generate test cases.