특정 최종 사용자를 대신하여 에이전트가 외부 도구 및 서비스 (예: Jira 작업 또는 GitHub 저장소)에 액세스하도록 허용하려면 Agent Identity 인증 관리자에서 3-legged OAuth 인증 제공업체를 구성합니다.
사용자 인증 정보 및 토큰을 관리하여 3-legged OAuth 인증 제공업체는 인증 흐름을 처리하기 위한 커스텀 코드가 필요하지 않도록 합니다.
3-legged OAuth 워크플로
3-legged OAuth 인증 제공업체는 에이전트가 사용자를 대신하여 리소스에 액세스하므로 사용자 동의가 필요합니다.
- 프롬프트 및 리디렉션: 채팅 인터페이스에서 사용자에게 로그인하라는 메시지를 표시한 다음 사용자를 서드 파티 애플리케이션의 동의 페이지로 리디렉션합니다.
- 동의 및 저장: 사용자가 권한을 부여하면 Agent Identity 인증 관리자가 결과 OAuth 토큰을 Google 관리 사용자 인증 정보 보관소에 저장합니다.
- 삽입: 에이전트 개발 키트 (ADK)를 사용하면 에이전트가 인증 제공업체에서 토큰을 자동으로 가져와 도구 호출 헤더에 삽입합니다.
시작하기 전에
- 올바른 인증 방법을 선택했는지 확인합니다.
-
Agent Identity API를 사용 설정합니다.
API 사용 설정에 필요한 역할
API를 사용 설정하려면
serviceusage.services.enable권한이 포함된 서비스 사용량 관리자 IAM 역할(roles/serviceusage.serviceUsageAdmin)이 필요합니다. 역할 부여 방법 알아보기 - 에이전트를 만들고 배포합니다.
- 사용자 로그인 프롬프트를 처리하고 서드 파티 동의 페이지로 리디렉션하는 프런트엔드 애플리케이션이 있는지 확인합니다.
- 이 작업을 완료하는 데 필요한 역할이 있는지 확인합니다.
필요한 역할
3-legged 인증 제공업체를 만들고 사용하는 데 필요한 권한을 얻으려면 관리자에게 프로젝트에 대한 다음 IAM 역할을 부여해 달라고 요청하세요.
-
인증 제공업체를 만들려면 다음 안내를 따르세요.
- Agent Identity 관리자 (
roles/agentidentity.admin) - Agent Identity 편집자 (
roles/agentidentity.editor)
- Agent Identity 관리자 (
-
인증 제공업체를 사용하려면 다음 안내를 따르세요.
- Agent Identity 사용자 (
roles/agentidentity.user) - Vertex AI 사용자 (
roles/aiplatform.user) - 서비스 사용량 소비자 (
roles/serviceusage.serviceUsageConsumer)
- Agent Identity 사용자 (
역할 부여에 대한 자세한 내용은 프로젝트, 폴더, 조직에 대한 액세스 관리를 참조하세요.
이러한 사전 정의된 역할에는 3-legged 인증 제공업체를 만들고 사용하는 데 필요한 권한이 포함되어 있습니다. 필요한 정확한 권한을 보려면 필수 권한 섹션을 펼치세요.
필수 권한
3-legged 인증 제공업체를 만들고 사용하려면 다음 권한이 필요합니다.
-
인증 제공업체를 만들려면:
agentidentity.authProviders.create -
인증 제공업체를 사용하려면 다음 안내를 따르세요.
-
agentidentity.authProviders.retrieveCredentials -
aiplatform.endpoints.predict -
aiplatform.sessions.create
-
커스텀 역할이나 다른 사전 정의된 역할을 사용하여 이 권한을 부여받을 수도 있습니다.
3-legged 인증 제공업체 만들기
인증 제공업체를 만들어 서드 파티 애플리케이션의 구성 및 사용자 인증 정보를 정의합니다.
3-legged 인증 제공업체를 만들려면 gcloud CLI를 사용하세요.
-
OAuth 클라이언트 애플리케이션을 구성하여 클라이언트를 등록하고 클라이언트 ID와 클라이언트 보안 비밀번호를 가져옵니다. 해당 섹션의 템플릿을 사용하여 리디렉션 URI를 지정합니다.
-
클라이언트 사용자 인증 정보를 사용하여 인증 제공업체를 만듭니다.
gcloud alpha agent-identity authProviders create
AUTH_PROVIDER_NAME\ --project="PROJECT_ID" \ --location="LOCATION" \ --three-legged-oauth-client-id="CLIENT_ID" \ --three-legged-oauth-client-secret="CLIENT_SECRET" \ --three-legged-oauth-authorization-url="AUTHORIZATION_URL" \ --three-legged-oauth-token-url="TOKEN_URL" - 인증 제공업체가 목록에 표시되고 상태가
ENABLED인지 확인합니다.gcloud alpha agent-identity authProviders list \ --project="
PROJECT_ID" \ --location="LOCATION" -
에이전트 및 로컬 개발 환경이 인증 제공업체에서 사용자 인증 정보를 가져올 수 있도록 액세스 권한을 부여합니다. 배포된 에이전트와 개인 사용자 계정이 인증 제공업체에 액세스하도록 허용하려면 인증 제공업체 리소스에 Agent Identity User(
roles/agentidentity.user) 역할을 부여합니다.-
배포된 에이전트의 SPIFFE ID (Agent Identity)에 대한 액세스 권한을 부여합니다.
gcloud alpha agent-identity authProviders add-iam-policy-binding
AUTH_PROVIDER_NAME\ --project="PROJECT_ID" \ --location="LOCATION" \ --role="roles/agentidentity.user" \ --member="principal://agents.global.org-ORGANIZATION_ID.system.id.goog/resources/aiplatform/projects/PROJECT_NUMBER/locations/LOCATION/reasoningEngines/ENGINE_ID" -
로컬 개발 및 테스트 (
adk web)를 위해 개인 사용자 계정에 대한 액세스 권한을 부여합니다.gcloud alpha agent-identity authProviders add-iam-policy-binding
AUTH_PROVIDER_NAME\ --project="PROJECT_ID" \ --location="LOCATION" \ --role="roles/agentidentity.user" \ --member="user:USER_EMAIL"
-
다음을 바꿉니다.
PROJECT_ID: 프로젝트 ID입니다. Google CloudLOCATION: 인증 제공업체 및 에이전트가 배포되는 위치 (예:us-west1).AUTH_PROVIDER_NAME: 인증 제공업체의 이름 (예:bigquery-mcp-3lo-authprovider).AUTHORIZATION_URL: 인증 서버 URL (예:https://accounts.google.com/o/oauth2/v2/auth).TOKEN_URL: 토큰 서버 URL (예:https://oauth2.googleapis.com/token).CLIENT_ID: 서드 파티 서비스에서 생성한 OAuth 클라이언트 ID.CLIENT_SECRET: 서드 파티 서비스에서 생성한 OAuth 클라이언트 보안 비밀번호.ORGANIZATION_ID: 조직 ID입니다. Google CloudPROJECT_NUMBER: 프로젝트 번호입니다. Google CloudENGINE_ID: 배포된 추론 엔진 에이전트의 ID입니다.USER_EMAIL: 개인 사용자 계정 이메일 주소입니다.
OAuth 클라이언트 애플리케이션 구성
OAuth 클라이언트 사용자 인증 정보를 등록하기 전에 서드 파티 인증 서버 (예: Google, GitHub 또는 Jira)에서 클라이언트 ID와 클라이언트 보안 비밀번호를 가져옵니다.
외부의 서드 파티 서비스에 연결하는 경우 해당 서비스의 개발자 포털에서 OAuth 클라이언트 사용자 인증 정보를 가져오고 이 섹션의 단계를 건너뜁니다.Google Cloud
리디렉션 URI 등록
OAuth 클라이언트 사용자 인증 정보를 구성할 때는 인증 제공업체의 전용 콜백 리디렉션 URI를 등록해야 합니다.
다음 템플릿을 사용하여 리디렉션 URI를 구성합니다.
https://agentidentitycredentials.googleapis.com/v1alpha/projects/PROJECT_ID/locations/LOCATION/authProviders/AUTH_PROVIDER_NAME/oauthcallback다음을 바꿉니다.
PROJECT_ID: 프로젝트 ID입니다. Google CloudLOCATION: 인증 제공업체가 배포될 리전 (예:us-west1).AUTH_PROVIDER_NAME: 인증 제공업체의 이름입니다.
예를 들면
https://agentidentitycredentials.googleapis.com/v1alpha/projects/my-project/locations/us-west1/authProviders/bigquery-mcp-3lo-authprovider/oauthcallback입니다.서비스 (예: BigQuery)에 연결하는 경우 Google Cloud console에서 동의 화면을 구성하고 OAuth 클라이언트 사용자 인증 정보를 만들 수 있습니다. Google Cloud
-
OAuth 동의 화면을 구성합니다.
- Google Cloud console에서 API 및
서비스>OAuth 동의 화면 페이지로 이동합니다.
API 및 서비스>OAuth 동의 화면으로 이동
- 앱 정보 섹션에서 애플리케이션 이름(예: BigQuery 관리자 애플리케이션)과 지원 이메일을 입력합니다.
- 대상 섹션에서 내부 또는 외부를 선택합니다.
- 알림을 받을 연락처 정보를 입력합니다.
- Google API 서비스 사용자 데이터 정책을 읽고 동의합니다.
- 마침 을 클릭합니다.
- Google Cloud console에서 API 및
서비스>OAuth 동의 화면 페이지로 이동합니다.
-
OAuth 클라이언트 사용자 인증 정보를 만듭니다.
- Google Cloud console에서 API 및
서비스>OAuth 동의
화면>클라이언트 페이지로 이동합니다.
API 및 서비스>OAuth 동의 화면 >클라이언트로 이동
- 사용자 인증 정보 만들기 >OAuth 클라이언트 ID를 클릭합니다.
- 목록에서 웹 애플리케이션 옵션을 선택합니다.
- OAuth 클라이언트의 인식 가능한 이름을 입력합니다.
- 승인된 리디렉션 URI 섹션에서 URI 추가를 클릭하고 구성된 리디렉션 URI를 입력합니다.
- 만들기 를 클릭합니다. OAuth 클라이언트 생성됨 대화상자에서 생성된 클라이언트 ID 및 클라이언트 보안 비밀번호 값을 복사합니다.
- Google Cloud console에서 API 및
서비스>OAuth 동의
화면>클라이언트 페이지로 이동합니다.
-
에이전트 코드에서 인증
에이전트를 인증하려면 ADK를 사용하거나 Agent Identity API를 직접 호출하면 됩니다.
ADK
ADK의 MCP 도구 모음을 사용하여 에이전트의 코드에서 인증 제공업체를 참조합니다.
from google.adk.agents.llm_agent import LlmAgent from google.adk.auth.credential_manager import CredentialManager from google.adk.integrations.agent_identity import GcpAuthProvider, GcpAuthProviderScheme from google.adk.tools.mcp_tool.mcp_session_manager import StreamableHTTPConnectionParams from google.adk.tools.mcp_tool.mcp_toolset import McpToolset from google.adk.auth.auth_tool import AuthConfig # Register Google Cloud auth provider CredentialManager.register_auth_provider(GcpAuthProvider()) # The URI to redirect the user to after consent is granted. CONTINUE_URI = "https://YOUR_FRONTEND_URL/validateUserId" # Create auth provider scheme # Note: If using the legacy V1 API, the resource name uses 'connectors' # instead of 'authProviders': projects/.../connectors/... auth_scheme = GcpAuthProviderScheme( name="projects/PROJECT_ID/locations/LOCATION/authProviders/AUTH_PROVIDER_NAME", continue_uri=CONTINUE_URI ) # Configure an MCP tool with the authentication scheme. toolset = McpToolset( connection_params=StreamableHTTPConnectionParams(url="https://YOUR_MCP_SERVER_URL"), auth_scheme=auth_scheme, ) # Initialize the agent with the authenticated tools. agent = LlmAgent( name="AGENT_NAME", model="gemini-2.5-flash", instruction="AGENT_INSTRUCTIONS", tools=[toolset], )
예: BigQuery MCP에 연결
다음 예에서는 에이전트를 BigQuery MCP 서버에 연결하는 agent.py 구성을 보여줍니다.
import os from google.adk.agents import Agent from google.adk.apps import App from google.adk.auth.credential_manager import CredentialManager from google.adk.integrations.agent_identity import GcpAuthProvider, GcpAuthProviderScheme from google.adk.models import Gemini from google.adk.tools.mcp_tool.mcp_session_manager import StreamableHTTPConnectionParams from google.adk.tools.mcp_tool.mcp_toolset import McpToolset import google.auth from google.genai import types _, project_id = google.auth.default() os.environ["GOOGLE_CLOUD_PROJECT"] = "PROJECT_ID" os.environ["GOOGLE_GENAI_USE_VERTEXAI"] = "True" bigquery_mcp_auth_provider_id = "AUTH_PROVIDER_NAME" bigquery_mcp_endpoint = os.environ.get( "BIGQUERY_MCP_ENDPOINT", "https://bigquery.googleapis.com/mcp" ) # Register Google Cloud auth provider CredentialManager.register_auth_provider(GcpAuthProvider()) # URI to redirect user to after consent is granted. CONTINUE_URI = "http://127.0.0.1:8501/validateUserId" bigquery_mcp_auth_scheme = GcpAuthProviderScheme( name=f"projects/{project_id}/locations/LOCATION/authProviders/{bigquery_mcp_auth_provider_id}", scopes=["https://www.googleapis.com/auth/bigquery"], continue_uri=CONTINUE_URI, ) bigquery_mcp_tools = McpToolset( connection_params=StreamableHTTPConnectionParams(url=bigquery_mcp_endpoint), auth_scheme=bigquery_mcp_auth_scheme, errlog=None, ) root_agent = Agent( name="root_agent", model=Gemini( model="gemini-2.5-flash", retry_options=types.HttpRetryOptions(attempts=3), ), instruction=( "You are a helpful AI assistant designed to provide accurate and useful" " information. You can also use your BigQuery MCP tools to look up" " BigQuery data." ), tools=[bigquery_mcp_tools], ) app = App( root_agent=root_agent, name="AGENT_NAME", )
ADK
ADK의 인증된 함수 도구를 사용하여 에이전트의 코드에서 인증 제공업체를 참조합니다.
import httpx from google.adk.agents.llm_agent import LlmAgent from google.adk.auth.credential_manager import CredentialManager from google.adk.integrations.agent_identity import GcpAuthProvider from google.adk.integrations.agent_identity import GcpAuthProviderScheme from google.adk.apps import App from google.adk.auth.auth_credential import AuthCredential from google.adk.auth.auth_tool import AuthConfig from google.adk.tools.authenticated_function_tool import AuthenticatedFunctionTool from vertexai import agent_engines # First, register Google Cloud auth provider CredentialManager.register_auth_provider(GcpAuthProvider()) # The URI to redirect the user to after consent is completed. CONTINUE_URI = "WEB_APP_VALIDATE_USER_URI" # Create Auth Config spotify_auth_config = AuthConfig( auth_scheme=GcpAuthProviderScheme( name="projects/PROJECT_ID/locations/LOCATION/authProviders/AUTH_PROVIDER_NAME", continue_uri=CONTINUE_URI ) ) # Use the Auth Config in Authenticated Function Tool spotify_search_track_tool = AuthenticatedFunctionTool( func=spotify_search_track, auth_config=spotify_auth_config ) # Sample function tool async def spotify_search_track(credential: AuthCredential, query: str) -> str | list: token = None if credential.http and credential.http.credentials: token = credential.http.credentials.token if not token: return "Error: No authentication token available." async with httpx.AsyncClient() as client: response = await client.get( "https://api.spotify.com/v1/search", headers={"Authorization": f"Bearer {token}"}, params={"q": query, "type": "track", "limit": 1}, ) # Add your own logic here agent = LlmAgent( name="AGENT_NAME", model="gemini-2.5-flash", instruction="AGENT_INSTRUCTIONS", tools=[spotify_search_track_tool], ) app = App( name="APP_NAME", root_agent=agent, ) vertex_app = agent_engines.AdkApp(app_name=app)
ADK
ADK의 에이전트 레지스트리 MCP 도구 모음을 사용하여 에이전트의 코드에서 인증 제공업체를 참조합니다.
from google.adk.agents.llm_agent import LlmAgent from google.adk.auth.credential_manager import CredentialManager from google.adk.integrations.agent_identity import GcpAuthProvider from google.adk.integrations.agent_identity import GcpAuthProviderScheme from google.adk.tools.mcp_tool.mcp_session_manager import StreamableHTTPConnectionParams from google.adk.tools.mcp_tool.mcp_toolset import McpToolset from google.adk.auth.auth_tool import AuthConfig from google.adk.integrations.agent_registry import AgentRegistry # First, register Google Cloud auth provider CredentialManager.register_auth_provider(GcpAuthProvider()) # The URI to redirect the user to after consent is completed. CONTINUE_URI="WEB_APP_VALIDATE_USER_URI" # Create Google Cloud auth provider scheme auth_scheme = GcpAuthProviderScheme( name="projects/PROJECT_ID/locations/LOCATION/authProviders/AUTH_PROVIDER_NAME", continue_uri=CONTINUE_URI ) # Set Agent Registry registry = AgentRegistry(project_id="PROJECT_ID", location="global") toolset = registry.get_mcp_toolset( mcp_server_name=( "projects/PROJECT_ID/locations/" "global/mcpServers/" "agentregistry-00000000-0000-0000-0000-000000000000" ), auth_scheme=auth_scheme, ) # Example MCP tool toolset = McpToolset( connection_params=StreamableHTTPConnectionParams(url="MCP_URL"), auth_scheme=auth_scheme, ) agent = LlmAgent( name="AGENT_NAME", model="MODEL_NAME", instruction="AGENT_INSTRUCTIONS", tools=[toolset], )
API 직접 호출
ADK를 사용하지 않는 경우 에이전트는 agentidentitycredentials.retrieveCredentials API를 호출하여 토큰을 가져와야 합니다.
이것은 다단계 OAuth 흐름이므로 에이전트는 작업의 수명 주기를 처리해야 합니다.
- 초기 요청: 에이전트가
retrieveCredentials를 호출합니다. - 동의 필요: 사용자가 동의를 부여하지 않은 경우 API는 결과가
uri_consent_required인 응답을 반환합니다. 여기에는authorization_uri및consent_nonce가 포함됩니다. - 프런트엔드 리디렉션: 애플리케이션은 사용자를
authorization_uri로 리디렉션해야 합니다. - 완료: 사용자가 동의를 부여한 후
FinalizeCredentials를 사용하여consent_nonce를 통해 흐름을 완료하고 토큰을 가져옵니다.
클라이언트 측 애플리케이션 업데이트
3-legged OAuth의 사용자 로그인 및 리디렉션을 처리하려면 클라이언트 측 애플리케이션에서 다음 단계를 구현하여 사용자 동의를 관리하고 대화를 재개해야 합니다.
샘플 UI 서버
uvicorn을 사용하는 완전한 샘플 UI 서버를 다운로드하고 실행할 수 있습니다. 시작하기 전에 GitHub
계정과 pip가 설치되어 있는지 확인합니다.
샘플 UI 서버를 설정하고 실행하려면 다음 단계를 따르세요.
-
adk-pythonGitHub 저장소를 클론합니다.git clone https://github.com/google/adk-python.git
-
저장소로 이동하여 Python 가상 환경을 활성화합니다.
cd adk-python python3 -m venv .venv source .venv/bin/activate
-
샘플 UI 클라이언트 디렉터리로 이동합니다.
cd contributing/samples/integrations/gcp_auth/client
-
클라이언트 종속 항목을 설치합니다.
pip install -r requirements.txt
-
서버를 시작하기 전에
AGENT_PROJECT_DIR환경 변수를 설정하여 에이전트 코드가 있는 디렉터리를 지정합니다. 그렇지 않으면 애플리케이션은 기본적으로 클라이언트 디렉터리의 상위 폴더에서 에이전트를 찾습니다.uvicorn을 사용하여 샘플 UI 서버를 실행합니다. 포트가 OAuth 클라이언트에 구성된 리디렉션 URI와 일치하는지 확인합니다:export AGENT_PROJECT_DIR="/path/to/your/agent_project" uvicorn main:app --port 8501 --reload
-
브라우저에서
http://localhost:8501을 엽니다. (참고: OAuth 리디렉션 URL에localhost호스트 이름이 필요하므로127.0.0.1이 아닌localhost을 사용해야 합니다.) 설정을 지정하고 설정 저장 및 적용을 클릭한 다음 에이전트와 상호작용합니다.
커스텀 UI 애플리케이션
커스텀 UI 애플리케이션에서 이러한 기능을 직접 구현하려면 다음 단계를 수행합니다.
승인 트리거 처리
에이전트에 사용자 동의가 필요한 경우 adk_request_credential 함수 호출을 반환합니다. 애플리케이션은 이 호출을 가로채서 사용자 승인 대화상자 또는 리디렉션을 시작해야 합니다.
인증 제공업체에서 제공하는 consent_nonce를 기록하여 세션 컨텍스트를 관리합니다. 이 nonce는 유효성 검사 단계에서 사용자를 확인하는 데 필요합니다. 사용자가 동의를 부여한 후 흐름을 쉽게 재개할 수 있도록 세션 내에 auth_config 및 auth_request_function_call_id 값을 저장합니다.
if (fc := get_auth_request_function_call(event_data)): print("--> Authentication required by agent.") try: auth_config = get_auth_config(fc) auth_uri, consent_nonce = handle_adk_request_credential( auth_config, AUTH_PROVIDER_NAME, request.user_id ) if auth_uri: event_data['popup_auth_uri'] = auth_uri fc_id = ( fc.get('id') if isinstance(fc, dict) else getattr(fc, 'id', None) ) event_data['auth_request_function_call_id'] = fc_id event_data['auth_config'] = auth_config.model_dump() # Store session state if session_id: consent_sessions[session_id] = { "user_id": request.user_id, "consent_nonce": consent_nonce } except Exception as e: print(f"Error handling adk_request_credential: {e}") # Optionally, add logic to inform the user about the error. def handle_adk_request_credential(auth_config, auth_provider_name, user_id): ec = auth_config.exchanged_auth_credential if ec and ec.oauth2: oauth2 = ec.oauth2 return oauth2.auth_uri, oauth2.nonce return None, None
사용자 유효성 검사 엔드포인트 구현
웹 서버에서 유효성 검사 엔드포인트를 구현합니다 (구성 중에 continue_uri로 제공된 동일한 URI). 이 엔드포인트는 다음 작업을 실행해야 합니다.
user_id_validation_state,auth_provider_name, 및uuid를 쿼리 매개변수로 수신합니다.- 세션 저장소에서
user_id및consent_nonce값을 가져옵니다. 여러 승인 흐름이 동시에 실행되는 경우,uuid을 사용하여 올바른 세션을 일치시킵니다. - 이러한
매개변수를 사용하여 인증 제공업체의
FinalizeCredentialsAPI를 호출합니다. - 성공 응답을 수신하면 승인 창을 닫습니다.
예: FastAPI 유효성 검사 엔드포인트 (main.py)
다음 예에서는 OAuth 콜백을 처리하고 사용자 사용자 인증 정보를 완료하는 완전한 FastAPI 유효성 검사 엔드포인트를 보여줍니다.
@app.api_route("/validateUserId", methods=["GET"]) async def validate_user(request: Request): auth_provider_name = request.query_params.get("auth_provider_name") session_id = request.cookies.get("session_id") session = consent_sessions.get(session_id, {}) payload = { "userId": session.get("user_id"), "userIdValidationState": request.query_params.get( "user_id_validation_state" ), "consentNonce": session.get("consent_nonce"), } base_url = "https://agentidentitycredentials.googleapis.com/v1alpha" finalize_url = f"{base_url}/{auth_provider_name}/credentials:finalize" try: async with httpx.AsyncClient(timeout=30.0) as client: resp = await client.post(finalize_url, json=payload) resp.raise_for_status() except httpx.HTTPError as e: err_text = e.response.text if hasattr(e, "response") else str(e) status = e.response.status_code if hasattr(e, "response") else 500 return HTMLResponse(err_text, status_code=status) return HTMLResponse(""" <script> window.close(); </script> <p>Success. You can close this window.</p> """)
에이전트 대화 재개
사용자가 동의를 부여하고 승인 창이 닫힌 후 세션 데이터에서 auth_config 및 auth_request_function_call_id 값을 가져옵니다. 대화를 계속하려면 이러한 세부정보를 function_response로 에이전트에 대한 새 요청에 포함합니다.
if (request.is_auth_resume and session.auth_request_function_call_id and session.auth_config): auth_content = types.Content( role='user', parts=[ types.Part( function_response=types.FunctionResponse( id=session.auth_request_function_call_id, name='adk_request_credential', response=session.auth_config ) ) ], ) # Send message to agent async for event in agent.async_stream_query( user_id=request.user_id, message=auth_content, session_id=session_id, ): # ...
에이전트 배포
에이전트를 Google Cloud에 배포할 때는 Agent Identity가 사용 설정되어 있는지 확인합니다.
Gemini Enterprise Agent Platform의
Agent Runtime
에 배포하는 경우
identity_type=AGENT_IDENTITY 플래그를 사용합니다.
import vertexai
from vertexai import types
from vertexai.agent_engines import AdkApp
# Initialize the Vertex AI client with v1beta1 API for Agent Identity support
client = vertexai.Client(
project="PROJECT_ID",
location="LOCATION",
http_options=dict(api_version="v1beta1")
)
# Use the proper wrapper class for your Agent Framework (e.g., AdkApp)
app = AdkApp(agent=agent)
# Deploy the agent with Agent Identity enabled
remote_app = client.agent_engines.create(
agent=app,
config={
"identity_type": types.IdentityType.AGENT_IDENTITY,
"requirements": [
"google-cloud-aiplatform[agent_engines,adk]",
"google-adk[agent-identity]"
],
},
)
다음 단계
- Agent Identity 인증 문제 해결
- Agent Identity 개요
- 인증 관리자와 함께 2-legged OAuth를 사용하여 인증
- 인증 관리자와 함께 API 키를 사용하여 인증
- Agent Identity 인증 제공업체 관리