write_file tool => no clear description on content
I've found that at least for Claude Haiku 4.5, the model will call the write_file tool many times in a row without providing the content parameter (3-8 times incorrectly before finally providing content). This issue might be alleviated by refining the tool description, currently in which content is never explicitly described as the content of the file:
WRITE_FILE_TOOL_DESCRIPTION = """Writes to a new file in the filesystem.
Usage:
- The file_path parameter must be an absolute path, not a relative path
- The content parameter must be a string
- The write_file tool will create the a new file.
- Prefer to edit existing files over creating new ones when possible."""
While the purpose of the content parameter might seem obvious, it could be interpreted by a naive LLM as "content type" parameter and thus not seen as a truly necessary parameter.
Also, the LLM might be reluctant to write out such a long parameter value to a tool; in my case, the content is >60k tokens. Anecdotally, the reluctancy to provide the content parameter seems to increase as the content size increases (e.g., 8-10 failed tool calls if the content token count is >100k tokens).
I see this a lot too with Claude Sonnet 4.5. Seems to happen at a point where our models are producing a lot of content so this aligns with your observation.
I meet many times when I use claude-4.5
I'm using deepagents==0.2.8 and can confirm that even Sonnet 4.5 calls write_file with just file_path, omitting content and therefore erroring:
1 validation error for write_file
content
Field required [type=missing, input_value={'file_path': '/beam_defl...mgRaKGbKq', store=None)}, input_type=dict]
For further information visit https://errors.pydantic.dev/2.12/v/missingTraceback (most recent call last):
File "/Users/fioccom/Documents/Code/JARVIS/jarvis-web/apps/jarvis-assistant/agent/.venv/lib/python3.12/site-packages/langchain_core/tools/base.py", line 891, in run
tool_args, tool_kwargs = self._to_args_and_kwargs(
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/fioccom/Documents/Code/JARVIS/jarvis-web/apps/jarvis-assistant/agent/.venv/lib/python3.12/site-packages/langchain_core/tools/base.py", line 794, in _to_args_and_kwargs
tool_input = self._parse_input(tool_input, tool_call_id)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/fioccom/Documents/Code/JARVIS/jarvis-web/apps/jarvis-assistant/agent/.venv/lib/python3.12/site-packages/langchain_core/tools/base.py", line 672, in _parse_input
result = input_args.model_validate(tool_input)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/fioccom/Documents/Code/JARVIS/jarvis-web/apps/jarvis-assistant/agent/.venv/lib/python3.12/site-packages/pydantic/main.py", line 716, in model_validate
return cls.__pydantic_validator__.validate_python(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
pydantic_core._pydantic_core.ValidationError: 1 validation error for write_file
content
Field required [type=missing, input_value={'file_path': '/beam_defl...mgRaKGbKq', store=None)}, input_type=dict]
For further information visit https://errors.pydantic.dev/2.12/v/missing
I try the modify Prompt from merge request,but it still doesn't work,I guess Claude model cant cover long content because its output restrict,its curious in langchain agent!
+1 in deepagents==0.2.8
sometimes Sonnet 4.5 works after a couple of retries usually, but when running a longer deepagent with Opus 4.5: it can successfully write a new file in the beginning of the chain, but after a couple of sub-agent calls has close to 0% accuracy when trying to write a new file
breaks the use of deepagents in application development with these models
error from LangSmith:
1 validation error for write_file
content
Field required [type=missing, input_value={'file_path': '/full_rese...ftfTXK86p', store=None)}, input_type=dict]
For further information visit https://errors.pydantic.dev/2.12/v/missingTraceback (most recent call last):
File "/usr/local/lib/python3.13/site-packages/langchain_core/tools/base.py", line 891, in run
tool_args, tool_kwargs = self._to_args_and_kwargs(
~~~~~~~~~~~~~~~~~~~~~~~~^
tool_input, tool_call_id
^^^^^^^^^^^^^^^^^^^^^^^^
)
^
File "/usr/local/lib/python3.13/site-packages/langchain_core/tools/base.py", line 794, in _to_args_and_kwargs
tool_input = self._parse_input(tool_input, tool_call_id)
File "/usr/local/lib/python3.13/site-packages/langchain_core/tools/base.py", line 672, in _parse_input
result = input_args.model_validate(tool_input)
File "/usr/local/lib/python3.13/site-packages/pydantic/main.py", line 716, in model_validate
return cls.__pydantic_validator__.validate_python(
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
obj,
^^^^
...<5 lines>...
by_name=by_name,
^^^^^^^^^^^^^^^^
)
^
pydantic_core._pydantic_core.ValidationError: 1 validation error for write_file
content
Field required [type=missing, input_value={'file_path': '/full_rese...ftfTXK86p', store=None)}, input_type=dict]
For further information visit https://errors.pydantic.dev/2.12/v/missing
yes, does anyone have a solution for this ?
yes, does anyone have a solution for this ?
gpt-5.1 & gpt-5.1-mini
yes, does anyone have a solution for this ?
change model,like deepseek v3.1