Deterministic workflow contract and DSL for Jidoka.
Workflows are application-owned deterministic processes exposed to an agent
as one model-callable operation. Callback workflows implement run/2
directly. Declarative workflows use workflow do, steps do, and output
and execute through a Runic workflow.
Summary
Callbacks
Returns the optional description shown to the model.
Returns the stable workflow identifier.
Returns the optional JSON-compatible input schema.
Runs a callback workflow with normalized input and runtime context.
Functions
Defines a deterministic workflow.
Returns the normalized workflow definition for a workflow module.
Returns a workflow definition or raises when the workflow module is invalid.
Resumes a declarative workflow from a serialized or decoded snapshot.
Runs a workflow with normalized map input.
Types
@type definition() :: Jidoka.Workflow.Spec.t()
Callbacks
@callback description() :: String.t() | nil
Returns the optional description shown to the model.
@callback id() :: String.t()
Returns the stable workflow identifier.
@callback parameters_schema() :: map() | nil
Returns the optional JSON-compatible input schema.
Runs a callback workflow with normalized input and runtime context.
Functions
Defines a deterministic workflow.
Use callback form for a simple opaque operation:
use Jidoka.Workflow, id: :my_workflow
def run(input, context), do: {:ok, %{input: input, context: context}}Use DSL form for a validated multi-step workflow:
use Jidoka.Workflow
workflow do
id :my_workflow
input Zoi.object(%{value: Zoi.integer()})
end
steps do
function :double, {MyApp.Fns, :double, 2}, input: %{value: input(:value)}
end
output from(:double)
@spec definition(module()) :: {:ok, definition()} | {:error, term()}
Returns the normalized workflow definition for a workflow module.
@spec definition!(module()) :: definition()
Returns a workflow definition or raises when the workflow module is invalid.
@spec resume( Jidoka.Workflow.Snapshot.t() | binary(), keyword() ) :: {:ok, term()} | {:hibernate, Jidoka.Workflow.Snapshot.t()} | {:error, term()}
Resumes a declarative workflow from a serialized or decoded snapshot.
@spec run(module(), map() | keyword(), keyword()) :: {:ok, term()} | {:hibernate, Jidoka.Workflow.Snapshot.t()} | {:error, term()}
Runs a workflow with normalized map input.
Options:
:context- runtime context passed to workflow functions, actions, and agent steps.:timeout- total workflow wall-clock timeout in milliseconds.:async- whentrue, independent workflow steps may execute concurrently.:max_concurrency- maximum concurrent workflow steps when:asyncis enabled.:agent_opts- options forwarded to nested agent steps.