Jidoka.Workflow behaviour (Jidoka v0.8.0-beta.1)

Copy Markdown View Source

Minimal deterministic workflow contract for Jidoka.

A workflow is application-owned deterministic code exposed to an agent as one model-callable operation. It is separate from the Runic agent turn spine: the agent chooses when to call it, while the workflow module owns the ordered process inside run/2.

Summary

Functions

Defines a deterministic workflow module for agent tool exposure.

Returns the normalized operation definition for a workflow module.

Returns a workflow definition or raises when the workflow module is invalid.

Runs a workflow with normalized map input and optional context.

Types

definition()

@type definition() :: %{
  :id => String.t(),
  :module => module(),
  optional(:description) => String.t() | nil,
  optional(:parameters_schema) => map() | nil
}

Callbacks

description()

(optional)
@callback description() :: String.t() | nil

id()

@callback id() :: String.t()

parameters_schema()

(optional)
@callback parameters_schema() :: map() | nil

run(input, context)

@callback run(input :: map(), context :: map()) ::
  {:ok, term()} | {:error, term()} | term()

Functions

__using__(opts \\ [])

(macro)

Defines a deterministic workflow module for agent tool exposure.

definition(workflow_module)

@spec definition(module()) :: {:ok, definition()} | {:error, term()}

Returns the normalized operation definition for a workflow module.

definition!(workflow_module)

@spec definition!(module()) :: definition()

Returns a workflow definition or raises when the workflow module is invalid.

run(workflow_module, input, opts \\ [])

@spec run(module(), map() | keyword(), keyword()) :: {:ok, term()} | {:error, term()}

Runs a workflow with normalized map input and optional context.