Skip to content

YAML Schema

A Runsight workflow is a YAML file with a defined schema. The engine validates every file against Pydantic models before parsing. A JSON schema is auto-generated for Monaco editor autocomplete.

version: "1.0"
souls: # optional — inline soul definitions
my_soul:
id: my_soul
role: Analyst
system_prompt: "..."
model_name: gpt-4.1-mini
tools: [delegate, http] # optional — tool IDs available to this workflow
blocks:
step_one:
type: linear
soul_ref: my_soul
exits:
- id: done
label: Done
- id: retry
label: Retry
step_two:
type: code
code: |
def main(data):
return {"result": data["step_one"].upper()}
depends: step_one
workflow:
name: Example Workflow
entry: step_one
limits: # optional — budget constraints
cost_cap_usd: 1.0
max_duration_seconds: 300
on_exceed: fail
eval: # optional — test cases
cases:
- id: basic_test
fixtures:
step_one: "mock output"
SectionTypeDefaultDescription
versionstr"1.0"Schema version. Currently only "1.0" is supported.
workflowWorkflowDefrequiredGraph metadata — the only required section.
blocksDict[str, BlockDef]{}Block definitions keyed by block ID.
soulsDict[str, SoulDef]{}Inline soul definitions. Key must match soul.id.
toolsList[str][]Tool IDs available to souls in this workflow.
limitsWorkflowLimitsDefnoneWorkflow-level budget constraints.
evalEvalSectionDefnoneEmbedded test cases for offline evaluation.
enabledboolfalseWhether the workflow is active.
configDict[str, Any]{}Arbitrary workflow configuration.
interfaceWorkflowInterfaceDefnonePublic input/output contract for callable sub-workflows.

The graph definition. This is the only required top-level section.

workflow:
name: My Workflow
entry: step_one
transitions:
- from: step_one
to: step_two
- from: step_two
to: null # terminal
FieldTypeDefaultDescription
namestrrequiredWorkflow name
entrystrrequiredBlock ID to start execution
transitionsList[TransitionDef][]Simple A→B transitions
conditional_transitionsList[ConditionalTransitionDef][]Multi-path transitions based on output
transitions:
- from: step_a
to: step_b
- from: step_b
to: null # terminal — workflow ends after this block
FieldTypeDescription
fromstrSource block ID
tostr or nullTarget block ID, or null for terminal
conditional_transitions:
- from: classifier
urgent: handle_urgent
normal: handle_normal
default: handle_normal
FieldTypeDescription
fromstrSource block ID
defaultstr or nullFallback target if no key matches
(extra keys)strDecision key → target block ID

Block definitions are keyed by block ID and use a discriminated union on the type field. See Block Types for the complete reference.

All blocks share these common fields from BaseBlockDef:

FieldTypeDefaultDescription
typestrrequiredBlock type discriminator
dependsstr or List[str]noneUpstream block dependencies
error_routestrnoneTarget block on error
exitsList[ExitDef]noneNamed exit ports for branching
exit_conditionsList[ExitCondition]noneOutput pattern → exit handle mapping
assertionsList[Dict]noneBlock-level quality assertions
retry_configRetryConfignoneRetry on failure
timeout_secondsint300Block execution timeout (1–3600 seconds)
limitsBlockLimitsDefnonePer-block budget constraints
statefulboolfalseMaintain conversation history across re-invocations
inputsDict[str, InputRef]noneExplicit upstream data references
outputsDict[str, str]noneOutput field name → type string
output_conditionsList[CaseDef]noneNamed output branches (mutually exclusive with routes)
routesList[RouteDef]noneShorthand routing (mutually exclusive with output_conditions)
exits:
- id: approve
label: Approved by reviewer
- id: reject
label: Rejected — needs revision

Maps output patterns to exit handles:

exit_conditions:
- contains: "APPROVED"
exit_handle: approve
- regex: "reject|deny"
exit_handle: reject
retry_config:
max_attempts: 3
backoff: exponential
backoff_base_seconds: 2.0
FieldTypeDefaultConstraintsDescription
max_attemptsint31–20Maximum retry attempts
backoffstr"fixed""fixed" or "exponential"Backoff strategy
backoff_base_secondsfloat1.00.1–60.0Base delay between retries
non_retryable_errorsList[str]noneError types that should not be retried

Explicit reference to upstream block output:

inputs:
summary:
from: research_step.output

Budget constraints at the workflow or block level.

limits:
cost_cap_usd: 5.0
max_duration_seconds: 600
token_cap: 50000
on_exceed: fail # "warn" or "fail"
warn_at_pct: 0.8 # 0.0–1.0, triggers warning at this threshold
FieldTypeDefaultConstraints
cost_cap_usdfloatnone>= 0.0
max_duration_secondsintnone1–86400
token_capintnone>= 1
on_exceedstr"fail""warn" or "fail"
warn_at_pctfloat0.80.0–1.0

Same fields as WorkflowLimitsDef minus warn_at_pct. Applied per block via the limits field:

blocks:
expensive_step:
type: linear
soul_ref: analyst
limits:
cost_cap_usd: 0.50
max_duration_seconds: 60
on_exceed: fail

Embedded test cases for offline evaluation. Run without LLM calls using fixture mode.

eval:
threshold: 0.8 # 0.0–1.0, optional pass rate threshold
cases:
- id: test_summary
description: Verify summary output
inputs:
topic: "machine learning"
fixtures:
research: "ML is a subset of AI..."
expected:
summarize:
- type: contains
value: "machine learning"
- type: word-count
min: 50
max: 200
FieldTypeDefaultDescription
idstrrequiredUnique test case ID
descriptionstrnoneHuman-readable description
inputsDict[str, Any]noneInput data for the workflow
fixturesDict[str, str]noneBlock ID → mock output (skips LLM calls)
expectedDict[str, List[Dict]]noneBlock ID → list of assertions

Public contract for sub-workflows called via workflow blocks.

interface:
inputs:
- name: topic
target: research.instruction
type: string
required: true
- name: max_words
target: config.max_words
type: integer
required: false
default: 500
outputs:
- name: summary
source: summarize.output
type: string
FieldTypeDefaultDescription
namestrrequiredInput parameter name (must be unique)
targetstrrequiredDot-notation path to child state key
typestrnoneType hint
requiredbooltrueWhether input must be provided
defaultAnynoneDefault value if not provided
descriptionstrnoneHuman-readable description
FieldTypeDefaultDescription
namestrrequiredOutput parameter name (must be unique)
sourcestrrequiredDot-notation path to child result
typestrnoneType hint
descriptionstrnoneHuman-readable description

A JSON schema is auto-generated from the Pydantic models for Monaco editor autocomplete:

Terminal window
python packages/core/scripts/generate_schema.py # generate
python packages/core/scripts/generate_schema.py --check # verify in sync

The generated schema lives at packages/core/runsight-workflow-schema.json.