Back to Trl

`terminal_notes` harness

examples/scripts/harbor/harnesses/terminal_notes/README.md

1.7.02.0 KB
Original Source

terminal_notes harness

A richer shell harness: 6 shell tools (including background processes) plus a 4-tool persistent note toolkit. Implemented by TerminalNotesEnv in env.py.

Tools

Shell (backed by the sandbox)

ToolSignatureWhat it does
shell_execshell_exec(command: str, blocking: bool = True) -> strRun a command. Blocking → combined stdout+stderr; non-blocking → detach and return a PID.
shell_write_content_to_fileshell_write_content_to_file(path: str, content: str) -> strWrite content to path (used to commit /workdir/answer.txt).
shell_write_to_processshell_write_to_process(pid: str, content: str) -> strWrite to a background process's stdin.
shell_viewshell_view(pid: str) -> strRead the captured stdout of a background process.
shell_waitshell_wait(pid: str) -> strWait (≤5 min) for a background process to exit, then return its output.
shell_kill_processshell_kill_process(pid: str) -> strSIGKILL a background process.

Notes (in-env state, persist across turns of a rollout)

ToolSignatureWhat it does
create_notecreate_note(title: str, content: str) -> strCreate a note.
append_noteappend_note(title: str, content: str) -> strAppend to an existing note.
read_noteread_note(title: str) -> strRead a note's content.
list_notelist_note() -> strList note titles + sizes.

Unlike the original SETA agent, notes are not auto-injected into the prompt each turn (TRL owns the prompt under environment_factory); recall them on demand with read_note / list_note.

Submission

Write the answer to /workdir/answer.txt, e.g. shell_write_content_to_file(path="/workdir/answer.txt", content="<value>").

Use it

python
from trl.experimental.harbor import HarborSpec
spec = HarborSpec(dataset, agent="examples/scripts/harbor/harnesses/terminal_notes/env.py:TerminalNotesEnv")