Skip to content

feat: Implement GCS offloader to asynchronously offload large payloads - #1384

Draft
vasilyl wants to merge 4 commits into
google:mainfrom
vasilyl:large-content-offloading
Draft

feat: Implement GCS offloader to asynchronously offload large payloads#1384
vasilyl wants to merge 4 commits into
google:mainfrom
vasilyl:large-content-offloading

Conversation

@vasilyl

@vasilyl vasilyl commented Aug 21, 2026

Copy link
Copy Markdown
Contributor

Please ensure you have read the contribution guide before creating a pull request.

Link to Issue or Description of Change

1. Link to an existing issue (if applicable):

2. Or, if no issue exists, describe the change:

Problem:
Logging very large prompts, tool outputs, or media payloads (e.g., high-res images) directly in-line inside a relational BigQuery row is inefficient, expensive, and hit strict row limits.

Solution:
Introduce a GCS-backed asynchronous offloading strategy inside bigquery_agent_analytics_plugin.go via gcsOffloader and hybridContentParser.

  1. When the logged content (text or media) exceeds the configured inlineTextLimit, or is binary content, upload it to GCS using the gcsOffloader.
  2. Record the object storage path as a GCS_REFERENCE in BigQuery, and store structured metadata under object_ref (including the GCS uri, bucket details, and an optional authorizer connection ID).
  3. Fall back to standard smart truncation if the offloader is not configured or if the upload fails.

Testing Plan

Added a robust unit test TestHybridContentParser with a mock httptest TLS GCS server verifying that:

  1. Text payloads below the threshold are successfully kept inline and summarized.
  2. Large text and binary media payloads are intercepted, correctly uploaded to the mock GCS bucket, and substituted in the database record with a GCS URI reference containing object_ref details.
  3. If the GCS offloader is missing or fails, the parser gracefully falls back to local truncation.

Checklist

  • I have read the CONTRIBUTING.md document.
  • I have performed a self-review of my own code.
  • I have commented my code, particularly in hard-to-understand areas.
  • I have added tests that prove my fix is effective or that my feature works.
  • New and existing unit tests pass locally with my changes.
  • I have manually tested my changes end-to-end.

@vasilyl
vasilyl force-pushed the large-content-offloading branch from 0fa83e6 to 033651e Compare August 25, 2026 19:48
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