Skip to content

feat: flattened tool call schema#756

Merged
mykhailobuleshnyi merged 7 commits into
mainfrom
feat/flatten-tool-calling-schema
Jun 1, 2026
Merged

feat: flattened tool call schema#756
mykhailobuleshnyi merged 7 commits into
mainfrom
feat/flatten-tool-calling-schema

Conversation

@mykhailobuleshnyi
Copy link
Copy Markdown
Contributor

@mykhailobuleshnyi mykhailobuleshnyi commented May 28, 2026

Note

High Risk
Changes the FC contract (schemas, parsing, and streaming deltas) across the agent pipeline; consumers expecting nested action_input in streamed or parsed payloads need to adapt, though runtime unwraps the old shape.

Overview
This PR flattens function-calling tool arguments: thought and each tool parameter are top-level fields in the LLM schema and wire JSON, replacing the nested action_input wrapper. ToolCallArguments.to_action_input() still unwraps the legacy nested shape when the model emits only thought + action_input.

Streaming adds JSONInnerThoughtsExtractor and rewires FC handling so thought streams as REASONING and the remaining JSON (without thought) as TOOL_INPUT, with optional fc_wait_for_first_key ordering and an end-of-stream fallback when thought is missing. provide_final_answer still uses the existing JSON-field path.

Schema generation puts thought first, merges tool properties at the root, and relaxes strict/open rules for extra="allow" tools. ThinkingTool uses reflection (with thought as an alias) so it does not collide with agent-level thought. Prompts, tests, and a live OpenAI callback test cover the new behavior.

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

@mykhailobuleshnyi mykhailobuleshnyi requested a review from a team as a code owner May 28, 2026 17:57
Comment thread dynamiq/callbacks/inner_thoughts_extractor.py
Comment thread dynamiq/callbacks/inner_thoughts_extractor.py
Comment thread dynamiq/nodes/agents/agent.py Outdated
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 29, 2026

Coverage

Coverage Report •
FileStmtsMissCoverMissing
dynamiq/callbacks
   inner_thoughts_extractor.py1641093%44, 74–75, 97, 170, 188, 197, 203, 211, 227
   streaming.py6768088%23, 190, 203–204, 212–213, 229–230, 268–269, 277, 304–310, 314, 322–327, 335, 343–344, 399, 403, 407, 450, 453, 461–462, 528, 592, 596, 649, 689–692, 720–721, 804–807, 920, 922, 948, 974–975, 1061, 1088, 1101, 1127–1128, 1130, 1163, 1187–1192, 1228, 1232, 1248, 1250–1258, 1263
dynamiq/nodes/agents
   agent.py87813984%109–110, 356–359, 364, 380–381, 399–400, 422, 429–430, 437–438, 444–445, 447, 506–508, 718–720, 735, 744, 770, 786, 805, 817–820, 822, 844–845, 847, 862, 874, 879, 896–897, 907, 910, 920, 960–962, 968–970, 1079, 1084, 1135, 1169, 1171, 1186–1187, 1194, 1197, 1224–1225, 1241, 1280, 1307–1311, 1378, 1384, 1388, 1391, 1425, 1453, 1456, 1461, 1477, 1539–1540, 1575, 1580, 1604, 1660, 1682–1684, 1687–1688, 1698, 1701, 1711, 1718, 1768–1771, 1791–1792, 1796, 1798–1800, 1802, 1804, 1837, 1845–1846, 1848, 1851, 1854, 1905–1908, 1924, 1933, 1998, 2004–2010, 2016, 2018–2027, 2029–2030
dynamiq/nodes/agents/components
   schema_generator.py1894178%61, 64, 142, 252, 256, 261–266, 269–271, 276, 280–281, 283–291, 293, 308, 310, 321–322, 331, 336, 338, 341, 345, 379–380, 382, 387–388
dynamiq/nodes/tools
   thinking_tool.py1024357%156, 161, 165–167, 171, 173–174, 176–177, 179–181, 187, 189, 208–210, 212–214, 216, 218, 220, 222, 224–225, 232, 234, 236–237, 239, 241–242, 252, 256, 282–285, 289–290, 294
dynamiq/types
   streaming.py107298%84, 92
TOTAL32721950270% 

Tests Skipped Failures Errors Time
2422 2 💤 0 ❌ 0 🔥 2m 51s ⏱️

Михайло Булешний added 2 commits June 1, 2026 02:03
@mykhailobuleshnyi mykhailobuleshnyi added the run-integration-tests-with-creds Trigger integration tests with credentials (optional) label May 31, 2026
Comment thread dynamiq/nodes/agents/agent.py Outdated
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.

There are 2 total unresolved issues (including 1 from previous review).

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 56d6b05. Configure here.

Comment thread dynamiq/nodes/agents/agent.py Outdated
@mykhailobuleshnyi mykhailobuleshnyi 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 Jun 1, 2026
Copy link
Copy Markdown
Contributor

@olbychos olbychos left a comment

Choose a reason for hiding this comment

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

Overall looks solid. Let’s consider better patterns and rely on tests.

Comment thread dynamiq/callbacks/inner_thoughts_extractor.py
@mykhailobuleshnyi mykhailobuleshnyi merged commit c88a535 into main Jun 1, 2026
10 of 11 checks passed
@mykhailobuleshnyi mykhailobuleshnyi deleted the feat/flatten-tool-calling-schema branch June 1, 2026 19:08
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.

4 participants