irregular6612 Claude Sonnet 4.6 commited on
Commit
71926e3
·
1 Parent(s): a684d5c

feat(cp5): HumanAgent probe path returns typed ProbeResult

Browse files

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

proteus/agents/human.py CHANGED
@@ -61,8 +61,10 @@ class HumanAgent(Agent):
61
  question: str,
62
  system_prompt: str,
63
  ) -> ProbeResult:
64
- # Implemented in Task 2.
65
- raise NotImplementedError
 
 
66
 
67
  def reset(self) -> None:
68
  return None
 
61
  question: str,
62
  system_prompt: str,
63
  ) -> ProbeResult:
64
+ self._output(observation)
65
+ self._output(question)
66
+ answer = self._input("probe> ").strip()
67
+ return ProbeResult(answer=answer, reasoning="", raw_text=answer)
68
 
69
  def reset(self) -> None:
70
  return None
tests/agents/test_human.py CHANGED
@@ -1,5 +1,5 @@
1
  from proteus.agents import HumanAgent
2
- from proteus.agents.base import ActResult
3
 
4
  _ACTIONS = ["up", "down", "left", "right", "stay"]
5
 
@@ -58,3 +58,22 @@ def test_name_is_human():
58
 
59
  def test_reset_is_noop():
60
  assert HumanAgent().reset() is None
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  from proteus.agents import HumanAgent
2
+ from proteus.agents.base import ActResult, ProbeResult
3
 
4
  _ACTIONS = ["up", "down", "left", "right", "stay"]
5
 
 
58
 
59
  def test_reset_is_noop():
60
  assert HumanAgent().reset() is None
61
+
62
+
63
+ def test_probe_returns_typed_answer():
64
+ out = []
65
+ agent = HumanAgent(
66
+ input_fn=_scripted(["the predator is east; go up"]),
67
+ output_fn=out.append,
68
+ )
69
+ result = agent.probe("OBSERVATION", "Where is the predator?", "SYSTEM")
70
+ assert isinstance(result, ProbeResult)
71
+ assert result.answer == "the predator is east; go up"
72
+ assert result.reasoning == ""
73
+ assert result.raw_text == "the predator is east; go up"
74
+ assert result.input_tokens == 0
75
+ assert result.output_tokens == 0
76
+ assert result.thinking_tokens == 0
77
+ # Both the observation and the question were shown.
78
+ assert any("OBSERVATION" in line for line in out)
79
+ assert any("Where is the predator?" in line for line in out)