Skip to main content

Workflow Schema Reference

This page documents every field in a workflow.json file. For the full TypeScript interface and JSON Schema, see the API Reference: Workflow Schema.

Top-Level Structure

{
"name": "my-pipeline",
"description": "A multi-step RAG pipeline",
"version": "1.0.0",
"branding": {
"icon": "search",
"color": "#00D4AA"
},
"inputs": {
"query": { "type": "string", "required": true }
},
"defaults": {
"db": "mydb",
"collection": "docs"
},
"steps": [ ... ],
"output": "{{ brief.output.response }}"
}

Top-level fields

FieldTypeRequiredDescription
namestringYesHuman-readable workflow name.
descriptionstringNoWhat this workflow does.
versionstringNoSemver version (e.g., "1.0.0").
brandingobjectNoIcon and accent color for the Workflow Store. See Branding.
inputsobjectNoParameterized inputs the user provides at runtime.
defaultsobjectNoShared default values for db, collection, and model.
stepsarrayYesOrdered array of pipeline steps.
outputobjectNoTemplate expressions defining the final workflow result.

Branding

The branding field controls how your workflow appears in the Workflow Store UI. It contains two optional properties:

"branding": {
"icon": "target",
"color": "#8B5CF6"
}
FieldTypeDescription
iconstringA predefined Lucide icon name (e.g., "search", "brain", "trophy").
colorstringHex color code for the icon accent (e.g., "#00D4AA").

If omitted, the store infers branding from the workflow's category and tools. For the full list of available icon names, see Publishing Workflows: Available Icons.

tip

Branding in workflow.json is used for built-in workflows. For published npm packages, set branding in package.json under vai.branding instead. See Publishing Workflows.

Inputs

Each key in inputs declares a parameter the user can set at runtime with --input:

"inputs": {
"query": {
"type": "string",
"required": true,
"description": "The search query"
},
"limit": {
"type": "number",
"default": 10,
"description": "Maximum results to retrieve"
}
}
FieldTypeDescription
type"string" | "number" | "boolean"Data type for the input.
requiredbooleanWhether the input must be provided.
defaultanyDefault value when not provided.
descriptionstringHuman-readable description (shown in vai workflow info).

Reference inputs in step definitions with {{ inputs.query }}.

Defaults

Shared defaults that steps inherit when they do not specify their own values:

"defaults": {
"db": "production",
"collection": "knowledge",
"model": "voyage-4-large"
}
FieldTypeDescription
dbstringDefault MongoDB database name.
collectionstringDefault collection name.
modelstringDefault Voyage AI model.

Steps

Each step is an object in the steps array:

{
"id": "search",
"name": "Search knowledge base",
"tool": "query",
"inputs": {
"query": "{{ inputs.query }}",
"limit": "{{ inputs.limit }}"
},
"condition": "{{ inputs.query }}",
"continueOnError": false
}

Step fields

FieldTypeRequiredDescription
idstringYesUnique identifier. Must match ^[a-zA-Z_][a-zA-Z0-9_]*$. Referenced by other steps.
namestringNoHuman-readable label shown during execution.
descriptionstringNoLonger description of what this step does.
toolstringYesThe operation to run. See Step Types.
inputsobjectYesTool-specific inputs. Supports template expressions.
conditionstringNoTemplate expression. Step runs only if this evaluates truthy.
forEachstringNoTemplate expression resolving to an array. Step runs once per element.
continueOnErrorbooleanNoIf true, the workflow continues even if this step fails. Default: false.

Step types

ToolDescription
queryFull RAG query with embedding, vector search, and optional reranking.
searchRaw vector similarity search without reranking.
rerankRerank documents against a query using Voyage AI reranker.
embedGenerate an embedding vector for text.
similarityCompute cosine similarity between two texts.
ingestChunk, embed, and store a document in MongoDB.
collectionsList MongoDB collections.
modelsList available Voyage AI models.
explainGet an educational explanation of a topic.
estimateEstimate embedding costs.
mergeConcatenate arrays from multiple steps.
filterFilter array items by a condition.
transformTransform data with expressions.
generateCall the configured LLM.

For detailed input schemas for each tool, see the API Reference: Workflow Schema.

Output

The output field defines what the workflow produces. Use template expressions to reference step results:

"output": "{{ brief.output.response }}"

Or return a structured object:

"output": {
"summary": "{{ brief.output.response }}",
"sources": "{{ search.output.results }}",
"cost": "{{ estimate.output.total }}"
}

Validation Rules

  • Every step must have a unique id
  • Step IDs must start with a letter or underscore, followed by letters, digits, or underscores
  • Template expressions referencing step outputs (e.g., {{ search.output }}) must point to a step that exists
  • No circular dependencies allowed
  • At least one step is required

Validate any workflow file:

vai workflow validate my-workflow.json

Further Reading