Skip to content

Comments

feat: implements identityRequestProcessor to internal/llminternal#585

Draft
zchee wants to merge 7 commits intogoogle:mainfrom
zchee:processors-identity-request
Draft

feat: implements identityRequestProcessor to internal/llminternal#585
zchee wants to merge 7 commits intogoogle:mainfrom
zchee:processors-identity-request

Conversation

@zchee
Copy link
Contributor

@zchee zchee commented Feb 20, 2026

Implements identityRequestProcessor corresponding to adk-python behaviour. Also recreated the affected httprr.

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @zchee, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request introduces a significant enhancement by implementing an identityRequestProcessor that automatically embeds the agent's identity (name and description) into the system instructions provided to the Large Language Model. This ensures that the LLM has a clearer understanding of its persona and purpose during interactions. Concurrently, the default model used in testing has been updated to gemini-2.5-flash, and all affected HTTP replay test data has been refreshed to align with these changes, ensuring consistency and accuracy in testing the new behavior.

Highlights

  • Agent Identity Injection: A new identityRequestProcessor has been implemented to automatically inject the agent's name and description into the LLM's system instructions, enhancing the model's contextual awareness of its role.
  • Model Version Update: The default Gemini model used in various tests has been upgraded from gemini-2.0-flash to gemini-2.5-flash.
  • Test Data Regeneration: Numerous HTTP replay (.httprr) test data files have been regenerated to reflect the new system instruction behavior and the updated Gemini model version.
  • Test Helper Refactoring: The mockLLMAgent struct, a test helper, has been moved to a dedicated file (internal/llminternal/helpers_test.go) to promote reusability across internal LLM agent tests.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Changelog
  • agent/llmagent/llmagent_test.go
    • Updated the default model name from gemini-2.0-flash to gemini-2.5-flash.
    • Modified system instruction content in test cases to include agent identity.
  • agent/llmagent/testdata/TestFunctionTool.httprr
    • Regenerated HTTP replay data to reflect the gemini-2.5-flash model and include agent identity in system instructions.
  • agent/llmagent/testdata/TestLLMAgentStreamingModeSSE.httprr
    • Regenerated HTTP replay data to include agent identity in system instructions.
  • agent/llmagent/testdata/TestLLMAgent_healthy_backend.httprr
    • Regenerated HTTP replay data to include agent identity in system instructions.
  • agent/llmagent/testdata/TestToolCallback.httprr
    • Regenerated HTTP replay data to reflect the gemini-2.5-flash model and include agent identity in system instructions.
  • agent/remoteagent/testdata/TestA2ARemoteAgentStreamingGeminiError.httprr
    • Regenerated HTTP replay data to include agent identity in system instructions.
  • agent/remoteagent/testdata/TestA2ARemoteAgentStreamingGeminiSuccess.httprr
    • Regenerated HTTP replay data to include agent identity in system instructions.
  • agent/remoteagent/testdata/TestA2ASingleHopFinalResponse_llm_mid-response_error.httprr
    • Regenerated HTTP replay data to include agent identity in system instructions.
  • agent/remoteagent/testdata/TestA2ASingleHopFinalResponse_llm_mid-response_error_response.httprr
    • Regenerated HTTP replay data to include agent identity in system instructions.
  • internal/llminternal/helpers_test.go
    • Added a new file containing the mockLLMAgent struct for shared test utility.
  • internal/llminternal/identity_request_processor.go
    • Added a new file implementing the identityRequestProcessor to inject agent identity into LLM requests.
  • internal/llminternal/identity_request_processor_test.go
    • Added a new test file for the identityRequestProcessor.
  • internal/llminternal/other_processors.go
    • Removed the placeholder identityRequestProcessor function as its implementation moved to a dedicated file.
  • internal/llminternal/outputschema_processor_test.go
    • Removed the mockLLMAgent struct, which was moved to helpers_test.go.
    • Updated model names in test cases to gemini-2.5-flash.
  • internal/utils/utils.go
    • Added a godoc comment for the AppendInstructions function.
  • model/gemini/gemini_test.go
    • Updated the default model name to gemini-2.5-flash.
    • Adjusted expected token counts in test assertions to match the new model's behavior.
  • model/gemini/testdata/TestModel_GenerateStream_ok.httprr
    • Regenerated HTTP replay data to reflect the gemini-2.5-flash model and updated token counts.
  • model/gemini/testdata/TestModel_Generate_ok.httprr
    • Regenerated HTTP replay data to reflect the gemini-2.5-flash model and updated token counts.
  • model/gemini/testdata/TestModel_TrackingHeaders_verifies_headers_are_set.httprr
    • Regenerated HTTP replay data to reflect the gemini-2.5-flash model and updated token counts.
  • plugin/functioncallmodifier/integration_test.go
    • Updated the go:generate command for test data recording.
    • Refined rationale text in a test case for clarity.
  • plugin/functioncallmodifier/testdata/TestPluginCallbackIntegration_agent_tool_default_schema.httprr
    • Regenerated HTTP replay data to include agent identity in system instructions and reflect updated rationale and request format.
  • plugin/functioncallmodifier/testdata/TestPluginCallbackIntegration_no_relevant_tools.httprr
    • Regenerated HTTP replay data to include agent identity in system instructions and reflect updated rationale.
  • plugin/functioncallmodifier/testdata/TestPluginCallbackIntegration_transfer_to_agent_tool.httprr
    • Regenerated HTTP replay data to include agent identity in system instructions and reflect updated rationale.
  • tool/functiontool/function_test.go
    • Updated the go:generate command for test data recording.
    • Updated the default model name to gemini-2.5-flash.
  • tool/functiontool/testdata/TestFunctionTool_Simple.httprr
    • Regenerated HTTP replay data to reflect the gemini-2.5-flash model and updated thought signatures.
  • tool/mcptoolset/set_test.go
    • Updated the go:generate command for test data recording.
    • Refined model responses in test cases for consistency.
  • tool/mcptoolset/testdata/TestMCPToolSet.httprr
    • Regenerated HTTP replay data to include agent identity in system instructions.
  • tool/mcptoolset/testdata/TestMCPToolSetConfirmation_Conditional_Confirmation_Not_Required.httprr
    • Regenerated HTTP replay data to include agent identity in system instructions.
  • tool/mcptoolset/testdata/TestMCPToolSetConfirmation_Conditional_Confirmation_Not_Required_For_This_Tool.httprr
    • Regenerated HTTP replay data to include agent identity in system instructions.
  • tool/mcptoolset/testdata/TestMCPToolSetConfirmation_Conditional_Confirmation_Required.httprr
    • Regenerated HTTP replay data to include agent identity in system instructions.
  • tool/mcptoolset/testdata/TestMCPToolSetConfirmation_Conditional_Confirmation_Required_and_is_confirmed.httprr
    • Regenerated HTTP replay data to include agent identity in system instructions.
  • tool/mcptoolset/testdata/TestMCPToolSetConfirmation_Conditional_Confirmation_Required_and_is_rejected.httprr
    • Regenerated HTTP replay data to include agent identity in system instructions.
  • tool/mcptoolset/testdata/TestMCPToolSetConfirmation_Confirmation_Required.httprr
    • Regenerated HTTP replay data to include agent identity in system instructions.
  • tool/mcptoolset/testdata/TestMCPToolSetConfirmation_Confirmation_Required_and_is_confirmed.httprr
    • Regenerated HTTP replay data to include agent identity in system instructions.
  • tool/mcptoolset/testdata/TestMCPToolSetConfirmation_Confirmation_Required_and_is_rejected.httprr
    • Regenerated HTTP replay data to include agent identity in system instructions.
  • tool/mcptoolset/testdata/TestMCPToolSetConfirmation_No_Confirmation_Required.httprr
    • Regenerated HTTP replay data to include agent identity in system instructions.
