feat: add agent identity support for Agent Engine deployments#720
feat: add agent identity support for Agent Engine deployments#720eliasecchig merged 4 commits intomainfrom
Conversation
- Add --agent-identity flag to deploy.py for opt-in agent identity - Auto-grant required IAM roles to agent identity principal - Use v1beta1 API when agent identity is enabled - Add AGENT_IDENTITY=true parameter to Makefile deploy target
Summary of ChangesHello @eliasecchig, 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 enhances the Agent Engine deployment process by integrating support for agent identity. This feature enables fine-grained IAM access control for individual agents, improving security and resource management. The changes involve modifications to the deployment script and Makefile to allow users to opt-in to agent identity, along with automated IAM role assignment and API version handling to facilitate this new capability. Highlights
Using Gemini Code AssistThe 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
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 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
|
There was a problem hiding this comment.
Code Review
This pull request introduces support for agent identity in Agent Engine deployments, allowing for per-agent IAM access control. The changes include adding a new --agent-identity CLI flag to deploy.py, integrating AGENT_IDENTITY=true into the Makefile, and implementing a function to automatically grant necessary IAM roles. The deployment logic has been updated to use the v1beta1 API when agent identity is enabled, and to handle the creation of an empty agent for identity provisioning before the full deployment. Overall, the changes are well-structured and address the stated goal. However, there are a couple of areas related to IAM policy management that could be improved for robustness and maintainability.
.../deployment_targets/agent_engine/python/{{cookiecutter.agent_directory}}/app_utils/deploy.py
Outdated
Show resolved
Hide resolved
.../deployment_targets/agent_engine/python/{{cookiecutter.agent_directory}}/app_utils/deploy.py
Outdated
Show resolved
Hide resolved
- Add docstring explaining etag-based optimistic concurrency control - Move IAM roles list inside grant_agent_identity_roles function - Fix import ordering and line length issues for linting
Use conditional multi-line import for vertexai types when AgentServerMode is included in adk_live templates.
…CloudPlatform#720) * feat: add agent identity support for Agent Engine deployments - Add --agent-identity flag to deploy.py for opt-in agent identity - Auto-grant required IAM roles to agent identity principal - Use v1beta1 API when agent identity is enabled - Add AGENT_IDENTITY=true parameter to Makefile deploy target * chore: update dependency lock files * refactor: address code review feedback for agent identity - Add docstring explaining etag-based optimistic concurrency control - Move IAM roles list inside grant_agent_identity_roles function - Fix import ordering and line length issues for linting * fix: split long import line for adk_live template Use conditional multi-line import for vertexai types when AgentServerMode is included in adk_live templates.
Summary
--agent-identityflag todeploy.pyfor Agent Engine deploymentsAGENT_IDENTITY=trueparameter support in MakefileChanges
$(if $(AGENT_IDENTITY),--agent-identity)to deploy target--agent-identityCLI flagIdentityTypeand Resource Manager dependenciesgrant_agent_identity_roles()function to grant required IAM rolesUsage