Reference · Chapter 13

End-to-End Audit Attribution (W3C Trace, BigQuery Sink) & Kill Switch Runbook

Linking every SQL query to the human caller and agent turn, enforcing Principal Access Boundaries (PAB), and executing the 3-step emergency kill switch.

1. Closing the Audit Blind Spot (T8)

By default, Cloud SQL, AlloyDB, and Spanner disable DATA_READ and DATA_WRITE audit logs, and logs in _Default expire after 30 days. Our control plane enables Data Access logs across all data stores, routes them to a 400-day partitioned BigQuery sink, propagates W3C traceparent from the client edge into SQL comments/job labels, and streams full agent trajectories via ADK's BigQueryAgentAnalyticsPlugin.

2. ADK BigQueryAgentAnalyticsPlugin & BigQueryLoggerConfig

Attached to the ADK App container (or enabled at scaffold time via uvx agent-starter-pack create . --bq-analytics), BigQueryAgentAnalyticsPlugin streams structured agent lifecycle events directly into BigQuery using the BigQuery Storage Write API, supporting auto-schema upgrades, GCS offloading for multimodal content, and OpenTelemetry trace_id / span_id correlation:

Parameter / FieldType / ScopeSecurity & Governance Purpose
trace_id / span_idEvent ColumnOpenTelemetry distributed trace context; joins directly with sqlcommenter traceparent tags in 400-day Database Data Access Audit Logs.
tool_provenanceEvent MetadataIdentifies tool execution origin: LOCAL, MCP, SUB_AGENT, A2A, or TRANSFER_AGENT.
content_formatterBigQueryLoggerConfigPre-ingestion Python callback that scrubs or redacts residual SSNs, credit cards, or bearer tokens before events leave the container (T2 / LLM02).
event_allowlistBigQueryLoggerConfigOptional filter restricting logged events (e.g., USER_MESSAGE_RECEIVED, LLM_REQUEST, LLM_RESPONSE, TOOL_STARTING, TOOL_COMPLETED, TOOL_ERROR).
max_content_length & shutdown_timeoutBigQueryLoggerConfigCaps inline string payloads (with optional GCS bucket offloading for large/multimodal content) and flushes buffered events on container shutdown.

3. The 3-Step Emergency Kill Switch Runbook

StepActionCommand / Control Plane TargetForensic Impact
Step 1: Block Agent PrincipalApply an immediate IAM Deny policy & Principal Access Boundary (PAB) ceiling on the agent's SPIFFE identity, and remove the agent's egress permission at the Egress Gateway (iap.googleapis.com/resources.egressViaIAP under Unified Access Policies, or roles/iap.egressor under the earlier IAP policy version).gcloud iam deny-policies create / IAM PABHalts all tool and database calls within seconds while keeping the container intact.
Step 2: Revoke Delegated TokensRevoke the user's sessions and refresh tokens at the identity provider, remove any credentials vaulted in Agent Identity auth manager, and rotate the ALLOWED_KIDS KMS context signing key version if needed.Identity provider / auth manager / Cloud KMSInvalidates any in-flight tokens immediately across all MCP servers.
Step 3: Preserve EvidenceSnapshot Cloud Run / Agent Runtime revisions, export Memory Bank sessions, and query the 400-day BigQuery audit sink by trace_id and spiffe_id.BigQuery Audit Sink + Security Command CenterPreserves complete chain of custody for incident response.