---
title: "ClikaRT::runtime::Pipeline"
sidebar_label: "Pipeline"
description: "A multi-step serving ensemble: each step wraps a Model with its own executor tuning, wired by input/output name maps into one request/response surface."
---

<!-- Generated by tools/doxygen2mdx from Doxygen XML. Do not edit. -->

<span class="api-kind api-kind--class">class</span>

**Header:** `ClikaRT/runtime/pipeline.h`

A multi-step serving ensemble: each step wraps a [`Model`](./Model.md) with its own executor tuning, wired by input/output name maps into one request/response surface.

Build with `create(steps, external_schema)`; enqueue/await follow the [`Executor`](./Executor.md) surface. Move-only handle.

## Static member functions

### create() {#create}

<div class="api-signature">

`static` [`Pipeline`](./Pipeline.md) **`create`**(`std::vector<`[`PipelineStep`](./PipelineStep.md)`>` `steps`, [`ModelSchema`](./ModelSchema.md) `external_schema` `=` `{}`)

</div>

Build a pipeline from its steps (in flow order) and the pipeline's external I/O schema (the request inputs it accepts + the response outputs it emits). Each step's [`Model`](./Model.md) is contained HERE (in your translation unit) so an override's throw is caught caller-side and fails the session; it never unwinds into the engine.

<div class="api-declared">

Declared in `ClikaRT/runtime/pipeline.h`, line 56

</div>

## Member functions

### Pipeline() {#Pipeline}

<div class="api-signature">

**`Pipeline`**(`Pipeline&&` `other`) `noexcept`

</div>

<div class="api-declared">

Declared in `ClikaRT/runtime/pipeline.h`, line 74

</div>

### operator=() {#operator-assign}

<div class="api-signature">

[`Pipeline`](./Pipeline.md)`&` **`operator=`**([`Pipeline`](./Pipeline.md)`&&` `other`) `noexcept`

</div>

Move-only handle; the moved-from object is empty.

<div class="api-declared">

Declared in `ClikaRT/runtime/pipeline.h`, line 76

</div>

### \~Pipeline() {#Pipeline-2}

<div class="api-signature">

**`~Pipeline`**()

</div>

Implicitly shuts down every step's engine.

<div class="api-declared">

Declared in `ClikaRT/runtime/pipeline.h`, line 78

</div>

### enqueue(Request) {#enqueue}

<div class="api-signature">

[`SessionId`](./index.md#SessionId) **`enqueue`**([`Request`](./Request.md) `request`)

</div>

Submit a request; returns its session handle. Non-blocking. The request is validated against the pipeline's external schema before anything runs: every non-optional input present, each supplied input's dtype, rank and every concrete dim as declared (a spec that declares no dims constrains the dtype alone), and inputs sharing a `dim_names` entry agreeing on that extent; a violation is refused here with [`Status::InvalidArgument`](../../index.md#Status) naming the input. An input the schema does not declare is carried through untouched (a step's phase body may read it).

<div class="api-declared">

Declared in `ClikaRT/runtime/pipeline.h`, line 90

</div>

### enqueue(Request, RequestCallbacks) {#enqueue-2}

<div class="api-signature">

[`SessionId`](./index.md#SessionId) **`enqueue`**([`Request`](./Request.md) `request`, [`RequestCallbacks`](./RequestCallbacks.md) `callbacks`)

</div>

Submit a request; returns its session handle. Non-blocking. The request is validated against the pipeline's external schema before anything runs: every non-optional input present, each supplied input's dtype, rank and every concrete dim as declared (a spec that declares no dims constrains the dtype alone), and inputs sharing a `dim_names` entry agreeing on that extent; a violation is refused here with [`Status::InvalidArgument`](../../index.md#Status) naming the input. An input the schema does not declare is carried through untouched (a step's phase body may read it).

<div class="api-declared">

Declared in `ClikaRT/runtime/pipeline.h`, line 96

</div>

### await() {#await}

<div class="api-signature">

[`Response`](./Response.md) **`await`**([`SessionId`](./index.md#SessionId) `session`)

</div>

Block until `session` completes; return its final response.

<div class="api-declared">

Declared in `ClikaRT/runtime/pipeline.h`, line 119

</div>

### cancel() {#cancel}

<div class="api-signature">

`void` **`cancel`**([`SessionId`](./index.md#SessionId) `session`)

</div>

Cooperatively cancel an in-flight session: the step holding it stops at its next step boundary, no later step starts, and [await()](./Pipeline.md#await) or the session's on\_complete report the cancellation (code\_name() "CANCELLED"). A canceled session never marks a chunk final. A session that already completed is a no-op; a session this pipeline never issued is a NotFound-status error.

<div class="api-declared">

Declared in `ClikaRT/runtime/pipeline.h`, line 128

</div>

### shutdown() {#shutdown}

<div class="api-signature">

`void` **`shutdown`**()

</div>

Drain in-flight work and stop. When [shutdown()](./Pipeline.md#shutdown) returns, every accepted session has completed and [await()](./Pipeline.md#await) still returns its result. A later [enqueue()](./Pipeline.md#enqueue) is refused with an InvalidArgument-status error whose code\_name() is "FAILED\_PRECONDITION".

<div class="api-declared">

Declared in `ClikaRT/runtime/pipeline.h`, line 135

</div>
