Skip to main content

Class: Pipeline

Defined in: packages/tools/src/baleybots-dsl-v2/pipeline.ts:68

A compiled DSL pipeline that can be executed multiple times.

Pipeline implements the Processable interface, allowing it to be composed with other Baleybots primitives (chains, parallels, etc.).

Examples

Basic usage

const pipeline = Pipeline.from(`
writer { "goal": "Write a haiku about the input" }
`);
const result = await pipeline.process('mountains');

With streaming

const result = await pipeline.process(input, {
onToken: (botName, event) => {
if (event.type === 'text_delta') {
process.stdout.write(event.text);
}
}
});

With custom tools

const pipeline = Pipeline.from(code, {
availableTools: { myTool: myCustomTool }
});

Implements

  • Processable<unknown, unknown>

Methods

getBotNames()

getBotNames(): string[]

Defined in: packages/tools/src/baleybots-dsl-v2/pipeline.ts:150

Get all bot names defined in the pipeline.

Returns

string[]

Array of entity names from the DSL code

Implementation of

Processable.getBotNames


getChildren()

getChildren(): ProcessableChild[]

Defined in: packages/tools/src/baleybots-dsl-v2/pipeline.ts:141

Delegate to the compiled executable.

A Pipeline is a handle on whatever the DSL compiled to, not a node in its own right — reporting the executable as a child would show a wrapper the developer never wrote, one level above the constructs they did.

Returns

ProcessableChild[]

Implementation of

Processable.getChildren


getId()

getId(): string

Defined in: packages/tools/src/baleybots-dsl-v2/pipeline.ts:123

Get unique pipeline ID.

Returns

string

Implementation of

Processable.getId


getName()

getName(): string

Defined in: packages/tools/src/baleybots-dsl-v2/pipeline.ts:130

Get pipeline name (from main composition or 'pipeline').

Returns

string

Implementation of

Processable.getName


getRunInput()

getRunInput(): string | null

Defined in: packages/tools/src/baleybots-dsl-v2/pipeline.ts:168

Get the run input from the DSL code (if any).

Returns

string | null

The input string from run("...") statement, or null


getStructure()

getStructure(): PipelineStructure | null

Defined in: packages/tools/src/baleybots-dsl-v2/pipeline.ts:159

Get the pipeline structure for visualization.

Returns

PipelineStructure | null

Serializable structure describing the pipeline topology


process()

process(input, options?): Promise<unknown>

Defined in: packages/tools/src/baleybots-dsl-v2/pipeline.ts:114

Execute the pipeline with the given input.

If the DSL code includes a run("...") statement, that input will be used. Otherwise, the provided input parameter is used.

Parameters

input

unknown

Input to process (ignored if DSL has run statement)

options?

ProcessOptions

Processing options (streaming, abort signal, etc.)

Returns

Promise<unknown>

The pipeline output

Implementation of

Processable.process


subscribeToAll()

subscribeToAll(options?): Subscription

Defined in: packages/tools/src/baleybots-dsl-v2/pipeline.ts:178

Subscribe to all pipeline events.

Parameters

options?

Subscription options with categorized callbacks

omit?

string[]

onComplete?

(botId, botName, output) => void

onError?

(botId, botName, event) => void

onProgressUpdate?

(botId, botName, event) => void

onStreamEvent?

(botId, botName, event) => void

Returns

Subscription

Subscription that can be unsubscribed

Implementation of

Processable.subscribeToAll


from()

static from(code, config?): Pipeline

Defined in: packages/tools/src/baleybots-dsl-v2/pipeline.ts:98

Create a pipeline from DSL code.

Parameters

code

string

BAL (Baleybots Assembly Language) code

config?

PipelineConfig

Optional configuration for model, tools, etc.

Returns

Pipeline

A compiled Pipeline ready for execution

Example

const pipeline = Pipeline.from(`
sentiment { "goal": "Analyze sentiment" }
keywords { "goal": "Extract keywords" }
chain { sentiment keywords }
`);