Skip to content

feat: add agent identity support for Agent Engine deployments#720

Merged
eliasecchig merged 4 commits intomainfrom
feat/agent-identity-support
Jan 21, 2026
Merged

feat: add agent identity support for Agent Engine deployments#720
eliasecchig merged 4 commits intomainfrom
feat/agent-identity-support

Conversation

@eliasecchig
Copy link
Collaborator

Summary

  • Add optional --agent-identity flag to deploy.py for Agent Engine deployments
  • Add AGENT_IDENTITY=true parameter support in Makefile
  • Auto-grant required IAM roles to agent identity principal on deployment
  • Use v1beta1 API when agent identity is enabled (required for identity_type)
  • Update dependency lock files

Changes

  • Makefile: Add usage comment and $(if $(AGENT_IDENTITY),--agent-identity) to deploy target
  • deploy.py:
    • Add --agent-identity CLI flag
    • Import IdentityType and Resource Manager dependencies
    • Add grant_agent_identity_roles() function to grant required IAM roles
    • Create empty agent with identity first, grant roles, then update with code
    • Use v1beta1 API version when agent identity is enabled

Usage

make deploy AGENT_IDENTITY=true

- 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
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @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

  • Agent Identity Support: Introduced support for agent identity in Agent Engine deployments, allowing for per-agent IAM access control and enhanced security.
  • Deployment Flag and Makefile Integration: Added an optional --agent-identity CLI flag to deploy.py and integrated AGENT_IDENTITY=true parameter support in the Makefile for easy activation of the feature.
  • Automated IAM Role Granting: Implemented automatic granting of necessary IAM roles (aiplatform.expressUser, serviceusage.serviceUsageConsumer, browser) to the agent's effective identity during deployment.
  • API Version Management: Ensured the use of the v1beta1 API version for Agent Engine deployments when agent identity is enabled, as this is required for the identity_type configuration.
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 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.

- 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.
@eliasecchig eliasecchig merged commit a49befe into main Jan 21, 2026
34 checks passed
enriquekalven pushed a commit to enriquekalven/agent-starter-pack that referenced this pull request Feb 7, 2026
…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.
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