diff --git a/src/anthropic/lib/tools/agent_toolset.py b/src/anthropic/lib/tools/agent_toolset.py index d771996a..083e09aa 100644 --- a/src/anthropic/lib/tools/agent_toolset.py +++ b/src/anthropic/lib/tools/agent_toolset.py @@ -544,7 +544,7 @@ async def write(file_path: str, content: str) -> str: target.write_text(content) except OSError as e: raise _fs_error("write", file_path, e) from e - return f"wrote {len(content)} bytes to {file_path}" + return f"wrote {len(content.encode(\"utf-8\"))} bytes to {file_path}" return write