Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
".": "2.43.0"
".": "2.44.0"
}
6 changes: 3 additions & 3 deletions .stats.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
configured_endpoints: 116
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/anthropic/anthropic-2ecf157aa324d82fa8f3636a325aea5bd96ecab93193f6e37864ebe665c48685.yml
openapi_spec_hash: 29873ea69a87e047c4f742a960648bf0
config_hash: 48f7cbc6648bf7f1e6c68ad3dab477fc
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/anthropic/anthropic-a548d120cebb4d68d46c828028d51d04b4d4abb868a7bad21dad960cb72cbd18.yml
openapi_spec_hash: 2b3214760a4e23a9704779ac99bce417
config_hash: ce2cd5d2f03228adacf04ebcceb14465
20 changes: 20 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,25 @@
# Changelog

## 2.44.0 (2026-06-24)

Full Changelog: [v2.43.0...v2.44.0](https://github.com/anthropics/anthropic-sdk-java/compare/v2.43.0...v2.44.0)

### Features

* **client:** add support for system.message streaming events ([e27e961](https://github.com/anthropics/anthropic-sdk-java/commit/e27e9613a570ddd4981a175fa96617635cb353ca))


### Chores

* **api:** add support for new refusal category ([8c1bd29](https://github.com/anthropics/anthropic-sdk-java/commit/8c1bd29b53721182ec114f214c22eebc3475e2dc))
* **api:** add support for sending User Profile ID in request headers ([8d69cbe](https://github.com/anthropics/anthropic-sdk-java/commit/8d69cbe7a7a5c733e80e0385a971a8f77d98a566))


### Build System

* enable warnings as errors ([#106](https://github.com/anthropics/anthropic-sdk-java/issues/106)) ([43f1430](https://github.com/anthropics/anthropic-sdk-java/commit/43f1430e3077d038a457127e303d7008806e1985))
* fix lock file enforcement for IDEs ([#107](https://github.com/anthropics/anthropic-sdk-java/issues/107)) ([48940e3](https://github.com/anthropics/anthropic-sdk-java/commit/48940e34f71a711efec12bd5f1891129217999ed))

## 2.43.0 (2026-06-18)

Full Changelog: [v2.42.0...v2.43.0](https://github.com/anthropics/anthropic-sdk-java/compare/v2.42.0...v2.43.0)
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Full documentation is available at **[platform.claude.com/docs/en/api/sdks/java]
### Gradle

```kotlin
implementation("com.anthropic:anthropic-java:2.43.0")
implementation("com.anthropic:anthropic-java:2.44.0")
```

### Maven
Expand All @@ -24,7 +24,7 @@ implementation("com.anthropic:anthropic-java:2.43.0")
<dependency>
<groupId>com.anthropic</groupId>
<artifactId>anthropic-java</artifactId>
<version>2.43.0</version>
<version>2.44.0</version>
</dependency>
```

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,8 @@ internal fun sseHandler(jsonMapper: JsonMapper): Handler<StreamResponse<SseMessa
"session.thread_status_running",
"session.thread_status_idle",
"session.thread_status_rescheduled",
"session.thread_status_terminated" -> yield(message)
"session.thread_status_terminated",
"system.message" -> yield(message)
"ping" -> continue
"error" -> {
throw SseException.builder()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ internal class PhantomReachableClosingAsyncStreamResponse<T>(
/**
* An object used for keeping `asyncStreamResponse` open while the object is still reachable.
*/
private val reachabilityTracker = Object()
private val reachabilityTracker = Any()

init {
closeWhenPhantomReachable(reachabilityTracker, asyncStreamResponse::close)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -214,8 +214,8 @@ class MessageAccumulator private constructor() {
) = TextCitation.ofContentBlockLocation(contentBlockLocation)

override fun visitWebSearchResultLocation(
citationsWebSearchResultLocation: CitationsWebSearchResultLocation
) = TextCitation.ofWebSearchResultLocation(citationsWebSearchResultLocation)
webSearchResultLocation: CitationsWebSearchResultLocation
) = TextCitation.ofWebSearchResultLocation(webSearchResultLocation)

override fun visitSearchResultLocation(
searchResultLocation: CitationsSearchResultLocation
Expand Down Expand Up @@ -263,18 +263,18 @@ class MessageAccumulator private constructor() {

event.accept(
object : RawMessageStreamEvent.Visitor<Unit> {
override fun visitMessageStart(start: RawMessageStartEvent) {
override fun visitMessageStart(messageStart: RawMessageStartEvent) {
if (messageBuilder != null) {
throw AnthropicInvalidDataException(
"'message_start' event already received."
)
}
messageBuilder = start.message().toBuilder()
messageUsage = start.message().usage()
messageBuilder = messageStart.message().toBuilder()
messageUsage = messageStart.message().usage()
}

override fun visitMessageDelta(deltaEvent: RawMessageDeltaEvent) {
val delta = deltaEvent.delta()
override fun visitMessageDelta(messageDelta: RawMessageDeltaEvent) {
val delta = messageDelta.delta()

// The Anthropic API allows that there may be "one or more `message_delta`
// events". Here, the interpretation is that if multiple `message_delta` events
Expand Down Expand Up @@ -302,10 +302,10 @@ class MessageAccumulator private constructor() {
}

// Ensure we properly update the usage information from the delta event
messageUsage = mergeMessageUsage(requireMessageUsage(), deltaEvent.usage())
messageUsage = mergeMessageUsage(requireMessageUsage(), messageDelta.usage())
}

override fun visitMessageStop(stop: RawMessageStopEvent) {
override fun visitMessageStop(messageStop: RawMessageStopEvent) {
message =
requireMessageBuilder()
// The indexed content block map is converted to a list with the blocks
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,10 @@ private constructor(
fun description(): Optional<String> = body.description()

/**
* MCP servers this agent connects to. Maximum 20. Names must be unique within the array.
* MCP servers this agent connects to. Maximum 20. Names must be unique within the array. Every
* server must be referenced by an `mcp_toolset` in `tools`; unreferenced servers are rejected.
* See the
* [MCP connector guide](https://platform.claude.com/docs/en/managed-agents/mcp-connector).
*
* @throws AnthropicInvalidDataException if the JSON field has an unexpected type (e.g. if the
* server responded with an unexpected value).
Expand Down Expand Up @@ -320,6 +323,9 @@ private constructor(

/**
* MCP servers this agent connects to. Maximum 20. Names must be unique within the array.
* Every server must be referenced by an `mcp_toolset` in `tools`; unreferenced servers are
* rejected. See the
* [MCP connector guide](https://platform.claude.com/docs/en/managed-agents/mcp-connector).
*/
fun mcpServers(mcpServers: List<BetaManagedAgentsUrlMcpServerParams>) = apply {
body.mcpServers(mcpServers)
Expand Down Expand Up @@ -741,6 +747,9 @@ private constructor(

/**
* MCP servers this agent connects to. Maximum 20. Names must be unique within the array.
* Every server must be referenced by an `mcp_toolset` in `tools`; unreferenced servers are
* rejected. See the
* [MCP connector guide](https://platform.claude.com/docs/en/managed-agents/mcp-connector).
*
* @throws AnthropicInvalidDataException if the JSON field has an unexpected type (e.g. if
* the server responded with an unexpected value).
Expand Down Expand Up @@ -980,7 +989,9 @@ private constructor(

/**
* MCP servers this agent connects to. Maximum 20. Names must be unique within the
* array.
* array. Every server must be referenced by an `mcp_toolset` in `tools`; unreferenced
* servers are rejected. See the
* [MCP connector guide](https://platform.claude.com/docs/en/managed-agents/mcp-connector).
*/
fun mcpServers(mcpServers: List<BetaManagedAgentsUrlMcpServerParams>) =
mcpServers(JsonField.of(mcpServers))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,10 @@ private constructor(
fun description(): Optional<String> = body.description()

/**
* MCP servers. Full replacement. Omit to preserve; send empty array or null to clear. Names
* must be unique. Maximum 20.
* MCP servers. Full replacement. Omit to preserve; send empty array or `null` to clear. Names
* must be unique. Maximum 20. Every server must be referenced by an `mcp_toolset` in the
* agent's resulting `tools`; unreferenced servers are rejected. See the
* [MCP connector guide](https://platform.claude.com/docs/en/managed-agents/mcp-connector).
*
* @throws AnthropicInvalidDataException if the JSON field has an unexpected type (e.g. if the
* server responded with an unexpected value).
Expand Down Expand Up @@ -326,8 +328,10 @@ private constructor(
fun description(description: JsonField<String>) = apply { body.description(description) }

/**
* MCP servers. Full replacement. Omit to preserve; send empty array or null to clear. Names
* must be unique. Maximum 20.
* MCP servers. Full replacement. Omit to preserve; send empty array or `null` to clear.
* Names must be unique. Maximum 20. Every server must be referenced by an `mcp_toolset` in
* the agent's resulting `tools`; unreferenced servers are rejected. See the
* [MCP connector guide](https://platform.claude.com/docs/en/managed-agents/mcp-connector).
*/
fun mcpServers(mcpServers: List<BetaManagedAgentsUrlMcpServerParams>?) = apply {
body.mcpServers(mcpServers)
Expand Down Expand Up @@ -804,8 +808,10 @@ private constructor(
fun description(): Optional<String> = description.getOptional("description")

/**
* MCP servers. Full replacement. Omit to preserve; send empty array or null to clear. Names
* must be unique. Maximum 20.
* MCP servers. Full replacement. Omit to preserve; send empty array or `null` to clear.
* Names must be unique. Maximum 20. Every server must be referenced by an `mcp_toolset` in
* the agent's resulting `tools`; unreferenced servers are rejected. See the
* [MCP connector guide](https://platform.claude.com/docs/en/managed-agents/mcp-connector).
*
* @throws AnthropicInvalidDataException if the JSON field has an unexpected type (e.g. if
* the server responded with an unexpected value).
Expand Down Expand Up @@ -1046,8 +1052,10 @@ private constructor(
}

/**
* MCP servers. Full replacement. Omit to preserve; send empty array or null to clear.
* Names must be unique. Maximum 20.
* MCP servers. Full replacement. Omit to preserve; send empty array or `null` to clear.
* Names must be unique. Maximum 20. Every server must be referenced by an `mcp_toolset`
* in the agent's resulting `tools`; unreferenced servers are rejected. See the
* [MCP connector guide](https://platform.claude.com/docs/en/managed-agents/mcp-connector).
*/
fun mcpServers(mcpServers: List<BetaManagedAgentsUrlMcpServerParams>?) =
mcpServers(JsonField.ofNullable(mcpServers))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,9 @@ private constructor(
* - `5m`: 5 minutes
* - `1h`: 1 hour
*
* Defaults to `5m`.
* Defaults to `5m`. See
* [prompt caching pricing](https://docs.claude.com/en/docs/build-with-claude/prompt-caching)
* for details.
*
* @throws AnthropicInvalidDataException if the JSON field has an unexpected type (e.g. if the
* server responded with an unexpected value).
Expand Down Expand Up @@ -118,7 +120,9 @@ private constructor(
* - `5m`: 5 minutes
* - `1h`: 1 hour
*
* Defaults to `5m`.
* Defaults to `5m`. See
* [prompt caching pricing](https://docs.claude.com/en/docs/build-with-claude/prompt-caching)
* for details.
*/
fun ttl(ttl: Ttl) = ttl(JsonField.of(ttl))

Expand Down Expand Up @@ -207,7 +211,9 @@ private constructor(
* - `5m`: 5 minutes
* - `1h`: 1 hour
*
* Defaults to `5m`.
* Defaults to `5m`. See
* [prompt caching pricing](https://docs.claude.com/en/docs/build-with-claude/prompt-caching)
* for details.
*/
class Ttl @JsonCreator private constructor(private val value: JsonField<String>) : Enum {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,8 @@ private constructor(

@JvmField val REASONING_EXTRACTION = of("reasoning_extraction")

@JvmField val MILITARY_WEAPONS = of("military_weapons")

@JvmStatic fun of(value: String) = Category(JsonField.of(value))
}

Expand All @@ -240,6 +242,7 @@ private constructor(
BIO,
FRONTIER_LLM,
REASONING_EXTRACTION,
MILITARY_WEAPONS,
}

/**
Expand All @@ -256,6 +259,7 @@ private constructor(
BIO,
FRONTIER_LLM,
REASONING_EXTRACTION,
MILITARY_WEAPONS,
/** An enum member indicating that [Category] was instantiated with an unknown value. */
_UNKNOWN,
}
Expand All @@ -273,6 +277,7 @@ private constructor(
BIO -> Value.BIO
FRONTIER_LLM -> Value.FRONTIER_LLM
REASONING_EXTRACTION -> Value.REASONING_EXTRACTION
MILITARY_WEAPONS -> Value.MILITARY_WEAPONS
else -> Value._UNKNOWN
}

Expand All @@ -291,6 +296,7 @@ private constructor(
BIO -> Known.BIO
FRONTIER_LLM -> Known.FRONTIER_LLM
REASONING_EXTRACTION -> Known.REASONING_EXTRACTION
MILITARY_WEAPONS -> Known.MILITARY_WEAPONS
else -> throw AnthropicInvalidDataException("Unknown Category: $value")
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -520,6 +520,8 @@ private constructor(

@JvmField val REASONING_EXTRACTION = of("reasoning_extraction")

@JvmField val MILITARY_WEAPONS = of("military_weapons")

@JvmStatic fun of(value: String) = Category(JsonField.of(value))
}

Expand All @@ -529,6 +531,7 @@ private constructor(
BIO,
FRONTIER_LLM,
REASONING_EXTRACTION,
MILITARY_WEAPONS,
}

/**
Expand All @@ -545,6 +548,7 @@ private constructor(
BIO,
FRONTIER_LLM,
REASONING_EXTRACTION,
MILITARY_WEAPONS,
/** An enum member indicating that [Category] was instantiated with an unknown value. */
_UNKNOWN,
}
Expand All @@ -562,6 +566,7 @@ private constructor(
BIO -> Value.BIO
FRONTIER_LLM -> Value.FRONTIER_LLM
REASONING_EXTRACTION -> Value.REASONING_EXTRACTION
MILITARY_WEAPONS -> Value.MILITARY_WEAPONS
else -> Value._UNKNOWN
}

Expand All @@ -580,6 +585,7 @@ private constructor(
BIO -> Known.BIO
FRONTIER_LLM -> Known.FRONTIER_LLM
REASONING_EXTRACTION -> Known.REASONING_EXTRACTION
MILITARY_WEAPONS -> Known.MILITARY_WEAPONS
else -> throw AnthropicInvalidDataException("Unknown Category: $value")
}

Expand Down
Loading
Loading