Skip to content

Sanitize dirty JSON tool responses#1706

Open
dmytryk-here wants to merge 1 commit into
agent0ai:mainfrom
dmytryk-here:fix-json-parse-sanitize-llm-output
Open

Sanitize dirty JSON tool responses#1706
dmytryk-here wants to merge 1 commit into
agent0ai:mainfrom
dmytryk-here:fix-json-parse-sanitize-llm-output

Conversation

@dmytryk-here

Copy link
Copy Markdown

Summary

  • Sanitize common LLM output artifacts before dirty JSON extraction.
  • Handles markdown code fences, XML-like invoke artifacts, function-style prefixes, and leading text before JSON.
  • Adds a focused regression test for wrapped tool-call JSON parsing.

Tests

. .venv/bin/activate && pytest tests/test_dirty_json.py tests/test_extract_tools_json_parse.py tests/test_tool_request_normalization.py

Result:

13 passed

## Notes

Searched for overlapping upstream PRs related to json_parse_dirty / sanitizer behavior before preparing this change.

@dmytryk-here dmytryk-here force-pushed the fix-json-parse-sanitize-llm-output branch from fa67e4d to 082ed8b Compare June 16, 2026 00:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant