Skip to content

feat: relax structured output parsing#685

Merged
maksymbuleshnyi merged 7 commits intomainfrom
fix/structured-output-parsing
Apr 9, 2026
Merged

feat: relax structured output parsing#685
maksymbuleshnyi merged 7 commits intomainfrom
fix/structured-output-parsing

Conversation

@maksymbuleshnyi
Copy link
Copy Markdown
Contributor

@maksymbuleshnyi maksymbuleshnyi commented Apr 8, 2026

Note

Medium Risk
Touches core agent output parsing: strict=False will accept previously-invalid JSON (e.g., literal newlines), which can change what gets executed as tool inputs and may mask malformed model outputs.

Overview
Agent parsing is made more tolerant of imperfect LLM JSON. Agent._handle_structured_output_mode and Agent._handle_function_calling_mode now parse with json.loads(..., strict=False) (and the structured-output fallback JSONDecoder(strict=False)) so tool action_input can contain literal newlines and the first JSON object can be extracted from concatenated responses.

Prompts and tests are updated accordingly. The structured-output and function-calling instructions add stricter guidance about field ordering and newline escaping, and new unit tests cover literal-newline action_input plus the multi-JSON fallback path.

Reviewed by Cursor Bugbot for commit 575dee4. Bugbot is set up for automated code reviews on this repo. Configure here.

@maksymbuleshnyi maksymbuleshnyi requested a review from a team as a code owner April 8, 2026 13:14
Copy link
Copy Markdown

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit b5898ad. Configure here.

@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 8, 2026

Coverage

Coverage Report •
FileStmtsMissCoverMissing
dynamiq/nodes/agents
   agent.py69313580%213–216, 221, 229, 234, 252–253, 271–272, 325–327, 488–497, 500–502, 517, 526, 535–536, 552, 555–556, 566–569, 574, 587, 600–601, 616, 628, 633, 649–650, 660, 663, 673, 713–715, 721–723, 837, 842, 892, 926, 928, 943–944, 951, 954, 979, 981–982, 998, 1023–1027, 1094, 1100, 1104, 1107, 1140, 1165, 1168, 1173, 1189, 1193, 1235, 1271–1272, 1298, 1312, 1321, 1324–1325, 1335, 1342, 1404–1405, 1409, 1411–1413, 1415, 1417, 1450, 1458–1459, 1461, 1464, 1467, 1518–1521, 1537, 1546, 1585, 1591–1597, 1603, 1605–1614, 1616–1617
TOTAL26780896066% 

Tests Skipped Failures Errors Time
1548 1 💤 0 ❌ 0 🔥 1m 54s ⏱️

TrachukT
TrachukT previously approved these changes Apr 9, 2026
@TrachukT TrachukT added the run-integration-tests-with-creds Trigger integration tests with credentials (optional) label Apr 9, 2026
@maksymbuleshnyi maksymbuleshnyi added run-integration-tests-with-creds Trigger integration tests with credentials (optional) and removed run-integration-tests-with-creds Trigger integration tests with credentials (optional) labels Apr 9, 2026
@maksymbuleshnyi maksymbuleshnyi added run-integration-tests-with-creds Trigger integration tests with credentials (optional) and removed run-integration-tests-with-creds Trigger integration tests with credentials (optional) labels Apr 9, 2026
@maksymbuleshnyi maksymbuleshnyi added run-integration-tests-with-creds Trigger integration tests with credentials (optional) and removed run-integration-tests-with-creds Trigger integration tests with credentials (optional) labels Apr 9, 2026
@maksymbuleshnyi maksymbuleshnyi merged commit 3848ef0 into main Apr 9, 2026
10 checks passed
@maksymbuleshnyi maksymbuleshnyi deleted the fix/structured-output-parsing branch April 9, 2026 12:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

run-integration-tests-with-creds Trigger integration tests with credentials (optional)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants