I'm testing the V1 CLI and it crashes on `Function...
# feedback
f
I'm testing the V1 CLI and it crashes on
FunctionCallValidationError
exception. IIRC in V0 we send these errors back as observations so that the agent can recover from, maybe we should do the same for V1?
Copy code
File "/home/hoang/.cache/uv/archive-v0/wOgA6PHvOssGAfpLhM2TD/lib/python3.12/site-packages/tenacity/__init__.py", line 400, in lambda
    self._add_action_func(lambda rs: rs.outcome.result())
                                     ^^^^^^^^^^^^^^^^^^^
  File "/home/hoang/.local/share/uv/python/cpython-3.12.11-linux-x86_64-gnu/lib/python3.12/concurrent/futures/_base.py", line 449, in result
    return self.__get_result()
           ^^^^^^^^^^^^^^^^^^^
  File "/home/hoang/.local/share/uv/python/cpython-3.12.11-linux-x86_64-gnu/lib/python3.12/concurrent/futures/_base.py", line 401, in __get_result
    raise self._exception
  File "/home/hoang/.cache/uv/archive-v0/wOgA6PHvOssGAfpLhM2TD/lib/python3.12/site-packages/tenacity/__init__.py", line 480, in __call__
    result = fn(*args, **kwargs)
             ^^^^^^^^^^^^^^^^^^^
  File "/home/hoang/.cache/uv/archive-v0/wOgA6PHvOssGAfpLhM2TD/lib/python3.12/site-packages/openhands/sdk/llm/llm.py", line 462, in _one_attempt
    resp = self.post_response_prompt_mock(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/hoang/.cache/uv/archive-v0/wOgA6PHvOssGAfpLhM2TD/lib/python3.12/site-packages/openhands/sdk/llm/mixins/non_native_fc.py", line 82, in post_response_prompt_mock
    fn_msgs: list[dict] = convert_non_fncall_messages_to_fncall_messages(
                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/hoang/.cache/uv/archive-v0/wOgA6PHvOssGAfpLhM2TD/lib/python3.12/site-packages/openhands/sdk/llm/mixins/fn_call_converter.py", line 957, in convert_non_fncall_messages_to_fncall_messages
    params = _extract_and_validate_params(
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/hoang/.cache/uv/archive-v0/wOgA6PHvOssGAfpLhM2TD/lib/python3.12/site-packages/openhands/sdk/llm/mixins/fn_call_converter.py", line 739, in _extract_and_validate_params
    raise FunctionCallValidationError(
openhands.sdk.llm.exceptions.FunctionCallValidationError: Missing required parameters for function 'str_replace_editor': {'command', 'security_risk', 'path'}
nod 1
c
In V1, I think we have an AgentErrorEvent for this kind of error
c
We should be send these errors
AgentErrorEvent
back to the LLM nod We should also add test for it
f
I think this happens before we even have a tool id/name so maybe we can directly send a
MessageEvent
instead? 🤔 https://github.com/OpenHands/agent-sdk/pull/832
c
The tool call... urgh
I'm not sure, but FWIW I had the impression that this
action=None
will be problematic in some places, and it turned out it wasn't. Maybe... it's possible to make it without tool, too? And with the tool string in the AgentError?
c
left a comment on the PR, if we do this, will we be able to send the "malformed action" along with the error message or not?
f
From my understanding the malformed action is included in the trajectory in the assistant turn, so for user message only the error message is enough. Or are there other reasons we should include the action itself in the error message?
c
I thought the malformed action is not included if we never formed an ActionEvent?
f
I think the behavior is that the agent sends the tool call as XML, and we parse it into tool calls if valid
c
Yes, and we transform it into an ActionEvent when we receive it, if we are able to parse it somehow, right? (Now we will claim to have a tool call, from our perspective it becomes the same as if we received an actual tool call I think.) And next step, we pick up all ActionEvents and Obs and make up the new prompt to send back to the LLM
In other words, I’m just trying to say, if we never made a malformed message into an Action, then we don’t send it back. Only way to sort-of send it back, on the PR, would be I guess, to save it as received into the new MessageEvent, so like, make sure that that message tells the LLM a full story of what happened, not only one quick error
Did that make any sense? Sorry if I’m missing something here!
f
Yeah I think I get the idea now, skimming through the trajectories for non-fn-calling mode I also see it's a bit weird... let me have a closer look
c
Thank you! I should finish this little PR https://github.com/OpenHands/agent-sdk/pull/749 It’s a page where it shows the real context we sent to the LLM, and for each step, the Actions/Obs/etc, corresponding to that context
🙌 1