Package¶
Everything exported at the top level.
science_adk
¶
Science ADK — an agent development kit for autonomous scientific research.
Built on Google Agent Development Kit (ADK), Science ADK provides typed scientific ports, machine-recorded provenance ledgers, deterministic gates, and reproducible experiment lifecycles.
Basic Example
Define a scientific agent and run it:
from science_adk import AlgorithmAgent, Port, Ports
class Simulate(AlgorithmAgent):
'''Integrate the equations of motion.'''
ports: Ports = Ports(
inputs=[Port("config", "json")],
outputs=[Port("trajectory", "dataframe")],
)
async def execute(self):
config = await self.input("config")
...
return {"trajectory": frame}
Agent
¶
Bases: BaseAgent
Base class for scientific agents built on Google ADK.
Subclasses declare :attr:ports and implement :meth:execute. Everything
else exists to make that method short, reproducible, and verifiable.
Attributes:
| Name | Type | Description |
|---|---|---|
ports |
Ports
|
Typed input and output port declarations. |
params |
dict[str, Any]
|
Static parameters from the experiment workflow definition. |
purpose |
str
|
Description of what this agent does and why. |
kind |
str
|
Primitive role played by this agent (e.g., algorithm, data). |
execute
async
¶
Executes the scientific computation.
Returns:
| Type | Description |
|---|---|
dict[str, Any]
|
A dictionary mapping declared output port names to their computed values. |
Raises:
| Type | Description |
|---|---|
NotImplementedError
|
If the subclass does not implement this method. |
Source code in python/src/science_adk/agent.py
bind
¶
Provides input values directly.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
**inputs
|
Any
|
Keyword arguments representing input port values. |
{}
|
Returns:
| Type | Description |
|---|---|
Agent
|
Self for chaining. |
Source code in python/src/science_adk/agent.py
attach
¶
Attaches execution services (tools, data storage, logging).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
services
|
Any
|
The execution services provider. |
required |
Returns:
| Type | Description |
|---|---|
Agent
|
Self for chaining. |
Source code in python/src/science_adk/agent.py
input
async
¶
Reads a declared input port.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
port
|
str
|
The name of the input port. |
required |
default
|
Any
|
Default value if the port carries no value and is optional. |
None
|
Returns:
| Type | Description |
|---|---|
Any
|
The hydrated value associated with the port. |
Raises:
| Type | Description |
|---|---|
AgentError
|
If the port is not declared or a required port has no value. |
Source code in python/src/science_adk/agent.py
param
¶
Reads a static parameter from node configuration.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
Name of the parameter. |
required |
default
|
Any
|
Default fallback value if not specified. |
None
|
Returns:
| Type | Description |
|---|---|
Any
|
The parameter value. |
Source code in python/src/science_adk/agent.py
call_tool
async
¶
Calls a tool by name and records provenance.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
Name of the tool. |
required |
**arguments
|
Any
|
Arguments to pass to the tool. |
{}
|
Returns:
| Type | Description |
|---|---|
Any
|
The tool execution result. |
Raises:
| Type | Description |
|---|---|
AgentError
|
If execution services are not attached. |
Source code in python/src/science_adk/agent.py
fetch
async
¶
Fetches a URL with bounded exponential backoff and records provenance.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
url
|
str
|
The URL to fetch. |
required |
timeout
|
int
|
Timeout in seconds. |
60
|
retries
|
int
|
Maximum number of retry attempts. |
3
|
Returns:
| Type | Description |
|---|---|
str
|
The decoded response text. |
Raises:
| Type | Description |
|---|---|
AgentError
|
If the fetch fails after all retry attempts. |
Source code in python/src/science_adk/agent.py
artifact
¶
Reserves a path in this run's data directory and logs file creation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
filename
|
str
|
Name of the artifact file. |
required |
Returns:
| Type | Description |
|---|---|
Path
|
Path to the reserved file location. |
Raises:
| Type | Description |
|---|---|
AgentError
|
If execution services are not attached. |
Source code in python/src/science_adk/agent.py
log
async
¶
Records an informational log message in the provenance trace.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
message
|
str
|
Message text to record. |
required |
Source code in python/src/science_adk/agent.py
validate_outputs
¶
Validates execution output against declared output ports.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
outputs
|
Any
|
The output dictionary returned by |
required |
Returns:
| Type | Description |
|---|---|
dict[str, Any]
|
The validated outputs dictionary. |
Raises:
| Type | Description |
|---|---|
AgentError
|
If output types or keys mismatch declared output ports. |
Source code in python/src/science_adk/agent.py
default_ports
classmethod
¶
describe
classmethod
¶
Returns a machine-readable summary of the agent class.
Source code in python/src/science_adk/agent.py
AgentError
¶
Bases: RuntimeError
Raised when an agent misuses the runtime (bad port, missing input).
Edge
dataclass
¶
A typed connection carrying an output port into an input port.
Attributes:
| Name | Type | Description |
|---|---|---|
source |
str
|
Source node id. |
source_port |
str
|
Name of the output port on the source node. |
target |
str
|
Target node id. |
target_port |
str
|
Name of the input port on the target node. |
from_dict
classmethod
¶
Constructs an Edge from dictionary data.
Source code in python/src/science_adk/models.py
Experiment
dataclass
¶
Experiment(id, hypothesis='', rationale='', parent='', generation=0, status='draft', best_run='', best_score=None, created_at=utcnow())
One testable hypothesis and its lineage.
Attributes:
| Name | Type | Description |
|---|---|---|
id |
str
|
Unique experiment identifier (e.g., '001-nonlinear-oscillator'). |
hypothesis |
str
|
Precise testable claim. |
rationale |
str
|
Empirical justification for why this hypothesis was chosen. |
parent |
str
|
Parent experiment ID in the hypothesis tree. |
generation |
int
|
Tree depth level of this experiment. |
status |
str
|
Current status (draft, ready, run, superseded, abandoned). |
best_run |
str
|
Run ID of the highest scoring run. |
best_score |
float | None
|
Highest score achieved. |
created_at |
str
|
ISO-8601 creation timestamp. |
from_dict
classmethod
¶
Constructs an Experiment from dictionary data.
Source code in python/src/science_adk/models.py
Gate
dataclass
¶
Goal
dataclass
¶
Goal(question='', background='', target_metric='', target_value=None, constraints=list(), created_at=utcnow())
The overarching research question, success metric, and constraints.
Attributes:
| Name | Type | Description |
|---|---|---|
question |
str
|
The scientific question under investigation. |
background |
str
|
Contextual background and motivation. |
target_metric |
str
|
Quantitative evaluation metric name. |
target_value |
float | None
|
Success threshold for the target metric. |
constraints |
list[str]
|
List of experimental or methodological constraints. |
created_at |
str
|
ISO-8601 creation timestamp. |
from_dict
classmethod
¶
Constructs a Goal from dictionary data.
Source code in python/src/science_adk/models.py
Learning
dataclass
¶
Learning(insight, evidence='', experiment='', run_id='', created_at=utcnow())
An empirically validated insight backed by run evidence.
Attributes:
| Name | Type | Description |
|---|---|---|
insight |
str
|
The empirical finding or generalization. |
evidence |
str
|
Specific runs or measurements demonstrating the finding. |
experiment |
str
|
Experiment identifier where the finding was made. |
run_id |
str
|
Run identifier of the supporting run. |
created_at |
str
|
ISO-8601 creation timestamp. |
from_dict
classmethod
¶
Constructs a Learning from dictionary data.
Source code in python/src/science_adk/models.py
Node
dataclass
¶
Node(id, name, kind='algorithm', purpose='', ports=Ports(), module='', tools=list(), params=dict(), workflow='')
One step of an experiment: a named agent with a typed port surface.
Attributes:
| Name | Type | Description |
|---|---|---|
id |
str
|
Unique identifier of the node within the workflow DAG. |
name |
str
|
Human-readable name for the node. |
kind |
str
|
The primitive agent kind (must be one of AGENT_KINDS). |
purpose |
str
|
Description of what this node does and why. |
ports |
Ports
|
Declared input and output ports. |
module |
str
|
Path to the Python file implementing the agent. |
tools |
list[str]
|
Advisory list of tools this agent may call. |
params |
dict[str, Any]
|
Static parameters passed to the agent. |
workflow |
str
|
For composite agents, the path to the nested workflow. |
from_dict
classmethod
¶
Constructs a Node from dictionary data.
Source code in python/src/science_adk/models.py
to_dict
¶
Serializes the Node instance to a dictionary.
Source code in python/src/science_adk/models.py
NodeRun
dataclass
¶
NodeRun(node_id, state='pending', started_at='', finished_at='', duration_s=0.0, outputs=dict(), logs=list(), error='', traceback='', provenance=dict(), fingerprint='')
The execution record of one node.
Attributes:
| Name | Type | Description |
|---|---|---|
node_id |
str
|
Identifier of the executing node. |
state |
str
|
Execution status (pending, running, passed, failed, cached). |
started_at |
str
|
ISO-8601 execution start timestamp. |
finished_at |
str
|
ISO-8601 execution finish timestamp. |
duration_s |
float
|
Total run duration in seconds. |
outputs |
dict[str, Any]
|
Map of output port names to values or dataset references. |
logs |
list[str]
|
Informational log messages recorded during execution. |
error |
str
|
Error message string if execution failed. |
traceback |
str
|
Exception traceback if execution failed. |
provenance |
dict[str, list[dict[str, Any]]]
|
Machine-recorded ingress and tool-call evidence. |
fingerprint |
str
|
Execution cache hash (code + inputs + parameters). |
from_dict
classmethod
¶
Constructs a NodeRun from dictionary data.
Source code in python/src/science_adk/models.py
Port
dataclass
¶
A single typed input or output port of an agent.
Attributes:
| Name | Type | Description |
|---|---|---|
name |
str
|
The unique name of the port on this agent. |
type |
str
|
Data type of the port (must be one of PORT_TYPES). |
description |
str
|
Explanation of what this port carries. |
required |
bool
|
Whether a value is strictly required on this port. |
from_dict
classmethod
¶
Constructs a Port from a dictionary or string shorthand.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
dict[str, Any] | str
|
Dictionary containing port specification or string port name. |
required |
Returns:
| Type | Description |
|---|---|
Port
|
A new Port instance. |
Source code in python/src/science_adk/models.py
Ports
dataclass
¶
The complete input and output port surface of an agent.
Attributes:
| Name | Type | Description |
|---|---|---|
inputs |
list[Port]
|
List of declared input ports. |
outputs |
list[Port]
|
List of declared output ports. |
input
¶
output
¶
from_dict
classmethod
¶
Constructs Ports from dictionary data.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
dict[str, Any] | None
|
Dictionary with 'inputs' and 'outputs' lists. |
required |
Returns:
| Type | Description |
|---|---|
Ports
|
A new Ports instance. |
Source code in python/src/science_adk/models.py
to_dict
¶
Serializes the Ports instance to a dictionary.
Score
dataclass
¶
Score(run_id, gates=list(), pillars=dict(), rationale='', target_metric='', target_value=None, observed_value=None, audited_at='')
The evaluation verdict on one run.
Attributes:
| Name | Type | Description |
|---|---|---|
run_id |
str
|
Unique run identifier. |
gates |
list[Gate]
|
List of deterministic Gate results. |
pillars |
dict[str, float]
|
Judgement pillar scores (in [0, 1]). |
rationale |
str
|
Written audit rationale. |
target_metric |
str
|
Name of the target metric. |
target_value |
float | None
|
Goal threshold target. |
observed_value |
float | None
|
Empirically measured value. |
audited_at |
str
|
ISO-8601 audit timestamp. |
from_dict
classmethod
¶
Constructs a Score from dictionary data.
Source code in python/src/science_adk/models.py
to_dict
¶
Serializes the Score to a dictionary.
Source code in python/src/science_adk/models.py
Trace
dataclass
¶
Trace(run_id, experiment='', state='pending', started_at=utcnow(), finished_at='', duration_s=0.0, nodes=list(), error='')
The complete record of one workflow execution run.
Attributes:
| Name | Type | Description |
|---|---|---|
run_id |
str
|
Unique run identifier. |
experiment |
str
|
Experiment identifier. |
state |
str
|
Overall workflow state. |
started_at |
str
|
ISO-8601 start timestamp. |
finished_at |
str
|
ISO-8601 finish timestamp. |
duration_s |
float
|
Total execution duration in seconds. |
nodes |
list[NodeRun]
|
List of NodeRun records. |
error |
str
|
Top-level error message if run aborted. |
node
¶
from_dict
classmethod
¶
Constructs a Trace from dictionary data.
Source code in python/src/science_adk/models.py
to_dict
¶
Serializes the Trace to a dictionary.
Source code in python/src/science_adk/models.py
Workflow
dataclass
¶
Workflow(name='', description='', nodes=list(), edges=list(), created_at=utcnow())
The experiment DAG: what runs, in what order, carrying what data.
Attributes:
| Name | Type | Description |
|---|---|---|
name |
str
|
Descriptive name of the workflow. |
description |
str
|
Summary of the experiment pipeline. |
nodes |
list[Node]
|
List of nodes in the DAG. |
edges |
list[Edge]
|
List of edges connecting nodes. |
created_at |
str
|
ISO-8601 creation timestamp. |
node
¶
parents
¶
Returns sorted list of parent node IDs that precede node_id.
children
¶
Returns sorted list of child node IDs that consume output from node_id.
descendants
¶
Returns all node IDs transitively downstream of node_id.
Source code in python/src/science_adk/models.py
terminal_nodes
¶
from_dict
classmethod
¶
Constructs a Workflow from dictionary data.
Source code in python/src/science_adk/models.py
to_dict
¶
Serializes the Workflow to a dictionary.
Source code in python/src/science_adk/models.py
AlgorithmAgent
¶
CompositeAgent
¶
Bases: Agent
A node that executes an entire nested workflow DAG.
Attributes:
| Name | Type | Description |
|---|---|---|
workflow |
str
|
Relative path to the nested workflow.json file. |
execute
async
¶
Executes the nested workflow and surfaces its terminal outputs.
Returns:
| Type | Description |
|---|---|
dict[str, Any]
|
Dictionary of outputs mapped to declared output ports. |
Raises:
| Type | Description |
|---|---|
AgentError
|
If the workflow path is missing, not in runtime, or outputs mismatch. |
Source code in python/src/science_adk/primitives/composite.py
ConfigAgent
¶
Bases: Agent
Emits configuration settings, hyperparameters, and physical constants.
settings
¶
Merges default values with workflow params overrides.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
**defaults
|
Any
|
Default configuration key-value pairs. |
{}
|
Returns:
| Type | Description |
|---|---|
dict[str, Any]
|
Combined settings dictionary. |
Source code in python/src/science_adk/primitives/config.py
DataAgent
¶
Bases: Agent
Produces or ingests dataset payloads for experiment workflows.
Attributes:
| Name | Type | Description |
|---|---|---|
source_kind |
str
|
ClassVar string indicating data provenance ('measured', 'simulated', 'synthetic'). |
check_frame
¶
Validates that a DataFrame has required columns and minimum row count.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
frame
|
Any
|
The DataFrame object to validate. |
required |
columns
|
list[str]
|
List of required column names. |
required |
min_rows
|
int
|
Minimum required number of rows. |
1
|
Returns:
| Type | Description |
|---|---|
Any
|
The validated DataFrame. |
Raises:
| Type | Description |
|---|---|
AgentError
|
If columns are missing or row count is insufficient. |
Source code in python/src/science_adk/primitives/data.py
EvaluationAgent
¶
Bases: Agent
Measures the experiment's quantitative outcome.
report
¶
Constructs standardized evaluation output port dictionary.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
metric
|
str
|
Name of the evaluated metric. |
required |
value
|
float
|
Quantitative numeric result. |
required |
detail
|
dict[str, Any] | None
|
Optional supporting dictionary of details. |
None
|
higher_is_better
|
bool
|
Optimization direction indicator. |
True
|
Returns:
| Type | Description |
|---|---|
dict[str, Any]
|
Output port dictionary for execute(). |
Raises:
| Type | Description |
|---|---|
AgentError
|
If the value is non-numeric or NaN. |
Source code in python/src/science_adk/primitives/evaluation.py
TrainingAgent
¶
Bases: Agent
Fits models to data and manages reproducible train/test splits.
Attributes:
| Name | Type | Description |
|---|---|---|
seed |
int | None
|
Seed for reproducible random splitting and initialization. |
split
¶
Splits dataset into (train, test) subsets deterministically under seed.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
Any
|
Data sequence or DataFrame. |
required |
test_fraction
|
float
|
Fraction of rows allocated to the test set (0 < frac < 1). |
0.2
|
shuffle
|
bool
|
Whether to shuffle before splitting. |
True
|
Returns:
| Type | Description |
|---|---|
tuple[Any, Any]
|
Tuple of (train_data, test_data). |
Raises:
| Type | Description |
|---|---|
AgentError
|
If test_fraction is invalid or data has fewer than 2 elements. |
Source code in python/src/science_adk/primitives/training.py
seed_everything
¶
Sets random seed across Python standard library, NumPy, and PyTorch.
Source code in python/src/science_adk/primitives/training.py
VisualizationAgent
¶
Bases: Agent
Renders visual plots and figures from results produced upstream.
figure_path
¶
Reserves a path for a figure file inside this run's data directory.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
Base figure name. |
required |
extension
|
str
|
File extension without leading dot. |
'png'
|
Returns:
| Type | Description |
|---|---|
Path
|
Path to the reserved figure file. |
Source code in python/src/science_adk/primitives/visualization.py
save_figure
¶
Saves a matplotlib figure and returns its run-relative path.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
figure
|
Any
|
Matplotlib Figure object. |
required |
name
|
str
|
Name of the figure. |
required |
dpi
|
int
|
Resolution in dots per inch. |
150
|
Returns:
| Type | Description |
|---|---|
str
|
Run-relative path string. |
Source code in python/src/science_adk/primitives/visualization.py
RunError
¶
Bases: RuntimeError
Raised when an experiment cannot be run.
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
ToolError
¶
Bases: RuntimeError
Raised when a tool cannot be resolved or fails during execution.
ToolRegistry
¶
Aggregates and resolves tools across all configured providers.
Source code in python/src/science_adk/tools/registry.py
from_project
classmethod
¶
specs
¶
Returns all ToolSpecs from all active providers.
Source code in python/src/science_adk/tools/registry.py
resolve
¶
Resolves a tool by qualified or unqualified name.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
Qualified ('provider.tool') or bare tool name. |
required |
Returns:
| Type | Description |
|---|---|
ToolSpec
|
Matching ToolSpec. |
Raises:
| Type | Description |
|---|---|
ToolError
|
If tool is missing or name is ambiguous. |
Source code in python/src/science_adk/tools/registry.py
call
¶
Invokes a tool by name with arguments.
close
¶
Closes all active provider backends.
ToolSpec
dataclass
¶
Specification of a tool callable by agents.
Attributes:
| Name | Type | Description |
|---|---|---|
name |
str
|
Tool name. |
provider |
str
|
Name of the provider providing the tool. |
description |
str
|
Explanation of what the tool does. |
parameters |
dict[str, Any]
|
JSON schema dictionary describing input arguments. |
signature
¶
Returns a Python-like signature representation for prompting.
Source code in python/src/science_adk/tools/registry.py
to_dict
¶
Serializes the ToolSpec to a dictionary.
Project
¶
Manages files and directories in a Science ADK research workspace.
Source code in python/src/science_adk/workspace.py
find
classmethod
¶
Discovers the root Project by walking up parent directories.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
start
|
Path | str | None
|
Directory to start searching from (defaults to cwd). |
None
|
Returns:
| Type | Description |
|---|---|
Project
|
Discovered Project instance. |
Raises:
| Type | Description |
|---|---|
ProjectError
|
If no science.toml is found. |
Source code in python/src/science_adk/workspace.py
experiment_dir
¶
runs_dir
¶
run_dir
¶
rel
¶
Formats path relative to the project root for display.
config
¶
read_goal
¶
Reads and parses GOAL.md.
Source code in python/src/science_adk/workspace.py
write_goal
¶
Serializes and writes Goal data to GOAL.md.
Source code in python/src/science_adk/workspace.py
experiment_ids
¶
Returns sorted list of experiment directory IDs.
Source code in python/src/science_adk/workspace.py
experiments
¶
next_experiment_id
¶
Generates a sequential experiment ID slug.
Source code in python/src/science_adk/workspace.py
read_experiment
¶
Reads and parses an experiment's HYPOTHESIS.md file.
Source code in python/src/science_adk/workspace.py
write_experiment
¶
Writes an Experiment model to HYPOTHESIS.md.
Source code in python/src/science_adk/workspace.py
delete_experiment
¶
workflow_path
¶
read_workflow
¶
write_workflow
¶
Writes workflow.json for an experiment.
agent_path
¶
new_run_id
¶
Allocates a unique chronological run ID.
Source code in python/src/science_adk/workspace.py
run_ids
¶
Returns sorted list of run IDs for an experiment.
Source code in python/src/science_adk/workspace.py
latest_run_id
¶
Returns the most recent run ID for an experiment.
Source code in python/src/science_adk/workspace.py
read_trace
¶
Reads trace.json for a specific run.
write_trace
¶
Writes trace.json for a specific run.
score_path
¶
read_score
¶
write_score
¶
data_dir
¶
iter_runs
¶
Yields (run_id, trace) tuples for an experiment.
Source code in python/src/science_adk/workspace.py
best_score
¶
Finds the highest-scoring audited run for an experiment.
Source code in python/src/science_adk/workspace.py
append_learning
¶
Appends an empirical insight to LEARNINGS.md.
Source code in python/src/science_adk/workspace.py
read_learnings
¶
Parses LEARNINGS.md into Learning objects.
Source code in python/src/science_adk/workspace.py
ProjectError
¶
Bases: RuntimeError
Raised when the project workspace is missing, invalid, or corrupted.
load_agent_class
¶
Imports a single-class agent file and returns its Agent subclass.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
Path
|
Path to the agent Python file. |
required |
Returns:
| Type | Description |
|---|---|
type[Agent]
|
The single Agent subclass defined in the file. |
Raises:
| Type | Description |
|---|---|
AgentError
|
If the file does not exist, fails to import, or defines zero or multiple Agent subclasses. |
Source code in python/src/science_adk/agent.py
compute_gates
¶
Computes all deterministic integrity gates against a completed run trace.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
trace
|
Trace
|
The completed Trace record. |
required |
workflow
|
Workflow
|
The Workflow specification that was executed. |
required |
Returns:
| Type | Description |
|---|---|
list[Gate]
|
A list of Gate results. |
Source code in python/src/science_adk/score.py
record_audit
¶
Records audit judgements and rationale onto a Score object.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
score
|
Score
|
The target Score object to augment. |
required |
pillars
|
dict[str, float]
|
Dictionary mapping SCORE_PILLARS to scores in [0.0, 1.0]. |
required |
rationale
|
str
|
Written explanation supporting the evaluation. |
required |
Returns:
| Type | Description |
|---|---|
Score
|
The updated Score instance. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If pillars are unknown, missing, or rationale is empty. |
Source code in python/src/science_adk/score.py
score_run
¶
Constructs the deterministic score structure for a completed run.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
trace
|
Trace
|
The completed Trace. |
required |
workflow
|
Workflow
|
The Workflow specification. |
required |
target_metric
|
str
|
The metric name being targeted. |
''
|
target_value
|
float | None
|
The target value threshold. |
None
|
Returns:
| Type | Description |
|---|---|
Score
|
A populated Score instance. |
Source code in python/src/science_adk/score.py
validate_agent_source
¶
Statically validates an agent Python source file against its node contract.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
Path
|
Path to the agent Python file. |
required |
node
|
Node | None
|
Optional Node specification from workflow.json to verify consistency against. |
None
|
Returns:
| Type | Description |
|---|---|
Report
|
A validation Report. |
Source code in python/src/science_adk/validate.py
249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 | |
validate_experiment
¶
Validates an entire experiment including workflow DAG and agent files.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
project
|
Project
|
The Project workspace instance. |
required |
experiment_id
|
str
|
Identifier of the experiment to validate. |
required |
Returns:
| Type | Description |
|---|---|
Report
|
A combined validation Report. |
Source code in python/src/science_adk/validate.py
validate_workflow
¶
Verifies that a workflow DAG is acyclic, connected, and typed correctly.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
workflow
|
Workflow
|
The Workflow object to validate. |
required |
Returns:
| Type | Description |
|---|---|
Report
|
A validation Report. |
Source code in python/src/science_adk/validate.py
125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 | |