espnet3.bin.atlas.stages.write_files.WriteFilesStage
espnet3.bin.atlas.stages.write_files.WriteFilesStage
class espnet3.bin.atlas.stages.write_files.WriteFilesStage
Bases: BaseStage
Ask the agent to generate implementation + unit tests via <file path=””> blocks.
Reads code_edit.reference_files (local paths) and fetches code_edit.doc_urls (web pages) to include in the prompt alongside the resolved training config, so the agent has full context on model dimensions and ESPnet3 wiring conventions.
On re-runs after a failed run_tests, the previous pytest error log is prepended to the prompt so the agent can fix the issues.
run(context) → StageResult
Ask the agent to write implementation + test files, then apply them.
Builds the prompt (training config, reference files, fetched docs, current allowed-dir contents, and any previous test failure), calls the agent, parses <file> blocks from its response, backs up and overwrites each allowed file, and records what was written/skipped.
- Parameters:context – The node run’s
StageContext; must have a current trial. - Returns:
status="success"ifcode_edit.allowed_dirsis unset (no-op), the agent produced no<file>blocks, or files were written successfully;status="failure"if the agent call itself failed. - Return type:StageResult
Example
>>> result = WriteFilesStage().run(stage_context)
>>> result.status
'success'study_lock_name : str | None = 'study_controller'
Name of the study-wide lock file to hold while running, or None to run without a lock.
