PreviewPipeline

Updated at:

Previews a pipeline. Runs a trial query based on the specified data source, node orchestration, and time range without creating pipeline resources, and returns a small amount of sample data to authenticate parameter settings and preview processing results.

Operation description

Request description

  • agentSpace must be an AgentSpace created under the current account.

  • source.type supports logstore, dataset, trace, and oss. If you select logstore, the project and Logstore used must be authorized in the AgentSpace and reside in the same region.

  • If you select oss, configure source.oss and omit source.inputFields. The server derives the schema from the source. For LeRobot, you can pass an empty array for pipeline.nodes to preview directly. For MCAP, you must pass an empty array. OSS previews ignore fromTime and toTime.

  • For other sources, you must pass a non-empty pipeline.nodes array and provide fromTime and toTime in UNIX seconds. The fromTime must be earlier than the toTime.

  • A preview returns up to 5 samples and filters out internal fields of the data source. For OSS, a batch tries up to 5 candidates. Failed candidates or candidates filtered out by the processing chain also count toward the limit. If no samples are returned but the schema can be derived, meta.schema is still returned.

Try it now

Try this API in OpenAPI Explorer, no manual signing needed. Successful calls auto-generate SDK code matching your parameters. Download it with built-in credential security for local usage.

Test

RAM authorization

The table below describes the authorization required to call this API. You can define it in a Resource Access Management (RAM) policy. The table's columns are detailed below:

  • Action: The actions can be used in the Action element of RAM permission policy statements to grant permissions to perform the operation.

  • API: The API that you can call to perform the action.

  • Access level: The predefined level of access granted for each API. Valid values: create, list, get, update, and delete.

  • Resource type: The type of the resource that supports authorization to perform the action. It indicates if the action supports resource-level permission. The specified resource must be compatible with the action. Otherwise, the policy will be ineffective.

    • For APIs with resource-level permissions, required resource types are marked with an asterisk (*). Specify the corresponding Alibaba Cloud Resource Name (ARN) in the Resource element of the policy.

    • For APIs without resource-level permissions, it is shown as All Resources. Use an asterisk (*) in the Resource element of the policy.

  • Condition key: The condition keys defined by the service. The key allows for granular control, applying to either actions alone or actions associated with specific resources. In addition to service-specific condition keys, Alibaba Cloud provides a set of common condition keys applicable across all RAM-supported services.

  • Dependent action: The dependent actions required to run the action. To complete the action, the RAM user or the RAM role must have the permissions to perform all dependent actions.

Action

Access level

Resource type

Condition key

Dependent action

agentloop:PreviewPipeline

list

*Pipeline

