Skip to content

Dev/AgentStudio: add AgentStudio sub-module for managed agents#236

Merged
lzsweb merged 4 commits into
mainfrom
dev/agentstudio
Jul 2, 2026
Merged

Dev/AgentStudio: add AgentStudio sub-module for managed agents#236
lzsweb merged 4 commits into
mainfrom
dev/agentstudio

Conversation

@foleydang

Copy link
Copy Markdown
Collaborator

Add AgentStudio sub-module with full API coverage:

  • Agents: create/retrieve/update/list/listVersions/archive
  • Sessions: create/retrieve/update/list/archive/delete
  • SessionEvents: send/list/stream(SSE)
  • Environments: create/retrieve/update/list/archive/delete
  • Files: upload(multipart)/retrieve/list/delete
  • Skills: create(file auto-upload)/retrieve/list/delete + versions
  • Vaults + Credentials: full CRUD with typed CredentialAuth

Key design:

  • AgentStudioClient with constructors + Builder pattern (apiKey+workspace for production, Builder for pre-env baseUrl)
  • workspace required (no default), region defaults to cn-beijing
  • CursorPage with auto-pagination via Iterable
  • AgentStudioEventStream (SSE) with Message.getStopReason()
  • ClientEvents: 6 event constructors (userMessage, interrupt, toolConfirmation, customToolResult, toolResult, defineOutcome)
  • async support via client.async(Supplier) + CompletableFuture
  • ContentBlock polymorphic deserialization (text/image/audio/data/file/refusal/error)

E2e verified: 18/18 tests pass via JAR against real API.
Unit tests: 52 tests + 163 total SDK tests pass.
Google Java Format: clean.

@foleydang foleydang requested a review from kevinlin09 July 1, 2026 07:53

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread src/main/java/com/alibaba/dashscope/agentstudio/resource/Files.java
- 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
foleydang and others added 3 commits July 1, 2026 16:46
- 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>
@lzsweb lzsweb merged commit a906f55 into main Jul 2, 2026
3 checks passed
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.

2 participants