Skip to content

[bot] Google GenAI Batch API (ai.batches.create()) not instrumented #2343

Description

@braintrust-bot

Summary

The @google/genai SDK's Batch API (ai.batches.create() / client.batches.*) is a documented, GA generative-execution surface for asynchronous, high-throughput generateContent (and embeddings) processing at a 50% cost discount. It is not instrumented anywhere in this repository — no wrapper support, no channel definitions, no plugin, no auto-instrumentation config entry, and no e2e coverage.

What instrumentation is missing

Channels (js/src/instrumentation/plugins/google-genai-channels.ts)

googleGenAIChannels (lines 20–57) defines only four channels: generateContent, generateContentStream, embedContent, and interactionsCreate. There is no batches-related channel.

Wrapper (js/src/wrappers/google-genai.ts)

wrapModels() (lines 118–133) proxies only generateContent, generateContentStream, and embedContent on instance.models. The instance.batches namespace (ai.batches.create(), .get(), .list(), .cancel()) is not proxied at all and passes through completely untraced.

Plugin (js/src/instrumentation/plugins/google-genai-plugin.ts)

Only subscribes to the four existing channels above — no batch handler exists.

Vendored types (js/src/vendor-sdk-types/google-genai.ts)

No type exists for the batches namespace or its request/response/job-status shapes.

Auto-instrumentation config (js/src/auto-instrumentations/configs/google-genai.ts)

No batch-related entry.

e2e coverage (e2e/scenarios/google-genai-instrumentation/)

No batch-related scenario, cassette, or span-tree snapshot among the existing google-genai-v1/v2 (pinned + latest) scenarios.

Upstream operations not instrumented

  • ai.batches.create({ model, src, config }) — submit a batch job (file-based or inline requests) for generateContent
  • ai.batches.create_embeddings(...) — submit a batch job for embeddings
  • ai.batches.get(name) — poll job status (JOB_STATE_SUCCEEDED, etc.)
  • ai.batches.list() — list batch jobs
  • ai.batches.cancel(name) — cancel a batch job

Braintrust docs status

not_found. The Braintrust Gemini integration guide (https://www.braintrust.dev/docs/integrations/ai-providers/gemini) documents generateContent/generateContentStream, embedContent, grounding metadata, generate_images (Python only), and interactions/Live API (Python only) — but does not mention batch processing anywhere.

Upstream references

Braintrust docs sources checked

Local files inspected

  • js/src/instrumentation/plugins/google-genai-channels.ts (full file — only 4 channels defined, no batches)
  • js/src/instrumentation/plugins/google-genai-plugin.ts (subscribes only to the 4 existing channels)
  • js/src/wrappers/google-genai.ts (full file — wrapModels() proxies only generateContent/generateContentStream/embedContent; instance.batches untouched)
  • js/src/vendor-sdk-types/google-genai.ts (no batches type)
  • js/src/auto-instrumentations/configs/google-genai.ts (no batches entry)
  • e2e/scenarios/google-genai-instrumentation/ (full directory listing — no batch scenario/cassette/snapshot)
  • Repo-wide case-insensitive grep for batch under js/src — zero matches related to Google GenAI

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions