The pipelines SDK provides programmatic access to Gentrace pipelines. Pipelines are the top-level organizational unit that contains datasets, experiments, and traces.
Basic usage
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);
}
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.
Pipeline structure
Each pipeline contains:
URL-friendly unique identifier
Optional human-readable name
Optional folder UUID for organization
UUID of the golden dataset (if set)
Timestamp when archived (null if active)
Resource methods
Create a pipeline
const pipeline = await pipelines.create({
slug: 'customer-support-ai',
displayName: 'Customer Support AI Pipeline',
folderId: 'folder-uuid', // optional
});
Retrieve a pipeline
const pipeline = await pipelines.retrieve('pipeline-id');
console.log(pipeline.slug);
Update a pipeline
const pipeline = await pipelines.update('pipeline-id', {
displayName: 'Updated Pipeline Name',
isArchived: false,
});
List with filters
// 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:
// 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