-
Notifications
You must be signed in to change notification settings - Fork 214
feat: replace claude sdk #504
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: liuhy <[email protected]>
…icChatFormatter Signed-off-by: liuhy <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
| return metadata; | ||
| } | ||
|
|
||
| public void setMetadata(Map<String, Object> metadata) { |
Copilot
AI
Jan 10, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
setMetadata exposes the internal representation stored in field metadata. The value may be modified through the variable metadata.
| this.stopSequences = stopSequences; | ||
| } | ||
|
|
||
| public Map<String, Object> getMetadata() { |
Copilot
AI
Jan 10, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
getMetadata exposes the internal representation stored in field metadata. The value may be modified after this call to getMetadata.
agentscope-core/src/main/java/io/agentscope/core/formatter/anthropic/AnthropicToolsHelper.java
Outdated
Show resolved
Hide resolved
…ge formatting Signed-off-by: liuhy <[email protected]>
…hropic/AnthropicToolsHelper.java Co-authored-by: Copilot <[email protected]>
…cRequest Signed-off-by: liuhy <[email protected]>
…AnthropicRequest" This reverts commit 4aa7870.
…scope-java into feat/replace_claude
…ti-agent conversation handling Signed-off-by: liuhy <[email protected]>
… tests Signed-off-by: liuhy <[email protected]>
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)