Dev/AgentStudio: add AgentStudio sub-module for managed agents#236
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces the AgentStudio client SDK, adding core clients, resources, models, parameters, pagination, and event streaming support, along with comprehensive unit tests and a quick-start sample. The review feedback highlights several critical robustness improvements: addressing potential NullPointerExceptions in CursorPage's iterator, Skills' file resolution, and Agents' updateAsync method; preventing resource leaks of input streams in Files and OkHttpClients in SessionEvents; and correcting the session status extraction logic in AgentStudioEventStream to scan all content blocks rather than just the first one.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
- Sync-first API with typed models and CursorPage auto-pagination - Resources: agents, sessions, environments, files, skills, vaults, credentials - AsyncClient via client.async() - Region parameter, SSE event parsing - Sample and E2E tests
a051952 to
1027219
Compare
- AgentStudioEventStream.extractSessionStatus: scan all content blocks instead of only the first; add isJsonNull guard - CursorPage.hasNext: guard against null currentPage and null out on exhaustion to prevent NPE on subsequent calls - Files.uploadAsync: close InputStream on failure path; mark streaming RequestBody as one-shot so OkHttp won't retry after writeTo closes the stream - SessionEvents.stream: drop per-call dispatcher/connectionPool overrides so the shared template owns the resources; AgentStudioEventStream.close no longer shuts down the shared pool (which previously killed sibling streams) - Skills.resolveFileId, Agents.updateAsync, plus 13 sibling create/update/ list methods across Vaults/Environments/Sessions/Agents/Skills: return InputRequiredException on null param instead of letting it NPE inside withApiKey/toQueryString Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
- Remove afterId/beforeId from FileListParam (server only accepts page) - Remove keyword from VaultListParam (server does not accept it) - Add resources field to SessionCreateParam for file mounting - Fix AgentStudioSimple sample: getStopReason() returns StopReason, not JsonObject Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Files.listAsync and SessionEvents.listAsync called param.toQueryString() without checking if param was null, causing NPEs. All other listAsync methods already had this guard. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add AgentStudio sub-module with full API coverage:
Key design:
E2e verified: 18/18 tests pass via JAR against real API.
Unit tests: 52 tests + 163 total SDK tests pass.
Google Java Format: clean.