OKHAM.org Documentation EnglishCastellano

OBC · Open Business Contract

An Open Business Contract (OBC) describes how a piece of work proceeds. It breaks a process into named steps and describes how work passes between them. A team can use the same flow to explain a procedure to a colleague, review what happens at a decision point, or guide an application that carries out the work.

Scope and execution

A flow can declare the data it receives and returns, the state it carries between steps, and the conditions for taking a particular branch. A step can call an operation, delegate part of the work to another flow, or refer to a policy that governs the next action. Keeping those references in the flow lets a reader trace a decision back to the rule and the operation involved.

The OBC can document a process that already runs in application code. To execute it directly, a workflow engine must understand its actions and transitions, resolve the references, and carry out the selected step. Schema validation checks the flow's structure. Whether a branch reaches its intended destination depends on those bindings and the behaviour of the executor. See the policy contract and the function registry.

Field reference

Read each table within its named object. A required field must be present whenever that object is supplied. Brackets ([]) denote one array entry.

Document

Only the fields listed here are accepted.

Field JSON type Required Meaning and constraints
id string Yes Unique flow identifier. Use at least four dot-separated segments. Each starts with a lowercase letter and continues with lowercase letters or digits.
name string Yes Human-readable flow name. Must be nonempty.
description string Yes Purpose description. Must be nonempty.
steps array of objects Yes Flow steps. At least one entry is required.
inputs array of objects No Typed input parameters (OTC references).
metadata object No Additional metadata.
outputs array of objects No Typed output values (OTC references).
policies array of strings No Governance policies (OPC references).
state object No Business state tracked during execution.
version string No Flow version (semver). Use three dot-separated numbers.

steps[]

Only the fields listed here are accepted.

Field JSON type Required Meaning and constraints
id string Yes Unique step identifier within flow. Start with a lowercase letter, followed by lowercase letters, digits, underscores or hyphens.
type string Yes Step type. Allowed values are action, decision, subflow, event.
description string Yes Step purpose. Must be nonempty.
action object No Configuration interpreted by the executor for an action step.
events array of strings No Identifiers of events emitted by this step.
inputs object No Step input mapping.
outputs object No Step output mapping.
policies array of strings No Policies applied to this step (OPC references).
retry object No Retry configuration.
timeout string No Maximum step duration (ISO 8601 duration). Use an ISO 8601 duration, such as PT30S.
transitions array of objects No Outgoing transitions. Each is an open object interpreted by the executor.

steps[].retry

Additional properties are accepted.

Field JSON type Required Meaning and constraints
backoff string No Backoff strategy. Allowed values are fixed, exponential, linear.
delay string No Initial delay (ISO 8601 duration). Use an ISO 8601 duration, such as PT30S.
maxAttempts integer No Maximum retry attempts. Minimum: 1.

inputs[], outputs[]

Only the fields listed here are accepted.

Field JSON type Required Meaning and constraints
name string Yes Parameter name. Start with a lowercase letter, followed by letters or digits.
type string Yes OTC type reference. Use at least four dot-separated segments. Each starts with a lowercase letter and continues with lowercase letters or digits.
default any JSON value No Default value if not provided.
description string No Parameter description.
required boolean No Whether parameter is required. Schema default: true.

state

Additional properties are accepted.

Field JSON type Required Meaning and constraints
type string Yes OTC type reference for state structure. Use at least four dot-separated segments. Each starts with a lowercase letter and continues with lowercase letters or digits.
initial object No Initial state values.

Defining the workflow

At workflow level, inputs and outputs are lists of parameters. Within a step, those names refer to objects that map values into and out of the step. The flow and its steps can each list policy references in policies. Workflow metadata can carry additional context.

Example: following a branch in OKHAM Memory

The save workflow sends ordinary records and test suites through different preparation steps. Both paths lead to authorisation before storage. In this flow, the step classify names an OFR operation in action.operation. Its transitions use to for the next step and condition for the condition selecting it. When context.saveRecord holds, the target is prepare_record. Transition and action objects are open in this edition. An executor must interpret their fields and resolve each referenced operation, policy and target step.

A step can declare emitted events, a duration in timeout, and a retry object with maxAttempts (at least one), delay and backoff (fixed, linear or exponential). These settings tell the executor how to handle a step that takes too long or fails.

Edition 0.2.0 · JSON Schema · Full example

Read the specification on GitHub