Runner¶
DAG execution and trace recording.
runner
¶
Executing a scientific experiment.
This module orchestrates deterministic DAG execution, dataset externalization, machine-recorded provenance collection, and dirty-node caching.
RunError
¶
Bases: RuntimeError
Raised when an experiment cannot be run.
RunServices
dataclass
¶
Execution context and services provided to agents during a run.
Attributes:
| Name | Type | Description |
|---|---|---|
run_dir |
Path
|
Path to the active run directory. |
tools |
ToolRegistry
|
Tool registry for resolving and executing tool calls. |
experiment_dir |
Path
|
Path to the experiment directory containing workflows. |
on_log |
Callable[[str, str], None] | None
|
Optional callback for streaming log messages. |
data_dir
¶
hydrate
¶
Rehydrates dataset reference pointers into active Python objects.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
value
|
Any
|
Value or dataset reference to hydrate. |
required |
Returns:
| Type | Description |
|---|---|
Any
|
The hydrated data object. |
Source code in python/src/science_adk/runner.py
call_tool
async
¶
Calls a tool asynchronously on a thread pool.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
Name of the tool to execute. |
required |
arguments
|
dict[str, Any]
|
Arguments dictionary for the tool. |
required |
Returns:
| Type | Description |
|---|---|
Any
|
Tool execution output. |
Source code in python/src/science_adk/runner.py
log
async
¶
Logs an informational message for a node.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
node_id
|
str
|
Identifier of the node. |
required |
message
|
str
|
Message text to log. |
required |
Runner
dataclass
¶
Orchestrates experiment execution and persists provenance traces.
Attributes:
| Name | Type | Description |
|---|---|---|
project |
Project
|
The active scientific research Project workspace. |
experiment_id |
str
|
Target experiment identifier. |
tools |
ToolRegistry | None
|
Tool registry for tools available to the experiment. |
verbose |
bool
|
Whether to log execution progress to stdout. |
run
¶
Synchronously executes the experiment workflow.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
only
|
list[str] | None
|
Optional list of node IDs to restrict execution to. |
None
|
reuse
|
str | None
|
Optional prior run ID to reuse cached node outputs from. |
None
|
Returns:
| Type | Description |
|---|---|
Trace
|
Completed Trace object. |
Source code in python/src/science_adk/runner.py
run_async
async
¶
Asynchronously executes the experiment workflow.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
only
|
list[str] | None
|
Optional list of node IDs to restrict execution to. |
None
|
reuse
|
str | None
|
Optional prior run ID to reuse cached node outputs from. |
None
|
Returns:
| Type | Description |
|---|---|
Trace
|
Completed Trace object. |
Raises:
| Type | Description |
|---|---|
RunError
|
If the workflow fails validation. |
Source code in python/src/science_adk/runner.py
fingerprint
¶
Computes a SHA-256 fingerprint of node inputs, parameters, and code.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
code
|
str
|
Source code of the agent module. |
required |
params
|
dict[str, Any]
|
Node parameter dictionary. |
required |
inputs
|
dict[str, Any]
|
Port inputs dictionary. |
required |
Returns:
| Type | Description |
|---|---|
str
|
16-character hexadecimal hash string. |
Source code in python/src/science_adk/runner.py
run_nested
async
¶
Runs a nested sub-workflow for a CompositeAgent.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
workflow_path
|
str
|
Relative path to the nested workflow.json file. |
required |
inputs
|
dict[str, Any]
|
Inputs dictionary mapped to the composite agent. |
required |
services
|
RunServices
|
Active execution services. |
required |
Returns:
| Type | Description |
|---|---|
dict[str, Any]
|
Dictionary of terminal outputs mapped to output ports. |
Raises:
| Type | Description |
|---|---|
RunError
|
If the sub-workflow file is missing or invalid. |