Skip to content

fix(py/plugins/google-genai): don't treat already-run Antigravity sandbox calls as tool requests - #6803

Closed
hkarmoush wants to merge 1 commit into
genkit-ai:mainfrom
hkarmoush:faris/py-antigravity-sandbox-calls
Closed

hkarmoush wants to merge 1 commit into
genkit-ai:mainfrom
hkarmoush:faris/py-antigravity-sandbox-calls

Conversation

@hkarmoush

Copy link
Copy Markdown
Contributor

Part of #6711 (Python prerequisite).

from_function_call_step turned every function_call step into a ToolRequest. Antigravity's sandbox tools (write_to_file etc.) come back as function_call steps that already have a function_result, so the generate loop tried to run them and failed with Tool write_to_file not found. JS already avoids this.

  • A function_call with a matching function_result is now stashed as a custom serverFunctionCall part and replayed as a function_call step, so its result keeps a partner.
  • A call with no result is still a ToolRequest.
  • from_interaction_sync returns the pending client calls on requires_action instead of raising FAILED_PRECONDITION. With nothing pending (e.g. plan approval) it still raises.

Behavior is unchanged while Antigravity stays tools=False; this unblocks sending function tools from Python. Unit tests only, no request-side changes.

…dbox calls as tool requests

A function_call that already has a matching function_result ran inside the
agent's sandbox, but it was surfaced as a ToolRequest, so the generate loop
failed with 'Tool write_to_file not found'. Stash those calls as custom
serverFunctionCall parts (replayed as function_call steps), and have
from_interaction_sync return pending client calls on requires_action instead
of raising.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request introduces support for handling server-side function calls and pending client-side function calls when an interaction is in the requires_action state. It adds the SERVER_FUNCTION_CALL custom type to distinguish between tools executed on the server (which are stashed as custom parts) and pending tools that need to be executed by the client (which are returned as tool requests). Corresponding unit tests have been added and updated to verify these behaviors. There are no review comments, so I have no feedback to provide.

@hkarmoush

Copy link
Copy Markdown
Contributor Author

@hilariie @cabljac would one of you mind taking a look when you get a chance? It's a small fix in the Antigravity response parsing so sandbox calls that already ran don't come back as tool requests.

@hkarmoush

Copy link
Copy Markdown
Contributor Author

Friendly bump on this one, @hilariie @cabljac. Still a small change in the Antigravity response parsing. Happy to adjust anything.

@hkarmoush

Copy link
Copy Markdown
Contributor Author

Closing since #7004 landed the same fix: already-run sandbox calls go to serverFunctionCall instead of becoming tool requests, and requires_action is handled as a pause. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

python Python

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant