spdl.autoresearch.core.TaskSpec¶
- class TaskSpec(id: str, priority: float = 0.0, kind: str = 'default', payload: dict[str, object] = <factory>)[source]¶
Serializable unit of work for the async engine.
Methods
from_dict(data)Reconstruct a
TaskSpecfrom a dictionary.to_dict()Serialize this spec to a JSON-compatible dictionary.
Attributes
Category tag used by the adapter to distinguish spec types without inspecting the payload.
Scheduling priority.
Unique identifier for this work item.
Arbitrary key-value data that travels with the spec through the engine lifecycle (enqueue → checkpoint → make_coro → on_result).
- classmethod from_dict(data: dict[str, object]) TaskSpec¶
Reconstruct a
TaskSpecfrom a dictionary.Missing keys fall back to field defaults. A non-dict
payloadvalue is replaced with an empty dictionary.- Parameters:
data – Dictionary previously produced by
to_dict().- Returns:
A new
TaskSpecinstance.
- kind: str = 'default'¶
Category tag used by the adapter to distinguish spec types without inspecting the payload. For example, the SPDL workflow sets this to
"experiment"so the policy layer can filter experiment specs from other internal bookkeeping specs.
- payload: dict[str, object]¶
Arbitrary key-value data that travels with the spec through the engine lifecycle (enqueue → checkpoint → make_coro → on_result). The adapter stores domain-specific state here — for example, the SPDL workflow stores the full
HypothesisNodedict underpayload["node"].