espnet3.bin.atlas.agents.cli.CliAgent
espnet3.bin.atlas.agents.cli.CliAgent
class espnet3.bin.atlas.agents.cli.CliAgent(config, recipe_dir: Path)
Bases: object
Run a coding-agent CLI as a subprocess and read its reply.
Exposes run(request, artifact_dir). Renders the prompt, lets the configured provider (see agents/providers) build the command and read the output, and keeps the artifacts of every call. A request with an output_schema is run with the CLI’s schema-constrained final reply, and the reply is checked against the schema once more before it is returned.
Configure the agent CLI wrapper.
- Parameters:
- config – Mapping or OmegaConf node of
atlas.agent, merged over the defaults bybuild_agent_config(). - recipe_dir – Recipe root; used as the default working directory when
config.cwdis unset.
- config – Mapping or OmegaConf node of
- Raises:ValueError – If
provideris invalid.
run(request: AgentRequest, artifact_dir=None) → AgentResponse
Execute one CLI invocation and validate its final structured response.
Every agent call is kept on disk so a study’s agent history can be audited afterwards. artifact_dir is the owner’s directory (a trial dir, or the study dir for study-level skills) and ends up like this:
<artifact_dir>/
├── agent_calls/
│ └── call_<uuid>/ one per ``run()``, never overwritten
│ ├── agent_prompt.txt prompt sent to the CLI
│ ├── agent_schema.json JSON Schema the reply is constrained to
│ ├── agent_output.txt final reply the response is parsed from
│ ├── agent_stdout.log raw CLI stdout
│ ├── agent_stderr.log raw CLI stderr
│ ├── agent_events.jsonl same as stdout (JSON events, if any)
│ └── agent_parse_error.json only if the reply was invalid
├── agent_prompt.txt latest call: the same files as in
├── agent_schema.json ``call_<uuid>/``, overwritten by the
├── agent_output.txt next call. The returned
├── agent_stdout.log ``AgentResponse.artifacts`` points
├── agent_stderr.log here, plus ``invocation`` for the
├── agent_events.jsonl ``call_<uuid>`` dir.
├── agent_parse_error.json
├── agent_usage.json latest call's token usage (codex)
└── agent_usage_history.jsonl usage of every call, appended (codex)agent_parse_error.json at the top is deleted at the start of each call, so it only exists when the latest call’s reply was invalid.
