Open
Conversation
Signed-off-by: liuhy <liuhongyu@apache.org>
…icChatFormatter Signed-off-by: liuhy <liuhongyu@apache.org>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR replaces the Anthropic Java SDK with a custom HTTP client implementation using OkHttp. The change eliminates the external dependency on com.anthropic:anthropic-java and replaces it with internal DTO classes and a custom AnthropicClient.
Changes:
- Replaced Anthropic SDK with custom HTTP client (
AnthropicClient.java) - Introduced new DTO classes (
AnthropicRequest,AnthropicResponse,AnthropicMessage,AnthropicContent, etc.) - Updated all formatters and converters to work with DTOs instead of SDK types
- Updated comprehensive test suite to use new DTO-based approach
Reviewed changes
Copilot reviewed 24 out of 24 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
AnthropicClient.java |
New HTTP client for Anthropic API with sync and streaming support |
AnthropicChatModel.java |
Updated to use new client instead of SDK |
AnthropicRequest.java |
DTO for API requests |
AnthropicResponse.java |
DTO for API responses |
AnthropicMessage.java |
DTO for message structure |
AnthropicContent.java |
DTO for content blocks with helper methods |
AnthropicTool.java |
DTO for tool definitions |
AnthropicUsage.java |
DTO for usage statistics |
AnthropicStreamEvent.java |
DTO for streaming events |
AnthropicToolsHelper.java |
Updated to work with DTOs |
AnthropicResponseParser.java |
Updated to parse DTOs |
AnthropicMessageConverter.java |
Updated to convert to DTOs |
AnthropicMediaConverter.java |
Updated to return DTO ImageSource |
AnthropicChatFormatter.java |
Enhanced with multi-agent detection |
AnthropicMultiAgentFormatter.java |
Updated for DTOs with constructor improvements |
AnthropicBaseFormatter.java |
Updated to work with DTOs |
pom.xml |
Removed Anthropic SDK dependency |
| Test files | Updated to use DTOs and mocks instead of SDK classes |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
agentscope-core/src/main/java/io/agentscope/core/formatter/anthropic/dto/AnthropicRequest.java
Show resolved
Hide resolved
agentscope-core/src/main/java/io/agentscope/core/formatter/anthropic/dto/AnthropicRequest.java
Show resolved
Hide resolved
agentscope-core/src/main/java/io/agentscope/core/formatter/anthropic/AnthropicToolsHelper.java
Outdated
Show resolved
Hide resolved
…ge formatting Signed-off-by: liuhy <liuhongyu@apache.org>
…hropic/AnthropicToolsHelper.java Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…cRequest Signed-off-by: liuhy <liuhongyu@apache.org>
…AnthropicRequest" This reverts commit 4aa7870.
…scope-java into feat/replace_claude
…ti-agent conversation handling Signed-off-by: liuhy <liuhongyu@apache.org>
… tests Signed-off-by: liuhy <liuhongyu@apache.org>
LearningGp
requested changes
Mar 10, 2026
agentscope-core/src/main/java/io/agentscope/core/formatter/anthropic/AnthropicToolsHelper.java
Show resolved
Hide resolved
agentscope-core/src/main/java/io/agentscope/core/model/AnthropicChatModel.java
Show resolved
Hide resolved
...tscope-core/src/main/java/io/agentscope/core/formatter/anthropic/AnthropicBaseFormatter.java
Outdated
Show resolved
Hide resolved
...-core/src/main/java/io/agentscope/core/formatter/anthropic/AnthropicMultiAgentFormatter.java
Outdated
Show resolved
Hide resolved
# Conflicts: # agentscope-core/src/test/java/io/agentscope/core/formatter/anthropic/AnthropicResponseParserTest.java
Signed-off-by: liuhy <liuhongyu@apache.org>
Signed-off-by: liuhy <liuhongyu@apache.org>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
AgentScope-Java Version
[The version of AgentScope-Java you are working on, e.g. 1.0.6, check your pom.xml dependency version or run
mvn dependency:tree | grep agentscope-parent:pom(only mac/linux)]Description
replace claude sdk
fix #97
[Please describe the background, purpose, changes made, and how to test this PR]
Checklist
Please check the following items before code is ready to be reviewed.
mvn spotless:applymvn test)