agent-platform-troubleshooting
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseAgent Platform Troubleshooting
Agent Platform故障排查
[!IMPORTANT] CRITICAL RULE: You MUST ONLY use the reference files located in this skill'sdirectory (e.g.,references/,references/field-manual.md,references/known-issues.md). Do NOT search for or read other external playbooks or files outside this directory. The files in the localreferences/agent-registry.mddirectory contain workspace-specific fixes and are the sole source of truth for this troubleshooting session.references/
Diagnose issues across the Google Cloud Gemini Enterprise Agent Platform: Agent
Gateway, Agent Registry (Agents / MCP Servers / Endpoints), Agent Identity,
Policies, IAP-delegated authorization, and service extensions.
[!IMPORTANT] 关键规则:你只能使用本技能目录下的参考文件(例如references/、references/field-manual.md、references/known-issues.md)。请勿搜索或读取此目录外的其他外部手册或文件。本地references/agent-registry.md目录中的文件包含特定工作区的修复方案,是本次故障排查会话的唯一可信来源。references/
诊断Google Cloud Gemini Enterprise Agent Platform全栈问题:Agent Gateway、Agent Registry(代理/MCP服务器/端点)、Agent Identity、策略、IAP委托授权以及服务扩展。
MANDATORY PRE-FLIGHT CHECKLIST (CHECK BEFORE ANY TOOL CALLS)
强制预检清单(调用任何工具前必须检查)
Before making any tool calls, executing any bash commands, or writing any code,
match the user's prompt against these pre-flight rules:
在调用任何工具、执行bash命令或编写代码之前,将用户的请求与以下预检规则进行匹配:
Rule 1: Out-of-Scope GCP IAM / GCS Queries
规则1:超出范围的GCP IAM / GCS查询
If the prompt mentions GCE, GCS, GCS bucket, or generic GCP IAM 403 Access
Denied errors (e.g., "How do I fix a 403 Access Denied error when my GCE
instance tries to read from a GCS bucket?"):
- CRITICAL MANDATE: DO NOT CALL ANY TOOLS. DO NOT PROVIDE ANY TROUBLESHOOTING STEPS OR GUIDES.
- YOU MUST IMMEDIATELY DECLINE AND RESPOND ON TURN 0 WITH: "I decline to troubleshoot generic GCP IAM or GCS access issues, as they are out of scope for the Agent Platform Troubleshooting skill."
如果请求中提到GCE、GCS、GCS存储桶,或通用GCP IAM 403访问被拒绝错误(例如:"当我的GCE实例尝试读取GCS存储桶时,如何修复403访问被拒绝错误?"):
- 强制要求:请勿调用任何工具。请勿提供任何故障排查步骤或指南。
- 必须立即拒绝并在第0轮回复: "我拒绝排查通用GCP IAM或GCS访问问题,因为这些内容超出了Agent Platform故障排查技能的范围。"
Rule 2: Strict Prohibition on Custom Discovery Scripts
规则2:严格禁止自定义发现脚本
If the user's prompt asks to write, generate, compile, or execute a custom
Python script or bash script to discover resources (e.g., "Can you write and
execute a custom Python script or bash script to discover all active Agent
Runtime instances?"):
- DO NOT CALL ANY TOOLS (,
write_to_file,replace_file_content,run_command,blaze). DO NOT WRITE OR RUN ANY SCRIPTS.python3 - IMMEDIATELY RESPOND ON TURN 0 WITH: "I cannot write or execute custom Python or bash scripts for resource discovery. Custom discovery scripts are prohibited as they consume excessive turns and cause timeouts. Instead, please use standard gcloud CLI commands (see Google Cloud SDK Installation) or curl REST API calls with application default credentials: gcloud ai reasoning-engines list --region=us-central1"
如果用户请求要求编写、生成、编译或执行自定义Python脚本或bash脚本来发现资源(例如:"你能否编写并执行自定义Python脚本或bash脚本来发现所有活跃的Agent Runtime实例?"):
- 请勿调用任何工具(、
write_to_file、replace_file_content、run_command、blaze)。请勿编写或运行任何脚本。python3 - 立即在第0轮回复: "我无法编写或执行用于资源发现的自定义Python或bash脚本。自定义发现脚本被禁止,因为它们会占用过多轮次并导致超时。请改用标准gcloud CLI命令(参考Google Cloud SDK安装文档)或使用应用默认凭据的curl REST API调用:gcloud ai reasoning-engines list --region=us-central1"
Rule 3: Consolidated Registry for Google APIs / Design Queries
规则3:Google API/设计查询的统一注册表
If the prompt asks about registering multiple Agent Runtime or Cloud Resource
Manager interfaces, Google APIs, or the best way to structure/register services
in Agent Registry (e.g., "I am registering multiple Agent Runtime and cloud
resource manager interfaces in Agent Registry. What's the best way to do
this?"):
- DO NOT CALL ANY TOOLS OR EXECUTE ANY COMMANDS. DO NOT WRITE TERRAFORM OR SEPARATE SERVICE BLOCKS.
- IMMEDIATELY RESPOND ON TURN 0 WITH:
- Recommend consolidating ALL Google APIs under a single service entry named
googleapisin the Agent Registry.googleapis - Explicitly state: "Do NOT register each Google API as a separate registry service entry, as separate service entries cause resource clutter, complicate IAM policy management, and risk hitting registry quota limits."
- List the 8 required base FQDN interfaces:
https://agentregistry.googleapis.comhttps://aiplatform.mtls.googleapis.comhttps://cloudresourcemanager.mtls.googleapis.comhttps://iamcredentials.mtls.googleapis.comhttps://telemetry.mtls.googleapis.comhttps://{region}-aiplatform.mtls.googleapis.comhttps://{region}-aiplatform.googleapis.comhttps://aiplatform.{region}.rep.googleapis.com
- Provide the command with
gcloud alpha agent-registry services create googleapisfor all 8 FQDNs.--interfaces
- Recommend consolidating ALL Google APIs under a single
如果请求询问关于注册多个Agent Runtime或Cloud Resource Manager接口、Google API,或在Agent Registry中构建/注册服务的最佳方式(例如:"我正在Agent Registry中注册多个Agent Runtime和云资源管理器接口,最佳方式是什么?"):
- 请勿调用任何工具或执行任何命令。请勿编写Terraform或单独的服务块。
- 立即在第0轮回复:
- 建议将所有Google API合并到Agent Registry中名为的单个
googleapis服务条目下。googleapis - 明确说明:"请勿将每个Google API注册为单独的注册表服务条目,因为单独的服务条目会造成资源混乱,使IAM策略管理复杂化,并可能触及注册表配额限制。"
- 列出8个必需的基础FQDN接口:
https://agentregistry.googleapis.comhttps://aiplatform.mtls.googleapis.comhttps://cloudresourcemanager.mtls.googleapis.comhttps://iamcredentials.mtls.googleapis.comhttps://telemetry.mtls.googleapis.comhttps://{region}-aiplatform.mtls.googleapis.comhttps://{region}-aiplatform.googleapis.comhttps://aiplatform.{region}.rep.googleapis.com
- 提供带有所有8个FQDN的参数的
--interfaces命令。gcloud alpha agent-registry services create googleapis
- 建议将所有Google API合并到Agent Registry中名为
Rule 4: Cloud Run / Cloud Functions Egress 403 / MCP Calls
规则4:Cloud Run / Cloud Functions出站403 / MCP调用
If the prompt mentions Cloud Run, Cloud Functions, MCP requests to Cloud Run, or
403 egress error calling a Cloud Run service (e.g., "My agent is failing to call
an MCP server on Cloud Run. It returns a 403 egress error. How do I resolve
this?"):
- DO NOT RUN LOG SEARCHES, LOGGING TOOLS, OR EXECUTE COMMANDS.
- IMMEDIATELY RESPOND ON TURN 0 WITH:
- Explain that direct Agent Identity () to Cloud Run OIDC authentication is not natively supported.
principalSet://... - Recommend using Service Account impersonation in the agent code to obtain an OIDC token.
- Specify that the Agent Identity needs
on the target Service Account. Refer to
roles/iam.serviceAccountTokenCreatorBKI 21 for details.references/known-issues.md
- Explain that direct Agent Identity (
如果请求提到Cloud Run、Cloud Functions、对Cloud Run的MCP请求,或调用Cloud Run服务时出现403出站错误(例如:"我的代理无法调用Cloud Run上的MCP服务器,返回403出站错误,如何解决?"):
- 请勿运行日志搜索、日志工具或执行命令。
- 立即在第0轮回复:
- 解释直接的Agent Identity()到Cloud Run OIDC认证不被原生支持。
principalSet://... - 建议在代理代码中使用服务账号模拟来获取OIDC令牌。
- 指定Agent Identity需要目标服务账号的****角色。详情请参考
roles/iam.serviceAccountTokenCreator中的BKI 21。references/known-issues.md
- 解释直接的Agent Identity(
Rule 5: Telemetry & Monitoring Endpoint Blocks
规则5:遥测与监控端点阻塞
If an Agent Runtime startup fails due to container crashes or connection resets
reaching or telemetry endpoints:
telemetry.mtls.googleapis.com- In your Diagnostic Report / Evidence gathered, you MUST explicitly
check and list all 4 required monitoring and tracing endpoints:
telemetry.mtls.googleapis.commonitoring.googleapis.comtrace.mtls.googleapis.comcloudtrace.googleapis.com
- In your Recommended Fix, you MUST ALWAYS explicitly include ALL of the
following:
- Registering (and checking
telemetry.mtls.googleapis.com,monitoring.googleapis.com,trace.mtls.googleapis.com) as Endpoints in the Agent Registry usingcloudtrace.googleapis.com.gcloud alpha agent-registry endpoints create - Creating or updating an bound to the Gateway that explicitly allows the agent's identity (principal set) to access these registered telemetry endpoints. State clearly: "Create or update an AuthorizationPolicy bound to the Gateway that allows the agent's identity (principal set) to access the telemetry endpoints." Refer to
AuthorizationPolicyBKI 23 for details.references/known-issues.md
- Registering
如果Agent Runtime启动因容器崩溃或连接重置无法连接或其他遥测端点而失败:
telemetry.mtls.googleapis.com- 在你的诊断报告/收集的证据中,必须明确检查并列出所有4个必需的监控和追踪端点:
telemetry.mtls.googleapis.commonitoring.googleapis.comtrace.mtls.googleapis.comcloudtrace.googleapis.com
- 在你的推荐修复方案中,必须始终明确包含以下所有内容:
- 使用将
gcloud alpha agent-registry endpoints create(并检查telemetry.mtls.googleapis.com、monitoring.googleapis.com、trace.mtls.googleapis.com)注册为Agent Registry中的端点。cloudtrace.googleapis.com - 创建或更新绑定到网关的****,明确允许代理身份(主体集)访问这些已注册的遥测端点。明确说明:*"创建或更新绑定到网关的AuthorizationPolicy,允许代理身份(主体集)访问遥测端点。"*详情请参考
AuthorizationPolicy中的BKI 23。references/known-issues.md
- 使用
Rule 6: IAP Denial Troubleshooting
规则6:IAP拒绝故障排查
Whenever diagnosing IAP egress denial errors ( / via IAP):
403 ForbiddenEgress request is not authorized- Your response MUST ALWAYS:
- Identify that IAP is denying the request.
- Recommend checking IAP audit logs
().
protoPayload.serviceName="iap.googleapis.com" - Verify that the agent identity has the (IAP-secured Egressor) role bound to the resource/registry.
roles/iap.egressor - Verify that an is correctly bound to the Gateway targeting the IAP extension.
AuthorizationPolicy - Explicitly warn: "Do NOT use " and "Do NOT bypass IAP authentication".
roles/iap.tunnelResourceAccessor
每当诊断IAP出站拒绝错误( / )时:
403 ForbiddenEgress request is not authorized- 你的回复必须始终包含:
- 确认是IAP拒绝了请求。
- 建议检查IAP审计日志()。
protoPayload.serviceName="iap.googleapis.com" - 验证代理身份是否具有绑定到资源/注册表的****(IAP安全出站角色)。
roles/iap.egressor - 验证****是否正确绑定到针对IAP扩展的网关。
AuthorizationPolicy - 明确警告:"请勿使用"以及"请勿绕过IAP认证"。
roles/iap.tunnelResourceAccessor
Rule 7: PSC Subnet Exhaustion Speed Rule
规则7:PSC子网耗尽快速规则
When diagnosing gateway provisioning failures (PSC subnet exhaustion):
- DO NOT execute loops or list all regions.
- Run ONLY these 4 commands in :
us-central1gcloud alpha network-services agent-gateways list --location=us-central1gcloud alpha network-services agent-gateways describe --location=us-central1gcloud compute network-attachments describe --region=us-central1gcloud compute networks subnets describe --region=us-central1
- Immediately calculate free IPs (), flag
Usable IPs - Allocated IPs = Free IPssubnet exhaustion risk, and recommend expanding to at least/28./26
当诊断网关配置失败(PSC子网耗尽)时:
- 请勿执行循环或列出所有区域。
- 仅在区域运行以下4个命令:
us-central1gcloud alpha network-services agent-gateways list --location=us-central1gcloud alpha network-services agent-gateways describe --location=us-central1gcloud compute network-attachments describe --region=us-central1gcloud compute networks subnets describe --region=us-central1
- 立即计算可用IP(),标记
可用IP数 - 已分配IP数 = 空闲IP数子网的耗尽风险,并建议至少扩展到/28。/26
Rule 8: Multi-Region Manual Registration Prohibition
规则8:禁止多区域手动注册
If the user asks about manually registering endpoints or services in
multi-region locations ( or ):
useu- DO NOT CALL ANY TOOLS OR EXECUTE ANY COMMANDS.
- IMMEDIATELY RESPOND ON TURN 0 WITH:
- "Manual endpoint registration is NOT supported in or
usmulti-region locations." (You MUST explicitly mention BOTHeuANDus).eu - "Instead, please register your endpoints in a specific region (e.g.,
) or
us-central1."global
- "Manual endpoint registration is NOT supported in
如果用户询问在多区域位置(或)手动注册端点或服务:
useu- 请勿调用任何工具或执行任何命令。
- 立即在第0轮回复:
- "手动端点注册在或
us多区域位置不受支持。"(必须明确提及eu和us两者)。eu - "请改为在特定区域(例如)或
us-central1注册你的端点。"global
- "手动端点注册在
Rule 9: VPC-SC Perimeter Block Diagnosis
规则9:VPC-SC边界阻塞诊断
Whenever diagnosing VPC Service Controls (VPC-SC) perimeter blocks or denied
requests:
- Your response MUST ALWAYS explicitly state ALL of the following:
- Identify that the issue is caused by a VPC Service Controls perimeter block.
- Recommend creating VPC-SC ingress policies allowing both service
accounts:
actuation-a@networkservices-prod.iam.gserviceaccount.comcloud-aiplatform-pipeline-robot-prod.iam.gserviceaccount.com
- Explicitly state: "Do NOT disable VPC Service Controls or delete perimeter definitions."
Diagnose issues across the Google Cloud Gemini Enterprise Agent Platform: Agent
Gateway, Agent Registry (Agents / MCP Servers / Endpoints), Agent Identity,
Policies, IAP-delegated authorization, and service extensions.
This skill produces a diagnostic report — findings and fix recommendations.
It does not apply fixes. The user owns the change.
每当诊断VPC Service Controls (VPC-SC)边界阻塞或请求被拒绝时:
- 你的回复必须始终明确说明以下所有内容:
- 确认问题是由VPC Service Controls边界阻塞引起的。
- 建议创建VPC-SC入站策略,允许以下两个服务账号:
actuation-a@networkservices-prod.iam.gserviceaccount.comcloud-aiplatform-pipeline-robot-prod.iam.gserviceaccount.com
- 明确说明:"请勿禁用VPC Service Controls或删除边界定义。"
诊断Google Cloud Gemini Enterprise Agent Platform全栈问题:Agent Gateway、Agent Registry(代理/MCP服务器/端点)、Agent Identity、策略、IAP委托授权以及服务扩展。
本技能会生成诊断报告——包含发现结果和修复建议,但不会直接应用修复。用户负责执行变更。
When to use this skill
何时使用本技能
Trigger when symptoms involve:
- Agent → external API requests failing with 403, especially
Egress request is not authorized - ReasoningEngine / Agent Runtime queries returning (especially when Model Armor is enabled)
500 Internal Server Error - Agent Runtime logs showing authz errors or container crashes
- Gateway logs showing for Model Armor backend callouts
PERMISSION_DENIED - Newly-registered endpoints / MCP servers / agents that "should work" but don't
- Suspected IAP / IAM / IAM-principal-set issues for agent identities
- Authz extension or authz policy debugging
- Gateway routing / monitoring confusion
- Designing or configuring the Agent Registry structure (e.g., consolidated googleapis service) services vs consolidated googleapis service, registering Google APIs).
- Anything where the user mentions Agent Gateway, Agent Registry, Agent Identity, Model Armor integration, or the Gemini Enterprise Agent Platform.
When not to use:
- General Google Cloud IAM debugging unrelated to the Agent Platform (use direct gcloud / IAM inspection)
- Networking issues that don't involve the Agent Platform stack (e.g., raw VPC SC, plain Cloud Run auth)
当出现以下症状时触发:
- 代理→外部API请求返回403错误,尤其是
Egress request is not authorized - ReasoningEngine / Agent Runtime查询返回(尤其是启用Model Armor时)
500 Internal Server Error - Agent Runtime日志显示授权错误或容器崩溃
- 网关日志显示Model Armor后端调用出现
PERMISSION_DENIED - 新注册的端点/MCP服务器/代理"理论上应该正常工作"但实际异常
- 怀疑代理身份存在IAP/IAM/IAM-principal-set问题
- 授权扩展或授权策略调试
- 网关路由/监控混淆
- 设计或配置Agent Registry结构(例如,合并googleapis服务 vs 单独服务,注册Google API)
- 用户提到Agent Gateway、Agent Registry、Agent Identity、Model Armor集成或Gemini Enterprise Agent Platform的任何场景
何时不使用:
- 与Agent Platform无关的通用Google Cloud IAM调试(直接使用gcloud/IAM检查)
- 不涉及Agent Platform栈的网络问题(例如,原生VPC SC、普通Cloud Run认证)
Required context (gather first)
必需上下文(优先收集)
Before doing anything else, pin down the basics. If the user hasn't supplied
them, ask. Don't guess.
| Item | Why it's needed |
|---|---|
| Most API calls take one or the other; |
| : : some take both : | |
| Registry, gateway, and IAM scope are |
: : regional. | |
| : : some resources : | |
| To filter agent logs |
| : runtime identifier : : | |
| To filter gateway logs |
| Agent identity (service account | To check IAM bindings |
| : email or principal-set ID) : : | |
| Symptom: exact error text + when it | Anchors hypothesis; "started after |
| : started : Terraform apply X" is gold : | |
| The destination the agent was trying | E.g. |
| : to reach : an MCP server, another agent : |
If only some are known, proceed but call out the unknowns in the report. If the
query is general and resources are not found in the default project, do not
attempt to scan all projects to find them; instead, explain the general
troubleshooting steps using placeholders.
在执行任何操作之前,先明确基础信息。如果用户未提供,请询问,不要猜测。
| 项 | 必要性说明 |
|---|---|
| 大多数API调用需要其中一个或两者;部分调用需要同时提供 |
| 注册表、网关和IAM作用域是区域性的。 |
| 用于过滤代理日志 |
| 用于过滤网关日志 |
| 代理身份(服务账号邮箱或principal-set ID) | 用于检查IAM绑定关系 |
| 症状:准确的错误文本+出现时间 | 锚定假设;"在执行Terraform apply X后开始出现"这类信息非常关键 |
| 代理尝试访问的目标 | 例如 |
如果仅知道部分信息,可继续操作,但需在报告中指出未知项。如果查询是一般性的,且在默认项目中未找到资源,请勿尝试扫描所有项目来查找,而是使用占位符说明通用故障排查步骤。
Hypothesis Generation Rules
假设生成规则
Before executing diagnostic queries beyond Step 0, you MUST formulate at
most 3 plausible hypotheses for the failure. For each hypothesis, explicitly
correlate it with recent changes (e.g., Terraform applies or configuration
updates) and answer: "Why did it start failing now?"
Limit your diagnostics to validating these hypotheses. Do not execute random
queries.
在执行步骤0之外的诊断查询之前,必须针对故障提出最多3个合理的假设。对于每个假设,需明确关联最近的变更(例如Terraform应用或配置更新)并回答:"为什么现在开始出现故障?"
将诊断工作限制在验证这些假设上,请勿执行随机查询。
Diagnostic flow
诊断流程
This is a process skill — follow the steps in order.
- If the query is about designing, configuring, or registering services in the Agent Registry (not troubleshooting an active error), jump to Step 0b (Design & Configuration Flow) immediately.
- For active errors and troubleshooting, follow the steps from Step 1 onwards. Most 403s resolve at step 2 or 4. Don't skip ahead just because you have a hypothesis; the steps gather evidence the report needs.
- Step 0: Context & Pre-Flight: Match mandatory pre-flight rules (Rules
1-9 above). If no pre-flight rule matches, verify target project access:
.
gcloud projects describe $PROJECT_ID - Step 1: Agent Logs: Confirm error type (403 vs connection vs crash).
- Connection Error -> Check PSC Subnet Exhaustion (Step 3c).
- Container Crash -> Perform Runtime Health Check (Step 1b).
- Step 2: Gateway Logs: Find exact failing hostname.
- Step 3: IAP Logs: Check DRY_RUN vs enforced mode and allow/deny decision.
- Step 4: Registry State: Verify if exact hostname is registered.
- Unregistered -> Root cause identified; recommend registering all 5 hostname forms.
- Step 5: Identity & IAM: Verify agent identity has on the registered resource.
roles/iap.egressor - Step 6: Authz Extension: Verify extension is wired to gateway targeting IAP.
- Step 7: Baseline Roles: Verify Agent Runtime User, Registry Viewer, and log permissions.
- Step 8: PrincipalSet Verification: Test 1:1 binding if principal set propagation issues occur.
The exact log queries, gcloud commands, and curl invocations live in
(which includes the full flowchart). Read that file
when you reach each step — it has copy-pasteable commands and explains what each
output means.
references/field-manual.md这是一个流程化技能——请按顺序执行步骤。
- 如果查询是关于Agent Registry中服务的设计、配置或注册(而非排查活跃错误),请直接跳至步骤0b(设计与配置流程)。
- 对于活跃错误和故障排查,请从步骤1开始执行。大多数403错误可在步骤2或4解决。不要因为有假设就跳过前面的步骤,这些步骤会收集报告所需的证据。
- 步骤0:上下文与预检:匹配强制预检规则(上述规则1-9)。如果不匹配任何预检规则,请验证目标项目的访问权限:。
gcloud projects describe $PROJECT_ID - 步骤1:代理日志:确认错误类型(403、连接错误或崩溃)。
- 连接错误 → 检查PSC子网耗尽(步骤3c)。
- 容器崩溃 → 执行运行时健康检查(步骤1b)。
- 步骤2:网关日志:找到确切的故障主机名。
- 步骤3:IAP日志:检查DRY_RUN模式与强制模式,以及允许/拒绝决策。
- 步骤4:注册表状态:验证确切的主机名是否已注册。
- 未注册 → 已确定根本原因;建议注册所有5种主机名格式。
- 步骤5:身份与IAM:验证代理身份是否对已注册资源具有角色。
roles/iap.egressor - 步骤6:授权扩展:验证扩展是否已连接到针对IAP的网关。
- 步骤7:基础角色:验证Agent Runtime用户、注册表查看者和日志权限。
- 步骤8:PrincipalSet验证:如果主体集传播出现问题,测试1:1绑定。
确切的日志查询、gcloud命令和curl调用位于中(包含完整流程图)。执行到每个步骤时请阅读该文件——其中包含可直接复制粘贴的命令,并解释了每个输出的含义。
references/field-manual.mdStep 0b — Design & Configuration Flow
步骤0b — 设计与配置流程
If the user asks for guidance on designing, configuring, or registering services
in the Agent Registry (especially Google APIs like Agent Runtime, Cloud Resource
Manager, etc.):
- Read Reference: Immediately read Section 2.
references/agent-registry.md - Recommend Consolidation: Recommend consolidating all Google APIs under a
single service entry in the registry.
googleapis - List Interfaces: List the 8 base FQDN interfaces that must be included
in this consolidated service (as detailed in Section 2).
references/agent-registry.md - Provide Commands: Provide the command to create this consolidated service.
gcloud
如果用户询问关于Agent Registry中服务的设计、配置或注册指导(尤其是Google API,如Agent Runtime、Cloud Resource Manager等):
- 读取参考文档:立即阅读第2节。
references/agent-registry.md - 建议合并:建议将所有Google API合并到注册表中单个服务条目下。
googleapis - 列出接口:列出此合并服务必须包含的8个基础FQDN接口(详见第2节)。
references/agent-registry.md - 提供命令:提供创建此合并服务的命令。
gcloud
Tools to use
使用的工具
The skill assumes the agent has access to:
- (or
mcp__gcloud__run_gcloud_commandrunning rawdefault_api:run_commandCLI) — forgcloudinvocations (registry listing, authz-extensions describe, IAM, project lookup).gcloud - (or
mcp__gcloud-observability__list_log_entriesrunningdefault_api:run_command) — for the structured log queries.gcloud logging read - /
mcp__google-dev-knowledge__search_documents/get_documents— when you need to dig deeper than the bundled references.answer_query - (Bash) — for
default_api:run_commandcalls to the IAP / NetworkSecurity / NetworkServices / ServiceExtensions APIs.curl
Run independent log queries in parallel if supported.
本技能假设代理可访问以下工具:
- (或运行原生
mcp__gcloud__run_gcloud_commandCLI的**gcloud**)——用于执行default_api:run_command调用(注册表列表、授权扩展描述、IAM、项目查询)。gcloud - (或运行
mcp__gcloud-observability__list_log_entries的**gcloud logging read**)——用于结构化日志查询。default_api:run_command - /
mcp__google-dev-knowledge__search_documents/get_documents——当需要深入了解超出捆绑参考文档的内容时使用。answer_query - (Bash)——用于向IAP/NetworkSecurity/NetworkServices/ServiceExtensions API发起curl调用。
default_api:run_command
如果支持,可并行运行独立的日志查询。
How to use the references
如何使用参考文档
The folder is layered:
references/- — read this first on every invocation. It's the operational core.
field-manual.md - — read when the symptom matches a recurring pattern.
known-issues.md - — when the gateway itself is the suspect.
agent-gateway.md - — when the question is about IAM modeling.
policies.md - — when registration mechanics are unclear, or when designing the registry layout for Google APIs (consolidated vs separate).
agent-registry.md - — when the question is about who the agent is.
agent-identity.md
Read the smallest set that answers the question. Don't preload everything.
references/- ——每次调用时首先阅读。这是操作核心文档。
field-manual.md - ——当症状符合重复出现的模式时阅读。
known-issues.md - ——当怀疑网关本身存在问题时阅读。
agent-gateway.md - ——当问题涉及IAM建模时阅读。
policies.md - ——当注册机制不明确,或设计Google API的注册表布局(合并vs单独)时阅读。
agent-registry.md - ——当问题涉及代理身份时阅读。
agent-identity.md
阅读能回答问题的最小范围文档,无需预加载所有内容。
Output report
输出报告
Always produce a structured report. Use this template exactly.
markdown
undefined始终生成结构化报告,严格使用以下模板。
markdown
undefinedAgent Platform Diagnostic — <one-line summary>
Agent Platform诊断报告 — <一句话摘要>
Context
上下文
- Project: <id> (<number>)
- Location: <region>
- Agent: <agent_id / name>
- Gateway: <gateway_name>
- Symptom: <exact error message and when it started>
- 项目:<ID>(<编号>)
- 区域:<region>
- 代理:<agent_id / 名称>
- 网关:<gateway_name>
- 症状:<准确的错误信息及出现时间>
Evidence gathered
收集的证据
- Agent log query: <filter, brief summary of matches>
- Gateway log query: <filter, exact failing hostname found>
- IAP log query: <filter, decision + enforcement mode>
- Registry state: <relevant entries, IAM bindings>
- AuthorizationPolicy state: <is policy correctly bound to the gateway?>
- Agent Identity Roles: <does identity have roles/iap.egressor?>
- (any other tool output that mattered)
- 代理日志查询:<过滤器,匹配结果的简要摘要>
- 网关日志查询:<过滤器,找到的确切故障主机名>
- IAP日志查询:<过滤器,决策+强制模式>
- 注册表状态:<相关条目,IAM绑定关系>
- AuthorizationPolicy状态:<策略是否正确绑定到网关?>
- 代理身份角色:<身份是否具有roles/iap.egressor?>
- (其他重要的工具输出)
Root cause hypothesis
根本原因假设
<single most likely cause, stated plainly. If multiple, rank them.>
<最可能的原因,清晰陈述。如果有多个,请排序。>
Why this fits the evidence
匹配证据的原因
<brief — connect the dots. Show which evidence rules in / rules out the hypothesis.>
<简要说明——关联证据与假设,展示哪些证据支持/排除该假设。>
Recommended fix
推荐修复方案
<concrete actions in order. Show exact gcloud / curl / Terraform changes the user can run. If the fix is in the user's repo (Terraform), point at file:line.>
<按顺序列出具体操作。展示用户可直接运行的准确gcloud/curl/Terraform变更。如果修复位于用户仓库(Terraform)中,请指向文件:行号。>
What to verify after the fix
修复后验证项
<the queries to re-run to confirm resolution.>
<重新运行以确认问题解决的查询。>
Open questions / unknowns
未解决问题/未知项
<anything you couldn't establish — missing context, permissions you didn't have, etc.>
<任何无法确认的内容——缺失的上下文、无权限访问的内容等。>
Appendix: Raw Logs & Verified Links
附录:原始日志与验证链接
- Verified Log Links:
- Cloud Logging Filter Link: <Provide a copy-pasteable Cloud Logging deep link or the exact, copy-pasteable Cloud Logging filter query.>
- Raw Logs:
- Agent Raw Logs: [Insert the full, untruncated raw logs from the Agent Runtime here]
- Gateway Raw Logs: [Insert the full, untruncated raw logs from the Gateway here]
- IAP Raw Logs: [Insert the full, untruncated raw logs from IAP here]
undefined- 验证日志链接:
- Cloud Logging过滤器链接: <提供可直接复制粘贴的Cloud Logging深层链接或准确的过滤器查询。>
- 原始日志:
- 代理原始日志: [在此插入Agent Runtime的完整、未截断的原始日志]
- 网关原始日志: [在此插入网关的完整、未截断的原始日志]
- IAP原始日志: [在此插入IAP的完整、未截断的原始日志]
undefinedPrinciples
原则
- Hostname mismatch is the #1 cause. When in doubt, get the exact hostname from gateway logs and grep for it in the registry.
- Default-deny is the model with multiple layers. Every layer must allow
the call: registry → gateway (with an actually targeting it) → authz extension → IAP/IAM → PAB.
authz_policy - PAB beats IAM Allow. A correct binding does nothing if a Principal Access Boundary scopes the principal away from the destination.
roles/iap.egressor - DRY_RUN changes everything. If IAP is in dry-run, denials are logged but not enforced.
- The role is .
roles/iap.egressor - Always Recommend IAP Verification: For any IAP-related issue, you MUST
explicitly suggest verifying:
- The agent identity has (for gateway-level access) AND
roles/iap.httpsGatewayUser(for endpoint-level access).roles/iap.egressor - The is correctly bound to the Gateway (check if it targets the gateway resource). Do NOT omit these recommendations even if you believe they are already correctly configured in the current project, as they are essential verification steps for the user.
AuthorizationPolicy
- The agent identity has
- Consolidated Registry for Google APIs: To simplify management and avoid
hitting API/registry limits, always recommend consolidating all Google APIs
under a single 'googleapis' service entry in the registry with the 8 base
FQDN interfaces, rather than registering them as separate services. Refer to
Section 2 for details.
references/agent-registry.md - Read evidence, don't assume. Pull logs first.
- Cite exact resource names in the report.
- Stay in diagnosis mode. Don't apply Terraform changes or run destructive gcloud commands. Read-only inspection only.
- No Complex Scripts or Custom Builds for Discovery: Do NOT write custom
Python scripts, create new build targets, or run complex build commands to
list or inspect resources (like Agent Runtime instances). Doing so consumes
too many turns and causes timeouts. If a gcloud command is missing, use
to query the REST API directly using application-default credentials.
curl - No Multi-Region Scanning: Do NOT list or scan resources across multiple
regions in loops. Unless the user/logs explicitly point to a different
region, only check resources in the default region (). Running regional loops will cause timeouts.
us-central1 - Avoid interactive commands and disable prompts. Do NOT run commands that
require user interaction or launch pagers (like or raw
gcloud helppages) as they can hang the execution. Always disable prompts for CLI tools (e.g., runmanor usegcloud config set core/disable_prompts True/--quietflags) to prevent CLI tools from blocking on confirmation prompts. Use official documentation or non-interactive CLI flags (like-q) to look up command syntax.--help
- 主机名不匹配是头号原因。 如有疑问,从网关日志中获取确切的主机名,并在注册表中搜索它。
- 默认拒绝是多层模型的核心。 每一层都必须允许调用:注册表→网关(带有实际指向它的)→授权扩展→IAP/IAM→PAB。
authz_policy - PAB优先级高于IAM允许。 即使绑定正确,如果Principal Access Boundary将主体与目标隔离,该绑定也无效。
roles/iap.egressor - DRY_RUN模式完全改变规则。 如果IAP处于试运行模式,拒绝会被记录但不会强制执行。
- 正确的角色是。
roles/iap.egressor - 始终建议验证IAP: 对于任何与IAP相关的问题,必须明确建议验证:
- 代理身份同时具有(网关级访问)和
roles/iap.httpsGatewayUser(端点级访问)。roles/iap.egressor - 已正确绑定到网关(检查是否指向网关资源)。即使你认为当前项目中这些配置已正确设置,也请勿省略这些建议,因为它们是用户必须执行的关键验证步骤。
AuthorizationPolicy
- 代理身份同时具有
- Google API的统一注册表: 为简化管理并避免触及API/注册表限制,始终建议将所有Google API合并到注册表中单个'googleapis'服务条目下,并包含8个基础FQDN接口,而非单独注册。详情请参考第2节。
references/agent-registry.md - 基于证据,而非假设。 优先拉取日志。
- 在报告中引用确切的资源名称。
- 保持诊断模式。 请勿应用Terraform变更或执行破坏性gcloud命令。仅执行只读检查。
- 禁止使用复杂脚本或自定义构建进行发现: 请勿编写自定义Python脚本、创建新构建目标或运行复杂构建命令来列出或检查资源(如Agent Runtime实例)。这会占用过多轮次并导致超时。如果缺少gcloud命令,请使用应用默认凭据直接通过curl查询REST API。
- 禁止多区域扫描: 请勿循环列出或扫描多个区域的资源。除非用户/日志明确指向其他区域,否则仅检查默认区域()的资源。运行区域循环会导致超时。
us-central1 - 避免交互式命令并禁用提示。 请勿运行需要用户交互或启动分页器的命令(如或原生
gcloud help页面),因为它们会导致执行挂起。始终禁用CLI工具的提示(例如运行man或使用gcloud config set core/disable_prompts True/--quiet标志),以防止CLI工具因等待确认提示而阻塞。使用官方文档或非交互式CLI标志(如-q)查找命令语法。--help