Cori
Reference

SDK reference

The @cori-do/sdk package — step constructors, shared options, and step file structure.

Installation

@cori-do/sdk is a dependency of your workflow's step files. It is automatically available when step files are compiled by the Cori CLI. You do not need to install it separately in the workflow folder.

Node.js ≥ 20 is required for step file execution.

Step file structure

Every step file must:

  1. Export a typed input Zod schema as a named export input
  2. Export a typed output Zod schema as a named export output
  3. Export a step.* constructor as the default export
  4. Use a two-digit numeric prefix in the filename (01_, 02_, …)

Schemas are enforced at runtime. A step's declared output schema is not documentation: the runner validates the produced output against it after every code and cli step (LLM steps are enforced provider-side), and a mismatch fails the step with a per-field error naming what drifted. A workflow that runs green really did honor its declared contracts.

steps/01_example.ts
import { step } from '@cori-do/sdk';
import { z } from 'zod';

export const input = z.object({
  value: z.string(),
});

export const output = z.object({
  result: z.string(),
});

export default step.cli({
  description: 'Example step',
  command: ({ input }) => `echo ${input.value}`,
  parse_output: (stdout) => ({ result: stdout.trim() }),
});

Step constructors

All five constructors are available on the step object:

import { step } from '@cori-do/sdk';

step.cli({ ... })
step.mcp_tool({ ... })
step.code({ ... })
step.llm({ ... })
step.builtin({ ... })  // deferred in v1

Shared options

All step constructors accept these shared options:

OptionTypeRequiredDefaultDescription
descriptionstring✓—Human-readable description of what this step does. Required.
retriesobjectSee Retries and timeoutsRetry configuration.
retries.maxnumberPer-kind defaultMaximum number of attempts.
retries.backoff"linear" | "exponential""exponential"Backoff strategy for retries.
timeout_msnumberPer-kind defaultPer-attempt timeout in milliseconds.

step.cli options

OptionTypeRequiredDescription
descriptionstring✓
command(ctx) => string✓Shell command to run. Receives { input }.
parse_output(stdout: string) => output✓Parse stdout into the step's output type.
env(ctx) => Record<string, string>Additional environment variables.

step.mcp_tool options

OptionTypeRequiredDescription
descriptionstring✓
serverstring✓MCP server name (must match mcp_servers in manifest).
toolstring✓Tool name on the MCP server.
args(ctx) => object✓Tool arguments. Receives { input }.
parse_output(result: unknown) => output✓Parse the tool's result into the step's output type.

step.code options

OptionTypeRequiredDescription
descriptionstring✓
run(ctx) => output✓Pure function. Receives { input }. Must not perform I/O.

step.llm options

OptionTypeRequiredDescription
descriptionstring✓
modelstring✓Model identifier (e.g., "gpt-4o-mini"). Provider inferred from name.
prompt(ctx) => string✓Prompt string. Receives { input }.
output_schemaZod schema✓Must match the file's output export.
systemstringOptional system prompt.

step.builtin — deferred in v1

Builtin constructors exist in the SDK but the v1 runtime does not execute them. See Activity kinds.

On this page