Repository: UKGovernmentBEIS/inspect_ai
Issue: Occasional KeyError with Think tool
Root cause: Validation Gap

I'm using the standard think tool with a custom description. This generally works well, but I'm seeing a KeyError happen on rare occasion.

```
┌───────────────────────────────────────── Traceback (most recent call last) ──────────────────────────────────────────┐
│ venv/lib/python3.12/site-packages/inspect_ai/_eval/task/run.py:672 in task_run_sample    │
│                                                                                                                      │
│ venv/lib/python3.12/site-packages/inspect_ai/solver/_plan.py:106 in __call__             │
│                                                                                                                      │
│ venv/lib/python3.12/site-packages/inspect_ai/agent/_as_solver.py:64 in solve             │
│                                                                                                                      │
│ venv/lib/python3.12/site-packages/inspect_ai/agent/_react.py:167 in execute              │
│                                                                                                                      │
│ venv/lib/python3.12/site-packages/inspect_ai/agent/_react.py:309 in _agent_generate      │
│                                                                                                                      │
│ venv/lib/python3.12/site-packages/inspect_ai/agent/_react.py:314 in generate             │
│                                                                                                                      │
│ venv/lib/python3.12/site-packages/inspect_ai/model/_model.py:409 in generate             │
│                                                                                                                      │
│ venv/lib/python3.12/site-packages/inspect_ai/model/_model.py:694 in _generate            │
│                                                                                                                      │
│ venv/lib/python3.12/site-packages/tenacity/asyncio/__init__.py:189 in async_wrapped      │
│                                                                                                                      │
│ venv/lib/python3.12/site-packages/tenacity/asyncio/__init__.py:111 in __call__           │
│                                                                                                                      │
│ venv/lib/python3.12/site-packages/tenacity/asyncio/__init__.py:153 in iter               │
│                                                                                                                      │
│ venv/lib/python3.12/site-packages/tenacity/_utils.py:99 in inner                         │
│                                                                                                                      │
│ venv/lib/python3.12/site-packages/tenacity/__init__.py:400 in <lambda>                   │
│                                                                                                                      │
│ ~/.local/share/uv/python/cpython-3.12.8-linux-x86_64-gnu/lib/python3.12/concurrent/futures/_base.py:449 in   │
│ result                                                                                                               │
│                                                                                                                      │
│   446 │   │   │   │   if self._state in [CANCELLED, CANCELLED_AND_NOTIFIED]:                                         │
│   447 │   │   │   │   │   raise CancelledError()                                                                     │
│   448 │   │   │   │   elif self._state == FINISHED:                                                                  │
│ > 449 │   │   │   │   │   return self.__get_result()                                                                 │
│   450 │   │   │   │                                                                                                  │
│   451 │   │   │   │   self._condition.wait(timeout)                                                                  │
│   452                                                                                                                │
│                                                                                                                      │
│ ~.local/share/uv/python/cpython-3.12.8-linux-x86_64-gnu/lib/python3.12/concurrent/futures/_base.py:401 in   │
│ __get_result                                                                                                         │
│                                                                                                                      │
│   398 │   def __get_result(self):                                                                                    │
│   399 │   │   if self._exception:                                                                                    │
│   400 │   │   │   try:                                                                                               │
│ > 401 │   │   │   │   raise self._exception                                                                          │
│   402 │   │   │   finally:                                                                                           │
│   403 │   │   │   │   # Break a reference cycle with the exception in self._exception                                │
│   404 │   │   │   │   self = None                                                                                    │
│                                                                                                                      │
│ venv/lib/python3.12/site-packages/tenacity/asyncio/__init__.py:114 in __call__           │
│                                                                                                                      │
│ venv/lib/python3.12/site-packages/inspect_ai/model/_model.py:670 in generate             │
│                                                                                                                      │
│ venv/lib/python3.12/site-packages/inspect_ai/model/_call_tools.py:680 in tool_call_view  │
│                                                                                                                      │
│ venv/lib/python3.12/site-packages/inspect_ai/tool/_tools/_think.py:44 in viewer          │
└──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
KeyError: 'thought'
```

I don't fully understand how this is going wrong, I think a model may have called the think tool with invalid arguments?

It seems like perhaps the accessor here should be changed to `arguments.get("thought")`
https://github.com/UKGovernmentBEIS/inspect_ai/blob/6c303eeaea3bb1588a8a1c163708e3da402a9092/src/inspect_ai/tool/_tools/_think.py#L44

Thanks for reporting this, made the change you suggested here: https://github.com/UKGovernmentBEIS/inspect_ai/pull/1829