ADFA-5410 | Implement native tool calling for Gemini and OpenAI agents - #86
Open
jatezzz wants to merge 1 commit into
Open
ADFA-5410 | Implement native tool calling for Gemini and OpenAI agents#86jatezzz wants to merge 1 commit into
jatezzz wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
Claude Code Review
This repository is configured for manual code reviews. Comment @claude review for a one-time review, or @claude review always to subscribe this PR to a review on every future push.
Tip: disable this comment in your organization's Code Review settings.
jatezzz
requested review from
a team,
Daniel-ADFA,
dara-abijo-adfa,
hal-eisen-adfa and
itsaky-adfa
September 4, 2026 16:25
Declare tools natively on both backends so calls arrive as structured data instead of unparseable prose, and read the dialects models still emit — Gemini's print(default_api.x()) and OpenAI's tool_calls deltas that carried no content — with a fallback to undeclared requests where a server refuses them. Report unreadable calls and abandoned runs honestly rather than COMPLETED, and name the source, layout and manifest paths up front.
jatezzz
force-pushed
the
fix/ADFA-5410-gemini-native-tool-calls
branch
from
September 4, 2026 19:51
e10b9e2 to
6fa029a
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This PR migrates the Gemini and OpenAI agent backends to use their native function-calling APIs instead of relying on plain text tool call envelopes. This addresses the issue where LLMs produced malformed text payloads (such as unescaped quotes or newlines) which caused valid tool calls to be skipped or silently fail. By correctly declaring tool schemas and updating the system prompts to stop teaching the
<tool_call>syntax when native calling is available, the agents can now execute actions reliably.Details
ToolCallingBackendcapabilities to bothGeminiBackendandOpenAiBackend.GeminiToolProtocolandOpenAiToolProtocolto manage provider-specific JSON schemas, declarations, and chunk parsing.ToolCallExtractorto diagnose and report malformed or truncated tool replies, preventing the agent loop from incorrectly reporting success.ToolCodeParserto intercept and extract tool calls from Gemini's undocumenteddefault_api.<tool>(...)fallback syntax.ToolSchemato standardise and provide structured parameter schemas for all tool handlers (e.g.,AddDependencyHandler,CreateFileHandler).ProjectLayoutcontext to the system prompt to explicitly inform the agent of the module structure, significantly reducing wastedlist_filessteps.OpenAI
Screen_Recording_20260904_104112_Code.on.the.Go.mp4
Gemini API
Screen_Recording_20260904_105334_Code.on.the.Go.mp4
Ticket
ADFA-5410
Observation
The
AgentLoophas also been updated to halt accurately when tool calls are unparsable or abandoned, providing specific diagnostic messages to the user rather than failing silently.