Metadata-Version: 2.4
Name: loom-workflow
Version: 0.9.0
Summary: Task orchestration, contracts
Requires-Python: >=3.10
Description-Content-Type: text/markdown

# Loom

Loom provides domain-neutral building blocks for executing tasks in flows and
exploring alternative flow implementations or configurations with a Workbench.
Contracts evaluate results independently of any particular domain or agent.

## Flow

A `Flow` controls task sequencing, branching and repetition. Its `execute()`
returns a `FlowResult`; tasks return `TaskResult`. `Flow.repeat()` runs a task
until it reports no modification or reaches its iteration limit.

## Workbench

A `Workbench` constructs flows and runs a `FlowVariant`, which specifies task
flow constructor configuration. Each Flow owns the selection and execution
of its tasks.

```python
from loom.core import Evaluation, FlowVariant, Workbench

workbench = Workbench(MyFlow)
result = workbench.run(input_value, FlowVariant(configuration={"level": 2}))

# strategy.propose(previous_evaluation) returns a FlowVariant.
# evaluator returns Evaluation(accepted=..., result=result, feedback=...).
result = workbench.explore(input_value, strategy, evaluator=evaluator,
                           max_attempts=5)
```

Without an evaluator, a run is accepted when it returns successfully. Execution
exceptions are passed to the strategy as failed `Evaluation` feedback. After
exhausting attempts, `AttemptsExhausted.evaluation` retains the last outcome.
An `input_factory` can supply fresh input for each run when flows mutate inputs.

## Contracts

`Contract`, `ContractResult`, `ContractException`, and `Verifier` are available
from `loom.core`. Contracts evaluate results; the verifier collects failures
and raises `ContractException` when a check fails.

## Example

See [examples](examples/README.md) for a mock flow and a Workbench running multiple configurations.
