@agentsmarket/pipeline-runtime
v0.5.0
Published
Runtime for executing PIPELINE.md workflows (multi-skill orchestration). Provider-agnostic (MiniMax, Claude, OpenAI).
Readme
@agentsmarket/pipeline-runtime
Executes PIPELINE.md files — multi-stage AI workflows.
Note (Phase 2): The production executor lives in
@agentsmarket/server(Cloudflare Worker), which runs pipelines server-side atPOST /v1/pipelines/:id/invokewith provenance signing. Thebin/webhook.mjsHTTP server in this package is a local dev tool + self-hosting reference. Use it when you want to run pipelines outside the marketplace (e.g. for testing, custom deployments, or before publishing your pipeline toagentsmarket.world).
Quick start
import { MiniMaxProvider, runPipeline, runPipelineV2 } from '@agentsmarket/pipeline-runtime';
const provider = new MiniMaxProvider(); // reads MINIMAX_API_KEY env
const pipeline = {
name: 'code-refactor',
version: '1.0.0',
stages: [
{
id: 'analyze',
provider: 'minimax', // R6: explicit provider declaration
model: 'MiniMax-M3',
system: 'You are a code analyzer.',
prompt: 'Analyze this code: {{code}}. List 3 improvement opportunities.',
},
{
id: 'refactor',
provider: 'minimax',
model: 'MiniMax-M3',
depends_on: ['analyze'],
system: 'You are a senior engineer.',
prompt: 'Refactor the code based on: {{analyze}}. Original: {{code}}. Return only the refactored code.',
},
],
};
const result = await runPipeline(pipeline, { code: '...' }, { provider });
console.log(result.refactor);Provider ≠ Model (R6, v0.3)
As of R6 every LLM stage must declare both provider: and model:.
Auto-dispatch by model name was removed. See
docs/R6-PROVIDER-MODEL.md for the
full design; quick reference:
stages:
- id: analyze
provider: minimax # required — one of openai|anthropic|minimax|openrouter|replicate
model: MiniMax-M3 # required — must be in PROVIDER_REGISTRY[provider].supportedModels
prompt: ...Use validateR6Spec(spec) (CLI / server) to fail-fast on invalid pairs:
import { validateR6Spec } from '@agentsmarket/pipeline-runtime';
const { errors } = validateR6Spec({
stages: [{ id: 's0', provider: 'replicate', model: 'gpt-4o', prompt: 'x' }],
});
// errors[0]: "Stage 's0': Provider 'replicate' does not support model 'gpt-4o'.
// Supported models for replicate: [...]"For automated migration of legacy v0.2 pipelines:
import { migrateProviderField } from '@agentsmarket/pipeline-runtime';
const migrated = migrateProviderField(legacySpec); // adds provider: minimax to LLM stagesProvider abstraction
Pipelines reference models by name. The runtime picks a provider that knows that model:
minimax— MiniMax (default). Models:MiniMax-M3,MiniMax-M2.7,MiniMax-M1. Env:MINIMAX_API_KEY.openai— OpenAI. Models:gpt-4o,gpt-4o-mini,o1-preview,o1-mini,gpt-3.5-turbo. Env:OPENAI_API_KEY.anthropic— Anthropic. Models:claude-3-5-sonnet-20241022,claude-3-5-haiku-20241022,claude-3-opus-20240229. Env:ANTHROPIC_API_KEY.openrouter— Multi-model gateway (supportedModels: ['*']). Env:OPENROUTER_API_KEY.replicate— Replicate (image gen). Models:black-forest-labs/flux-pro,black-forest-labs/flux-schnell,stability-ai/sdxl. Env:REPLICATE_API_TOKEN.
Single source of truth: PROVIDER_REGISTRY in
src/provider-registry.ts.
Status
v0.3 — R6 (Provider ≠ Model) shipped. Linear + DAG stage execution. Retry, parallel branches, checkpoint.