Activity
  • A new identityRequestProcessor has been introduced, which is responsible for injecting agent-specific identity information into LLM system instructions.
  • The default LLM model used in various tests has been updated to gemini-2.5-flash.
  • Extensive regeneration of HTTP replay test data (.httprr files) was performed to ensure compatibility and accurate reflection of the new system instruction behavior and model changes.
  • The mockLLMAgent test helper was refactored and moved to a shared internal package for improved test organization and reusability.
  • A godoc comment was added to the AppendInstructions utility function for better documentation.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

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

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 successfully implements the identityRequestProcessor, which aligns the Go ADK with the Python ADK by injecting agent identity information into system instructions. The change is well-implemented and includes comprehensive unit tests for the new processor. The related updates to integration tests and their recorded HTTP traffic are consistent with the new behavior and the model update to gemini-2.5-flash. The code is clean and the changes are logical. I have one minor suggestion for improving code style and performance in the new processor.

@zchee
Copy link
Contributor Author

zchee commented Feb 20, 2026

@dpasiukevich This PR is still a draft, but needs to be squash?

@zchee zchee force-pushed the processors-identity-request branch from 9279d4e to 8164e4f Compare February 20, 2026 13:11
zchee and others added 7 commits February 20, 2026 22:25
Signed-off-by: Koichi Shiraishi <zchee.io@gmail.com>
…adk-python

The Python reference wraps name/description in double quotes as delimiters.
Also removes variable shadowing of the agent import and cleans up string
building.

Signed-off-by: Koichi Shiraishi <zchee.io@gmail.com>
Move the shared test mock from outputschema_processor_test.go to a
dedicated helpers_test.go to prevent fragile cross-file test coupling.

Signed-off-by: Koichi Shiraishi <zchee.io@gmail.com>
Signed-off-by: Koichi Shiraishi <zchee.io@gmail.com>
Since gemini-2.0-flash is deprecated, `go generate` can no longer generate testdata using httprr.

Signed-off-by: Koichi Shiraishi <zchee.io@gmail.com>
Signed-off-by: Koichi Shiraishi <zchee.io@gmail.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
@zchee zchee force-pushed the processors-identity-request branch from 8164e4f to 282d17a Compare February 20, 2026 13:25
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