Skip to content

Conversation

@Aias00
Copy link
Contributor

@Aias00 Aias00 commented Jan 10, 2026

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.

  • Code has been formatted with mvn spotless:apply
  • All tests are passing (mvn test)
  • Javadoc comments are complete and follow project conventions
  • Related documentation has been updated (e.g. links, examples, etc.)
  • Code is ready for review

Copy link
Contributor

Copilot AI left a 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) {
Copy link

Copilot AI Jan 10, 2026

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.

Copilot uses AI. Check for mistakes.
this.stopSequences = stopSequences;
}

public Map<String, Object> getMetadata() {
Copy link

Copilot AI Jan 10, 2026

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.

Copilot uses AI. Check for mistakes.
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.

[Refactor] Use okhttp to replace Anthropic Model SDK

1 participant