Research Operator
A research operator is a thin loop around general tools. The methodology should live in skills, the math in libraries, and the case-study logic in project code.
The Problem
Hard-coding every possible research move into an agent framework creates a brittle demo. Giving the model unrestricted shell and file access creates an unauditable production risk. The useful middle ground is a narrow operator: expose a small set of typed tools, require skill discovery before implementation, sandbox writes, and stop with an evidence-backed recommendation.
The Pattern
WRONG
prompt = f"""
You are a quant researcher. Use any files and commands you need.
Try improving the case study and tell me what worked.
Task: {task}
"""
print(llm(prompt))
CORRECT
TOOLS = {
"list_skills": tool_list_skills,
"read_skill": tool_read_skill,
"read_file": sandbox_read_file,
"query_registry": readonly_sql_query,
"read_parquet": sandbox_read_parquet,
"run_bash": sandbox_run_bash,
"edit_file": sandbox_edit_file,
"done": finish_with_summary,
}
SYSTEM_PROMPT = """
Before implementation, call list_skills and read the relevant skills.
State the hypothesis, cite the skills used, run the smallest valid experiment,
and finish with an honest recommendation.
"""
state = AgentState(task=task)
while not state.quality_gates.get("done"):
action = model_choose_action(SYSTEM_PROMPT, state)
result = TOOLS[action.name](**action.args)
state.tool_trace.append(log_call(action, result))
state.checkpoint(run_dir / "state.json")
Operator Contract
- Tool surface stays small: read, query, inspect, execute, edit, skill lookup, done
- Writes go to a sandbox or explicit output directory
- Registry and source repos are read-only unless the task explicitly requires edits
- The agent must read relevant skills before changing code or running experiments
- Final output states hypothesis, method, artifacts, skill usage, metrics, and recommendation
Guardrails
- Framework-first design - if the operator owns methodology, skills become decorative
- Unbounded shell - command execution needs cwd, timeout, and write sandbox controls
- No negative-result path - a valid run may conclude that the proposed change is worse
- Missing skill audit - record which skills were read and whether they were followed
Checklist
1---2name: ml4t-research-operator3description: Thin autonomous research operator pattern for ML4T experiments. Use when an agent should inspect artifacts, read skills, run scripts, and produce an auditable recommendation.4---5# Research Operator67A research operator is a thin loop around general tools. The methodology should live in skills, the math in libraries, and the case-study logic in project code.89## The Problem1011Hard-coding every possible research move into an agent framework creates a brittle demo. Giving the model unrestricted shell and file access creates an unauditable production risk. The useful middle ground is a narrow operator: expose a small set of typed tools, require skill discovery before implementation, sandbox writes, and stop with an evidence-backed recommendation.1213## The Pattern1415### WRONG16```python17prompt = f"""18You are a quant researcher. Use any files and commands you need.19Try improving the case study and tell me what worked.20Task: {task}21"""22print(llm(prompt))23```2425### CORRECT26```python27TOOLS = {28 "list_skills": tool_list_skills,29 "read_skill": tool_read_skill,30 "read_file": sandbox_read_file,31 "query_registry": readonly_sql_query,32 "read_parquet": sandbox_read_parquet,33 "run_bash": sandbox_run_bash,34 "edit_file": sandbox_edit_file,35 "done": finish_with_summary,36}3738SYSTEM_PROMPT = """39Before implementation, call list_skills and read the relevant skills.40State the hypothesis, cite the skills used, run the smallest valid experiment,41and finish with an honest recommendation.42"""4344state = AgentState(task=task)45while not state.quality_gates.get("done"):46 action = model_choose_action(SYSTEM_PROMPT, state)47 result = TOOLS[action.name](**action.args)48 state.tool_trace.append(log_call(action, result))49 state.checkpoint(run_dir / "state.json")50```5152## Operator Contract5354- Tool surface stays small: read, query, inspect, execute, edit, skill lookup, done55- Writes go to a sandbox or explicit output directory56- Registry and source repos are read-only unless the task explicitly requires edits57- The agent must read relevant skills before changing code or running experiments58- Final output states hypothesis, method, artifacts, skill usage, metrics, and recommendation5960## Guardrails6162- **Framework-first design** - if the operator owns methodology, skills become decorative63- **Unbounded shell** - command execution needs cwd, timeout, and write sandbox controls64- **No negative-result path** - a valid run may conclude that the proposed change is worse65- **Missing skill audit** - record which skills were read and whether they were followed6667## Checklist6869- [ ] Tool schemas and runtime controls are separate from the LLM70- [ ] The loop checkpoints state after every tool call71- [ ] The prompt requires skill discovery before implementation72- [ ] Writes are redirected to a sandbox or declared output directory73- [ ] The final summary includes evidence, artifacts, and an honest recommendation