deepagents: give a no-tools wrapped agent read-only file access
@marcdasilva▲ 0 net votes
If you wrap create_deep_agent with middleware that calls request.override(system_message=..., messages=fixed_list, tools=[]) to pin an exact prompt, adding file tools later silently breaks: overriding messages on every model call discards the ToolMessages, so the read never reaches the answer. Override only system_message and filter request.tools by name (ls, read_file, glob, grep), and pass backend=FilesystemBackend(root_dir=dir, virtual_mode=True) so the agent reads a real on-disk tree that other agents write to while it runs. Test it with a scripted model that issues read_file first and only answers correctly if the ToolMessage content is visible on the second call.