espnet3.bin.atlas.core.models.StageContext
espnet3.bin.atlas.core.models.StageContext
class espnet3.bin.atlas.core.models.StageContext(study_dir: Path, recipe_dir: Path, node_name: str, run_id: str, attempt_id: str, graph: ResearchGraph, config: DictConfig, state: StateStore, agent: Any, logger: logging.Logger, scheduler: AtlasGraphRuntime, current_trial: Trial | None = None, gpu_self_controller: bool = False)
Bases: object
Everything one node run of BaseStage.run needs to do its work.
Built fresh for each node run by the scheduler and passed to stage.execute(context).
- Parameters:
- study_dir – Study’s root directory.
- recipe_dir – Recipe root directory.
- node_name – Graph node being run.
- run_id – Unique id of this node run.
- attempt_id – Attempt id within this node run (for retries).
- graph – The study’s loaded
ResearchGraph. - config – The study’s resolved
atlas.yamlconfig. - state – The study’s
StateStore. - agent – The configured coding-agent client (e.g.
CliAgent). - logger – Logger scoped to this run.
- scheduler – The owning
AtlasGraphRuntime. - current_trial – The trial this node run operates on, or
Nonefor study-level nodes (e.g.research_context). - gpu_self_controller – Whether this node run is executing inside a GPU job acting as its own controller (affects some stages’ behavior, e.g. whether to submit a follow-up job).
agent : Any
attempt_id : str
config : DictConfig
current_trial : Trial | None = None
get_artifact_dir(*parts: str) → Path
Return this node run’s artifact directory, optionally with subparts.
- Parameters:*parts – Optional path components appended under the run’s artifact directory.
- Returns:
study_dir/node_runs/<run_id>[/parts...]. - Return type: Path
Example
>>> context.get_artifact_dir("skill_name")
PosixPath('exp/atlas/my_study/node_runs/run_abc123/skill_name')get_trial_dir() → Path
Return this run’s trial directory: study_dir/trials/<trial_id>.
- Parameters:None.
- Returns: The current trial’s directory.
- Return type: Path
- Raises:AssertionError – If called when
current_trialisNone.
Example
>>> context.get_trial_dir()
PosixPath('exp/atlas/my_study/trials/trial_001')gpu_self_controller : bool = False
graph : ResearchGraph
logger : logging.Logger
node_name : str
recipe_dir : Path
run_id : str
scheduler : AtlasGraphRuntime
state : StateStore
study_dir : Path
