Quickstart Guide

Get started with RelayPlane in 5 minutes. Build your first multi-step AI workflow.

Installation

Install the RelayPlane SDK using npm or pnpm:

1npm install @relayplane/sdk

Your First Workflow

Let's create a simple workflow that generates a greeting and translates it to French.

1import { relay } from '@relayplane/sdk'
2
3// Create a two-step workflow
4const greetingWorkflow = relay
5 .workflow('greeting-workflow')
6 .step('greet', {
7 systemPrompt: 'Say hello to the user in a friendly way.'
8 })
9 .with('openai:gpt-4o')
10 .step('translate', {
11 systemPrompt: 'Translate the previous greeting to French: {{greet.output}}'
12 })
13 .with('openai:gpt-4o')
14 .depends('greet')
15
16// Run the workflow
17const result = await greetingWorkflow.run({
18 apiKeys: {
19 openai: process.env.OPENAI_API_KEY
20 },
21 input: {
22 name: 'Alice'
23 }
24})
25
26// Check the results
27if (result.success) {
28 console.log('Greeting:', result.steps[0].output)
29 console.log('Translation:', result.steps[1].output)
30}
This is the canonical RelayPlane workflow pattern. Every multi-step AI workflow follows this structure: define steps, specify explicit provider:model, declare dependencies, and run.

How It Works

RelayPlane is a local-first workflow orchestration engine. Unlike traditional AI routers or gateways, RelayPlane lets you build multi-step AI workflows that run entirely on your machine with explicit control over which provider and model handles each step.

The .workflow() method creates a new workflow definition. Each .step() defines a task in your workflow. The .with() method specifies the exact provider:model to use. The .depends() method creates a dependency graph (DAG) that determines execution order.

Understanding the Code

1. Import the SDK

The relay object is your main entry point. It provides the workflow() factory method.

2. Define Steps

Each step requires:

  • name - Unique identifier for the step
  • provider:model - Which AI provider to use (openai, anthropic, google, xai, local)
  • systemPrompt - Instructions for the AI model
  • depends() - Optional step names that must complete first

3. Template Variables

Use {{stepName.output}} to reference previous step outputs. Use {{input.field}} to reference workflow inputs.

4. Run the Workflow

Pass your API keys and input data to run(). The engine will:

  • 1.Validate the workflow DAG (detect cycles, check dependencies)
  • 2.Sort steps topologically
  • 3.Execute steps in dependency order
  • 4.Handle retries on failures (if configured)
  • 5.Return complete execution results

Expected Output

1{
2 runId: "run_abc123",
3 workflowName: "greeting-workflow",
4 success: true,
5 steps: [
6 {
7 stepName: "greet",
8 success: true,
9 output: "Hello Alice! It's wonderful to meet you...",
10 durationMs: 1234,
11 tokensIn: 15,
12 tokensOut: 25
13 },
14 {
15 stepName: "translate",
16 success: true,
17 output: "Bonjour Alice! C'est merveilleux de vous rencontrer...",
18 durationMs: 1456,
19 tokensIn: 30,
20 tokensOut: 35
21 }
22 ]
23}

Next Steps