acs:agentloop:{#regionId}:{#accountId}:agentspace/{#AgentSpaceName}/pipeline/*

None None

Request syntax

POST /agentspace/{agentSpace}/pipeline/preview HTTP/1.1

Path Parameters

Parameter

Type

Required

Description

Example

agentSpace

string

No

The name of the AgentSpace where the pipeline is located.

my-agent-space

Request parameters

Parameter

Type

Required

Description

Example

body

object

No

The request body.

source

object

No

The data source of the pipeline.

{"type":"logstore","logstore":{"project":"my-sls-project","logstore":"agent-logs"},"inputFields":[{"name":"question","type":"text"}]}

type

string

No

The type of the data source. Valid values: logstore, dataset, trace, and oss. trace indicates the trajectory signal-driven processing mode. If you select oss, specify source.oss.

oss

oss PipelineOssSource

No

The OSS data source configuration. When source.type is set to oss, format, region, roleArn, and uri in source.oss are required. You can omit formatOptions or pass an empty object {}. The initial version has no available configuration keys. Non-empty objects and other JSON types return a parameter error.

inputFields

array<object>

No

The input fields and field types. For OSS sources, the server derives the input fields from the metadata. Omit source.inputFields.

[{"name":"question","type":"text"}]

object

No

The input field.

name

string

No

The name of the field.

question

type

string

No

The type of the field. Valid values: text, long, double, and json.

text

logstore

object

No

The SLS Logstore datasource config.

{"project":"my-sls-project","logstore":"agent-logs"}

project

string

No

The name of the SLS project.

my-sls-project

logstore

string

No

The name of the SLS Logstore.

my-sls-logstore

query

string

No

The filtered query statement (SLS query and analysis syntax).

* | SELECT *

dataset

object

No

The Dataset datasource config in the current AgentSpace.

{"dataset":"my-dataset","filter":"status = 'pending'"}

dataset

string

No

The name of the source dataset.

my-dataset

filter

string

No

The data filter condition for the dataset.

status = 'pending'

version

string

No

The version of the source dataset.

v1

trajectory

object

No

The trajectory data configuration. This parameter is optional and takes effect only when type is set to trace. It obtains ATIF standard trajectory data from the trajectory cleaning service and extends it by feature.

{"enrich":{"enabled":true,"columns":["input","output"]}}

enrich

object

No

The trajectory enrichment configuration. It mounts trajectory data into the cleaning result by trace_id. When writing to a dataset, it uses the fixed column agent_trajectory to store the trajectory JSON content.

{"enabled":true,"columns":["input","output"]}

enabled

boolean

No

Specifies whether to enable trajectory enrichment.

false

columns

array

No

The list of enrichment columns. This parameter is retained for compatibility. The current implementation outputs a single fixed column agent_trajectory, and this parameter no longer affects the output.

["input","output","session_id"]

string

No

The name of the trajectory column.

input

pipeline

object

No

The pipeline configuration, which defines the node orchestration.

{"nodes":[{"id":"select-fields","type":"project","parameters":{"question":"user_query"}}]}

nodes

array<object>

No

The list of nodes. For non-OSS sources, you must pass a non-empty array. For LeRobot sources, you can pass an empty array to preview directly. For MCAP sources, you must pass an empty array.

[{"id":"select-fields","type":"project","parameters":{}}]

array<object>

No

The configuration of a single node.

id

string

No

The ID of the node.

node-1

type

string

No

The type of the node.

transform

parameters

object

No

The parameters of the node. This is a key-value structure that varies based on the node type.

{"ID":"ID"}

any

No

The value of the node parameter.

{"ID":"ID"}

fromTime

integer

No

The start time of the preview data window, in UNIX seconds. For OSS sources, the preview is based on objects or episodes, and the time window is ignored.

1735660800

toTime

integer

No

The end time of the preview data window, in UNIX seconds. For OSS sources, the preview is based on objects or episodes, and the time window is ignored.

1735747200

  • For OSS sources, source.oss.format supports lerobot and mcap. LeRobot accepts v2.1 package directories or parent directories. MCAP accepts exact .mcap object keys or directories ending with /.

  • When source.type is set to oss, the format, region, roleArn, and uri parameters in source.oss are all required. formatOptions can be omitted or passed as an empty object {}. The initial version has no available configuration keys. Non-empty objects and other JSON types return a parameter error. source.oss.roleArn must belong to the currently authenticated account.

  • The preview provides the final output schema and samples. The formal submission independently discovers the OSS scope.

  • source.logstore.query uses SLS query syntax and can include SPL stages. Verify the query in the SLS console. Fill in the parameters of a node based on the type of the node.

Sample OSS preview request

{
  "source": {
    "type": "oss",
    "oss": {
      "format": "lerobot",
      "region": "cn-beijing",
      "roleArn": "acs:ram::1234567890123456:role/oss-reader",
      "uri": "oss://example-bucket/robot-datasets/"
    }
  },
  "pipeline": {"nodes": []}
}

Response elements

Element

Type

Description

Example

object

The response data.

requestId

string

The request ID used to locate the request during troubleshooting.

9ACFB10A-1B2C-3D4E-5F6G-7H8I9J0K1L2M

meta

object

The query metadata.

progress

string

The SLS query progress. A value of Complete indicates that the query is completed.

Complete

aggQuery

string

The SPL statement for aggregation analysis.

* | SELECT status, count(*) AS cnt GROUP BY status

whereQuery

string

The SPL statement for filter conditions.

status: 200

hasSQL

boolean

Specifies whether an SQL query is used.

true

processedRows

integer

The number of processed log rows.

10000

elapsedMillisecond

integer

The query duration in milliseconds.

1200

cpuSec

number

The consumed CPU time in seconds.

0.5

cpuCores

integer

The number of consumed CPU cores.

2

keys

array

The list of result column names.

["status","method","path"]

string

The list of result column names.

[]

schema

object

The final output dataset schema of the pipeline. The keys are field names, and the type in the values supports text, long, double, and json. The field order is subject to keys.

{"status":{"type":"long"}}

object

The schema description object.

type

string

The dataset field type. Valid values: text, long, double, and json.

text

terms

array<object>

The column types and aggregation information.

[{"column":"status","type":"long"}]

object

The column types and aggregation information.

{"column":"status","type":"long"}

limited

integer

The maximum number of rows returned in the result.

5

mode

integer

The query mode identifier.

1

scanBytes

integer

The number of bytes of scanned raw data.

1048576

count

integer

The number of matched log entries. For OSS sources, the actual number of sample rows is returned.

100

processedBytes

integer

The number of bytes of processed data.

524288

isAccurate

boolean

Specifies whether nanosecond-level ordering is enabled.

true

columnTypes

array

The meta.columnTypes field provides a mapping from column names to data types, such as string, long, double, and json.

["long","string"]

string

The meta.columnTypes field provides a mapping from column names to data types, such as string, long, double, and json.

string

failedRows

integer

The number of rows that failed to be processed in the preview sample. This field is omitted if it is not counted or the count is 0.

1

skippedRows

integer

The number of rows skipped in the preview sample, such as rows filtered by the processing chain. This field is omitted if it is not counted or the count is 0.

2

data

array<object>

The data field is a collection of sample rows (maps in an array) and contains only the first N rows (up to 5 rows by default). It does not reflect the complete write plan.

[{"status":"200","method":"POST"}]

object

The field values.

string

The returned data.

saturation

  • The data field is a collection of sample rows (maps in an array) and contains only the first N rows (up to 5 rows by default). It does not reflect the complete write plan.

  • The meta.limited field indicates whether the row limit is reached. If the value is true, the current data is a truncated subset.

  • The meta.mode field describes the execution mode (spl, sql, or hybrid) and can be used to understand query degradation behavior.

  • The meta.columnTypes field provides a mapping from column names to data types (string, long, double, or json).

  • The meta.processedRows, processedBytes, scanBytes, cpuSec, and cpuCores fields reflect resource consumption and can be used for capacity estimation before creating a pipeline.

  • If the preview does not match any data, data is an empty array, meta.count is 0, and requestId is still returned for log tracing.

The OSS preview uses meta.schema to return the final output schema. Check meta.keys for the column order. If the sample is empty, meta.schema is still returned as long as the schema can be inferred.

Examples

Success response

JSON format

{
  "requestId": "9ACFB10A-1B2C-3D4E-5F6G-7H8I9J0K1L2M",
  "meta": {
    "progress": "Complete",
    "aggQuery": "* | SELECT status, count(*) AS cnt GROUP BY status",
    "whereQuery": "status: 200",
    "hasSQL": true,
    "processedRows": 10000,
    "elapsedMillisecond": 1200,
    "cpuSec": 0.5,
    "cpuCores": 2,
    "keys": [
      "[]"
    ],
    "schema": {
      "key": {
        "type": "text"
      }
    },
    "terms": [
      {
        "column": "status",
        "type": "long"
      }
    ],
    "limited": 5,
    "mode": 1,
    "scanBytes": 1048576,
    "count": 100,
    "processedBytes": 524288,
    "isAccurate": true,
    "columnTypes": [
      "string"
    ],
    "failedRows": 1,
    "skippedRows": 2
  },
  "data": [
    {
      "key": "saturation"
    }
  ]
}

Error codes

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.