Skip to main content
Version: 4.7.66

Pipelines

🛑Alpha

OpenTelemetry support is currently in alpha and may undergo significant changes.

Pipelines

The pipelines SDK provides programmatic access to Gentrace pipelines. Pipelines are the top-level organizational unit that contains datasets, experiments, and traces.

Overview​

The SDK is built by Stainless and provides type-safe access to Gentrace entities. The pipelines object exposes methods to create, retrieve, update, and list pipelines.

Basic usage​

typescript
import { init, pipelines } from 'gentrace';
init({
apiKey: process.env.GENTRACE_API_KEY,
});
// List pipelines
const pipelineList = await pipelines.list();
// Access the pipelines
for (const pipeline of pipelineList.data) {
console.log(pipeline.slug);
console.log(pipeline.displayName);
}

Pipeline structure​

Each pipeline contains:

  • id: Unique identifier (UUID)
  • slug: URL-friendly unique identifier
  • displayName: Optional human-readable name
  • folderId: Optional folder UUID for organization
  • goldenDatasetId: UUID of the golden dataset (if set)
  • archivedAt: Timestamp when archived (null if active)
  • createdAt: Creation timestamp
  • updatedAt: Last update timestamp

Resource methods​

Create a pipeline​

typescript
const pipeline = await pipelines.create({
slug: 'customer-support-ai',
displayName: 'Customer Support AI Pipeline',
folderId: 'folder-uuid', // optional
});

Retrieve a pipeline​

typescript
const pipeline = await pipelines.retrieve('pipeline-id');
console.log(pipeline.slug);

Update a pipeline​

typescript
const pipeline = await pipelines.update('pipeline-id', {
displayName: 'Updated Pipeline Name',
isArchived: false,
});

List with filters​

typescript
// Filter by folder or slug
const pipelineList = await pipelines.list({
folderId: 'folder-id',
slug: 'customer-support', // exact match or use advanced filters
});

Usage in AI workflows​

Pipelines are used throughout Gentrace to organize your AI workflows:

typescript
// Use pipeline ID with interaction()
const tracedFunction = interaction('My AI Function', myAIFunction, {
pipelineId: pipeline.id,
});
// Use pipeline ID with experiment()
experiment(pipeline.id, async () => {
// Your experiment code
});

See also​