diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index bf1d13065..7e80545fc 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -74,7 +74,9 @@ jobs:
cache-encryption-key: ${{ secrets.GRADLE_ENCRYPTION_KEY }}
- name: Build SDK
- run: ./scripts/build
+ # Where the "Build local Maven repo" step runs it needs the Javadoc, and generating it in
+ # the same Gradle run as the compile is faster.
+ run: ./scripts/build ${{ github.repository != 'anthropics/anthropic-sdk-java' && !startsWith(github.ref, 'refs/heads/stl/') && 'dokkaGeneratePublicationJavadoc' || '' }}
- name: Build local Maven repo
if: |-
diff --git a/.release-please-manifest.json b/.release-please-manifest.json
index fc6bc1a45..db4a1f8cc 100644
--- a/.release-please-manifest.json
+++ b/.release-please-manifest.json
@@ -1,3 +1,3 @@
{
- ".": "2.68.0"
+ ".": "2.69.0"
}
\ No newline at end of file
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 22d92ae18..ff96e9e90 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,56 @@
# Changelog
+## 2.69.0 (2026-10-07)
+
+Full Changelog: [v2.68.0...v2.69.0](https://github.com/anthropics/anthropic-sdk-java/compare/v2.68.0...v2.69.0)
+
+### Features
+
+* **api:** add claude-haiku-5-5 and typed computer and browser toolset tool calls ([8c207f2](https://github.com/anthropics/anthropic-sdk-java/commit/8c207f2e239dedd88f7d3bb5c15d49ed44446892))
+* **api:** add disabled to thinking types in model capabilities ([9de8343](https://github.com/anthropics/anthropic-sdk-java/commit/9de83439a4f684c5231f3596f4d0cdb8606550aa))
+* **api:** add display_name to RBAC roles and deprecate name ([20b61fc](https://github.com/anthropics/anthropic-sdk-java/commit/20b61fc8fadb5ad4f75c0fe162e865bec3e7edcc))
+* **api:** add include_default parameter to list workspaces ([c1450d5](https://github.com/anthropics/anthropic-sdk-java/commit/c1450d5e7eee91d777365f300677f3a1f84100e7))
+* **api:** add lifecycle stage fields and filter to /v1/models ([476c9df](https://github.com/anthropics/anthropic-sdk-java/commit/476c9df6b02d2c1d5d41e118b739a8c73c19ae9c))
+* **api:** add line to model objects ([df57dee](https://github.com/anthropics/anthropic-sdk-java/commit/df57deef84fb1f68e7761adba5024bd7ad1a41c9))
+* **api:** add url_sources to the Managed Agents web_fetch tool config ([9de8343](https://github.com/anthropics/anthropic-sdk-java/commit/9de83439a4f684c5231f3596f4d0cdb8606550aa))
+* **api:** add web search and code execution support to model capabilities ([9de8343](https://github.com/anthropics/anthropic-sdk-java/commit/9de83439a4f684c5231f3596f4d0cdb8606550aa))
+
+
+### Bug Fixes
+
+* **api:** send the beta header by default when listing spend limits ([bbd9598](https://github.com/anthropics/anthropic-sdk-java/commit/bbd95986796f7b02dbbff9840f2b11bb843265f5))
+* **client:** don't send a default header value again when the caller passes it too ([6560b24](https://github.com/anthropics/anthropic-sdk-java/commit/6560b247049c02f2e79d5a7cda12244c8cf5602d))
+* **client:** fix profile config parsing under ProGuard with older Jackson versions ([#338](https://github.com/anthropics/anthropic-sdk-java/issues/338)) ([a5c7977](https://github.com/anthropics/anthropic-sdk-java/commit/a5c7977fcd7190b8bd3ed39838d11be0bdd9981a))
+* **client:** fix requests failing under ProGuard and R8, and keep much less code ([8dd88f3](https://github.com/anthropics/anthropic-sdk-java/commit/8dd88f3e7ff7fd6fee74e2f7a526ffc3d4adc9c1))
+* **client:** handle mcp tool listing blocks in structured content blocks ([#340](https://github.com/anthropics/anthropic-sdk-java/issues/340)) ([9de8343](https://github.com/anthropics/anthropic-sdk-java/commit/9de83439a4f684c5231f3596f4d0cdb8606550aa))
+* **client:** send array header params as a single comma-separated header ([a012009](https://github.com/anthropics/anthropic-sdk-java/commit/a012009076aa31993bedbf591d61f846e20c2e00))
+* **client:** send default and caller-provided array header values in a single header ([83c1432](https://github.com/anthropics/anthropic-sdk-java/commit/83c1432eac855a114ca7b8e797cc78a623f2b899))
+* **client:** throw an error when a path parameter is "." or ".." ([9de8343](https://github.com/anthropics/anthropic-sdk-java/commit/9de83439a4f684c5231f3596f4d0cdb8606550aa))
+* **docs:** omit empty doc comments for blank descriptions ([9de8343](https://github.com/anthropics/anthropic-sdk-java/commit/9de83439a4f684c5231f3596f4d0cdb8606550aa))
+
+
+### Chores
+
+* **api:** mark the Text Completions API as deprecated ([9de8343](https://github.com/anthropics/anthropic-sdk-java/commit/9de83439a4f684c5231f3596f4d0cdb8606550aa))
+* **ci:** generate the Javadoc in the same Gradle run as the compile ([d1f3a63](https://github.com/anthropics/anthropic-sdk-java/commit/d1f3a6329c42ae06d486291c2194f3b0cbb09a59))
+* **docs:** correct example groups in rate limit list description ([ddb499a](https://github.com/anthropics/anthropic-sdk-java/commit/ddb499a6fa826ea874114243b990d77ad47889a2))
+* **docs:** correct when usage and cost report data becomes final ([9de8343](https://github.com/anthropics/anthropic-sdk-java/commit/9de83439a4f684c5231f3596f4d0cdb8606550aa))
+* **docs:** describe a federation rule's target by its type ([9de8343](https://github.com/anthropics/anthropic-sdk-java/commit/9de83439a4f684c5231f3596f4d0cdb8606550aa))
+* **docs:** fix example IDs in sessions, agents and vault credentials ([9de8343](https://github.com/anthropics/anthropic-sdk-java/commit/9de83439a4f684c5231f3596f4d0cdb8606550aa))
+* **docs:** update Managed Agents multiagent and thread descriptions ([9de8343](https://github.com/anthropics/anthropic-sdk-java/commit/9de83439a4f684c5231f3596f4d0cdb8606550aa))
+* **docs:** update the activity summaries endpoint description ([00de508](https://github.com/anthropics/anthropic-sdk-java/commit/00de508f05be834859c73b646c4c7e697206352c))
+* **docs:** update the description of the Model line field ([1c424bf](https://github.com/anthropics/anthropic-sdk-java/commit/1c424bff639f9ed48adf4294e8b204217e62bd49))
+* **internal:** add REVIEW.md with review instructions ([9de8343](https://github.com/anthropics/anthropic-sdk-java/commit/9de83439a4f684c5231f3596f4d0cdb8606550aa))
+* **internal:** run detekt on the core module in eight parallel tasks ([c355f1a](https://github.com/anthropics/anthropic-sdk-java/commit/c355f1ad3c3d66b0fc55e46507f317a605938f06))
+* **tests:** run tests skipped for a query param bug that is now fixed ([9231cff](https://github.com/anthropics/anthropic-sdk-java/commit/9231cffafe40bdae1b7d42759d2ee632656c417a))
+* **tests:** run tests that an older mock server could not serve ([d50ce89](https://github.com/anthropics/anthropic-sdk-java/commit/d50ce890160b0289b4cd572dfb83f7a2bbf15684))
+* **tests:** run the tests skipped for incomplete example responses ([d21d76f](https://github.com/anthropics/anthropic-sdk-java/commit/d21d76f11274bbeb3b23949eadc9cf922d2143a1))
+
+
+### Documentation
+
+* **api:** state the agent tools limit as 256 ([537fae7](https://github.com/anthropics/anthropic-sdk-java/commit/537fae7f7e37537a5bf8ba0599544c8d5aff8bae))
+
## 2.68.0 (2026-09-30)
Full Changelog: [v2.67.0...v2.68.0](https://github.com/anthropics/anthropic-sdk-java/compare/v2.67.0...v2.68.0)
diff --git a/README.md b/README.md
index 43cd26372..0a41fbf15 100644
--- a/README.md
+++ b/README.md
@@ -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.68.0")
+implementation("com.anthropic:anthropic-java:2.69.0")
```
### Maven
@@ -24,7 +24,7 @@ implementation("com.anthropic:anthropic-java:2.68.0")
com.anthropic
anthropic-java
- 2.68.0
+ 2.69.0
```
diff --git a/REVIEW.md b/REVIEW.md
new file mode 100644
index 000000000..d5fc88a83
--- /dev/null
+++ b/REVIEW.md
@@ -0,0 +1,24 @@
+# Review instructions
+
+## Report these as Important, as well as functional bugs
+
+- A violation of this repository's `CLAUDE.md`. Quote the rule
+- A new public name, parameter or option that the PR description does not list
+- A behavior change that still applies with the PR's feature switched off
+- A new runtime check of an API response, or a client-side copy of validation
+ that the API does
+- Code that validates, reorders, defaults or drops part of a request the caller
+ built
+- Code that fails on an enum member, union variant or field this version does
+ not know
+- A fix made to one copy of logic that exists more than once
+- A behavior change with no test that fails before it and passes after
+- A hand-written list of fields, variants or names that generated code also
+ carries, with no tripwire test
+- A comment that restates the code, or that runs past three lines on a symbol
+ that is not public
+
+## Don't report these
+
+- A missing runtime check of an API response, or missing client-side validation
+- What an application can do to its own process, credentials or telemetry
diff --git a/anthropic-java-client-okhttp/src/main/resources/META-INF/proguard/anthropic-java-client-okhttp.pro b/anthropic-java-client-okhttp/src/main/resources/META-INF/proguard/anthropic-java-client-okhttp.pro
new file mode 100644
index 000000000..6bc10f9a6
--- /dev/null
+++ b/anthropic-java-client-okhttp/src/main/resources/META-INF/proguard/anthropic-java-client-okhttp.pro
@@ -0,0 +1,3 @@
+# ProGuard narrows the return types of these methods but leaves the casts to their original return types in place, so
+# the class fails verification on the first request. This only stops ProGuard from optimizing the methods.
+-keepclassmembers,allowshrinking,allowobfuscation class okio.Okio__JvmOkioKt { *; }
\ No newline at end of file
diff --git a/anthropic-java-core/src/main/kotlin/com/anthropic/client/AnthropicClientAsyncImpl.kt b/anthropic-java-core/src/main/kotlin/com/anthropic/client/AnthropicClientAsyncImpl.kt
index 088babca2..bec81f6f2 100644
--- a/anthropic-java-core/src/main/kotlin/com/anthropic/client/AnthropicClientAsyncImpl.kt
+++ b/anthropic-java-core/src/main/kotlin/com/anthropic/client/AnthropicClientAsyncImpl.kt
@@ -25,7 +25,7 @@ class AnthropicClientAsyncImpl(private val clientOptions: ClientOptions) : Anthr
else
clientOptions
.toBuilder()
- .putHeader("User-Agent", "${javaClass.simpleName}/Java ${getPackageVersion()}")
+ .putHeader("User-Agent", "AnthropicClientAsyncImpl/Java ${getPackageVersion()}")
.build()
// Pass the original clientOptions so that this client sets its own User-Agent.
diff --git a/anthropic-java-core/src/main/kotlin/com/anthropic/client/AnthropicClientImpl.kt b/anthropic-java-core/src/main/kotlin/com/anthropic/client/AnthropicClientImpl.kt
index 0c6a8c9fb..8971a85cb 100644
--- a/anthropic-java-core/src/main/kotlin/com/anthropic/client/AnthropicClientImpl.kt
+++ b/anthropic-java-core/src/main/kotlin/com/anthropic/client/AnthropicClientImpl.kt
@@ -25,7 +25,7 @@ class AnthropicClientImpl(private val clientOptions: ClientOptions) : AnthropicC
else
clientOptions
.toBuilder()
- .putHeader("User-Agent", "${javaClass.simpleName}/Java ${getPackageVersion()}")
+ .putHeader("User-Agent", "AnthropicClientImpl/Java ${getPackageVersion()}")
.build()
// Pass the original clientOptions so that this client sets its own User-Agent.
diff --git a/anthropic-java-core/src/main/kotlin/com/anthropic/config/ProfileConfig.kt b/anthropic-java-core/src/main/kotlin/com/anthropic/config/ProfileConfig.kt
index 51ae2a094..f2ae0c2c8 100644
--- a/anthropic-java-core/src/main/kotlin/com/anthropic/config/ProfileConfig.kt
+++ b/anthropic-java-core/src/main/kotlin/com/anthropic/config/ProfileConfig.kt
@@ -1,5 +1,6 @@
package com.anthropic.config
+import com.fasterxml.jackson.annotation.JsonCreator
import com.fasterxml.jackson.annotation.JsonIgnoreProperties
import com.fasterxml.jackson.annotation.JsonProperty
import com.fasterxml.jackson.databind.json.JsonMapper
@@ -14,6 +15,7 @@ enum class AuthenticationType {
@JsonIgnoreProperties(ignoreUnknown = true)
class IdentityTokenConfig
+@JsonCreator
private constructor(
@JsonProperty("source") private val source: String?,
@JsonProperty("path") private val path: String?,
@@ -52,6 +54,7 @@ private constructor(
@JsonIgnoreProperties(ignoreUnknown = true)
class AuthenticationConfig
+@JsonCreator
private constructor(
@JsonProperty("type") private val type: AuthenticationType?,
@JsonProperty("federation_rule_id") private val federationRuleId: String?,
@@ -156,6 +159,7 @@ private constructor(
@JsonIgnoreProperties(ignoreUnknown = true)
class ProfileConfig
+@JsonCreator
private constructor(
@JsonProperty("authentication") private val authentication: AuthenticationConfig?,
@JsonProperty("base_url") private val baseUrl: String?,
diff --git a/anthropic-java-core/src/main/kotlin/com/anthropic/core/http/Headers.kt b/anthropic-java-core/src/main/kotlin/com/anthropic/core/http/Headers.kt
index 7dc4e6ace..88709a3b0 100644
--- a/anthropic-java-core/src/main/kotlin/com/anthropic/core/http/Headers.kt
+++ b/anthropic-java-core/src/main/kotlin/com/anthropic/core/http/Headers.kt
@@ -43,7 +43,28 @@ private constructor(
is JsonBoolean -> put(name, value.value.toString())
is JsonNumber -> put(name, value.value.toString())
is JsonString -> put(name, value.value)
- is JsonArray -> value.values.forEach { put(name, it) }
+ is JsonArray ->
+ if (value.values.isNotEmpty())
+ put(
+ name,
+ value.values
+ .asSequence()
+ .mapNotNull {
+ when (it) {
+ is JsonMissing,
+ is JsonNull -> null
+ is JsonBoolean -> it.value.toString()
+ is JsonNumber -> it.value.toString()
+ is JsonString -> it.value
+ is JsonArray,
+ is JsonObject ->
+ throw IllegalArgumentException(
+ "Cannot comma separate non-primitives in headers"
+ )
+ }
+ }
+ .joinToString(","),
+ )
is JsonObject ->
value.values.forEach { (nestedName, value) -> put("$name.$nestedName", value) }
}
diff --git a/anthropic-java-core/src/main/kotlin/com/anthropic/core/http/HttpRequest.kt b/anthropic-java-core/src/main/kotlin/com/anthropic/core/http/HttpRequest.kt
index 687008fdb..343247257 100644
--- a/anthropic-java-core/src/main/kotlin/com/anthropic/core/http/HttpRequest.kt
+++ b/anthropic-java-core/src/main/kotlin/com/anthropic/core/http/HttpRequest.kt
@@ -92,10 +92,12 @@ private constructor(
/** Alias for calling [Builder.baseUrl] with `baseUrl.orElse(null)`. */
fun baseUrl(baseUrl: Optional) = baseUrl(baseUrl.getOrNull())
- fun addPathSegment(pathSegment: String) = apply { pathSegments.add(pathSegment) }
+ fun addPathSegment(pathSegment: String) = apply {
+ pathSegments.add(checkPathSegment(pathSegment))
+ }
fun addPathSegments(vararg pathSegments: String) = apply {
- this.pathSegments.addAll(pathSegments)
+ this.pathSegments.addAll(pathSegments.onEach { checkPathSegment(it) })
}
fun replaceAllPathSegments(vararg pathSegments: String) = apply {
@@ -195,3 +197,12 @@ private constructor(
)
}
}
+
+// Throws on a "." or ".." segment: HTTP clients collapse them ("/cards/.." becomes "/"), so the
+// request would go to a different path.
+private fun checkPathSegment(segment: String): String =
+ segment.also {
+ check(it != "." && it != "..") {
+ "Path segment \"$it\" is a dot-segment and can't be safely passed as a path parameter"
+ }
+ }
diff --git a/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/agents/AgentArchiveParams.kt b/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/agents/AgentArchiveParams.kt
index ef73decc7..8e38996ac 100644
--- a/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/agents/AgentArchiveParams.kt
+++ b/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/agents/AgentArchiveParams.kt
@@ -265,7 +265,16 @@ private constructor(
override fun _headers(): Headers =
Headers.builder()
.apply {
- betas?.forEach { put("anthropic-beta", it.toString()) }
+ betas?.let {
+ if (it.isNotEmpty()) {
+ put(
+ "anthropic-beta",
+ it.map { it.toString() }
+ .let { it + (listOf("managed-agents-2026-04-01") - it) }
+ .joinToString(","),
+ )
+ }
+ }
workspaceId?.let { put("anthropic-workspace-id", it) }
putAll(additionalHeaders)
}
diff --git a/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/agents/AgentCreateParams.kt b/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/agents/AgentCreateParams.kt
index 0caafebbf..123147160 100644
--- a/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/agents/AgentCreateParams.kt
+++ b/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/agents/AgentCreateParams.kt
@@ -103,8 +103,7 @@ private constructor(
fun metadata(): Optional = body.metadata()
/**
- * Multiagent orchestration configuration. Currently supports the `coordinator` topology with a
- * roster of 1-20 agents.
+ * Multiagent orchestration configuration.
*
* @throws AnthropicInvalidDataException if the JSON field has an unexpected type (e.g. if the
* server responded with an unexpected value).
@@ -128,7 +127,7 @@ private constructor(
fun system(): Optional = body.system()
/**
- * Tool configurations available to the agent. Maximum of 128 tools across all toolsets allowed.
+ * Tool configurations available to the agent. Maximum of 256 tools across all toolsets allowed.
*
* @throws AnthropicInvalidDataException if the JSON field has an unexpected type (e.g. if the
* server responded with an unexpected value).
@@ -389,10 +388,7 @@ private constructor(
*/
fun metadata(metadata: JsonField) = apply { body.metadata(metadata) }
- /**
- * Multiagent orchestration configuration. Currently supports the `coordinator` topology
- * with a roster of 1-20 agents.
- */
+ /** Multiagent orchestration configuration. */
fun multiagent(multiagent: BetaManagedAgentsMultiagentParams?) = apply {
body.multiagent(multiagent)
}
@@ -494,7 +490,7 @@ private constructor(
fun system(system: JsonField) = apply { body.system(system) }
/**
- * Tool configurations available to the agent. Maximum of 128 tools across all toolsets
+ * Tool configurations available to the agent. Maximum of 256 tools across all toolsets
* allowed.
*/
fun tools(tools: List) = apply { body.tools(tools) }
@@ -686,7 +682,16 @@ private constructor(
override fun _headers(): Headers =
Headers.builder()
.apply {
- betas?.forEach { put("anthropic-beta", it.toString()) }
+ betas?.let {
+ if (it.isNotEmpty()) {
+ put(
+ "anthropic-beta",
+ it.map { it.toString() }
+ .let { it + (listOf("managed-agents-2026-04-01") - it) }
+ .joinToString(","),
+ )
+ }
+ }
workspaceId?.let { put("anthropic-workspace-id", it) }
putAll(additionalHeaders)
}
@@ -792,8 +797,7 @@ private constructor(
fun metadata(): Optional = metadata.getOptional("metadata")
/**
- * Multiagent orchestration configuration. Currently supports the `coordinator` topology
- * with a roster of 1-20 agents.
+ * Multiagent orchestration configuration.
*
* @throws AnthropicInvalidDataException if the JSON field has an unexpected type (e.g. if
* the server responded with an unexpected value).
@@ -818,7 +822,7 @@ private constructor(
fun system(): Optional = system.getOptional("system")
/**
- * Tool configurations available to the agent. Maximum of 128 tools across all toolsets
+ * Tool configurations available to the agent. Maximum of 256 tools across all toolsets
* allowed.
*
* @throws AnthropicInvalidDataException if the JSON field has an unexpected type (e.g. if
@@ -1059,10 +1063,7 @@ private constructor(
*/
fun metadata(metadata: JsonField) = apply { this.metadata = metadata }
- /**
- * Multiagent orchestration configuration. Currently supports the `coordinator` topology
- * with a roster of 1-20 agents.
- */
+ /** Multiagent orchestration configuration. */
fun multiagent(multiagent: BetaManagedAgentsMultiagentParams?) =
multiagent(JsonField.ofNullable(multiagent))
@@ -1187,7 +1188,7 @@ private constructor(
fun system(system: JsonField) = apply { this.system = system }
/**
- * Tool configurations available to the agent. Maximum of 128 tools across all toolsets
+ * Tool configurations available to the agent. Maximum of 256 tools across all toolsets
* allowed.
*/
fun tools(tools: List) = tools(JsonField.of(tools))
diff --git a/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/agents/AgentListParams.kt b/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/agents/AgentListParams.kt
index e62ae3ec6..4758b46ac 100644
--- a/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/agents/AgentListParams.kt
+++ b/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/agents/AgentListParams.kt
@@ -299,7 +299,16 @@ private constructor(
override fun _headers(): Headers =
Headers.builder()
.apply {
- betas?.forEach { put("anthropic-beta", it.toString()) }
+ betas?.let {
+ if (it.isNotEmpty()) {
+ put(
+ "anthropic-beta",
+ it.map { it.toString() }
+ .let { it + (listOf("managed-agents-2026-04-01") - it) }
+ .joinToString(","),
+ )
+ }
+ }
workspaceId?.let { put("anthropic-workspace-id", it) }
putAll(additionalHeaders)
}
diff --git a/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/agents/AgentRetrieveParams.kt b/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/agents/AgentRetrieveParams.kt
index 2a8575ea0..75e14b16b 100644
--- a/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/agents/AgentRetrieveParams.kt
+++ b/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/agents/AgentRetrieveParams.kt
@@ -252,7 +252,16 @@ private constructor(
override fun _headers(): Headers =
Headers.builder()
.apply {
- betas?.forEach { put("anthropic-beta", it.toString()) }
+ betas?.let {
+ if (it.isNotEmpty()) {
+ put(
+ "anthropic-beta",
+ it.map { it.toString() }
+ .let { it + (listOf("managed-agents-2026-04-01") - it) }
+ .joinToString(","),
+ )
+ }
+ }
workspaceId?.let { put("anthropic-workspace-id", it) }
putAll(additionalHeaders)
}
diff --git a/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/agents/AgentUpdateParams.kt b/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/agents/AgentUpdateParams.kt
index cde9e5bb2..d69d6a6f1 100644
--- a/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/agents/AgentUpdateParams.kt
+++ b/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/agents/AgentUpdateParams.kt
@@ -135,7 +135,7 @@ private constructor(
/**
* Tool configurations available to the agent. Full replacement. Omit to preserve; send empty
- * array or null to clear. Maximum of 128 tools across all toolsets allowed.
+ * array or null to clear. Maximum of 256 tools across all toolsets allowed.
*
* @throws AnthropicInvalidDataException if the JSON field has an unexpected type (e.g. if the
* server responded with an unexpected value).
@@ -535,7 +535,7 @@ private constructor(
/**
* Tool configurations available to the agent. Full replacement. Omit to preserve; send
- * empty array or null to clear. Maximum of 128 tools across all toolsets allowed.
+ * empty array or null to clear. Maximum of 256 tools across all toolsets allowed.
*/
fun tools(tools: List?) = apply { body.tools(tools) }
@@ -744,7 +744,16 @@ private constructor(
override fun _headers(): Headers =
Headers.builder()
.apply {
- betas?.forEach { put("anthropic-beta", it.toString()) }
+ betas?.let {
+ if (it.isNotEmpty()) {
+ put(
+ "anthropic-beta",
+ it.map { it.toString() }
+ .let { it + (listOf("managed-agents-2026-04-01") - it) }
+ .joinToString(","),
+ )
+ }
+ }
workspaceId?.let { put("anthropic-workspace-id", it) }
putAll(additionalHeaders)
}
@@ -882,7 +891,7 @@ private constructor(
/**
* Tool configurations available to the agent. Full replacement. Omit to preserve; send
- * empty array or null to clear. Maximum of 128 tools across all toolsets allowed.
+ * empty array or null to clear. Maximum of 256 tools across all toolsets allowed.
*
* @throws AnthropicInvalidDataException if the JSON field has an unexpected type (e.g. if
* the server responded with an unexpected value).
@@ -1277,7 +1286,7 @@ private constructor(
/**
* Tool configurations available to the agent. Full replacement. Omit to preserve; send
- * empty array or null to clear. Maximum of 128 tools across all toolsets allowed.
+ * empty array or null to clear. Maximum of 256 tools across all toolsets allowed.
*/
fun tools(tools: List?) = tools(JsonField.ofNullable(tools))
diff --git a/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/agents/BetaManagedAgentsModel.kt b/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/agents/BetaManagedAgentsModel.kt
index ac3eff51f..88e75967f 100644
--- a/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/agents/BetaManagedAgentsModel.kt
+++ b/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/agents/BetaManagedAgentsModel.kt
@@ -25,6 +25,9 @@ class BetaManagedAgentsModel private constructor(private val value: JsonField CLAUDE_HAIKU_5_5
"claude-sonnet-5-5" -> CLAUDE_SONNET_5_5
"claude-opus-5-5" -> CLAUDE_OPUS_5_5
"claude-fable-5-1" -> CLAUDE_FABLE_5_1
@@ -120,6 +124,8 @@ class BetaManagedAgentsModel private constructor(private val value: JsonField Value.CLAUDE_HAIKU_5_5
CLAUDE_SONNET_5_5 -> Value.CLAUDE_SONNET_5_5
CLAUDE_OPUS_5_5 -> Value.CLAUDE_OPUS_5_5
CLAUDE_FABLE_5_1 -> Value.CLAUDE_FABLE_5_1
@@ -259,6 +268,7 @@ class BetaManagedAgentsModel private constructor(private val value: JsonField Known.CLAUDE_HAIKU_5_5
CLAUDE_SONNET_5_5 -> Known.CLAUDE_SONNET_5_5
CLAUDE_OPUS_5_5 -> Known.CLAUDE_OPUS_5_5
CLAUDE_FABLE_5_1 -> Known.CLAUDE_FABLE_5_1
diff --git a/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/agents/BetaManagedAgentsWebFetchToolConfig.kt b/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/agents/BetaManagedAgentsWebFetchToolConfig.kt
index cadb29d60..a33703fa1 100644
--- a/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/agents/BetaManagedAgentsWebFetchToolConfig.kt
+++ b/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/agents/BetaManagedAgentsWebFetchToolConfig.kt
@@ -36,6 +36,7 @@ private constructor(
private val name: JsonValue,
private val permissionPolicy: JsonField,
private val type: JsonValue,
+ private val urlSources: JsonField,
private val allowedDomains: JsonField>,
private val blockedDomains: JsonField>,
private val maxContentTokens: JsonField,
@@ -50,6 +51,9 @@ private constructor(
@ExcludeMissing
permissionPolicy: JsonField = JsonMissing.of(),
@JsonProperty("type") @ExcludeMissing type: JsonValue = JsonMissing.of(),
+ @JsonProperty("url_sources")
+ @ExcludeMissing
+ urlSources: JsonField = JsonMissing.of(),
@JsonProperty("allowed_domains")
@ExcludeMissing
allowedDomains: JsonField> = JsonMissing.of(),
@@ -64,6 +68,7 @@ private constructor(
name,
permissionPolicy,
type,
+ urlSources,
allowedDomains,
blockedDomains,
maxContentTokens,
@@ -106,6 +111,16 @@ private constructor(
*/
@JsonProperty("type") @ExcludeMissing fun _type(): JsonValue = type
+ /**
+ * Which sources contribute URLs the tool may fetch, always in the object form. Null when not
+ * set, which allows every source.
+ *
+ * @throws AnthropicInvalidDataException if the JSON field has an unexpected type (e.g. if the
+ * server responded with an unexpected value).
+ */
+ fun urlSources(): Optional =
+ urlSources.getOptional("url_sources")
+
/**
* @throws AnthropicInvalidDataException if the JSON field has an unexpected type (e.g. if the
* server responded with an unexpected value).
@@ -141,6 +156,15 @@ private constructor(
@ExcludeMissing
fun _permissionPolicy(): JsonField = permissionPolicy
+ /**
+ * Returns the raw JSON value of [urlSources].
+ *
+ * Unlike [urlSources], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("url_sources")
+ @ExcludeMissing
+ fun _urlSources(): JsonField = urlSources
+
/**
* Returns the raw JSON value of [allowedDomains].
*
@@ -191,6 +215,7 @@ private constructor(
* ```java
* .enabled()
* .permissionPolicy()
+ * .urlSources()
* ```
*/
@JvmStatic fun builder() = Builder()
@@ -203,6 +228,7 @@ private constructor(
private var name: JsonValue = JsonValue.from("web_fetch")
private var permissionPolicy: JsonField? = null
private var type: JsonValue = JsonValue.from("web_fetch")
+ private var urlSources: JsonField? = null
private var allowedDomains: JsonField>? = null
private var blockedDomains: JsonField>? = null
private var maxContentTokens: JsonField = JsonMissing.of()
@@ -216,6 +242,7 @@ private constructor(
name = betaManagedAgentsWebFetchToolConfig.name
permissionPolicy = betaManagedAgentsWebFetchToolConfig.permissionPolicy
type = betaManagedAgentsWebFetchToolConfig.type
+ urlSources = betaManagedAgentsWebFetchToolConfig.urlSources
allowedDomains =
betaManagedAgentsWebFetchToolConfig.allowedDomains
.map { it.toMutableList() }
@@ -296,6 +323,28 @@ private constructor(
*/
fun type(type: JsonValue) = apply { this.type = type }
+ /**
+ * Which sources contribute URLs the tool may fetch, always in the object form. Null when
+ * not set, which allows every source.
+ */
+ fun urlSources(urlSources: BetaManagedAgentsWebFetchUrlSources?) =
+ urlSources(JsonField.ofNullable(urlSources))
+
+ /** Alias for calling [Builder.urlSources] with `urlSources.orElse(null)`. */
+ fun urlSources(urlSources: Optional) =
+ urlSources(urlSources.getOrNull())
+
+ /**
+ * Sets [Builder.urlSources] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.urlSources] with a well-typed
+ * [BetaManagedAgentsWebFetchUrlSources] value instead. This method is primarily for setting
+ * the field to an undocumented or not yet supported value.
+ */
+ fun urlSources(urlSources: JsonField) = apply {
+ this.urlSources = urlSources
+ }
+
fun allowedDomains(allowedDomains: List) =
allowedDomains(JsonField.of(allowedDomains))
@@ -401,6 +450,7 @@ private constructor(
* ```java
* .enabled()
* .permissionPolicy()
+ * .urlSources()
* ```
*
* @throws IllegalStateException if any required field is unset.
@@ -411,6 +461,7 @@ private constructor(
name,
checkRequired("permissionPolicy", permissionPolicy),
type,
+ checkRequired("urlSources", urlSources),
(allowedDomains ?: JsonMissing.of()).map { it.toImmutable() },
(blockedDomains ?: JsonMissing.of()).map { it.toImmutable() },
maxContentTokens,
@@ -445,6 +496,7 @@ private constructor(
throw AnthropicInvalidDataException("'type' is invalid, received $it")
}
}
+ urlSources().ifPresent { it.validate() }
allowedDomains()
blockedDomains()
maxContentTokens()
@@ -470,6 +522,7 @@ private constructor(
name.let { if (it == JsonValue.from("web_fetch")) 1 else 0 } +
(permissionPolicy.asKnown().getOrNull()?.validity() ?: 0) +
type.let { if (it == JsonValue.from("web_fetch")) 1 else 0 } +
+ (urlSources.asKnown().getOrNull()?.validity() ?: 0) +
(allowedDomains.asKnown().getOrNull()?.size ?: 0) +
(blockedDomains.asKnown().getOrNull()?.size ?: 0) +
(if (maxContentTokens.asKnown().isPresent) 1 else 0)
@@ -928,6 +981,7 @@ private constructor(
name == other.name &&
permissionPolicy == other.permissionPolicy &&
type == other.type &&
+ urlSources == other.urlSources &&
allowedDomains == other.allowedDomains &&
blockedDomains == other.blockedDomains &&
maxContentTokens == other.maxContentTokens &&
@@ -940,6 +994,7 @@ private constructor(
name,
permissionPolicy,
type,
+ urlSources,
allowedDomains,
blockedDomains,
maxContentTokens,
@@ -950,5 +1005,5 @@ private constructor(
override fun hashCode(): Int = hashCode
override fun toString() =
- "BetaManagedAgentsWebFetchToolConfig{enabled=$enabled, name=$name, permissionPolicy=$permissionPolicy, type=$type, allowedDomains=$allowedDomains, blockedDomains=$blockedDomains, maxContentTokens=$maxContentTokens, additionalProperties=$additionalProperties}"
+ "BetaManagedAgentsWebFetchToolConfig{enabled=$enabled, name=$name, permissionPolicy=$permissionPolicy, type=$type, urlSources=$urlSources, allowedDomains=$allowedDomains, blockedDomains=$blockedDomains, maxContentTokens=$maxContentTokens, additionalProperties=$additionalProperties}"
}
diff --git a/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/agents/BetaManagedAgentsWebFetchToolConfigParams.kt b/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/agents/BetaManagedAgentsWebFetchToolConfigParams.kt
index a7ec0eb79..ba88722db 100644
--- a/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/agents/BetaManagedAgentsWebFetchToolConfigParams.kt
+++ b/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/agents/BetaManagedAgentsWebFetchToolConfigParams.kt
@@ -38,6 +38,7 @@ private constructor(
private val maxContentTokens: JsonField,
private val permissionPolicy: JsonField,
private val type: JsonField,
+ private val urlSources: JsonField,
private val additionalProperties: MutableMap,
) {
@@ -58,6 +59,9 @@ private constructor(
@ExcludeMissing
permissionPolicy: JsonField = JsonMissing.of(),
@JsonProperty("type") @ExcludeMissing type: JsonField = JsonMissing.of(),
+ @JsonProperty("url_sources")
+ @ExcludeMissing
+ urlSources: JsonField = JsonMissing.of(),
) : this(
name,
allowedDomains,
@@ -66,6 +70,7 @@ private constructor(
maxContentTokens,
permissionPolicy,
type,
+ urlSources,
mutableMapOf(),
)
@@ -135,6 +140,15 @@ private constructor(
*/
fun type(): Optional = type.getOptional("type")
+ /**
+ * Which sources contribute URLs the tool may fetch. Omit to allow every source.
+ *
+ * @throws AnthropicInvalidDataException if the JSON field has an unexpected type (e.g. if the
+ * server responded with an unexpected value).
+ */
+ fun urlSources(): Optional =
+ urlSources.getOptional("url_sources")
+
/**
* Returns the raw JSON value of [allowedDomains].
*
@@ -187,6 +201,15 @@ private constructor(
*/
@JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type
+ /**
+ * Returns the raw JSON value of [urlSources].
+ *
+ * Unlike [urlSources], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("url_sources")
+ @ExcludeMissing
+ fun _urlSources(): JsonField = urlSources
+
@JsonAnySetter
private fun putAdditionalProperty(key: String, value: JsonValue) {
additionalProperties.put(key, value)
@@ -218,6 +241,8 @@ private constructor(
private var maxContentTokens: JsonField = JsonMissing.of()
private var permissionPolicy: JsonField = JsonMissing.of()
private var type: JsonField = JsonMissing.of()
+ private var urlSources: JsonField =
+ JsonMissing.of()
private var additionalProperties: MutableMap = mutableMapOf()
@JvmSynthetic
@@ -237,6 +262,7 @@ private constructor(
maxContentTokens = betaManagedAgentsWebFetchToolConfigParams.maxContentTokens
permissionPolicy = betaManagedAgentsWebFetchToolConfigParams.permissionPolicy
type = betaManagedAgentsWebFetchToolConfigParams.type
+ urlSources = betaManagedAgentsWebFetchToolConfigParams.urlSources
additionalProperties =
betaManagedAgentsWebFetchToolConfigParams.additionalProperties.toMutableMap()
}
@@ -417,6 +443,25 @@ private constructor(
*/
fun type(type: JsonField) = apply { this.type = type }
+ /** Which sources contribute URLs the tool may fetch. Omit to allow every source. */
+ fun urlSources(urlSources: BetaManagedAgentsWebFetchUrlSourcesParams?) =
+ urlSources(JsonField.ofNullable(urlSources))
+
+ /** Alias for calling [Builder.urlSources] with `urlSources.orElse(null)`. */
+ fun urlSources(urlSources: Optional) =
+ urlSources(urlSources.getOrNull())
+
+ /**
+ * Sets [Builder.urlSources] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.urlSources] with a well-typed
+ * [BetaManagedAgentsWebFetchUrlSourcesParams] value instead. This method is primarily for
+ * setting the field to an undocumented or not yet supported value.
+ */
+ fun urlSources(urlSources: JsonField) = apply {
+ this.urlSources = urlSources
+ }
+
fun additionalProperties(additionalProperties: Map) = apply {
this.additionalProperties.clear()
putAllAdditionalProperties(additionalProperties)
@@ -450,6 +495,7 @@ private constructor(
maxContentTokens,
permissionPolicy,
type,
+ urlSources,
additionalProperties.toMutableMap(),
)
}
@@ -480,6 +526,7 @@ private constructor(
maxContentTokens()
permissionPolicy().ifPresent { it.validate() }
type().ifPresent { it.validate() }
+ urlSources().ifPresent { it.validate() }
validated = true
}
@@ -504,7 +551,8 @@ private constructor(
(if (enabled.asKnown().isPresent) 1 else 0) +
(if (maxContentTokens.asKnown().isPresent) 1 else 0) +
(permissionPolicy.asKnown().getOrNull()?.validity() ?: 0) +
- (type.asKnown().getOrNull()?.validity() ?: 0)
+ (type.asKnown().getOrNull()?.validity() ?: 0) +
+ (urlSources.asKnown().getOrNull()?.validity() ?: 0)
/**
* Permission policy for this tool. Controls whether tool calls are auto-approved or require
@@ -1107,6 +1155,7 @@ private constructor(
maxContentTokens == other.maxContentTokens &&
permissionPolicy == other.permissionPolicy &&
type == other.type &&
+ urlSources == other.urlSources &&
additionalProperties == other.additionalProperties
}
@@ -1119,6 +1168,7 @@ private constructor(
maxContentTokens,
permissionPolicy,
type,
+ urlSources,
additionalProperties,
)
}
@@ -1126,5 +1176,5 @@ private constructor(
override fun hashCode(): Int = hashCode
override fun toString() =
- "BetaManagedAgentsWebFetchToolConfigParams{name=$name, allowedDomains=$allowedDomains, blockedDomains=$blockedDomains, enabled=$enabled, maxContentTokens=$maxContentTokens, permissionPolicy=$permissionPolicy, type=$type, additionalProperties=$additionalProperties}"
+ "BetaManagedAgentsWebFetchToolConfigParams{name=$name, allowedDomains=$allowedDomains, blockedDomains=$blockedDomains, enabled=$enabled, maxContentTokens=$maxContentTokens, permissionPolicy=$permissionPolicy, type=$type, urlSources=$urlSources, additionalProperties=$additionalProperties}"
}
diff --git a/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/agents/BetaManagedAgentsWebFetchUrlSourceAll.kt b/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/agents/BetaManagedAgentsWebFetchUrlSourceAll.kt
new file mode 100644
index 000000000..4885ae006
--- /dev/null
+++ b/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/agents/BetaManagedAgentsWebFetchUrlSourceAll.kt
@@ -0,0 +1,171 @@
+package com.anthropic.models.beta.agents
+
+import com.anthropic.core.ExcludeMissing
+import com.anthropic.core.JsonMissing
+import com.anthropic.core.JsonValue
+import com.anthropic.errors.AnthropicInvalidDataException
+import com.fasterxml.jackson.annotation.JsonAnyGetter
+import com.fasterxml.jackson.annotation.JsonAnySetter
+import com.fasterxml.jackson.annotation.JsonCreator
+import com.fasterxml.jackson.annotation.JsonProperty
+import java.util.Collections
+import java.util.Objects
+
+/** Every URL from this source may be fetched. This is the default. */
+class BetaManagedAgentsWebFetchUrlSourceAll
+@JsonCreator(mode = JsonCreator.Mode.DISABLED)
+private constructor(
+ private val type: JsonValue,
+ private val additionalProperties: MutableMap,
+) {
+
+ @JsonCreator
+ private constructor(
+ @JsonProperty("type") @ExcludeMissing type: JsonValue = JsonMissing.of()
+ ) : this(type, mutableMapOf())
+
+ /**
+ * Expected to always return the following:
+ * ```java
+ * JsonValue.from("all")
+ * ```
+ *
+ * However, this method can be useful for debugging and logging (e.g. if the server responded
+ * with an unexpected value).
+ */
+ @JsonProperty("type") @ExcludeMissing fun _type(): JsonValue = type
+
+ @JsonAnySetter
+ private fun putAdditionalProperty(key: String, value: JsonValue) {
+ additionalProperties.put(key, value)
+ }
+
+ @JsonAnyGetter
+ @ExcludeMissing
+ fun _additionalProperties(): Map =
+ Collections.unmodifiableMap(additionalProperties)
+
+ fun toBuilder() = Builder().from(this)
+
+ companion object {
+
+ /**
+ * Returns a mutable builder for constructing an instance of
+ * [BetaManagedAgentsWebFetchUrlSourceAll].
+ */
+ @JvmStatic fun builder() = Builder()
+ }
+
+ /** A builder for [BetaManagedAgentsWebFetchUrlSourceAll]. */
+ class Builder internal constructor() {
+
+ private var type: JsonValue = JsonValue.from("all")
+ private var additionalProperties: MutableMap = mutableMapOf()
+
+ @JvmSynthetic
+ internal fun from(
+ betaManagedAgentsWebFetchUrlSourceAll: BetaManagedAgentsWebFetchUrlSourceAll
+ ) = apply {
+ type = betaManagedAgentsWebFetchUrlSourceAll.type
+ additionalProperties =
+ betaManagedAgentsWebFetchUrlSourceAll.additionalProperties.toMutableMap()
+ }
+
+ /**
+ * Sets the field to an arbitrary JSON value.
+ *
+ * It is usually unnecessary to call this method because the field defaults to the
+ * following:
+ * ```java
+ * JsonValue.from("all")
+ * ```
+ *
+ * This method is primarily for setting the field to an undocumented or not yet supported
+ * value.
+ */
+ fun type(type: JsonValue) = apply { this.type = type }
+
+ fun additionalProperties(additionalProperties: Map) = apply {
+ this.additionalProperties.clear()
+ putAllAdditionalProperties(additionalProperties)
+ }
+
+ fun putAdditionalProperty(key: String, value: JsonValue) = apply {
+ additionalProperties.put(key, value)
+ }
+
+ fun putAllAdditionalProperties(additionalProperties: Map) = apply {
+ this.additionalProperties.putAll(additionalProperties)
+ }
+
+ fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) }
+
+ fun removeAllAdditionalProperties(keys: Set) = apply {
+ keys.forEach(::removeAdditionalProperty)
+ }
+
+ /**
+ * Returns an immutable instance of [BetaManagedAgentsWebFetchUrlSourceAll].
+ *
+ * Further updates to this [Builder] will not mutate the returned instance.
+ */
+ fun build(): BetaManagedAgentsWebFetchUrlSourceAll =
+ BetaManagedAgentsWebFetchUrlSourceAll(type, additionalProperties.toMutableMap())
+ }
+
+ private var validated: Boolean = false
+
+ /**
+ * Validates that the types of all values in this object match their expected types recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws AnthropicInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
+ fun validate(): BetaManagedAgentsWebFetchUrlSourceAll = apply {
+ if (validated) {
+ return@apply
+ }
+
+ _type().let {
+ if (it != JsonValue.from("all")) {
+ throw AnthropicInvalidDataException("'type' is invalid, received $it")
+ }
+ }
+ validated = true
+ }
+
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: AnthropicInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int = type.let { if (it == JsonValue.from("all")) 1 else 0 }
+
+ override fun equals(other: Any?): Boolean {
+ if (this === other) {
+ return true
+ }
+
+ return other is BetaManagedAgentsWebFetchUrlSourceAll &&
+ type == other.type &&
+ additionalProperties == other.additionalProperties
+ }
+
+ private val hashCode: Int by lazy { Objects.hash(type, additionalProperties) }
+
+ override fun hashCode(): Int = hashCode
+
+ override fun toString() =
+ "BetaManagedAgentsWebFetchUrlSourceAll{type=$type, additionalProperties=$additionalProperties}"
+}
diff --git a/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/agents/BetaManagedAgentsWebFetchUrlSourceExcept.kt b/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/agents/BetaManagedAgentsWebFetchUrlSourceExcept.kt
new file mode 100644
index 000000000..57f1022a7
--- /dev/null
+++ b/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/agents/BetaManagedAgentsWebFetchUrlSourceExcept.kt
@@ -0,0 +1,261 @@
+package com.anthropic.models.beta.agents
+
+import com.anthropic.core.ExcludeMissing
+import com.anthropic.core.JsonField
+import com.anthropic.core.JsonMissing
+import com.anthropic.core.JsonValue
+import com.anthropic.core.checkKnown
+import com.anthropic.core.checkRequired
+import com.anthropic.core.toImmutable
+import com.anthropic.errors.AnthropicInvalidDataException
+import com.fasterxml.jackson.annotation.JsonAnyGetter
+import com.fasterxml.jackson.annotation.JsonAnySetter
+import com.fasterxml.jackson.annotation.JsonCreator
+import com.fasterxml.jackson.annotation.JsonProperty
+import java.util.Collections
+import java.util.Objects
+import kotlin.jvm.optionals.getOrNull
+
+/** Every tool's results contribute URLs that may be fetched, except the named tools' results. */
+class BetaManagedAgentsWebFetchUrlSourceExcept
+@JsonCreator(mode = JsonCreator.Mode.DISABLED)
+private constructor(
+ private val tools: JsonField>,
+ private val type: JsonValue,
+ private val additionalProperties: MutableMap,
+) {
+
+ @JsonCreator
+ private constructor(
+ @JsonProperty("tools")
+ @ExcludeMissing
+ tools: JsonField> = JsonMissing.of(),
+ @JsonProperty("type") @ExcludeMissing type: JsonValue = JsonMissing.of(),
+ ) : this(tools, type, mutableMapOf())
+
+ /**
+ * The tools whose results do not contribute. Between 1 and 128 entries, each with a different
+ * name. An empty list is rejected; use "all" to leave out no tool's results.
+ *
+ * @throws AnthropicInvalidDataException if the JSON field has an unexpected type or is
+ * unexpectedly missing or null (e.g. if the server responded with an unexpected value).
+ */
+ fun tools(): List = tools.getRequired("tools")
+
+ /**
+ * Expected to always return the following:
+ * ```java
+ * JsonValue.from("except")
+ * ```
+ *
+ * However, this method can be useful for debugging and logging (e.g. if the server responded
+ * with an unexpected value).
+ */
+ @JsonProperty("type") @ExcludeMissing fun _type(): JsonValue = type
+
+ /**
+ * Returns the raw JSON value of [tools].
+ *
+ * Unlike [tools], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("tools")
+ @ExcludeMissing
+ fun _tools(): JsonField> = tools
+
+ @JsonAnySetter
+ private fun putAdditionalProperty(key: String, value: JsonValue) {
+ additionalProperties.put(key, value)
+ }
+
+ @JsonAnyGetter
+ @ExcludeMissing
+ fun _additionalProperties(): Map =
+ Collections.unmodifiableMap(additionalProperties)
+
+ fun toBuilder() = Builder().from(this)
+
+ companion object {
+
+ /**
+ * Returns a mutable builder for constructing an instance of
+ * [BetaManagedAgentsWebFetchUrlSourceExcept].
+ *
+ * The following fields are required:
+ * ```java
+ * .tools()
+ * ```
+ */
+ @JvmStatic fun builder() = Builder()
+
+ /**
+ * Returns an immutable instance of [BetaManagedAgentsWebFetchUrlSourceExcept] with the
+ * required [tools] set to the given value.
+ */
+ @JvmStatic
+ fun of(tools: List) =
+ builder().tools(tools).build()
+ }
+
+ /** A builder for [BetaManagedAgentsWebFetchUrlSourceExcept]. */
+ class Builder internal constructor() {
+
+ private var tools:
+ JsonField>? =
+ null
+ private var type: JsonValue = JsonValue.from("except")
+ private var additionalProperties: MutableMap = mutableMapOf()
+
+ @JvmSynthetic
+ internal fun from(
+ betaManagedAgentsWebFetchUrlSourceExcept: BetaManagedAgentsWebFetchUrlSourceExcept
+ ) = apply {
+ tools =
+ betaManagedAgentsWebFetchUrlSourceExcept.tools
+ .map { it.toMutableList() }
+ .takeUnless { it.isMissing() }
+ type = betaManagedAgentsWebFetchUrlSourceExcept.type
+ additionalProperties =
+ betaManagedAgentsWebFetchUrlSourceExcept.additionalProperties.toMutableMap()
+ }
+
+ /**
+ * The tools whose results do not contribute. Between 1 and 128 entries, each with a
+ * different name. An empty list is rejected; use "all" to leave out no tool's results.
+ */
+ fun tools(tools: List) =
+ tools(JsonField.of(tools))
+
+ /**
+ * Sets [Builder.tools] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.tools] with a well-typed
+ * `List` value instead. This method is
+ * primarily for setting the field to an undocumented or not yet supported value.
+ */
+ fun tools(tools: JsonField>) = apply {
+ this.tools = tools.map { it.toMutableList() }
+ }
+
+ /**
+ * Adds a single [BetaManagedAgentsWebFetchUrlSourceToolReference] to [tools].
+ *
+ * @throws IllegalStateException if the field was previously set to a non-list.
+ */
+ fun addTool(tool: BetaManagedAgentsWebFetchUrlSourceToolReference) = apply {
+ tools =
+ (tools ?: JsonField.of(mutableListOf())).also { checkKnown("tools", it).add(tool) }
+ }
+
+ /**
+ * Sets the field to an arbitrary JSON value.
+ *
+ * It is usually unnecessary to call this method because the field defaults to the
+ * following:
+ * ```java
+ * JsonValue.from("except")
+ * ```
+ *
+ * This method is primarily for setting the field to an undocumented or not yet supported
+ * value.
+ */
+ fun type(type: JsonValue) = apply { this.type = type }
+
+ fun additionalProperties(additionalProperties: Map) = apply {
+ this.additionalProperties.clear()
+ putAllAdditionalProperties(additionalProperties)
+ }
+
+ fun putAdditionalProperty(key: String, value: JsonValue) = apply {
+ additionalProperties.put(key, value)
+ }
+
+ fun putAllAdditionalProperties(additionalProperties: Map) = apply {
+ this.additionalProperties.putAll(additionalProperties)
+ }
+
+ fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) }
+
+ fun removeAllAdditionalProperties(keys: Set) = apply {
+ keys.forEach(::removeAdditionalProperty)
+ }
+
+ /**
+ * Returns an immutable instance of [BetaManagedAgentsWebFetchUrlSourceExcept].
+ *
+ * Further updates to this [Builder] will not mutate the returned instance.
+ *
+ * The following fields are required:
+ * ```java
+ * .tools()
+ * ```
+ *
+ * @throws IllegalStateException if any required field is unset.
+ */
+ fun build(): BetaManagedAgentsWebFetchUrlSourceExcept =
+ BetaManagedAgentsWebFetchUrlSourceExcept(
+ checkRequired("tools", tools).map { it.toImmutable() },
+ type,
+ additionalProperties.toMutableMap(),
+ )
+ }
+
+ private var validated: Boolean = false
+
+ /**
+ * Validates that the types of all values in this object match their expected types recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws AnthropicInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
+ fun validate(): BetaManagedAgentsWebFetchUrlSourceExcept = apply {
+ if (validated) {
+ return@apply
+ }
+
+ tools().forEach { it.validate() }
+ _type().let {
+ if (it != JsonValue.from("except")) {
+ throw AnthropicInvalidDataException("'type' is invalid, received $it")
+ }
+ }
+ validated = true
+ }
+
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: AnthropicInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ (tools.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) +
+ type.let { if (it == JsonValue.from("except")) 1 else 0 }
+
+ override fun equals(other: Any?): Boolean {
+ if (this === other) {
+ return true
+ }
+
+ return other is BetaManagedAgentsWebFetchUrlSourceExcept &&
+ tools == other.tools &&
+ type == other.type &&
+ additionalProperties == other.additionalProperties
+ }
+
+ private val hashCode: Int by lazy { Objects.hash(tools, type, additionalProperties) }
+
+ override fun hashCode(): Int = hashCode
+
+ override fun toString() =
+ "BetaManagedAgentsWebFetchUrlSourceExcept{tools=$tools, type=$type, additionalProperties=$additionalProperties}"
+}
diff --git a/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/agents/BetaManagedAgentsWebFetchUrlSourceNone.kt b/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/agents/BetaManagedAgentsWebFetchUrlSourceNone.kt
new file mode 100644
index 000000000..ea85956f2
--- /dev/null
+++ b/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/agents/BetaManagedAgentsWebFetchUrlSourceNone.kt
@@ -0,0 +1,171 @@
+package com.anthropic.models.beta.agents
+
+import com.anthropic.core.ExcludeMissing
+import com.anthropic.core.JsonMissing
+import com.anthropic.core.JsonValue
+import com.anthropic.errors.AnthropicInvalidDataException
+import com.fasterxml.jackson.annotation.JsonAnyGetter
+import com.fasterxml.jackson.annotation.JsonAnySetter
+import com.fasterxml.jackson.annotation.JsonCreator
+import com.fasterxml.jackson.annotation.JsonProperty
+import java.util.Collections
+import java.util.Objects
+
+/** This source contributes no URLs that may be fetched. */
+class BetaManagedAgentsWebFetchUrlSourceNone
+@JsonCreator(mode = JsonCreator.Mode.DISABLED)
+private constructor(
+ private val type: JsonValue,
+ private val additionalProperties: MutableMap,
+) {
+
+ @JsonCreator
+ private constructor(
+ @JsonProperty("type") @ExcludeMissing type: JsonValue = JsonMissing.of()
+ ) : this(type, mutableMapOf())
+
+ /**
+ * Expected to always return the following:
+ * ```java
+ * JsonValue.from("none")
+ * ```
+ *
+ * However, this method can be useful for debugging and logging (e.g. if the server responded
+ * with an unexpected value).
+ */
+ @JsonProperty("type") @ExcludeMissing fun _type(): JsonValue = type
+
+ @JsonAnySetter
+ private fun putAdditionalProperty(key: String, value: JsonValue) {
+ additionalProperties.put(key, value)
+ }
+
+ @JsonAnyGetter
+ @ExcludeMissing
+ fun _additionalProperties(): Map =
+ Collections.unmodifiableMap(additionalProperties)
+
+ fun toBuilder() = Builder().from(this)
+
+ companion object {
+
+ /**
+ * Returns a mutable builder for constructing an instance of
+ * [BetaManagedAgentsWebFetchUrlSourceNone].
+ */
+ @JvmStatic fun builder() = Builder()
+ }
+
+ /** A builder for [BetaManagedAgentsWebFetchUrlSourceNone]. */
+ class Builder internal constructor() {
+
+ private var type: JsonValue = JsonValue.from("none")
+ private var additionalProperties: MutableMap = mutableMapOf()
+
+ @JvmSynthetic
+ internal fun from(
+ betaManagedAgentsWebFetchUrlSourceNone: BetaManagedAgentsWebFetchUrlSourceNone
+ ) = apply {
+ type = betaManagedAgentsWebFetchUrlSourceNone.type
+ additionalProperties =
+ betaManagedAgentsWebFetchUrlSourceNone.additionalProperties.toMutableMap()
+ }
+
+ /**
+ * Sets the field to an arbitrary JSON value.
+ *
+ * It is usually unnecessary to call this method because the field defaults to the
+ * following:
+ * ```java
+ * JsonValue.from("none")
+ * ```
+ *
+ * This method is primarily for setting the field to an undocumented or not yet supported
+ * value.
+ */
+ fun type(type: JsonValue) = apply { this.type = type }
+
+ fun additionalProperties(additionalProperties: Map) = apply {
+ this.additionalProperties.clear()
+ putAllAdditionalProperties(additionalProperties)
+ }
+
+ fun putAdditionalProperty(key: String, value: JsonValue) = apply {
+ additionalProperties.put(key, value)
+ }
+
+ fun putAllAdditionalProperties(additionalProperties: Map) = apply {
+ this.additionalProperties.putAll(additionalProperties)
+ }
+
+ fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) }
+
+ fun removeAllAdditionalProperties(keys: Set) = apply {
+ keys.forEach(::removeAdditionalProperty)
+ }
+
+ /**
+ * Returns an immutable instance of [BetaManagedAgentsWebFetchUrlSourceNone].
+ *
+ * Further updates to this [Builder] will not mutate the returned instance.
+ */
+ fun build(): BetaManagedAgentsWebFetchUrlSourceNone =
+ BetaManagedAgentsWebFetchUrlSourceNone(type, additionalProperties.toMutableMap())
+ }
+
+ private var validated: Boolean = false
+
+ /**
+ * Validates that the types of all values in this object match their expected types recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws AnthropicInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
+ fun validate(): BetaManagedAgentsWebFetchUrlSourceNone = apply {
+ if (validated) {
+ return@apply
+ }
+
+ _type().let {
+ if (it != JsonValue.from("none")) {
+ throw AnthropicInvalidDataException("'type' is invalid, received $it")
+ }
+ }
+ validated = true
+ }
+
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: AnthropicInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int = type.let { if (it == JsonValue.from("none")) 1 else 0 }
+
+ override fun equals(other: Any?): Boolean {
+ if (this === other) {
+ return true
+ }
+
+ return other is BetaManagedAgentsWebFetchUrlSourceNone &&
+ type == other.type &&
+ additionalProperties == other.additionalProperties
+ }
+
+ private val hashCode: Int by lazy { Objects.hash(type, additionalProperties) }
+
+ override fun hashCode(): Int = hashCode
+
+ override fun toString() =
+ "BetaManagedAgentsWebFetchUrlSourceNone{type=$type, additionalProperties=$additionalProperties}"
+}
diff --git a/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/agents/BetaManagedAgentsWebFetchUrlSourceOnly.kt b/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/agents/BetaManagedAgentsWebFetchUrlSourceOnly.kt
new file mode 100644
index 000000000..a126feffa
--- /dev/null
+++ b/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/agents/BetaManagedAgentsWebFetchUrlSourceOnly.kt
@@ -0,0 +1,261 @@
+package com.anthropic.models.beta.agents
+
+import com.anthropic.core.ExcludeMissing
+import com.anthropic.core.JsonField
+import com.anthropic.core.JsonMissing
+import com.anthropic.core.JsonValue
+import com.anthropic.core.checkKnown
+import com.anthropic.core.checkRequired
+import com.anthropic.core.toImmutable
+import com.anthropic.errors.AnthropicInvalidDataException
+import com.fasterxml.jackson.annotation.JsonAnyGetter
+import com.fasterxml.jackson.annotation.JsonAnySetter
+import com.fasterxml.jackson.annotation.JsonCreator
+import com.fasterxml.jackson.annotation.JsonProperty
+import java.util.Collections
+import java.util.Objects
+import kotlin.jvm.optionals.getOrNull
+
+/** Only the named tools' results contribute URLs that may be fetched. */
+class BetaManagedAgentsWebFetchUrlSourceOnly
+@JsonCreator(mode = JsonCreator.Mode.DISABLED)
+private constructor(
+ private val tools: JsonField>,
+ private val type: JsonValue,
+ private val additionalProperties: MutableMap,
+) {
+
+ @JsonCreator
+ private constructor(
+ @JsonProperty("tools")
+ @ExcludeMissing
+ tools: JsonField> = JsonMissing.of(),
+ @JsonProperty("type") @ExcludeMissing type: JsonValue = JsonMissing.of(),
+ ) : this(tools, type, mutableMapOf())
+
+ /**
+ * The tools whose results contribute. Between 1 and 128 entries, each with a different name. An
+ * empty list is rejected; use "none" to allow no tool's results.
+ *
+ * @throws AnthropicInvalidDataException if the JSON field has an unexpected type or is
+ * unexpectedly missing or null (e.g. if the server responded with an unexpected value).
+ */
+ fun tools(): List = tools.getRequired("tools")
+
+ /**
+ * Expected to always return the following:
+ * ```java
+ * JsonValue.from("only")
+ * ```
+ *
+ * However, this method can be useful for debugging and logging (e.g. if the server responded
+ * with an unexpected value).
+ */
+ @JsonProperty("type") @ExcludeMissing fun _type(): JsonValue = type
+
+ /**
+ * Returns the raw JSON value of [tools].
+ *
+ * Unlike [tools], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("tools")
+ @ExcludeMissing
+ fun _tools(): JsonField> = tools
+
+ @JsonAnySetter
+ private fun putAdditionalProperty(key: String, value: JsonValue) {
+ additionalProperties.put(key, value)
+ }
+
+ @JsonAnyGetter
+ @ExcludeMissing
+ fun _additionalProperties(): Map =
+ Collections.unmodifiableMap(additionalProperties)
+
+ fun toBuilder() = Builder().from(this)
+
+ companion object {
+
+ /**
+ * Returns a mutable builder for constructing an instance of
+ * [BetaManagedAgentsWebFetchUrlSourceOnly].
+ *
+ * The following fields are required:
+ * ```java
+ * .tools()
+ * ```
+ */
+ @JvmStatic fun builder() = Builder()
+
+ /**
+ * Returns an immutable instance of [BetaManagedAgentsWebFetchUrlSourceOnly] with the
+ * required [tools] set to the given value.
+ */
+ @JvmStatic
+ fun of(tools: List) =
+ builder().tools(tools).build()
+ }
+
+ /** A builder for [BetaManagedAgentsWebFetchUrlSourceOnly]. */
+ class Builder internal constructor() {
+
+ private var tools:
+ JsonField>? =
+ null
+ private var type: JsonValue = JsonValue.from("only")
+ private var additionalProperties: MutableMap = mutableMapOf()
+
+ @JvmSynthetic
+ internal fun from(
+ betaManagedAgentsWebFetchUrlSourceOnly: BetaManagedAgentsWebFetchUrlSourceOnly
+ ) = apply {
+ tools =
+ betaManagedAgentsWebFetchUrlSourceOnly.tools
+ .map { it.toMutableList() }
+ .takeUnless { it.isMissing() }
+ type = betaManagedAgentsWebFetchUrlSourceOnly.type
+ additionalProperties =
+ betaManagedAgentsWebFetchUrlSourceOnly.additionalProperties.toMutableMap()
+ }
+
+ /**
+ * The tools whose results contribute. Between 1 and 128 entries, each with a different
+ * name. An empty list is rejected; use "none" to allow no tool's results.
+ */
+ fun tools(tools: List) =
+ tools(JsonField.of(tools))
+
+ /**
+ * Sets [Builder.tools] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.tools] with a well-typed
+ * `List` value instead. This method is
+ * primarily for setting the field to an undocumented or not yet supported value.
+ */
+ fun tools(tools: JsonField>) = apply {
+ this.tools = tools.map { it.toMutableList() }
+ }
+
+ /**
+ * Adds a single [BetaManagedAgentsWebFetchUrlSourceToolReference] to [tools].
+ *
+ * @throws IllegalStateException if the field was previously set to a non-list.
+ */
+ fun addTool(tool: BetaManagedAgentsWebFetchUrlSourceToolReference) = apply {
+ tools =
+ (tools ?: JsonField.of(mutableListOf())).also { checkKnown("tools", it).add(tool) }
+ }
+
+ /**
+ * Sets the field to an arbitrary JSON value.
+ *
+ * It is usually unnecessary to call this method because the field defaults to the
+ * following:
+ * ```java
+ * JsonValue.from("only")
+ * ```
+ *
+ * This method is primarily for setting the field to an undocumented or not yet supported
+ * value.
+ */
+ fun type(type: JsonValue) = apply { this.type = type }
+
+ fun additionalProperties(additionalProperties: Map) = apply {
+ this.additionalProperties.clear()
+ putAllAdditionalProperties(additionalProperties)
+ }
+
+ fun putAdditionalProperty(key: String, value: JsonValue) = apply {
+ additionalProperties.put(key, value)
+ }
+
+ fun putAllAdditionalProperties(additionalProperties: Map) = apply {
+ this.additionalProperties.putAll(additionalProperties)
+ }
+
+ fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) }
+
+ fun removeAllAdditionalProperties(keys: Set) = apply {
+ keys.forEach(::removeAdditionalProperty)
+ }
+
+ /**
+ * Returns an immutable instance of [BetaManagedAgentsWebFetchUrlSourceOnly].
+ *
+ * Further updates to this [Builder] will not mutate the returned instance.
+ *
+ * The following fields are required:
+ * ```java
+ * .tools()
+ * ```
+ *
+ * @throws IllegalStateException if any required field is unset.
+ */
+ fun build(): BetaManagedAgentsWebFetchUrlSourceOnly =
+ BetaManagedAgentsWebFetchUrlSourceOnly(
+ checkRequired("tools", tools).map { it.toImmutable() },
+ type,
+ additionalProperties.toMutableMap(),
+ )
+ }
+
+ private var validated: Boolean = false
+
+ /**
+ * Validates that the types of all values in this object match their expected types recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws AnthropicInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
+ fun validate(): BetaManagedAgentsWebFetchUrlSourceOnly = apply {
+ if (validated) {
+ return@apply
+ }
+
+ tools().forEach { it.validate() }
+ _type().let {
+ if (it != JsonValue.from("only")) {
+ throw AnthropicInvalidDataException("'type' is invalid, received $it")
+ }
+ }
+ validated = true
+ }
+
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: AnthropicInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ (tools.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) +
+ type.let { if (it == JsonValue.from("only")) 1 else 0 }
+
+ override fun equals(other: Any?): Boolean {
+ if (this === other) {
+ return true
+ }
+
+ return other is BetaManagedAgentsWebFetchUrlSourceOnly &&
+ tools == other.tools &&
+ type == other.type &&
+ additionalProperties == other.additionalProperties
+ }
+
+ private val hashCode: Int by lazy { Objects.hash(tools, type, additionalProperties) }
+
+ override fun hashCode(): Int = hashCode
+
+ override fun toString() =
+ "BetaManagedAgentsWebFetchUrlSourceOnly{tools=$tools, type=$type, additionalProperties=$additionalProperties}"
+}
diff --git a/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/agents/BetaManagedAgentsWebFetchUrlSourceShorthand.kt b/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/agents/BetaManagedAgentsWebFetchUrlSourceShorthand.kt
new file mode 100644
index 000000000..80c4118ac
--- /dev/null
+++ b/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/agents/BetaManagedAgentsWebFetchUrlSourceShorthand.kt
@@ -0,0 +1,163 @@
+package com.anthropic.models.beta.agents
+
+import com.anthropic.core.Enum
+import com.anthropic.core.JsonField
+import com.anthropic.errors.AnthropicInvalidDataException
+import com.fasterxml.jackson.annotation.JsonCreator
+import kotlin.jvm.optionals.getOrNull
+
+/**
+ * String form of a url_sources value that has no field other than its type: "all" means {"type":
+ * "all"} and "none" means {"type": "none"}.
+ */
+class BetaManagedAgentsWebFetchUrlSourceShorthand
+private constructor(private val value: JsonField) : Enum {
+
+ /**
+ * Returns this class instance's raw value.
+ *
+ * This is usually only useful if this instance was deserialized from data that doesn't match
+ * any known member, and you want to know that value. For example, if the SDK is on an older
+ * version than the API, then the API may respond with new members that the SDK is unaware of.
+ */
+ @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value
+
+ companion object {
+
+ @JvmField val ALL = BetaManagedAgentsWebFetchUrlSourceShorthand(JsonField.of("all"))
+
+ @JvmField val NONE = BetaManagedAgentsWebFetchUrlSourceShorthand(JsonField.of("none"))
+
+ @JvmStatic
+ fun of(value: String): BetaManagedAgentsWebFetchUrlSourceShorthand =
+ // Intern known values so `==` works
+ when (value) {
+ "all" -> ALL
+ "none" -> NONE
+ else -> BetaManagedAgentsWebFetchUrlSourceShorthand(JsonField.of(value))
+ }
+
+ @JsonCreator
+ @JvmStatic
+ fun of(value: JsonField): BetaManagedAgentsWebFetchUrlSourceShorthand =
+ value.asString().getOrNull()?.let { of(it) }
+ ?: BetaManagedAgentsWebFetchUrlSourceShorthand(value)
+ }
+
+ /** An enum containing [BetaManagedAgentsWebFetchUrlSourceShorthand]'s known values. */
+ enum class Known {
+ ALL,
+ NONE,
+ }
+
+ /**
+ * An enum containing [BetaManagedAgentsWebFetchUrlSourceShorthand]'s known values, as well as
+ * an [_UNKNOWN] member.
+ *
+ * An instance of [BetaManagedAgentsWebFetchUrlSourceShorthand] can contain an unknown value in
+ * a couple of cases:
+ * - It was deserialized from data that doesn't match any known member. For example, if the SDK
+ * is on an older version than the API, then the API may respond with new members that the SDK
+ * is unaware of.
+ * - It was constructed with an arbitrary value using the [of] method.
+ */
+ enum class Value {
+ ALL,
+ NONE,
+ /**
+ * An enum member indicating that [BetaManagedAgentsWebFetchUrlSourceShorthand] was
+ * instantiated with an unknown value.
+ */
+ _UNKNOWN,
+ }
+
+ /**
+ * Returns an enum member corresponding to this class instance's value, or [Value._UNKNOWN] if
+ * the class was instantiated with an unknown value.
+ *
+ * Use the [known] method instead if you're certain the value is always known or if you want to
+ * throw for the unknown case.
+ */
+ fun value(): Value =
+ when (this) {
+ ALL -> Value.ALL
+ NONE -> Value.NONE
+ else -> Value._UNKNOWN
+ }
+
+ /**
+ * Returns an enum member corresponding to this class instance's value.
+ *
+ * Use the [value] method instead if you're uncertain the value is always known and don't want
+ * to throw for the unknown case.
+ *
+ * @throws AnthropicInvalidDataException if this class instance's value is a not a known member.
+ */
+ fun known(): Known =
+ when (this) {
+ ALL -> Known.ALL
+ NONE -> Known.NONE
+ else ->
+ throw AnthropicInvalidDataException(
+ "Unknown BetaManagedAgentsWebFetchUrlSourceShorthand: $value"
+ )
+ }
+
+ /**
+ * Returns this class instance's primitive wire representation.
+ *
+ * This differs from the [toString] method because that method is primarily for debugging and
+ * generally doesn't throw.
+ *
+ * @throws AnthropicInvalidDataException if this class instance's value does not have the
+ * expected primitive type.
+ */
+ fun asString(): String =
+ _value().asString().orElseThrow { AnthropicInvalidDataException("Value is not a String") }
+
+ private var validated: Boolean = false
+
+ /**
+ * Validates that the types of all values in this object match their expected types recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws AnthropicInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
+ fun validate(): BetaManagedAgentsWebFetchUrlSourceShorthand = apply {
+ if (validated) {
+ return@apply
+ }
+
+ known()
+ validated = true
+ }
+
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: AnthropicInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1
+
+ override fun equals(other: Any?): Boolean {
+ if (this === other) {
+ return true
+ }
+
+ return other is BetaManagedAgentsWebFetchUrlSourceShorthand && value == other.value
+ }
+
+ override fun hashCode() = value.hashCode()
+
+ override fun toString() = value.toString()
+}
diff --git a/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/agents/BetaManagedAgentsWebFetchUrlSourceToolFilter.kt b/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/agents/BetaManagedAgentsWebFetchUrlSourceToolFilter.kt
new file mode 100644
index 000000000..13d469af1
--- /dev/null
+++ b/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/agents/BetaManagedAgentsWebFetchUrlSourceToolFilter.kt
@@ -0,0 +1,529 @@
+package com.anthropic.models.beta.agents
+
+import com.anthropic.core.BaseDeserializer
+import com.anthropic.core.BaseSerializer
+import com.anthropic.core.Enum
+import com.anthropic.core.JsonField
+import com.anthropic.core.JsonMissing
+import com.anthropic.core.JsonValue
+import com.anthropic.core.getOrThrow
+import com.anthropic.core.getProperty
+import com.anthropic.errors.AnthropicInvalidDataException
+import com.fasterxml.jackson.annotation.JsonCreator
+import com.fasterxml.jackson.core.JsonGenerator
+import com.fasterxml.jackson.core.ObjectCodec
+import com.fasterxml.jackson.databind.JsonNode
+import com.fasterxml.jackson.databind.SerializerProvider
+import com.fasterxml.jackson.databind.annotation.JsonDeserialize
+import com.fasterxml.jackson.databind.annotation.JsonSerialize
+import com.fasterxml.jackson.module.kotlin.jacksonTypeRef
+import java.util.Objects
+import java.util.Optional
+import kotlin.jvm.optionals.getOrNull
+
+/** Which tools' results contribute URLs that may be fetched. */
+@JsonDeserialize(using = BetaManagedAgentsWebFetchUrlSourceToolFilter.Deserializer::class)
+@JsonSerialize(using = BetaManagedAgentsWebFetchUrlSourceToolFilter.Serializer::class)
+class BetaManagedAgentsWebFetchUrlSourceToolFilter
+private constructor(
+ private val all: BetaManagedAgentsWebFetchUrlSourceAll? = null,
+ private val none: BetaManagedAgentsWebFetchUrlSourceNone? = null,
+ private val only: BetaManagedAgentsWebFetchUrlSourceOnly? = null,
+ private val except: BetaManagedAgentsWebFetchUrlSourceExcept? = null,
+ private val _json: JsonValue? = null,
+) {
+
+ fun type(): Type =
+ when {
+ all != null -> Type.ALL
+ none != null -> Type.NONE
+ only != null -> Type.ONLY
+ except != null -> Type.EXCEPT
+ else -> Type.of(_json?.asObject()?.getOrNull()?.get("type") ?: JsonMissing.of())
+ }
+
+ fun tools(): Optional> =
+ when {
+ all != null -> Optional.empty()
+ none != null -> Optional.empty()
+ only != null -> Optional.of(only.tools())
+ except != null -> Optional.of(except.tools())
+ else ->
+ _json
+ .getProperty>("tools")
+ .asKnown()
+ }
+
+ /** Every URL from this source may be fetched. This is the default. */
+ fun all(): Optional = Optional.ofNullable(all)
+
+ /** This source contributes no URLs that may be fetched. */
+ fun none(): Optional = Optional.ofNullable(none)
+
+ /** Only the named tools' results contribute URLs that may be fetched. */
+ fun only(): Optional = Optional.ofNullable(only)
+
+ /**
+ * Every tool's results contribute URLs that may be fetched, except the named tools' results.
+ */
+ fun except(): Optional = Optional.ofNullable(except)
+
+ fun isAll(): Boolean = all != null
+
+ fun isNone(): Boolean = none != null
+
+ fun isOnly(): Boolean = only != null
+
+ fun isExcept(): Boolean = except != null
+
+ /** Every URL from this source may be fetched. This is the default. */
+ fun asAll(): BetaManagedAgentsWebFetchUrlSourceAll = all.getOrThrow("all")
+
+ /** This source contributes no URLs that may be fetched. */
+ fun asNone(): BetaManagedAgentsWebFetchUrlSourceNone = none.getOrThrow("none")
+
+ /** Only the named tools' results contribute URLs that may be fetched. */
+ fun asOnly(): BetaManagedAgentsWebFetchUrlSourceOnly = only.getOrThrow("only")
+
+ /**
+ * Every tool's results contribute URLs that may be fetched, except the named tools' results.
+ */
+ fun asExcept(): BetaManagedAgentsWebFetchUrlSourceExcept = except.getOrThrow("except")
+
+ fun _json(): Optional = Optional.ofNullable(_json)
+
+ /**
+ * Maps this instance's current variant to a value of type [T] using the given [visitor].
+ *
+ * Note that this method is _not_ forwards compatible with new variants from the API, unless
+ * [visitor] overrides [Visitor.unknown]. To handle variants not known to this version of the
+ * SDK gracefully, consider overriding [Visitor.unknown]:
+ * ```java
+ * import com.anthropic.core.JsonValue;
+ * import java.util.Optional;
+ *
+ * Optional result = betaManagedAgentsWebFetchUrlSourceToolFilter.accept(new BetaManagedAgentsWebFetchUrlSourceToolFilter.Visitor>() {
+ * @Override
+ * public Optional visitAll(BetaManagedAgentsWebFetchUrlSourceAll all) {
+ * return Optional.of(all.toString());
+ * }
+ *
+ * // ...
+ *
+ * @Override
+ * public Optional unknown(JsonValue json) {
+ * // Or inspect the `json`.
+ * return Optional.empty();
+ * }
+ * });
+ * ```
+ *
+ * @throws AnthropicInvalidDataException if [Visitor.unknown] is not overridden in [visitor] and
+ * the current variant is unknown.
+ */
+ fun accept(visitor: Visitor): T =
+ when {
+ all != null -> visitor.visitAll(all)
+ none != null -> visitor.visitNone(none)
+ only != null -> visitor.visitOnly(only)
+ except != null -> visitor.visitExcept(except)
+ else -> visitor.unknown(_json)
+ }
+
+ private var validated: Boolean = false
+
+ /**
+ * Validates that the types of all values in this object match their expected types recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws AnthropicInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
+ fun validate(): BetaManagedAgentsWebFetchUrlSourceToolFilter = apply {
+ if (validated) {
+ return@apply
+ }
+
+ when {
+ all != null -> all.validate()
+ none != null -> none.validate()
+ only != null -> only.validate()
+ except != null -> except.validate()
+ else ->
+ throw AnthropicInvalidDataException(
+ "Unknown BetaManagedAgentsWebFetchUrlSourceToolFilter: $_json"
+ )
+ }
+ validated = true
+ }
+
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: AnthropicInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ when {
+ all != null -> all.validity()
+ none != null -> none.validity()
+ only != null -> only.validity()
+ except != null -> except.validity()
+ else -> 0
+ }
+
+ override fun equals(other: Any?): Boolean {
+ if (this === other) {
+ return true
+ }
+
+ return other is BetaManagedAgentsWebFetchUrlSourceToolFilter &&
+ all == other.all &&
+ none == other.none &&
+ only == other.only &&
+ except == other.except
+ }
+
+ override fun hashCode(): Int = Objects.hash(all, none, only, except)
+
+ override fun toString(): String =
+ when {
+ all != null -> "BetaManagedAgentsWebFetchUrlSourceToolFilter{all=$all}"
+ none != null -> "BetaManagedAgentsWebFetchUrlSourceToolFilter{none=$none}"
+ only != null -> "BetaManagedAgentsWebFetchUrlSourceToolFilter{only=$only}"
+ except != null -> "BetaManagedAgentsWebFetchUrlSourceToolFilter{except=$except}"
+ _json != null -> "BetaManagedAgentsWebFetchUrlSourceToolFilter{_unknown=$_json}"
+ else ->
+ throw IllegalStateException("Invalid BetaManagedAgentsWebFetchUrlSourceToolFilter")
+ }
+
+ companion object {
+
+ /** Every URL from this source may be fetched. This is the default. */
+ @JvmStatic
+ fun ofAll(all: BetaManagedAgentsWebFetchUrlSourceAll) =
+ BetaManagedAgentsWebFetchUrlSourceToolFilter(all = all)
+
+ /** This source contributes no URLs that may be fetched. */
+ @JvmStatic
+ fun ofNone(none: BetaManagedAgentsWebFetchUrlSourceNone) =
+ BetaManagedAgentsWebFetchUrlSourceToolFilter(none = none)
+
+ /** Only the named tools' results contribute URLs that may be fetched. */
+ @JvmStatic
+ fun ofOnly(only: BetaManagedAgentsWebFetchUrlSourceOnly) =
+ BetaManagedAgentsWebFetchUrlSourceToolFilter(only = only)
+
+ /**
+ * Returns an immutable instance of [BetaManagedAgentsWebFetchUrlSourceToolFilter] whose
+ * [ofOnly] variant is built from the given required [tools].
+ */
+ @JvmStatic
+ fun ofOnly(tools: List) =
+ ofOnly(BetaManagedAgentsWebFetchUrlSourceOnly.of(tools))
+
+ /**
+ * Every tool's results contribute URLs that may be fetched, except the named tools'
+ * results.
+ */
+ @JvmStatic
+ fun ofExcept(except: BetaManagedAgentsWebFetchUrlSourceExcept) =
+ BetaManagedAgentsWebFetchUrlSourceToolFilter(except = except)
+
+ /**
+ * Returns an immutable instance of [BetaManagedAgentsWebFetchUrlSourceToolFilter] whose
+ * [ofExcept] variant is built from the given required [tools].
+ */
+ @JvmStatic
+ fun ofExcept(tools: List) =
+ ofExcept(BetaManagedAgentsWebFetchUrlSourceExcept.of(tools))
+ }
+
+ /**
+ * An interface that defines how to map each variant of
+ * [BetaManagedAgentsWebFetchUrlSourceToolFilter] to a value of type [T].
+ */
+ interface Visitor {
+
+ /** Every URL from this source may be fetched. This is the default. */
+ fun visitAll(all: BetaManagedAgentsWebFetchUrlSourceAll): T
+
+ /** This source contributes no URLs that may be fetched. */
+ fun visitNone(none: BetaManagedAgentsWebFetchUrlSourceNone): T
+
+ /** Only the named tools' results contribute URLs that may be fetched. */
+ fun visitOnly(only: BetaManagedAgentsWebFetchUrlSourceOnly): T
+
+ /**
+ * Every tool's results contribute URLs that may be fetched, except the named tools'
+ * results.
+ */
+ fun visitExcept(except: BetaManagedAgentsWebFetchUrlSourceExcept): T
+
+ /**
+ * Maps an unknown variant of [BetaManagedAgentsWebFetchUrlSourceToolFilter] to a value of
+ * type [T].
+ *
+ * An instance of [BetaManagedAgentsWebFetchUrlSourceToolFilter] can contain an unknown
+ * variant if it was deserialized from data that doesn't match any known variant. For
+ * example, if the SDK is on an older version than the API, then the API may respond with
+ * new variants that the SDK is unaware of.
+ *
+ * @throws AnthropicInvalidDataException in the default implementation.
+ */
+ fun unknown(json: JsonValue?): T {
+ throw AnthropicInvalidDataException(
+ "Unknown BetaManagedAgentsWebFetchUrlSourceToolFilter: $json"
+ )
+ }
+ }
+
+ internal class Deserializer :
+ BaseDeserializer(
+ BetaManagedAgentsWebFetchUrlSourceToolFilter::class
+ ) {
+
+ override fun ObjectCodec.deserialize(
+ node: JsonNode
+ ): BetaManagedAgentsWebFetchUrlSourceToolFilter {
+ val json = JsonValue.fromJsonNode(node)
+ val type = json.asObject().getOrNull()?.get("type")?.asString()?.getOrNull()
+
+ when (type) {
+ "all" -> {
+ return tryDeserialize(
+ node,
+ jacksonTypeRef(),
+ )
+ ?.let {
+ BetaManagedAgentsWebFetchUrlSourceToolFilter(all = it, _json = json)
+ } ?: BetaManagedAgentsWebFetchUrlSourceToolFilter(_json = json)
+ }
+ "none" -> {
+ return tryDeserialize(
+ node,
+ jacksonTypeRef(),
+ )
+ ?.let {
+ BetaManagedAgentsWebFetchUrlSourceToolFilter(none = it, _json = json)
+ } ?: BetaManagedAgentsWebFetchUrlSourceToolFilter(_json = json)
+ }
+ "only" -> {
+ return tryDeserialize(
+ node,
+ jacksonTypeRef(),
+ )
+ ?.let {
+ BetaManagedAgentsWebFetchUrlSourceToolFilter(only = it, _json = json)
+ } ?: BetaManagedAgentsWebFetchUrlSourceToolFilter(_json = json)
+ }
+ "except" -> {
+ return tryDeserialize(
+ node,
+ jacksonTypeRef(),
+ )
+ ?.let {
+ BetaManagedAgentsWebFetchUrlSourceToolFilter(except = it, _json = json)
+ } ?: BetaManagedAgentsWebFetchUrlSourceToolFilter(_json = json)
+ }
+ }
+
+ return BetaManagedAgentsWebFetchUrlSourceToolFilter(_json = json)
+ }
+ }
+
+ internal class Serializer :
+ BaseSerializer(
+ BetaManagedAgentsWebFetchUrlSourceToolFilter::class
+ ) {
+
+ override fun serialize(
+ value: BetaManagedAgentsWebFetchUrlSourceToolFilter,
+ generator: JsonGenerator,
+ provider: SerializerProvider,
+ ) {
+ when {
+ value.all != null -> generator.writeObject(value.all)
+ value.none != null -> generator.writeObject(value.none)
+ value.only != null -> generator.writeObject(value.only)
+ value.except != null -> generator.writeObject(value.except)
+ value._json != null -> generator.writeObject(value._json)
+ else ->
+ throw IllegalStateException(
+ "Invalid BetaManagedAgentsWebFetchUrlSourceToolFilter"
+ )
+ }
+ }
+ }
+
+ class Type private constructor(private val value: JsonField) : Enum {
+
+ /**
+ * Returns this class instance's raw value.
+ *
+ * This is usually only useful if this instance was deserialized from data that doesn't
+ * match any known member, and you want to know that value. For example, if the SDK is on an
+ * older version than the API, then the API may respond with new members that the SDK is
+ * unaware of.
+ */
+ @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value
+
+ companion object {
+
+ @JvmField val ALL = Type(JsonField.of("all"))
+
+ @JvmField val NONE = Type(JsonField.of("none"))
+
+ @JvmField val ONLY = Type(JsonField.of("only"))
+
+ @JvmField val EXCEPT = Type(JsonField.of("except"))
+
+ @JvmStatic
+ fun of(value: String): Type =
+ // Intern known values so `==` works
+ when (value) {
+ "all" -> ALL
+ "none" -> NONE
+ "only" -> ONLY
+ "except" -> EXCEPT
+ else -> Type(JsonField.of(value))
+ }
+
+ @JsonCreator
+ @JvmStatic
+ fun of(value: JsonField): Type =
+ value.asString().getOrNull()?.let { of(it) } ?: Type(value)
+ }
+
+ /** An enum containing [Type]'s known values. */
+ enum class Known {
+ ALL,
+ NONE,
+ ONLY,
+ EXCEPT,
+ }
+
+ /**
+ * An enum containing [Type]'s known values, as well as an [_UNKNOWN] member.
+ *
+ * An instance of [Type] can contain an unknown value in a couple of cases:
+ * - It was deserialized from data that doesn't match any known member. For example, if the
+ * SDK is on an older version than the API, then the API may respond with new members that
+ * the SDK is unaware of.
+ * - It was constructed with an arbitrary value using the [of] method.
+ */
+ enum class Value {
+ ALL,
+ NONE,
+ ONLY,
+ EXCEPT,
+ /** An enum member indicating that [Type] was instantiated with an unknown value. */
+ _UNKNOWN,
+ }
+
+ /**
+ * Returns an enum member corresponding to this class instance's value, or [Value._UNKNOWN]
+ * if the class was instantiated with an unknown value.
+ *
+ * Use the [known] method instead if you're certain the value is always known or if you want
+ * to throw for the unknown case.
+ */
+ fun value(): Value =
+ when (this) {
+ ALL -> Value.ALL
+ NONE -> Value.NONE
+ ONLY -> Value.ONLY
+ EXCEPT -> Value.EXCEPT
+ else -> Value._UNKNOWN
+ }
+
+ /**
+ * Returns an enum member corresponding to this class instance's value.
+ *
+ * Use the [value] method instead if you're uncertain the value is always known and don't
+ * want to throw for the unknown case.
+ *
+ * @throws AnthropicInvalidDataException if this class instance's value is a not a known
+ * member.
+ */
+ fun known(): Known =
+ when (this) {
+ ALL -> Known.ALL
+ NONE -> Known.NONE
+ ONLY -> Known.ONLY
+ EXCEPT -> Known.EXCEPT
+ else -> throw AnthropicInvalidDataException("Unknown Type: $value")
+ }
+
+ /**
+ * Returns this class instance's primitive wire representation.
+ *
+ * This differs from the [toString] method because that method is primarily for debugging
+ * and generally doesn't throw.
+ *
+ * @throws AnthropicInvalidDataException if this class instance's value does not have the
+ * expected primitive type.
+ */
+ fun asString(): String =
+ _value().asString().orElseThrow {
+ AnthropicInvalidDataException("Value is not a String")
+ }
+
+ private var validated: Boolean = false
+
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws AnthropicInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
+ fun validate(): Type = apply {
+ if (validated) {
+ return@apply
+ }
+
+ known()
+ validated = true
+ }
+
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: AnthropicInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1
+
+ override fun equals(other: Any?): Boolean {
+ if (this === other) {
+ return true
+ }
+
+ return other is Type && value == other.value
+ }
+
+ override fun hashCode() = value.hashCode()
+
+ override fun toString() = value.toString()
+ }
+}
diff --git a/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/agents/BetaManagedAgentsWebFetchUrlSourceToolFilterParams.kt b/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/agents/BetaManagedAgentsWebFetchUrlSourceToolFilterParams.kt
new file mode 100644
index 000000000..6fa59879c
--- /dev/null
+++ b/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/agents/BetaManagedAgentsWebFetchUrlSourceToolFilterParams.kt
@@ -0,0 +1,310 @@
+package com.anthropic.models.beta.agents
+
+import com.anthropic.core.BaseDeserializer
+import com.anthropic.core.BaseSerializer
+import com.anthropic.core.JsonValue
+import com.anthropic.core.allMaxBy
+import com.anthropic.core.getOrThrow
+import com.anthropic.errors.AnthropicInvalidDataException
+import com.fasterxml.jackson.core.JsonGenerator
+import com.fasterxml.jackson.core.ObjectCodec
+import com.fasterxml.jackson.databind.JsonNode
+import com.fasterxml.jackson.databind.SerializerProvider
+import com.fasterxml.jackson.databind.annotation.JsonDeserialize
+import com.fasterxml.jackson.databind.annotation.JsonSerialize
+import com.fasterxml.jackson.module.kotlin.jacksonTypeRef
+import java.util.Objects
+import java.util.Optional
+
+/**
+ * Which tools' results contribute URLs that may be fetched. Accepts the string "all" or "none", or
+ * an object whose type is "all", "none", "only" or "except". Responses use the object form.
+ */
+@JsonDeserialize(using = BetaManagedAgentsWebFetchUrlSourceToolFilterParams.Deserializer::class)
+@JsonSerialize(using = BetaManagedAgentsWebFetchUrlSourceToolFilterParams.Serializer::class)
+class BetaManagedAgentsWebFetchUrlSourceToolFilterParams
+private constructor(
+ private val shorthand: BetaManagedAgentsWebFetchUrlSourceShorthand? = null,
+ private val betaManagedAgentsWebFetchUrlSourceToolFilter:
+ BetaManagedAgentsWebFetchUrlSourceToolFilter? =
+ null,
+ private val _json: JsonValue? = null,
+) {
+
+ /**
+ * String form of a url_sources value that has no field other than its type: "all" means
+ * {"type": "all"} and "none" means {"type": "none"}.
+ */
+ fun shorthand(): Optional =
+ Optional.ofNullable(shorthand)
+
+ /** Which tools' results contribute URLs that may be fetched. */
+ fun betaManagedAgentsWebFetchUrlSourceToolFilter():
+ Optional =
+ Optional.ofNullable(betaManagedAgentsWebFetchUrlSourceToolFilter)
+
+ fun isShorthand(): Boolean = shorthand != null
+
+ fun isBetaManagedAgentsWebFetchUrlSourceToolFilter(): Boolean =
+ betaManagedAgentsWebFetchUrlSourceToolFilter != null
+
+ /**
+ * String form of a url_sources value that has no field other than its type: "all" means
+ * {"type": "all"} and "none" means {"type": "none"}.
+ */
+ fun asShorthand(): BetaManagedAgentsWebFetchUrlSourceShorthand =
+ shorthand.getOrThrow("shorthand")
+
+ /** Which tools' results contribute URLs that may be fetched. */
+ fun asBetaManagedAgentsWebFetchUrlSourceToolFilter():
+ BetaManagedAgentsWebFetchUrlSourceToolFilter =
+ betaManagedAgentsWebFetchUrlSourceToolFilter.getOrThrow(
+ "betaManagedAgentsWebFetchUrlSourceToolFilter"
+ )
+
+ fun _json(): Optional = Optional.ofNullable(_json)
+
+ /**
+ * Maps this instance's current variant to a value of type [T] using the given [visitor].
+ *
+ * Note that this method is _not_ forwards compatible with new variants from the API, unless
+ * [visitor] overrides [Visitor.unknown]. To handle variants not known to this version of the
+ * SDK gracefully, consider overriding [Visitor.unknown]:
+ * ```java
+ * import com.anthropic.core.JsonValue;
+ * import java.util.Optional;
+ *
+ * Optional result = betaManagedAgentsWebFetchUrlSourceToolFilterParams.accept(new BetaManagedAgentsWebFetchUrlSourceToolFilterParams.Visitor>() {
+ * @Override
+ * public Optional visitShorthand(BetaManagedAgentsWebFetchUrlSourceShorthand shorthand) {
+ * return Optional.of(shorthand.toString());
+ * }
+ *
+ * // ...
+ *
+ * @Override
+ * public Optional unknown(JsonValue json) {
+ * // Or inspect the `json`.
+ * return Optional.empty();
+ * }
+ * });
+ * ```
+ *
+ * @throws AnthropicInvalidDataException if [Visitor.unknown] is not overridden in [visitor] and
+ * the current variant is unknown.
+ */
+ fun accept(visitor: Visitor): T =
+ when {
+ shorthand != null -> visitor.visitShorthand(shorthand)
+ betaManagedAgentsWebFetchUrlSourceToolFilter != null ->
+ visitor.visitBetaManagedAgentsWebFetchUrlSourceToolFilter(
+ betaManagedAgentsWebFetchUrlSourceToolFilter
+ )
+ else -> visitor.unknown(_json)
+ }
+
+ private var validated: Boolean = false
+
+ /**
+ * Validates that the types of all values in this object match their expected types recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws AnthropicInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
+ fun validate(): BetaManagedAgentsWebFetchUrlSourceToolFilterParams = apply {
+ if (validated) {
+ return@apply
+ }
+
+ when {
+ shorthand != null -> shorthand.validate()
+ betaManagedAgentsWebFetchUrlSourceToolFilter != null ->
+ betaManagedAgentsWebFetchUrlSourceToolFilter.validate()
+ else ->
+ throw AnthropicInvalidDataException(
+ "Unknown BetaManagedAgentsWebFetchUrlSourceToolFilterParams: $_json"
+ )
+ }
+ validated = true
+ }
+
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: AnthropicInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ when {
+ shorthand != null -> shorthand.validity()
+ betaManagedAgentsWebFetchUrlSourceToolFilter != null ->
+ betaManagedAgentsWebFetchUrlSourceToolFilter.validity()
+ else -> 0
+ }
+
+ override fun equals(other: Any?): Boolean {
+ if (this === other) {
+ return true
+ }
+
+ return other is BetaManagedAgentsWebFetchUrlSourceToolFilterParams &&
+ shorthand == other.shorthand &&
+ betaManagedAgentsWebFetchUrlSourceToolFilter ==
+ other.betaManagedAgentsWebFetchUrlSourceToolFilter
+ }
+
+ override fun hashCode(): Int =
+ Objects.hash(shorthand, betaManagedAgentsWebFetchUrlSourceToolFilter)
+
+ override fun toString(): String =
+ when {
+ shorthand != null ->
+ "BetaManagedAgentsWebFetchUrlSourceToolFilterParams{shorthand=$shorthand}"
+ betaManagedAgentsWebFetchUrlSourceToolFilter != null ->
+ "BetaManagedAgentsWebFetchUrlSourceToolFilterParams{betaManagedAgentsWebFetchUrlSourceToolFilter=$betaManagedAgentsWebFetchUrlSourceToolFilter}"
+ _json != null -> "BetaManagedAgentsWebFetchUrlSourceToolFilterParams{_unknown=$_json}"
+ else ->
+ throw IllegalStateException(
+ "Invalid BetaManagedAgentsWebFetchUrlSourceToolFilterParams"
+ )
+ }
+
+ companion object {
+
+ /**
+ * String form of a url_sources value that has no field other than its type: "all" means
+ * {"type": "all"} and "none" means {"type": "none"}.
+ */
+ @JvmStatic
+ fun ofShorthand(shorthand: BetaManagedAgentsWebFetchUrlSourceShorthand) =
+ BetaManagedAgentsWebFetchUrlSourceToolFilterParams(shorthand = shorthand)
+
+ /** Which tools' results contribute URLs that may be fetched. */
+ @JvmStatic
+ fun ofBetaManagedAgentsWebFetchUrlSourceToolFilter(
+ betaManagedAgentsWebFetchUrlSourceToolFilter:
+ BetaManagedAgentsWebFetchUrlSourceToolFilter
+ ) =
+ BetaManagedAgentsWebFetchUrlSourceToolFilterParams(
+ betaManagedAgentsWebFetchUrlSourceToolFilter =
+ betaManagedAgentsWebFetchUrlSourceToolFilter
+ )
+ }
+
+ /**
+ * An interface that defines how to map each variant of
+ * [BetaManagedAgentsWebFetchUrlSourceToolFilterParams] to a value of type [T].
+ */
+ interface Visitor {
+
+ /**
+ * String form of a url_sources value that has no field other than its type: "all" means
+ * {"type": "all"} and "none" means {"type": "none"}.
+ */
+ fun visitShorthand(shorthand: BetaManagedAgentsWebFetchUrlSourceShorthand): T
+
+ /** Which tools' results contribute URLs that may be fetched. */
+ fun visitBetaManagedAgentsWebFetchUrlSourceToolFilter(
+ betaManagedAgentsWebFetchUrlSourceToolFilter:
+ BetaManagedAgentsWebFetchUrlSourceToolFilter
+ ): T
+
+ /**
+ * Maps an unknown variant of [BetaManagedAgentsWebFetchUrlSourceToolFilterParams] to a
+ * value of type [T].
+ *
+ * An instance of [BetaManagedAgentsWebFetchUrlSourceToolFilterParams] can contain an
+ * unknown variant if it was deserialized from data that doesn't match any known variant.
+ * For example, if the SDK is on an older version than the API, then the API may respond
+ * with new variants that the SDK is unaware of.
+ *
+ * @throws AnthropicInvalidDataException in the default implementation.
+ */
+ fun unknown(json: JsonValue?): T {
+ throw AnthropicInvalidDataException(
+ "Unknown BetaManagedAgentsWebFetchUrlSourceToolFilterParams: $json"
+ )
+ }
+ }
+
+ internal class Deserializer :
+ BaseDeserializer(
+ BetaManagedAgentsWebFetchUrlSourceToolFilterParams::class
+ ) {
+
+ override fun ObjectCodec.deserialize(
+ node: JsonNode
+ ): BetaManagedAgentsWebFetchUrlSourceToolFilterParams {
+ val json = JsonValue.fromJsonNode(node)
+
+ val bestMatches =
+ sequenceOf(
+ tryDeserialize(
+ node,
+ jacksonTypeRef(),
+ )
+ ?.let {
+ BetaManagedAgentsWebFetchUrlSourceToolFilterParams(
+ shorthand = it,
+ _json = json,
+ )
+ },
+ tryDeserialize(
+ node,
+ jacksonTypeRef(),
+ )
+ ?.let {
+ BetaManagedAgentsWebFetchUrlSourceToolFilterParams(
+ betaManagedAgentsWebFetchUrlSourceToolFilter = it,
+ _json = json,
+ )
+ },
+ )
+ .filterNotNull()
+ .allMaxBy { it.validity() }
+ .toList()
+ return when (bestMatches.size) {
+ // This can happen if what we're deserializing is completely incompatible with all
+ // the possible variants (e.g. deserializing from boolean).
+ 0 -> BetaManagedAgentsWebFetchUrlSourceToolFilterParams(_json = json)
+ 1 -> bestMatches.single()
+ // If there's more than one match with the highest validity, then use the first
+ // completely valid match, or simply the first match if none are completely valid.
+ else -> bestMatches.firstOrNull { it.isValid() } ?: bestMatches.first()
+ }
+ }
+ }
+
+ internal class Serializer :
+ BaseSerializer(
+ BetaManagedAgentsWebFetchUrlSourceToolFilterParams::class
+ ) {
+
+ override fun serialize(
+ value: BetaManagedAgentsWebFetchUrlSourceToolFilterParams,
+ generator: JsonGenerator,
+ provider: SerializerProvider,
+ ) {
+ when {
+ value.shorthand != null -> generator.writeObject(value.shorthand)
+ value.betaManagedAgentsWebFetchUrlSourceToolFilter != null ->
+ generator.writeObject(value.betaManagedAgentsWebFetchUrlSourceToolFilter)
+ value._json != null -> generator.writeObject(value._json)
+ else ->
+ throw IllegalStateException(
+ "Invalid BetaManagedAgentsWebFetchUrlSourceToolFilterParams"
+ )
+ }
+ }
+ }
+}
diff --git a/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/agents/BetaManagedAgentsWebFetchUrlSourceToolReference.kt b/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/agents/BetaManagedAgentsWebFetchUrlSourceToolReference.kt
new file mode 100644
index 000000000..479f88cca
--- /dev/null
+++ b/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/agents/BetaManagedAgentsWebFetchUrlSourceToolReference.kt
@@ -0,0 +1,232 @@
+package com.anthropic.models.beta.agents
+
+import com.anthropic.core.ExcludeMissing
+import com.anthropic.core.JsonField
+import com.anthropic.core.JsonMissing
+import com.anthropic.core.JsonValue
+import com.anthropic.core.checkRequired
+import com.anthropic.errors.AnthropicInvalidDataException
+import com.fasterxml.jackson.annotation.JsonAnyGetter
+import com.fasterxml.jackson.annotation.JsonAnySetter
+import com.fasterxml.jackson.annotation.JsonCreator
+import com.fasterxml.jackson.annotation.JsonProperty
+import java.util.Collections
+import java.util.Objects
+
+/** Names one tool in an only or except list. */
+class BetaManagedAgentsWebFetchUrlSourceToolReference
+@JsonCreator(mode = JsonCreator.Mode.DISABLED)
+private constructor(
+ private val name: JsonField,
+ private val type: JsonValue,
+ private val additionalProperties: MutableMap,
+) {
+
+ @JsonCreator
+ private constructor(
+ @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(),
+ @JsonProperty("type") @ExcludeMissing type: JsonValue = JsonMissing.of(),
+ ) : this(name, type, mutableMapOf())
+
+ /**
+ * Name of the tool. Compared exactly, so upper and lower case letters are different.
+ *
+ * @throws AnthropicInvalidDataException if the JSON field has an unexpected type or is
+ * unexpectedly missing or null (e.g. if the server responded with an unexpected value).
+ */
+ fun name(): String = name.getRequired("name")
+
+ /**
+ * Must be "tool_reference".
+ *
+ * Expected to always return the following:
+ * ```java
+ * JsonValue.from("tool_reference")
+ * ```
+ *
+ * However, this method can be useful for debugging and logging (e.g. if the server responded
+ * with an unexpected value).
+ */
+ @JsonProperty("type") @ExcludeMissing fun _type(): JsonValue = type
+
+ /**
+ * Returns the raw JSON value of [name].
+ *
+ * Unlike [name], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name
+
+ @JsonAnySetter
+ private fun putAdditionalProperty(key: String, value: JsonValue) {
+ additionalProperties.put(key, value)
+ }
+
+ @JsonAnyGetter
+ @ExcludeMissing
+ fun _additionalProperties(): Map =
+ Collections.unmodifiableMap(additionalProperties)
+
+ fun toBuilder() = Builder().from(this)
+
+ companion object {
+
+ /**
+ * Returns a mutable builder for constructing an instance of
+ * [BetaManagedAgentsWebFetchUrlSourceToolReference].
+ *
+ * The following fields are required:
+ * ```java
+ * .name()
+ * ```
+ */
+ @JvmStatic fun builder() = Builder()
+
+ /**
+ * Returns an immutable instance of [BetaManagedAgentsWebFetchUrlSourceToolReference] with
+ * the required [name] set to the given value.
+ */
+ @JvmStatic fun of(name: String) = builder().name(name).build()
+ }
+
+ /** A builder for [BetaManagedAgentsWebFetchUrlSourceToolReference]. */
+ class Builder internal constructor() {
+
+ private var name: JsonField? = null
+ private var type: JsonValue = JsonValue.from("tool_reference")
+ private var additionalProperties: MutableMap = mutableMapOf()
+
+ @JvmSynthetic
+ internal fun from(
+ betaManagedAgentsWebFetchUrlSourceToolReference:
+ BetaManagedAgentsWebFetchUrlSourceToolReference
+ ) = apply {
+ name = betaManagedAgentsWebFetchUrlSourceToolReference.name
+ type = betaManagedAgentsWebFetchUrlSourceToolReference.type
+ additionalProperties =
+ betaManagedAgentsWebFetchUrlSourceToolReference.additionalProperties.toMutableMap()
+ }
+
+ /** Name of the tool. Compared exactly, so upper and lower case letters are different. */
+ fun name(name: String) = name(JsonField.of(name))
+
+ /**
+ * Sets [Builder.name] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.name] with a well-typed [String] value instead. This
+ * method is primarily for setting the field to an undocumented or not yet supported value.
+ */
+ fun name(name: JsonField) = apply { this.name = name }
+
+ /**
+ * Sets the field to an arbitrary JSON value.
+ *
+ * It is usually unnecessary to call this method because the field defaults to the
+ * following:
+ * ```java
+ * JsonValue.from("tool_reference")
+ * ```
+ *
+ * This method is primarily for setting the field to an undocumented or not yet supported
+ * value.
+ */
+ fun type(type: JsonValue) = apply { this.type = type }
+
+ fun additionalProperties(additionalProperties: Map) = apply {
+ this.additionalProperties.clear()
+ putAllAdditionalProperties(additionalProperties)
+ }
+
+ fun putAdditionalProperty(key: String, value: JsonValue) = apply {
+ additionalProperties.put(key, value)
+ }
+
+ fun putAllAdditionalProperties(additionalProperties: Map) = apply {
+ this.additionalProperties.putAll(additionalProperties)
+ }
+
+ fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) }
+
+ fun removeAllAdditionalProperties(keys: Set) = apply {
+ keys.forEach(::removeAdditionalProperty)
+ }
+
+ /**
+ * Returns an immutable instance of [BetaManagedAgentsWebFetchUrlSourceToolReference].
+ *
+ * Further updates to this [Builder] will not mutate the returned instance.
+ *
+ * The following fields are required:
+ * ```java
+ * .name()
+ * ```
+ *
+ * @throws IllegalStateException if any required field is unset.
+ */
+ fun build(): BetaManagedAgentsWebFetchUrlSourceToolReference =
+ BetaManagedAgentsWebFetchUrlSourceToolReference(
+ checkRequired("name", name),
+ type,
+ additionalProperties.toMutableMap(),
+ )
+ }
+
+ private var validated: Boolean = false
+
+ /**
+ * Validates that the types of all values in this object match their expected types recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws AnthropicInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
+ fun validate(): BetaManagedAgentsWebFetchUrlSourceToolReference = apply {
+ if (validated) {
+ return@apply
+ }
+
+ name()
+ _type().let {
+ if (it != JsonValue.from("tool_reference")) {
+ throw AnthropicInvalidDataException("'type' is invalid, received $it")
+ }
+ }
+ validated = true
+ }
+
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: AnthropicInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ (if (name.asKnown().isPresent) 1 else 0) +
+ type.let { if (it == JsonValue.from("tool_reference")) 1 else 0 }
+
+ override fun equals(other: Any?): Boolean {
+ if (this === other) {
+ return true
+ }
+
+ return other is BetaManagedAgentsWebFetchUrlSourceToolReference &&
+ name == other.name &&
+ type == other.type &&
+ additionalProperties == other.additionalProperties
+ }
+
+ private val hashCode: Int by lazy { Objects.hash(name, type, additionalProperties) }
+
+ override fun hashCode(): Int = hashCode
+
+ override fun toString() =
+ "BetaManagedAgentsWebFetchUrlSourceToolReference{name=$name, type=$type, additionalProperties=$additionalProperties}"
+}
diff --git a/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/agents/BetaManagedAgentsWebFetchUrlSourceUserInput.kt b/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/agents/BetaManagedAgentsWebFetchUrlSourceUserInput.kt
new file mode 100644
index 000000000..545d111c1
--- /dev/null
+++ b/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/agents/BetaManagedAgentsWebFetchUrlSourceUserInput.kt
@@ -0,0 +1,410 @@
+package com.anthropic.models.beta.agents
+
+import com.anthropic.core.BaseDeserializer
+import com.anthropic.core.BaseSerializer
+import com.anthropic.core.Enum
+import com.anthropic.core.JsonField
+import com.anthropic.core.JsonMissing
+import com.anthropic.core.JsonValue
+import com.anthropic.core.getOrThrow
+import com.anthropic.errors.AnthropicInvalidDataException
+import com.fasterxml.jackson.annotation.JsonCreator
+import com.fasterxml.jackson.core.JsonGenerator
+import com.fasterxml.jackson.core.ObjectCodec
+import com.fasterxml.jackson.databind.JsonNode
+import com.fasterxml.jackson.databind.SerializerProvider
+import com.fasterxml.jackson.databind.annotation.JsonDeserialize
+import com.fasterxml.jackson.databind.annotation.JsonSerialize
+import com.fasterxml.jackson.module.kotlin.jacksonTypeRef
+import java.util.Objects
+import java.util.Optional
+import kotlin.jvm.optionals.getOrNull
+
+/** Whether URLs in the text of user messages may be fetched. */
+@JsonDeserialize(using = BetaManagedAgentsWebFetchUrlSourceUserInput.Deserializer::class)
+@JsonSerialize(using = BetaManagedAgentsWebFetchUrlSourceUserInput.Serializer::class)
+class BetaManagedAgentsWebFetchUrlSourceUserInput
+private constructor(
+ private val all: BetaManagedAgentsWebFetchUrlSourceAll? = null,
+ private val none: BetaManagedAgentsWebFetchUrlSourceNone? = null,
+ private val _json: JsonValue? = null,
+) {
+
+ fun type(): Type =
+ when {
+ all != null -> Type.ALL
+ none != null -> Type.NONE
+ else -> Type.of(_json?.asObject()?.getOrNull()?.get("type") ?: JsonMissing.of())
+ }
+
+ /** Every URL from this source may be fetched. This is the default. */
+ fun all(): Optional = Optional.ofNullable(all)
+
+ /** This source contributes no URLs that may be fetched. */
+ fun none(): Optional = Optional.ofNullable(none)
+
+ fun isAll(): Boolean = all != null
+
+ fun isNone(): Boolean = none != null
+
+ /** Every URL from this source may be fetched. This is the default. */
+ fun asAll(): BetaManagedAgentsWebFetchUrlSourceAll = all.getOrThrow("all")
+
+ /** This source contributes no URLs that may be fetched. */
+ fun asNone(): BetaManagedAgentsWebFetchUrlSourceNone = none.getOrThrow("none")
+
+ fun _json(): Optional = Optional.ofNullable(_json)
+
+ /**
+ * Maps this instance's current variant to a value of type [T] using the given [visitor].
+ *
+ * Note that this method is _not_ forwards compatible with new variants from the API, unless
+ * [visitor] overrides [Visitor.unknown]. To handle variants not known to this version of the
+ * SDK gracefully, consider overriding [Visitor.unknown]:
+ * ```java
+ * import com.anthropic.core.JsonValue;
+ * import java.util.Optional;
+ *
+ * Optional result = betaManagedAgentsWebFetchUrlSourceUserInput.accept(new BetaManagedAgentsWebFetchUrlSourceUserInput.Visitor>() {
+ * @Override
+ * public Optional visitAll(BetaManagedAgentsWebFetchUrlSourceAll all) {
+ * return Optional.of(all.toString());
+ * }
+ *
+ * // ...
+ *
+ * @Override
+ * public Optional unknown(JsonValue json) {
+ * // Or inspect the `json`.
+ * return Optional.empty();
+ * }
+ * });
+ * ```
+ *
+ * @throws AnthropicInvalidDataException if [Visitor.unknown] is not overridden in [visitor] and
+ * the current variant is unknown.
+ */
+ fun accept(visitor: Visitor): T =
+ when {
+ all != null -> visitor.visitAll(all)
+ none != null -> visitor.visitNone(none)
+ else -> visitor.unknown(_json)
+ }
+
+ private var validated: Boolean = false
+
+ /**
+ * Validates that the types of all values in this object match their expected types recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws AnthropicInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
+ fun validate(): BetaManagedAgentsWebFetchUrlSourceUserInput = apply {
+ if (validated) {
+ return@apply
+ }
+
+ when {
+ all != null -> all.validate()
+ none != null -> none.validate()
+ else ->
+ throw AnthropicInvalidDataException(
+ "Unknown BetaManagedAgentsWebFetchUrlSourceUserInput: $_json"
+ )
+ }
+ validated = true
+ }
+
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: AnthropicInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ when {
+ all != null -> all.validity()
+ none != null -> none.validity()
+ else -> 0
+ }
+
+ override fun equals(other: Any?): Boolean {
+ if (this === other) {
+ return true
+ }
+
+ return other is BetaManagedAgentsWebFetchUrlSourceUserInput &&
+ all == other.all &&
+ none == other.none
+ }
+
+ override fun hashCode(): Int = Objects.hash(all, none)
+
+ override fun toString(): String =
+ when {
+ all != null -> "BetaManagedAgentsWebFetchUrlSourceUserInput{all=$all}"
+ none != null -> "BetaManagedAgentsWebFetchUrlSourceUserInput{none=$none}"
+ _json != null -> "BetaManagedAgentsWebFetchUrlSourceUserInput{_unknown=$_json}"
+ else ->
+ throw IllegalStateException("Invalid BetaManagedAgentsWebFetchUrlSourceUserInput")
+ }
+
+ companion object {
+
+ /** Every URL from this source may be fetched. This is the default. */
+ @JvmStatic
+ fun ofAll(all: BetaManagedAgentsWebFetchUrlSourceAll) =
+ BetaManagedAgentsWebFetchUrlSourceUserInput(all = all)
+
+ /** This source contributes no URLs that may be fetched. */
+ @JvmStatic
+ fun ofNone(none: BetaManagedAgentsWebFetchUrlSourceNone) =
+ BetaManagedAgentsWebFetchUrlSourceUserInput(none = none)
+ }
+
+ /**
+ * An interface that defines how to map each variant of
+ * [BetaManagedAgentsWebFetchUrlSourceUserInput] to a value of type [T].
+ */
+ interface Visitor {
+
+ /** Every URL from this source may be fetched. This is the default. */
+ fun visitAll(all: BetaManagedAgentsWebFetchUrlSourceAll): T
+
+ /** This source contributes no URLs that may be fetched. */
+ fun visitNone(none: BetaManagedAgentsWebFetchUrlSourceNone): T
+
+ /**
+ * Maps an unknown variant of [BetaManagedAgentsWebFetchUrlSourceUserInput] to a value of
+ * type [T].
+ *
+ * An instance of [BetaManagedAgentsWebFetchUrlSourceUserInput] can contain an unknown
+ * variant if it was deserialized from data that doesn't match any known variant. For
+ * example, if the SDK is on an older version than the API, then the API may respond with
+ * new variants that the SDK is unaware of.
+ *
+ * @throws AnthropicInvalidDataException in the default implementation.
+ */
+ fun unknown(json: JsonValue?): T {
+ throw AnthropicInvalidDataException(
+ "Unknown BetaManagedAgentsWebFetchUrlSourceUserInput: $json"
+ )
+ }
+ }
+
+ internal class Deserializer :
+ BaseDeserializer(
+ BetaManagedAgentsWebFetchUrlSourceUserInput::class
+ ) {
+
+ override fun ObjectCodec.deserialize(
+ node: JsonNode
+ ): BetaManagedAgentsWebFetchUrlSourceUserInput {
+ val json = JsonValue.fromJsonNode(node)
+ val type = json.asObject().getOrNull()?.get("type")?.asString()?.getOrNull()
+
+ when (type) {
+ "all" -> {
+ return tryDeserialize(
+ node,
+ jacksonTypeRef(),
+ )
+ ?.let {
+ BetaManagedAgentsWebFetchUrlSourceUserInput(all = it, _json = json)
+ } ?: BetaManagedAgentsWebFetchUrlSourceUserInput(_json = json)
+ }
+ "none" -> {
+ return tryDeserialize(
+ node,
+ jacksonTypeRef(),
+ )
+ ?.let {
+ BetaManagedAgentsWebFetchUrlSourceUserInput(none = it, _json = json)
+ } ?: BetaManagedAgentsWebFetchUrlSourceUserInput(_json = json)
+ }
+ }
+
+ return BetaManagedAgentsWebFetchUrlSourceUserInput(_json = json)
+ }
+ }
+
+ internal class Serializer :
+ BaseSerializer(
+ BetaManagedAgentsWebFetchUrlSourceUserInput::class
+ ) {
+
+ override fun serialize(
+ value: BetaManagedAgentsWebFetchUrlSourceUserInput,
+ generator: JsonGenerator,
+ provider: SerializerProvider,
+ ) {
+ when {
+ value.all != null -> generator.writeObject(value.all)
+ value.none != null -> generator.writeObject(value.none)
+ value._json != null -> generator.writeObject(value._json)
+ else ->
+ throw IllegalStateException(
+ "Invalid BetaManagedAgentsWebFetchUrlSourceUserInput"
+ )
+ }
+ }
+ }
+
+ class Type private constructor(private val value: JsonField) : Enum {
+
+ /**
+ * Returns this class instance's raw value.
+ *
+ * This is usually only useful if this instance was deserialized from data that doesn't
+ * match any known member, and you want to know that value. For example, if the SDK is on an
+ * older version than the API, then the API may respond with new members that the SDK is
+ * unaware of.
+ */
+ @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value
+
+ companion object {
+
+ @JvmField val ALL = Type(JsonField.of("all"))
+
+ @JvmField val NONE = Type(JsonField.of("none"))
+
+ @JvmStatic
+ fun of(value: String): Type =
+ // Intern known values so `==` works
+ when (value) {
+ "all" -> ALL
+ "none" -> NONE
+ else -> Type(JsonField.of(value))
+ }
+
+ @JsonCreator
+ @JvmStatic
+ fun of(value: JsonField): Type =
+ value.asString().getOrNull()?.let { of(it) } ?: Type(value)
+ }
+
+ /** An enum containing [Type]'s known values. */
+ enum class Known {
+ ALL,
+ NONE,
+ }
+
+ /**
+ * An enum containing [Type]'s known values, as well as an [_UNKNOWN] member.
+ *
+ * An instance of [Type] can contain an unknown value in a couple of cases:
+ * - It was deserialized from data that doesn't match any known member. For example, if the
+ * SDK is on an older version than the API, then the API may respond with new members that
+ * the SDK is unaware of.
+ * - It was constructed with an arbitrary value using the [of] method.
+ */
+ enum class Value {
+ ALL,
+ NONE,
+ /** An enum member indicating that [Type] was instantiated with an unknown value. */
+ _UNKNOWN,
+ }
+
+ /**
+ * Returns an enum member corresponding to this class instance's value, or [Value._UNKNOWN]
+ * if the class was instantiated with an unknown value.
+ *
+ * Use the [known] method instead if you're certain the value is always known or if you want
+ * to throw for the unknown case.
+ */
+ fun value(): Value =
+ when (this) {
+ ALL -> Value.ALL
+ NONE -> Value.NONE
+ else -> Value._UNKNOWN
+ }
+
+ /**
+ * Returns an enum member corresponding to this class instance's value.
+ *
+ * Use the [value] method instead if you're uncertain the value is always known and don't
+ * want to throw for the unknown case.
+ *
+ * @throws AnthropicInvalidDataException if this class instance's value is a not a known
+ * member.
+ */
+ fun known(): Known =
+ when (this) {
+ ALL -> Known.ALL
+ NONE -> Known.NONE
+ else -> throw AnthropicInvalidDataException("Unknown Type: $value")
+ }
+
+ /**
+ * Returns this class instance's primitive wire representation.
+ *
+ * This differs from the [toString] method because that method is primarily for debugging
+ * and generally doesn't throw.
+ *
+ * @throws AnthropicInvalidDataException if this class instance's value does not have the
+ * expected primitive type.
+ */
+ fun asString(): String =
+ _value().asString().orElseThrow {
+ AnthropicInvalidDataException("Value is not a String")
+ }
+
+ private var validated: Boolean = false
+
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws AnthropicInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
+ fun validate(): Type = apply {
+ if (validated) {
+ return@apply
+ }
+
+ known()
+ validated = true
+ }
+
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: AnthropicInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1
+
+ override fun equals(other: Any?): Boolean {
+ if (this === other) {
+ return true
+ }
+
+ return other is Type && value == other.value
+ }
+
+ override fun hashCode() = value.hashCode()
+
+ override fun toString() = value.toString()
+ }
+}
diff --git a/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/agents/BetaManagedAgentsWebFetchUrlSourceUserInputParams.kt b/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/agents/BetaManagedAgentsWebFetchUrlSourceUserInputParams.kt
new file mode 100644
index 000000000..2799f1b93
--- /dev/null
+++ b/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/agents/BetaManagedAgentsWebFetchUrlSourceUserInputParams.kt
@@ -0,0 +1,308 @@
+package com.anthropic.models.beta.agents
+
+import com.anthropic.core.BaseDeserializer
+import com.anthropic.core.BaseSerializer
+import com.anthropic.core.JsonValue
+import com.anthropic.core.allMaxBy
+import com.anthropic.core.getOrThrow
+import com.anthropic.errors.AnthropicInvalidDataException
+import com.fasterxml.jackson.core.JsonGenerator
+import com.fasterxml.jackson.core.ObjectCodec
+import com.fasterxml.jackson.databind.JsonNode
+import com.fasterxml.jackson.databind.SerializerProvider
+import com.fasterxml.jackson.databind.annotation.JsonDeserialize
+import com.fasterxml.jackson.databind.annotation.JsonSerialize
+import com.fasterxml.jackson.module.kotlin.jacksonTypeRef
+import java.util.Objects
+import java.util.Optional
+
+/**
+ * Whether URLs in the text of user messages may be fetched. Accepts the string "all" or "none", or
+ * the object {"type": "all"} or {"type": "none"}. Responses use the object form.
+ */
+@JsonDeserialize(using = BetaManagedAgentsWebFetchUrlSourceUserInputParams.Deserializer::class)
+@JsonSerialize(using = BetaManagedAgentsWebFetchUrlSourceUserInputParams.Serializer::class)
+class BetaManagedAgentsWebFetchUrlSourceUserInputParams
+private constructor(
+ private val shorthand: BetaManagedAgentsWebFetchUrlSourceShorthand? = null,
+ private val betaManagedAgentsWebFetchUrlSourceUserInput:
+ BetaManagedAgentsWebFetchUrlSourceUserInput? =
+ null,
+ private val _json: JsonValue? = null,
+) {
+
+ /**
+ * String form of a url_sources value that has no field other than its type: "all" means
+ * {"type": "all"} and "none" means {"type": "none"}.
+ */
+ fun shorthand(): Optional =
+ Optional.ofNullable(shorthand)
+
+ /** Whether URLs in the text of user messages may be fetched. */
+ fun betaManagedAgentsWebFetchUrlSourceUserInput():
+ Optional =
+ Optional.ofNullable(betaManagedAgentsWebFetchUrlSourceUserInput)
+
+ fun isShorthand(): Boolean = shorthand != null
+
+ fun isBetaManagedAgentsWebFetchUrlSourceUserInput(): Boolean =
+ betaManagedAgentsWebFetchUrlSourceUserInput != null
+
+ /**
+ * String form of a url_sources value that has no field other than its type: "all" means
+ * {"type": "all"} and "none" means {"type": "none"}.
+ */
+ fun asShorthand(): BetaManagedAgentsWebFetchUrlSourceShorthand =
+ shorthand.getOrThrow("shorthand")
+
+ /** Whether URLs in the text of user messages may be fetched. */
+ fun asBetaManagedAgentsWebFetchUrlSourceUserInput():
+ BetaManagedAgentsWebFetchUrlSourceUserInput =
+ betaManagedAgentsWebFetchUrlSourceUserInput.getOrThrow(
+ "betaManagedAgentsWebFetchUrlSourceUserInput"
+ )
+
+ fun _json(): Optional = Optional.ofNullable(_json)
+
+ /**
+ * Maps this instance's current variant to a value of type [T] using the given [visitor].
+ *
+ * Note that this method is _not_ forwards compatible with new variants from the API, unless
+ * [visitor] overrides [Visitor.unknown]. To handle variants not known to this version of the
+ * SDK gracefully, consider overriding [Visitor.unknown]:
+ * ```java
+ * import com.anthropic.core.JsonValue;
+ * import java.util.Optional;
+ *
+ * Optional result = betaManagedAgentsWebFetchUrlSourceUserInputParams.accept(new BetaManagedAgentsWebFetchUrlSourceUserInputParams.Visitor>() {
+ * @Override
+ * public Optional visitShorthand(BetaManagedAgentsWebFetchUrlSourceShorthand shorthand) {
+ * return Optional.of(shorthand.toString());
+ * }
+ *
+ * // ...
+ *
+ * @Override
+ * public Optional unknown(JsonValue json) {
+ * // Or inspect the `json`.
+ * return Optional.empty();
+ * }
+ * });
+ * ```
+ *
+ * @throws AnthropicInvalidDataException if [Visitor.unknown] is not overridden in [visitor] and
+ * the current variant is unknown.
+ */
+ fun accept(visitor: Visitor): T =
+ when {
+ shorthand != null -> visitor.visitShorthand(shorthand)
+ betaManagedAgentsWebFetchUrlSourceUserInput != null ->
+ visitor.visitBetaManagedAgentsWebFetchUrlSourceUserInput(
+ betaManagedAgentsWebFetchUrlSourceUserInput
+ )
+ else -> visitor.unknown(_json)
+ }
+
+ private var validated: Boolean = false
+
+ /**
+ * Validates that the types of all values in this object match their expected types recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws AnthropicInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
+ fun validate(): BetaManagedAgentsWebFetchUrlSourceUserInputParams = apply {
+ if (validated) {
+ return@apply
+ }
+
+ when {
+ shorthand != null -> shorthand.validate()
+ betaManagedAgentsWebFetchUrlSourceUserInput != null ->
+ betaManagedAgentsWebFetchUrlSourceUserInput.validate()
+ else ->
+ throw AnthropicInvalidDataException(
+ "Unknown BetaManagedAgentsWebFetchUrlSourceUserInputParams: $_json"
+ )
+ }
+ validated = true
+ }
+
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: AnthropicInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ when {
+ shorthand != null -> shorthand.validity()
+ betaManagedAgentsWebFetchUrlSourceUserInput != null ->
+ betaManagedAgentsWebFetchUrlSourceUserInput.validity()
+ else -> 0
+ }
+
+ override fun equals(other: Any?): Boolean {
+ if (this === other) {
+ return true
+ }
+
+ return other is BetaManagedAgentsWebFetchUrlSourceUserInputParams &&
+ shorthand == other.shorthand &&
+ betaManagedAgentsWebFetchUrlSourceUserInput ==
+ other.betaManagedAgentsWebFetchUrlSourceUserInput
+ }
+
+ override fun hashCode(): Int =
+ Objects.hash(shorthand, betaManagedAgentsWebFetchUrlSourceUserInput)
+
+ override fun toString(): String =
+ when {
+ shorthand != null ->
+ "BetaManagedAgentsWebFetchUrlSourceUserInputParams{shorthand=$shorthand}"
+ betaManagedAgentsWebFetchUrlSourceUserInput != null ->
+ "BetaManagedAgentsWebFetchUrlSourceUserInputParams{betaManagedAgentsWebFetchUrlSourceUserInput=$betaManagedAgentsWebFetchUrlSourceUserInput}"
+ _json != null -> "BetaManagedAgentsWebFetchUrlSourceUserInputParams{_unknown=$_json}"
+ else ->
+ throw IllegalStateException(
+ "Invalid BetaManagedAgentsWebFetchUrlSourceUserInputParams"
+ )
+ }
+
+ companion object {
+
+ /**
+ * String form of a url_sources value that has no field other than its type: "all" means
+ * {"type": "all"} and "none" means {"type": "none"}.
+ */
+ @JvmStatic
+ fun ofShorthand(shorthand: BetaManagedAgentsWebFetchUrlSourceShorthand) =
+ BetaManagedAgentsWebFetchUrlSourceUserInputParams(shorthand = shorthand)
+
+ /** Whether URLs in the text of user messages may be fetched. */
+ @JvmStatic
+ fun ofBetaManagedAgentsWebFetchUrlSourceUserInput(
+ betaManagedAgentsWebFetchUrlSourceUserInput: BetaManagedAgentsWebFetchUrlSourceUserInput
+ ) =
+ BetaManagedAgentsWebFetchUrlSourceUserInputParams(
+ betaManagedAgentsWebFetchUrlSourceUserInput =
+ betaManagedAgentsWebFetchUrlSourceUserInput
+ )
+ }
+
+ /**
+ * An interface that defines how to map each variant of
+ * [BetaManagedAgentsWebFetchUrlSourceUserInputParams] to a value of type [T].
+ */
+ interface Visitor {
+
+ /**
+ * String form of a url_sources value that has no field other than its type: "all" means
+ * {"type": "all"} and "none" means {"type": "none"}.
+ */
+ fun visitShorthand(shorthand: BetaManagedAgentsWebFetchUrlSourceShorthand): T
+
+ /** Whether URLs in the text of user messages may be fetched. */
+ fun visitBetaManagedAgentsWebFetchUrlSourceUserInput(
+ betaManagedAgentsWebFetchUrlSourceUserInput: BetaManagedAgentsWebFetchUrlSourceUserInput
+ ): T
+
+ /**
+ * Maps an unknown variant of [BetaManagedAgentsWebFetchUrlSourceUserInputParams] to a value
+ * of type [T].
+ *
+ * An instance of [BetaManagedAgentsWebFetchUrlSourceUserInputParams] can contain an unknown
+ * variant if it was deserialized from data that doesn't match any known variant. For
+ * example, if the SDK is on an older version than the API, then the API may respond with
+ * new variants that the SDK is unaware of.
+ *
+ * @throws AnthropicInvalidDataException in the default implementation.
+ */
+ fun unknown(json: JsonValue?): T {
+ throw AnthropicInvalidDataException(
+ "Unknown BetaManagedAgentsWebFetchUrlSourceUserInputParams: $json"
+ )
+ }
+ }
+
+ internal class Deserializer :
+ BaseDeserializer(
+ BetaManagedAgentsWebFetchUrlSourceUserInputParams::class
+ ) {
+
+ override fun ObjectCodec.deserialize(
+ node: JsonNode
+ ): BetaManagedAgentsWebFetchUrlSourceUserInputParams {
+ val json = JsonValue.fromJsonNode(node)
+
+ val bestMatches =
+ sequenceOf(
+ tryDeserialize(
+ node,
+ jacksonTypeRef(),
+ )
+ ?.let {
+ BetaManagedAgentsWebFetchUrlSourceUserInputParams(
+ shorthand = it,
+ _json = json,
+ )
+ },
+ tryDeserialize(
+ node,
+ jacksonTypeRef(),
+ )
+ ?.let {
+ BetaManagedAgentsWebFetchUrlSourceUserInputParams(
+ betaManagedAgentsWebFetchUrlSourceUserInput = it,
+ _json = json,
+ )
+ },
+ )
+ .filterNotNull()
+ .allMaxBy { it.validity() }
+ .toList()
+ return when (bestMatches.size) {
+ // This can happen if what we're deserializing is completely incompatible with all
+ // the possible variants (e.g. deserializing from boolean).
+ 0 -> BetaManagedAgentsWebFetchUrlSourceUserInputParams(_json = json)
+ 1 -> bestMatches.single()
+ // If there's more than one match with the highest validity, then use the first
+ // completely valid match, or simply the first match if none are completely valid.
+ else -> bestMatches.firstOrNull { it.isValid() } ?: bestMatches.first()
+ }
+ }
+ }
+
+ internal class Serializer :
+ BaseSerializer(
+ BetaManagedAgentsWebFetchUrlSourceUserInputParams::class
+ ) {
+
+ override fun serialize(
+ value: BetaManagedAgentsWebFetchUrlSourceUserInputParams,
+ generator: JsonGenerator,
+ provider: SerializerProvider,
+ ) {
+ when {
+ value.shorthand != null -> generator.writeObject(value.shorthand)
+ value.betaManagedAgentsWebFetchUrlSourceUserInput != null ->
+ generator.writeObject(value.betaManagedAgentsWebFetchUrlSourceUserInput)
+ value._json != null -> generator.writeObject(value._json)
+ else ->
+ throw IllegalStateException(
+ "Invalid BetaManagedAgentsWebFetchUrlSourceUserInputParams"
+ )
+ }
+ }
+ }
+}
diff --git a/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/agents/BetaManagedAgentsWebFetchUrlSources.kt b/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/agents/BetaManagedAgentsWebFetchUrlSources.kt
new file mode 100644
index 000000000..8e4ef87e0
--- /dev/null
+++ b/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/agents/BetaManagedAgentsWebFetchUrlSources.kt
@@ -0,0 +1,444 @@
+package com.anthropic.models.beta.agents
+
+import com.anthropic.core.ExcludeMissing
+import com.anthropic.core.JsonField
+import com.anthropic.core.JsonMissing
+import com.anthropic.core.JsonValue
+import com.anthropic.core.checkRequired
+import com.anthropic.errors.AnthropicInvalidDataException
+import com.fasterxml.jackson.annotation.JsonAnyGetter
+import com.fasterxml.jackson.annotation.JsonAnySetter
+import com.fasterxml.jackson.annotation.JsonCreator
+import com.fasterxml.jackson.annotation.JsonProperty
+import java.util.Collections
+import java.util.Objects
+import java.util.Optional
+import kotlin.jvm.optionals.getOrNull
+
+/**
+ * Which sources contribute URLs the web_fetch tool may fetch. A key that is null was not set and
+ * allows every URL from that source.
+ */
+class BetaManagedAgentsWebFetchUrlSources
+@JsonCreator(mode = JsonCreator.Mode.DISABLED)
+private constructor(
+ private val clientToolResults: JsonField,
+ private val serverToolResults: JsonField,
+ private val userInput: JsonField,
+ private val additionalProperties: MutableMap,
+) {
+
+ @JsonCreator
+ private constructor(
+ @JsonProperty("client_tool_results")
+ @ExcludeMissing
+ clientToolResults: JsonField =
+ JsonMissing.of(),
+ @JsonProperty("server_tool_results")
+ @ExcludeMissing
+ serverToolResults: JsonField =
+ JsonMissing.of(),
+ @JsonProperty("user_input")
+ @ExcludeMissing
+ userInput: JsonField = JsonMissing.of(),
+ ) : this(clientToolResults, serverToolResults, userInput, mutableMapOf())
+
+ /**
+ * Which custom tools' results contribute URLs that may be fetched. Null when not set, which
+ * allows every custom tool's results.
+ *
+ * @throws AnthropicInvalidDataException if the JSON field has an unexpected type (e.g. if the
+ * server responded with an unexpected value).
+ */
+ fun clientToolResults(): Optional =
+ clientToolResults.getOptional("client_tool_results")
+
+ /**
+ * Which of the web_search and web_fetch tools' results contribute URLs that may be fetched.
+ * Null when not set, which allows both.
+ *
+ * @throws AnthropicInvalidDataException if the JSON field has an unexpected type (e.g. if the
+ * server responded with an unexpected value).
+ */
+ fun serverToolResults(): Optional =
+ serverToolResults.getOptional("server_tool_results")
+
+ /**
+ * Whether URLs in the text of user messages may be fetched. Null when not set, which allows
+ * them.
+ *
+ * @throws AnthropicInvalidDataException if the JSON field has an unexpected type (e.g. if the
+ * server responded with an unexpected value).
+ */
+ fun userInput(): Optional =
+ userInput.getOptional("user_input")
+
+ /**
+ * Returns the raw JSON value of [clientToolResults].
+ *
+ * Unlike [clientToolResults], this method doesn't throw if the JSON field has an unexpected
+ * type.
+ */
+ @JsonProperty("client_tool_results")
+ @ExcludeMissing
+ fun _clientToolResults(): JsonField =
+ clientToolResults
+
+ /**
+ * Returns the raw JSON value of [serverToolResults].
+ *
+ * Unlike [serverToolResults], this method doesn't throw if the JSON field has an unexpected
+ * type.
+ */
+ @JsonProperty("server_tool_results")
+ @ExcludeMissing
+ fun _serverToolResults(): JsonField =
+ serverToolResults
+
+ /**
+ * Returns the raw JSON value of [userInput].
+ *
+ * Unlike [userInput], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("user_input")
+ @ExcludeMissing
+ fun _userInput(): JsonField = userInput
+
+ @JsonAnySetter
+ private fun putAdditionalProperty(key: String, value: JsonValue) {
+ additionalProperties.put(key, value)
+ }
+
+ @JsonAnyGetter
+ @ExcludeMissing
+ fun _additionalProperties(): Map =
+ Collections.unmodifiableMap(additionalProperties)
+
+ fun toBuilder() = Builder().from(this)
+
+ companion object {
+
+ /**
+ * Returns a mutable builder for constructing an instance of
+ * [BetaManagedAgentsWebFetchUrlSources].
+ *
+ * The following fields are required:
+ * ```java
+ * .clientToolResults()
+ * .serverToolResults()
+ * .userInput()
+ * ```
+ */
+ @JvmStatic fun builder() = Builder()
+ }
+
+ /** A builder for [BetaManagedAgentsWebFetchUrlSources]. */
+ class Builder internal constructor() {
+
+ private var clientToolResults: JsonField? =
+ null
+ private var serverToolResults: JsonField? =
+ null
+ private var userInput: JsonField? = null
+ private var additionalProperties: MutableMap = mutableMapOf()
+
+ @JvmSynthetic
+ internal fun from(
+ betaManagedAgentsWebFetchUrlSources: BetaManagedAgentsWebFetchUrlSources
+ ) = apply {
+ clientToolResults = betaManagedAgentsWebFetchUrlSources.clientToolResults
+ serverToolResults = betaManagedAgentsWebFetchUrlSources.serverToolResults
+ userInput = betaManagedAgentsWebFetchUrlSources.userInput
+ additionalProperties =
+ betaManagedAgentsWebFetchUrlSources.additionalProperties.toMutableMap()
+ }
+
+ /**
+ * Which custom tools' results contribute URLs that may be fetched. Null when not set, which
+ * allows every custom tool's results.
+ */
+ fun clientToolResults(clientToolResults: BetaManagedAgentsWebFetchUrlSourceToolFilter?) =
+ clientToolResults(JsonField.ofNullable(clientToolResults))
+
+ /** Alias for calling [Builder.clientToolResults] with `clientToolResults.orElse(null)`. */
+ fun clientToolResults(
+ clientToolResults: Optional
+ ) = clientToolResults(clientToolResults.getOrNull())
+
+ /**
+ * Sets [Builder.clientToolResults] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.clientToolResults] with a well-typed
+ * [BetaManagedAgentsWebFetchUrlSourceToolFilter] value instead. This method is primarily
+ * for setting the field to an undocumented or not yet supported value.
+ */
+ fun clientToolResults(
+ clientToolResults: JsonField
+ ) = apply { this.clientToolResults = clientToolResults }
+
+ /**
+ * Alias for calling [clientToolResults] with
+ * `BetaManagedAgentsWebFetchUrlSourceToolFilter.ofAll(all)`.
+ */
+ fun clientToolResults(all: BetaManagedAgentsWebFetchUrlSourceAll) =
+ clientToolResults(BetaManagedAgentsWebFetchUrlSourceToolFilter.ofAll(all))
+
+ /**
+ * Alias for calling [clientToolResults] with
+ * `BetaManagedAgentsWebFetchUrlSourceToolFilter.ofNone(none)`.
+ */
+ fun clientToolResults(none: BetaManagedAgentsWebFetchUrlSourceNone) =
+ clientToolResults(BetaManagedAgentsWebFetchUrlSourceToolFilter.ofNone(none))
+
+ /**
+ * Alias for calling [clientToolResults] with
+ * `BetaManagedAgentsWebFetchUrlSourceToolFilter.ofOnly(only)`.
+ */
+ fun clientToolResults(only: BetaManagedAgentsWebFetchUrlSourceOnly) =
+ clientToolResults(BetaManagedAgentsWebFetchUrlSourceToolFilter.ofOnly(only))
+
+ /**
+ * Alias for calling [clientToolResults] with the following:
+ * ```java
+ * BetaManagedAgentsWebFetchUrlSourceOnly.builder()
+ * .tools(tools)
+ * .build()
+ * ```
+ */
+ fun onlyClientToolResults(tools: List) =
+ clientToolResults(BetaManagedAgentsWebFetchUrlSourceOnly.builder().tools(tools).build())
+
+ /**
+ * Alias for calling [clientToolResults] with
+ * `BetaManagedAgentsWebFetchUrlSourceToolFilter.ofExcept(except)`.
+ */
+ fun clientToolResults(except: BetaManagedAgentsWebFetchUrlSourceExcept) =
+ clientToolResults(BetaManagedAgentsWebFetchUrlSourceToolFilter.ofExcept(except))
+
+ /**
+ * Alias for calling [clientToolResults] with the following:
+ * ```java
+ * BetaManagedAgentsWebFetchUrlSourceExcept.builder()
+ * .tools(tools)
+ * .build()
+ * ```
+ */
+ fun exceptClientToolResults(tools: List) =
+ clientToolResults(
+ BetaManagedAgentsWebFetchUrlSourceExcept.builder().tools(tools).build()
+ )
+
+ /**
+ * Which of the web_search and web_fetch tools' results contribute URLs that may be fetched.
+ * Null when not set, which allows both.
+ */
+ fun serverToolResults(serverToolResults: BetaManagedAgentsWebFetchUrlSourceToolFilter?) =
+ serverToolResults(JsonField.ofNullable(serverToolResults))
+
+ /** Alias for calling [Builder.serverToolResults] with `serverToolResults.orElse(null)`. */
+ fun serverToolResults(
+ serverToolResults: Optional
+ ) = serverToolResults(serverToolResults.getOrNull())
+
+ /**
+ * Sets [Builder.serverToolResults] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.serverToolResults] with a well-typed
+ * [BetaManagedAgentsWebFetchUrlSourceToolFilter] value instead. This method is primarily
+ * for setting the field to an undocumented or not yet supported value.
+ */
+ fun serverToolResults(
+ serverToolResults: JsonField
+ ) = apply { this.serverToolResults = serverToolResults }
+
+ /**
+ * Alias for calling [serverToolResults] with
+ * `BetaManagedAgentsWebFetchUrlSourceToolFilter.ofAll(all)`.
+ */
+ fun serverToolResults(all: BetaManagedAgentsWebFetchUrlSourceAll) =
+ serverToolResults(BetaManagedAgentsWebFetchUrlSourceToolFilter.ofAll(all))
+
+ /**
+ * Alias for calling [serverToolResults] with
+ * `BetaManagedAgentsWebFetchUrlSourceToolFilter.ofNone(none)`.
+ */
+ fun serverToolResults(none: BetaManagedAgentsWebFetchUrlSourceNone) =
+ serverToolResults(BetaManagedAgentsWebFetchUrlSourceToolFilter.ofNone(none))
+
+ /**
+ * Alias for calling [serverToolResults] with
+ * `BetaManagedAgentsWebFetchUrlSourceToolFilter.ofOnly(only)`.
+ */
+ fun serverToolResults(only: BetaManagedAgentsWebFetchUrlSourceOnly) =
+ serverToolResults(BetaManagedAgentsWebFetchUrlSourceToolFilter.ofOnly(only))
+
+ /**
+ * Alias for calling [serverToolResults] with the following:
+ * ```java
+ * BetaManagedAgentsWebFetchUrlSourceOnly.builder()
+ * .tools(tools)
+ * .build()
+ * ```
+ */
+ fun onlyServerToolResults(tools: List) =
+ serverToolResults(BetaManagedAgentsWebFetchUrlSourceOnly.builder().tools(tools).build())
+
+ /**
+ * Alias for calling [serverToolResults] with
+ * `BetaManagedAgentsWebFetchUrlSourceToolFilter.ofExcept(except)`.
+ */
+ fun serverToolResults(except: BetaManagedAgentsWebFetchUrlSourceExcept) =
+ serverToolResults(BetaManagedAgentsWebFetchUrlSourceToolFilter.ofExcept(except))
+
+ /**
+ * Alias for calling [serverToolResults] with the following:
+ * ```java
+ * BetaManagedAgentsWebFetchUrlSourceExcept.builder()
+ * .tools(tools)
+ * .build()
+ * ```
+ */
+ fun exceptServerToolResults(tools: List) =
+ serverToolResults(
+ BetaManagedAgentsWebFetchUrlSourceExcept.builder().tools(tools).build()
+ )
+
+ /**
+ * Whether URLs in the text of user messages may be fetched. Null when not set, which allows
+ * them.
+ */
+ fun userInput(userInput: BetaManagedAgentsWebFetchUrlSourceUserInput?) =
+ userInput(JsonField.ofNullable(userInput))
+
+ /** Alias for calling [Builder.userInput] with `userInput.orElse(null)`. */
+ fun userInput(userInput: Optional) =
+ userInput(userInput.getOrNull())
+
+ /**
+ * Sets [Builder.userInput] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.userInput] with a well-typed
+ * [BetaManagedAgentsWebFetchUrlSourceUserInput] value instead. This method is primarily for
+ * setting the field to an undocumented or not yet supported value.
+ */
+ fun userInput(userInput: JsonField) = apply {
+ this.userInput = userInput
+ }
+
+ /**
+ * Alias for calling [userInput] with
+ * `BetaManagedAgentsWebFetchUrlSourceUserInput.ofAll(all)`.
+ */
+ fun userInput(all: BetaManagedAgentsWebFetchUrlSourceAll) =
+ userInput(BetaManagedAgentsWebFetchUrlSourceUserInput.ofAll(all))
+
+ /**
+ * Alias for calling [userInput] with
+ * `BetaManagedAgentsWebFetchUrlSourceUserInput.ofNone(none)`.
+ */
+ fun userInput(none: BetaManagedAgentsWebFetchUrlSourceNone) =
+ userInput(BetaManagedAgentsWebFetchUrlSourceUserInput.ofNone(none))
+
+ fun additionalProperties(additionalProperties: Map) = apply {
+ this.additionalProperties.clear()
+ putAllAdditionalProperties(additionalProperties)
+ }
+
+ fun putAdditionalProperty(key: String, value: JsonValue) = apply {
+ additionalProperties.put(key, value)
+ }
+
+ fun putAllAdditionalProperties(additionalProperties: Map) = apply {
+ this.additionalProperties.putAll(additionalProperties)
+ }
+
+ fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) }
+
+ fun removeAllAdditionalProperties(keys: Set) = apply {
+ keys.forEach(::removeAdditionalProperty)
+ }
+
+ /**
+ * Returns an immutable instance of [BetaManagedAgentsWebFetchUrlSources].
+ *
+ * Further updates to this [Builder] will not mutate the returned instance.
+ *
+ * The following fields are required:
+ * ```java
+ * .clientToolResults()
+ * .serverToolResults()
+ * .userInput()
+ * ```
+ *
+ * @throws IllegalStateException if any required field is unset.
+ */
+ fun build(): BetaManagedAgentsWebFetchUrlSources =
+ BetaManagedAgentsWebFetchUrlSources(
+ checkRequired("clientToolResults", clientToolResults),
+ checkRequired("serverToolResults", serverToolResults),
+ checkRequired("userInput", userInput),
+ additionalProperties.toMutableMap(),
+ )
+ }
+
+ private var validated: Boolean = false
+
+ /**
+ * Validates that the types of all values in this object match their expected types recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws AnthropicInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
+ fun validate(): BetaManagedAgentsWebFetchUrlSources = apply {
+ if (validated) {
+ return@apply
+ }
+
+ clientToolResults().ifPresent { it.validate() }
+ serverToolResults().ifPresent { it.validate() }
+ userInput().ifPresent { it.validate() }
+ validated = true
+ }
+
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: AnthropicInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ (clientToolResults.asKnown().getOrNull()?.validity() ?: 0) +
+ (serverToolResults.asKnown().getOrNull()?.validity() ?: 0) +
+ (userInput.asKnown().getOrNull()?.validity() ?: 0)
+
+ override fun equals(other: Any?): Boolean {
+ if (this === other) {
+ return true
+ }
+
+ return other is BetaManagedAgentsWebFetchUrlSources &&
+ clientToolResults == other.clientToolResults &&
+ serverToolResults == other.serverToolResults &&
+ userInput == other.userInput &&
+ additionalProperties == other.additionalProperties
+ }
+
+ private val hashCode: Int by lazy {
+ Objects.hash(clientToolResults, serverToolResults, userInput, additionalProperties)
+ }
+
+ override fun hashCode(): Int = hashCode
+
+ override fun toString() =
+ "BetaManagedAgentsWebFetchUrlSources{clientToolResults=$clientToolResults, serverToolResults=$serverToolResults, userInput=$userInput, additionalProperties=$additionalProperties}"
+}
diff --git a/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/agents/BetaManagedAgentsWebFetchUrlSourcesParams.kt b/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/agents/BetaManagedAgentsWebFetchUrlSourcesParams.kt
new file mode 100644
index 000000000..2176002db
--- /dev/null
+++ b/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/agents/BetaManagedAgentsWebFetchUrlSourcesParams.kt
@@ -0,0 +1,387 @@
+package com.anthropic.models.beta.agents
+
+import com.anthropic.core.ExcludeMissing
+import com.anthropic.core.JsonField
+import com.anthropic.core.JsonMissing
+import com.anthropic.core.JsonValue
+import com.anthropic.errors.AnthropicInvalidDataException
+import com.fasterxml.jackson.annotation.JsonAnyGetter
+import com.fasterxml.jackson.annotation.JsonAnySetter
+import com.fasterxml.jackson.annotation.JsonCreator
+import com.fasterxml.jackson.annotation.JsonProperty
+import java.util.Collections
+import java.util.Objects
+import java.util.Optional
+import kotlin.jvm.optionals.getOrNull
+
+/**
+ * Which sources contribute URLs the web_fetch tool may fetch. When web_fetch is limited to URLs the
+ * conversation has already shown the model (in a user message, a custom tool's result, or an
+ * earlier web_search or web_fetch result), each key narrows one of those sources and defaults to
+ * "all". Setting all three keys to "none" is rejected.
+ */
+class BetaManagedAgentsWebFetchUrlSourcesParams
+@JsonCreator(mode = JsonCreator.Mode.DISABLED)
+private constructor(
+ private val clientToolResults: JsonField,
+ private val serverToolResults: JsonField,
+ private val userInput: JsonField,
+ private val additionalProperties: MutableMap,
+) {
+
+ @JsonCreator
+ private constructor(
+ @JsonProperty("client_tool_results")
+ @ExcludeMissing
+ clientToolResults: JsonField =
+ JsonMissing.of(),
+ @JsonProperty("server_tool_results")
+ @ExcludeMissing
+ serverToolResults: JsonField =
+ JsonMissing.of(),
+ @JsonProperty("user_input")
+ @ExcludeMissing
+ userInput: JsonField = JsonMissing.of(),
+ ) : this(clientToolResults, serverToolResults, userInput, mutableMapOf())
+
+ /**
+ * Which custom tools' results contribute URLs that may be fetched: "all" (the default), "none",
+ * or an only or except list. Each name in a list must be a custom tool in the same tools array.
+ *
+ * @throws AnthropicInvalidDataException if the JSON field has an unexpected type (e.g. if the
+ * server responded with an unexpected value).
+ */
+ fun clientToolResults(): Optional =
+ clientToolResults.getOptional("client_tool_results")
+
+ /**
+ * Which of the web_search and web_fetch tools' results contribute URLs that may be fetched:
+ * "all" (the default), "none", or an only or except list. Each name in a list must be
+ * "web_search" or "web_fetch".
+ *
+ * @throws AnthropicInvalidDataException if the JSON field has an unexpected type (e.g. if the
+ * server responded with an unexpected value).
+ */
+ fun serverToolResults(): Optional =
+ serverToolResults.getOptional("server_tool_results")
+
+ /**
+ * Whether URLs in the text of user messages may be fetched: "all" (the default) or "none".
+ *
+ * @throws AnthropicInvalidDataException if the JSON field has an unexpected type (e.g. if the
+ * server responded with an unexpected value).
+ */
+ fun userInput(): Optional =
+ userInput.getOptional("user_input")
+
+ /**
+ * Returns the raw JSON value of [clientToolResults].
+ *
+ * Unlike [clientToolResults], this method doesn't throw if the JSON field has an unexpected
+ * type.
+ */
+ @JsonProperty("client_tool_results")
+ @ExcludeMissing
+ fun _clientToolResults(): JsonField =
+ clientToolResults
+
+ /**
+ * Returns the raw JSON value of [serverToolResults].
+ *
+ * Unlike [serverToolResults], this method doesn't throw if the JSON field has an unexpected
+ * type.
+ */
+ @JsonProperty("server_tool_results")
+ @ExcludeMissing
+ fun _serverToolResults(): JsonField =
+ serverToolResults
+
+ /**
+ * Returns the raw JSON value of [userInput].
+ *
+ * Unlike [userInput], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("user_input")
+ @ExcludeMissing
+ fun _userInput(): JsonField = userInput
+
+ @JsonAnySetter
+ private fun putAdditionalProperty(key: String, value: JsonValue) {
+ additionalProperties.put(key, value)
+ }
+
+ @JsonAnyGetter
+ @ExcludeMissing
+ fun _additionalProperties(): Map =
+ Collections.unmodifiableMap(additionalProperties)
+
+ fun toBuilder() = Builder().from(this)
+
+ companion object {
+
+ /**
+ * Returns a mutable builder for constructing an instance of
+ * [BetaManagedAgentsWebFetchUrlSourcesParams].
+ */
+ @JvmStatic fun builder() = Builder()
+ }
+
+ /** A builder for [BetaManagedAgentsWebFetchUrlSourcesParams]. */
+ class Builder internal constructor() {
+
+ private var clientToolResults:
+ JsonField =
+ JsonMissing.of()
+ private var serverToolResults:
+ JsonField =
+ JsonMissing.of()
+ private var userInput: JsonField =
+ JsonMissing.of()
+ private var additionalProperties: MutableMap = mutableMapOf()
+
+ @JvmSynthetic
+ internal fun from(
+ betaManagedAgentsWebFetchUrlSourcesParams: BetaManagedAgentsWebFetchUrlSourcesParams
+ ) = apply {
+ clientToolResults = betaManagedAgentsWebFetchUrlSourcesParams.clientToolResults
+ serverToolResults = betaManagedAgentsWebFetchUrlSourcesParams.serverToolResults
+ userInput = betaManagedAgentsWebFetchUrlSourcesParams.userInput
+ additionalProperties =
+ betaManagedAgentsWebFetchUrlSourcesParams.additionalProperties.toMutableMap()
+ }
+
+ /**
+ * Which custom tools' results contribute URLs that may be fetched: "all" (the default),
+ * "none", or an only or except list. Each name in a list must be a custom tool in the same
+ * tools array.
+ */
+ fun clientToolResults(
+ clientToolResults: BetaManagedAgentsWebFetchUrlSourceToolFilterParams?
+ ) = clientToolResults(JsonField.ofNullable(clientToolResults))
+
+ /** Alias for calling [Builder.clientToolResults] with `clientToolResults.orElse(null)`. */
+ fun clientToolResults(
+ clientToolResults: Optional
+ ) = clientToolResults(clientToolResults.getOrNull())
+
+ /**
+ * Sets [Builder.clientToolResults] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.clientToolResults] with a well-typed
+ * [BetaManagedAgentsWebFetchUrlSourceToolFilterParams] value instead. This method is
+ * primarily for setting the field to an undocumented or not yet supported value.
+ */
+ fun clientToolResults(
+ clientToolResults: JsonField
+ ) = apply { this.clientToolResults = clientToolResults }
+
+ /**
+ * Alias for calling [clientToolResults] with
+ * `BetaManagedAgentsWebFetchUrlSourceToolFilterParams.ofShorthand(shorthand)`.
+ */
+ fun clientToolResults(shorthand: BetaManagedAgentsWebFetchUrlSourceShorthand) =
+ clientToolResults(
+ BetaManagedAgentsWebFetchUrlSourceToolFilterParams.ofShorthand(shorthand)
+ )
+
+ /**
+ * Alias for calling [clientToolResults] with
+ * `BetaManagedAgentsWebFetchUrlSourceToolFilterParams.ofBetaManagedAgentsWebFetchUrlSourceToolFilter(betaManagedAgentsWebFetchUrlSourceToolFilter)`.
+ */
+ fun clientToolResults(
+ betaManagedAgentsWebFetchUrlSourceToolFilter:
+ BetaManagedAgentsWebFetchUrlSourceToolFilter
+ ) =
+ clientToolResults(
+ BetaManagedAgentsWebFetchUrlSourceToolFilterParams
+ .ofBetaManagedAgentsWebFetchUrlSourceToolFilter(
+ betaManagedAgentsWebFetchUrlSourceToolFilter
+ )
+ )
+
+ /**
+ * Which of the web_search and web_fetch tools' results contribute URLs that may be fetched:
+ * "all" (the default), "none", or an only or except list. Each name in a list must be
+ * "web_search" or "web_fetch".
+ */
+ fun serverToolResults(
+ serverToolResults: BetaManagedAgentsWebFetchUrlSourceToolFilterParams?
+ ) = serverToolResults(JsonField.ofNullable(serverToolResults))
+
+ /** Alias for calling [Builder.serverToolResults] with `serverToolResults.orElse(null)`. */
+ fun serverToolResults(
+ serverToolResults: Optional
+ ) = serverToolResults(serverToolResults.getOrNull())
+
+ /**
+ * Sets [Builder.serverToolResults] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.serverToolResults] with a well-typed
+ * [BetaManagedAgentsWebFetchUrlSourceToolFilterParams] value instead. This method is
+ * primarily for setting the field to an undocumented or not yet supported value.
+ */
+ fun serverToolResults(
+ serverToolResults: JsonField
+ ) = apply { this.serverToolResults = serverToolResults }
+
+ /**
+ * Alias for calling [serverToolResults] with
+ * `BetaManagedAgentsWebFetchUrlSourceToolFilterParams.ofShorthand(shorthand)`.
+ */
+ fun serverToolResults(shorthand: BetaManagedAgentsWebFetchUrlSourceShorthand) =
+ serverToolResults(
+ BetaManagedAgentsWebFetchUrlSourceToolFilterParams.ofShorthand(shorthand)
+ )
+
+ /**
+ * Alias for calling [serverToolResults] with
+ * `BetaManagedAgentsWebFetchUrlSourceToolFilterParams.ofBetaManagedAgentsWebFetchUrlSourceToolFilter(betaManagedAgentsWebFetchUrlSourceToolFilter)`.
+ */
+ fun serverToolResults(
+ betaManagedAgentsWebFetchUrlSourceToolFilter:
+ BetaManagedAgentsWebFetchUrlSourceToolFilter
+ ) =
+ serverToolResults(
+ BetaManagedAgentsWebFetchUrlSourceToolFilterParams
+ .ofBetaManagedAgentsWebFetchUrlSourceToolFilter(
+ betaManagedAgentsWebFetchUrlSourceToolFilter
+ )
+ )
+
+ /**
+ * Whether URLs in the text of user messages may be fetched: "all" (the default) or "none".
+ */
+ fun userInput(userInput: BetaManagedAgentsWebFetchUrlSourceUserInputParams?) =
+ userInput(JsonField.ofNullable(userInput))
+
+ /** Alias for calling [Builder.userInput] with `userInput.orElse(null)`. */
+ fun userInput(userInput: Optional) =
+ userInput(userInput.getOrNull())
+
+ /**
+ * Sets [Builder.userInput] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.userInput] with a well-typed
+ * [BetaManagedAgentsWebFetchUrlSourceUserInputParams] value instead. This method is
+ * primarily for setting the field to an undocumented or not yet supported value.
+ */
+ fun userInput(userInput: JsonField) =
+ apply {
+ this.userInput = userInput
+ }
+
+ /**
+ * Alias for calling [userInput] with
+ * `BetaManagedAgentsWebFetchUrlSourceUserInputParams.ofShorthand(shorthand)`.
+ */
+ fun userInput(shorthand: BetaManagedAgentsWebFetchUrlSourceShorthand) =
+ userInput(BetaManagedAgentsWebFetchUrlSourceUserInputParams.ofShorthand(shorthand))
+
+ /**
+ * Alias for calling [userInput] with
+ * `BetaManagedAgentsWebFetchUrlSourceUserInputParams.ofBetaManagedAgentsWebFetchUrlSourceUserInput(betaManagedAgentsWebFetchUrlSourceUserInput)`.
+ */
+ fun userInput(
+ betaManagedAgentsWebFetchUrlSourceUserInput: BetaManagedAgentsWebFetchUrlSourceUserInput
+ ) =
+ userInput(
+ BetaManagedAgentsWebFetchUrlSourceUserInputParams
+ .ofBetaManagedAgentsWebFetchUrlSourceUserInput(
+ betaManagedAgentsWebFetchUrlSourceUserInput
+ )
+ )
+
+ fun additionalProperties(additionalProperties: Map) = apply {
+ this.additionalProperties.clear()
+ putAllAdditionalProperties(additionalProperties)
+ }
+
+ fun putAdditionalProperty(key: String, value: JsonValue) = apply {
+ additionalProperties.put(key, value)
+ }
+
+ fun putAllAdditionalProperties(additionalProperties: Map) = apply {
+ this.additionalProperties.putAll(additionalProperties)
+ }
+
+ fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) }
+
+ fun removeAllAdditionalProperties(keys: Set) = apply {
+ keys.forEach(::removeAdditionalProperty)
+ }
+
+ /**
+ * Returns an immutable instance of [BetaManagedAgentsWebFetchUrlSourcesParams].
+ *
+ * Further updates to this [Builder] will not mutate the returned instance.
+ */
+ fun build(): BetaManagedAgentsWebFetchUrlSourcesParams =
+ BetaManagedAgentsWebFetchUrlSourcesParams(
+ clientToolResults,
+ serverToolResults,
+ userInput,
+ additionalProperties.toMutableMap(),
+ )
+ }
+
+ private var validated: Boolean = false
+
+ /**
+ * Validates that the types of all values in this object match their expected types recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws AnthropicInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
+ fun validate(): BetaManagedAgentsWebFetchUrlSourcesParams = apply {
+ if (validated) {
+ return@apply
+ }
+
+ clientToolResults().ifPresent { it.validate() }
+ serverToolResults().ifPresent { it.validate() }
+ userInput().ifPresent { it.validate() }
+ validated = true
+ }
+
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: AnthropicInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ (clientToolResults.asKnown().getOrNull()?.validity() ?: 0) +
+ (serverToolResults.asKnown().getOrNull()?.validity() ?: 0) +
+ (userInput.asKnown().getOrNull()?.validity() ?: 0)
+
+ override fun equals(other: Any?): Boolean {
+ if (this === other) {
+ return true
+ }
+
+ return other is BetaManagedAgentsWebFetchUrlSourcesParams &&
+ clientToolResults == other.clientToolResults &&
+ serverToolResults == other.serverToolResults &&
+ userInput == other.userInput &&
+ additionalProperties == other.additionalProperties
+ }
+
+ private val hashCode: Int by lazy {
+ Objects.hash(clientToolResults, serverToolResults, userInput, additionalProperties)
+ }
+
+ override fun hashCode(): Int = hashCode
+
+ override fun toString() =
+ "BetaManagedAgentsWebFetchUrlSourcesParams{clientToolResults=$clientToolResults, serverToolResults=$serverToolResults, userInput=$userInput, additionalProperties=$additionalProperties}"
+}
diff --git a/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/agents/versions/VersionListParams.kt b/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/agents/versions/VersionListParams.kt
index d2dd929a5..5f857aa8d 100644
--- a/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/agents/versions/VersionListParams.kt
+++ b/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/agents/versions/VersionListParams.kt
@@ -265,7 +265,16 @@ private constructor(
override fun _headers(): Headers =
Headers.builder()
.apply {
- betas?.forEach { put("anthropic-beta", it.toString()) }
+ betas?.let {
+ if (it.isNotEmpty()) {
+ put(
+ "anthropic-beta",
+ it.map { it.toString() }
+ .let { it + (listOf("managed-agents-2026-04-01") - it) }
+ .joinToString(","),
+ )
+ }
+ }
workspaceId?.let { put("anthropic-workspace-id", it) }
putAll(additionalHeaders)
}
diff --git a/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/deploymentruns/DeploymentRunListParams.kt b/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/deploymentruns/DeploymentRunListParams.kt
index 796351256..3c9bcc292 100644
--- a/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/deploymentruns/DeploymentRunListParams.kt
+++ b/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/deploymentruns/DeploymentRunListParams.kt
@@ -371,7 +371,16 @@ private constructor(
override fun _headers(): Headers =
Headers.builder()
.apply {
- betas?.forEach { put("anthropic-beta", it.toString()) }
+ betas?.let {
+ if (it.isNotEmpty()) {
+ put(
+ "anthropic-beta",
+ it.map { it.toString() }
+ .let { it + (listOf("managed-agents-2026-04-01") - it) }
+ .joinToString(","),
+ )
+ }
+ }
workspaceId?.let { put("anthropic-workspace-id", it) }
putAll(additionalHeaders)
}
diff --git a/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/deploymentruns/DeploymentRunRetrieveParams.kt b/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/deploymentruns/DeploymentRunRetrieveParams.kt
index fadca7abc..6bc47797a 100644
--- a/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/deploymentruns/DeploymentRunRetrieveParams.kt
+++ b/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/deploymentruns/DeploymentRunRetrieveParams.kt
@@ -237,7 +237,16 @@ private constructor(
override fun _headers(): Headers =
Headers.builder()
.apply {
- betas?.forEach { put("anthropic-beta", it.toString()) }
+ betas?.let {
+ if (it.isNotEmpty()) {
+ put(
+ "anthropic-beta",
+ it.map { it.toString() }
+ .let { it + (listOf("managed-agents-2026-04-01") - it) }
+ .joinToString(","),
+ )
+ }
+ }
workspaceId?.let { put("anthropic-workspace-id", it) }
putAll(additionalHeaders)
}
diff --git a/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/deployments/DeploymentArchiveParams.kt b/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/deployments/DeploymentArchiveParams.kt
index 34ff601ce..e378a4450 100644
--- a/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/deployments/DeploymentArchiveParams.kt
+++ b/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/deployments/DeploymentArchiveParams.kt
@@ -266,7 +266,16 @@ private constructor(
override fun _headers(): Headers =
Headers.builder()
.apply {
- betas?.forEach { put("anthropic-beta", it.toString()) }
+ betas?.let {
+ if (it.isNotEmpty()) {
+ put(
+ "anthropic-beta",
+ it.map { it.toString() }
+ .let { it + (listOf("managed-agents-2026-04-01") - it) }
+ .joinToString(","),
+ )
+ }
+ }
workspaceId?.let { put("anthropic-workspace-id", it) }
putAll(additionalHeaders)
}
diff --git a/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/deployments/DeploymentCreateParams.kt b/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/deployments/DeploymentCreateParams.kt
index 35fc923c9..8b8993911 100644
--- a/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/deployments/DeploymentCreateParams.kt
+++ b/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/deployments/DeploymentCreateParams.kt
@@ -774,7 +774,16 @@ private constructor(
override fun _headers(): Headers =
Headers.builder()
.apply {
- betas?.forEach { put("anthropic-beta", it.toString()) }
+ betas?.let {
+ if (it.isNotEmpty()) {
+ put(
+ "anthropic-beta",
+ it.map { it.toString() }
+ .let { it + (listOf("managed-agents-2026-04-01") - it) }
+ .joinToString(","),
+ )
+ }
+ }
workspaceId?.let { put("anthropic-workspace-id", it) }
putAll(additionalHeaders)
}
diff --git a/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/deployments/DeploymentListParams.kt b/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/deployments/DeploymentListParams.kt
index afdc8fcd7..6d4ca0eea 100644
--- a/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/deployments/DeploymentListParams.kt
+++ b/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/deployments/DeploymentListParams.kt
@@ -331,7 +331,16 @@ private constructor(
override fun _headers(): Headers =
Headers.builder()
.apply {
- betas?.forEach { put("anthropic-beta", it.toString()) }
+ betas?.let {
+ if (it.isNotEmpty()) {
+ put(
+ "anthropic-beta",
+ it.map { it.toString() }
+ .let { it + (listOf("managed-agents-2026-04-01") - it) }
+ .joinToString(","),
+ )
+ }
+ }
workspaceId?.let { put("anthropic-workspace-id", it) }
putAll(additionalHeaders)
}
diff --git a/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/deployments/DeploymentPauseParams.kt b/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/deployments/DeploymentPauseParams.kt
index 5ca92258f..f670d7f7e 100644
--- a/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/deployments/DeploymentPauseParams.kt
+++ b/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/deployments/DeploymentPauseParams.kt
@@ -265,7 +265,16 @@ private constructor(
override fun _headers(): Headers =
Headers.builder()
.apply {
- betas?.forEach { put("anthropic-beta", it.toString()) }
+ betas?.let {
+ if (it.isNotEmpty()) {
+ put(
+ "anthropic-beta",
+ it.map { it.toString() }
+ .let { it + (listOf("managed-agents-2026-04-01") - it) }
+ .joinToString(","),
+ )
+ }
+ }
workspaceId?.let { put("anthropic-workspace-id", it) }
putAll(additionalHeaders)
}
diff --git a/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/deployments/DeploymentRetrieveParams.kt b/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/deployments/DeploymentRetrieveParams.kt
index 7cdcfb470..197f13e63 100644
--- a/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/deployments/DeploymentRetrieveParams.kt
+++ b/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/deployments/DeploymentRetrieveParams.kt
@@ -232,7 +232,16 @@ private constructor(
override fun _headers(): Headers =
Headers.builder()
.apply {
- betas?.forEach { put("anthropic-beta", it.toString()) }
+ betas?.let {
+ if (it.isNotEmpty()) {
+ put(
+ "anthropic-beta",
+ it.map { it.toString() }
+ .let { it + (listOf("managed-agents-2026-04-01") - it) }
+ .joinToString(","),
+ )
+ }
+ }
workspaceId?.let { put("anthropic-workspace-id", it) }
putAll(additionalHeaders)
}
diff --git a/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/deployments/DeploymentRunParams.kt b/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/deployments/DeploymentRunParams.kt
index 75c03a235..9e564744f 100644
--- a/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/deployments/DeploymentRunParams.kt
+++ b/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/deployments/DeploymentRunParams.kt
@@ -265,7 +265,16 @@ private constructor(
override fun _headers(): Headers =
Headers.builder()
.apply {
- betas?.forEach { put("anthropic-beta", it.toString()) }
+ betas?.let {
+ if (it.isNotEmpty()) {
+ put(
+ "anthropic-beta",
+ it.map { it.toString() }
+ .let { it + (listOf("managed-agents-2026-04-01") - it) }
+ .joinToString(","),
+ )
+ }
+ }
workspaceId?.let { put("anthropic-workspace-id", it) }
putAll(additionalHeaders)
}
diff --git a/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/deployments/DeploymentUnpauseParams.kt b/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/deployments/DeploymentUnpauseParams.kt
index f0b6ade53..939bd8305 100644
--- a/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/deployments/DeploymentUnpauseParams.kt
+++ b/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/deployments/DeploymentUnpauseParams.kt
@@ -266,7 +266,16 @@ private constructor(
override fun _headers(): Headers =
Headers.builder()
.apply {
- betas?.forEach { put("anthropic-beta", it.toString()) }
+ betas?.let {
+ if (it.isNotEmpty()) {
+ put(
+ "anthropic-beta",
+ it.map { it.toString() }
+ .let { it + (listOf("managed-agents-2026-04-01") - it) }
+ .joinToString(","),
+ )
+ }
+ }
workspaceId?.let { put("anthropic-workspace-id", it) }
putAll(additionalHeaders)
}
diff --git a/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/deployments/DeploymentUpdateParams.kt b/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/deployments/DeploymentUpdateParams.kt
index dbd0ffc75..7d656bec7 100644
--- a/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/deployments/DeploymentUpdateParams.kt
+++ b/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/deployments/DeploymentUpdateParams.kt
@@ -788,7 +788,16 @@ private constructor(
override fun _headers(): Headers =
Headers.builder()
.apply {
- betas?.forEach { put("anthropic-beta", it.toString()) }
+ betas?.let {
+ if (it.isNotEmpty()) {
+ put(
+ "anthropic-beta",
+ it.map { it.toString() }
+ .let { it + (listOf("managed-agents-2026-04-01") - it) }
+ .joinToString(","),
+ )
+ }
+ }
workspaceId?.let { put("anthropic-workspace-id", it) }
putAll(additionalHeaders)
}
diff --git a/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/dreams/DreamArchiveParams.kt b/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/dreams/DreamArchiveParams.kt
index 59f7b29d4..b450d838a 100644
--- a/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/dreams/DreamArchiveParams.kt
+++ b/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/dreams/DreamArchiveParams.kt
@@ -274,7 +274,16 @@ private constructor(
override fun _headers(): Headers =
Headers.builder()
.apply {
- betas?.forEach { put("anthropic-beta", it.toString()) }
+ betas?.let {
+ if (it.isNotEmpty()) {
+ put(
+ "anthropic-beta",
+ it.map { it.toString() }
+ .let { it + (listOf("dreaming-2026-04-21") - it) }
+ .joinToString(","),
+ )
+ }
+ }
workspaceId?.let { put("anthropic-workspace-id", it) }
putAll(additionalHeaders)
}
diff --git a/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/dreams/DreamCancelParams.kt b/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/dreams/DreamCancelParams.kt
index 0372a9659..18e481a73 100644
--- a/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/dreams/DreamCancelParams.kt
+++ b/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/dreams/DreamCancelParams.kt
@@ -274,7 +274,16 @@ private constructor(
override fun _headers(): Headers =
Headers.builder()
.apply {
- betas?.forEach { put("anthropic-beta", it.toString()) }
+ betas?.let {
+ if (it.isNotEmpty()) {
+ put(
+ "anthropic-beta",
+ it.map { it.toString() }
+ .let { it + (listOf("dreaming-2026-04-21") - it) }
+ .joinToString(","),
+ )
+ }
+ }
workspaceId?.let { put("anthropic-workspace-id", it) }
putAll(additionalHeaders)
}
diff --git a/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/dreams/DreamCreateParams.kt b/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/dreams/DreamCreateParams.kt
index d852bf26e..c06fefca6 100644
--- a/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/dreams/DreamCreateParams.kt
+++ b/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/dreams/DreamCreateParams.kt
@@ -523,7 +523,16 @@ private constructor(
override fun _headers(): Headers =
Headers.builder()
.apply {
- betas?.forEach { put("anthropic-beta", it.toString()) }
+ betas?.let {
+ if (it.isNotEmpty()) {
+ put(
+ "anthropic-beta",
+ it.map { it.toString() }
+ .let { it + (listOf("dreaming-2026-04-21") - it) }
+ .joinToString(","),
+ )
+ }
+ }
workspaceId?.let { put("anthropic-workspace-id", it) }
putAll(additionalHeaders)
}
diff --git a/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/dreams/DreamListParams.kt b/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/dreams/DreamListParams.kt
index d208a5b4d..205a5dd3a 100644
--- a/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/dreams/DreamListParams.kt
+++ b/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/dreams/DreamListParams.kt
@@ -348,7 +348,16 @@ private constructor(
override fun _headers(): Headers =
Headers.builder()
.apply {
- betas?.forEach { put("anthropic-beta", it.toString()) }
+ betas?.let {
+ if (it.isNotEmpty()) {
+ put(
+ "anthropic-beta",
+ it.map { it.toString() }
+ .let { it + (listOf("dreaming-2026-04-21") - it) }
+ .joinToString(","),
+ )
+ }
+ }
workspaceId?.let { put("anthropic-workspace-id", it) }
putAll(additionalHeaders)
}
diff --git a/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/dreams/DreamRetrieveParams.kt b/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/dreams/DreamRetrieveParams.kt
index 878c49480..3a5d4ba03 100644
--- a/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/dreams/DreamRetrieveParams.kt
+++ b/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/dreams/DreamRetrieveParams.kt
@@ -239,7 +239,16 @@ private constructor(
override fun _headers(): Headers =
Headers.builder()
.apply {
- betas?.forEach { put("anthropic-beta", it.toString()) }
+ betas?.let {
+ if (it.isNotEmpty()) {
+ put(
+ "anthropic-beta",
+ it.map { it.toString() }
+ .let { it + (listOf("dreaming-2026-04-21") - it) }
+ .joinToString(","),
+ )
+ }
+ }
workspaceId?.let { put("anthropic-workspace-id", it) }
putAll(additionalHeaders)
}
diff --git a/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/environments/EnvironmentArchiveParams.kt b/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/environments/EnvironmentArchiveParams.kt
index 90a9a98f7..06f79216c 100644
--- a/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/environments/EnvironmentArchiveParams.kt
+++ b/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/environments/EnvironmentArchiveParams.kt
@@ -265,7 +265,16 @@ private constructor(
override fun _headers(): Headers =
Headers.builder()
.apply {
- betas?.forEach { put("anthropic-beta", it.toString()) }
+ betas?.let {
+ if (it.isNotEmpty()) {
+ put(
+ "anthropic-beta",
+ it.map { it.toString() }
+ .let { it + (listOf("managed-agents-2026-04-01") - it) }
+ .joinToString(","),
+ )
+ }
+ }
workspaceId?.let { put("anthropic-workspace-id", it) }
putAll(additionalHeaders)
}
diff --git a/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/environments/EnvironmentCreateParams.kt b/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/environments/EnvironmentCreateParams.kt
index e6ee125d0..1f77c41e7 100644
--- a/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/environments/EnvironmentCreateParams.kt
+++ b/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/environments/EnvironmentCreateParams.kt
@@ -443,7 +443,16 @@ private constructor(
override fun _headers(): Headers =
Headers.builder()
.apply {
- betas?.forEach { put("anthropic-beta", it.toString()) }
+ betas?.let {
+ if (it.isNotEmpty()) {
+ put(
+ "anthropic-beta",
+ it.map { it.toString() }
+ .let { it + (listOf("managed-agents-2026-04-01") - it) }
+ .joinToString(","),
+ )
+ }
+ }
workspaceId?.let { put("anthropic-workspace-id", it) }
putAll(additionalHeaders)
}
diff --git a/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/environments/EnvironmentDeleteParams.kt b/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/environments/EnvironmentDeleteParams.kt
index 5480fa2af..43168b857 100644
--- a/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/environments/EnvironmentDeleteParams.kt
+++ b/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/environments/EnvironmentDeleteParams.kt
@@ -265,7 +265,16 @@ private constructor(
override fun _headers(): Headers =
Headers.builder()
.apply {
- betas?.forEach { put("anthropic-beta", it.toString()) }
+ betas?.let {
+ if (it.isNotEmpty()) {
+ put(
+ "anthropic-beta",
+ it.map { it.toString() }
+ .let { it + (listOf("managed-agents-2026-04-01") - it) }
+ .joinToString(","),
+ )
+ }
+ }
workspaceId?.let { put("anthropic-workspace-id", it) }
putAll(additionalHeaders)
}
diff --git a/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/environments/EnvironmentListParams.kt b/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/environments/EnvironmentListParams.kt
index 915117f7e..066bf8d75 100644
--- a/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/environments/EnvironmentListParams.kt
+++ b/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/environments/EnvironmentListParams.kt
@@ -275,7 +275,16 @@ private constructor(
override fun _headers(): Headers =
Headers.builder()
.apply {
- betas?.forEach { put("anthropic-beta", it.toString()) }
+ betas?.let {
+ if (it.isNotEmpty()) {
+ put(
+ "anthropic-beta",
+ it.map { it.toString() }
+ .let { it + (listOf("managed-agents-2026-04-01") - it) }
+ .joinToString(","),
+ )
+ }
+ }
workspaceId?.let { put("anthropic-workspace-id", it) }
putAll(additionalHeaders)
}
diff --git a/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/environments/EnvironmentRetrieveParams.kt b/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/environments/EnvironmentRetrieveParams.kt
index 66515be29..373109790 100644
--- a/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/environments/EnvironmentRetrieveParams.kt
+++ b/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/environments/EnvironmentRetrieveParams.kt
@@ -233,7 +233,16 @@ private constructor(
override fun _headers(): Headers =
Headers.builder()
.apply {
- betas?.forEach { put("anthropic-beta", it.toString()) }
+ betas?.let {
+ if (it.isNotEmpty()) {
+ put(
+ "anthropic-beta",
+ it.map { it.toString() }
+ .let { it + (listOf("managed-agents-2026-04-01") - it) }
+ .joinToString(","),
+ )
+ }
+ }
workspaceId?.let { put("anthropic-workspace-id", it) }
putAll(additionalHeaders)
}
diff --git a/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/environments/EnvironmentUpdateParams.kt b/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/environments/EnvironmentUpdateParams.kt
index 5836b6f14..130295d12 100644
--- a/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/environments/EnvironmentUpdateParams.kt
+++ b/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/environments/EnvironmentUpdateParams.kt
@@ -455,7 +455,16 @@ private constructor(
override fun _headers(): Headers =
Headers.builder()
.apply {
- betas?.forEach { put("anthropic-beta", it.toString()) }
+ betas?.let {
+ if (it.isNotEmpty()) {
+ put(
+ "anthropic-beta",
+ it.map { it.toString() }
+ .let { it + (listOf("managed-agents-2026-04-01") - it) }
+ .joinToString(","),
+ )
+ }
+ }
workspaceId?.let { put("anthropic-workspace-id", it) }
putAll(additionalHeaders)
}
diff --git a/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/environments/work/WorkAckParams.kt b/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/environments/work/WorkAckParams.kt
index d48c1db5f..e69fe9bf5 100644
--- a/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/environments/work/WorkAckParams.kt
+++ b/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/environments/work/WorkAckParams.kt
@@ -267,7 +267,16 @@ private constructor(
override fun _headers(): Headers =
Headers.builder()
.apply {
- betas?.forEach { put("anthropic-beta", it.toString()) }
+ betas?.let {
+ if (it.isNotEmpty()) {
+ put(
+ "anthropic-beta",
+ it.map { it.toString() }
+ .let { it + (listOf("managed-agents-2026-04-01") - it) }
+ .joinToString(","),
+ )
+ }
+ }
putAll(additionalHeaders)
}
.build()
diff --git a/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/environments/work/WorkHeartbeatParams.kt b/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/environments/work/WorkHeartbeatParams.kt
index 3a3e7b29f..81b170473 100644
--- a/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/environments/work/WorkHeartbeatParams.kt
+++ b/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/environments/work/WorkHeartbeatParams.kt
@@ -319,7 +319,16 @@ private constructor(
override fun _headers(): Headers =
Headers.builder()
.apply {
- betas?.forEach { put("anthropic-beta", it.toString()) }
+ betas?.let {
+ if (it.isNotEmpty()) {
+ put(
+ "anthropic-beta",
+ it.map { it.toString() }
+ .let { it + (listOf("managed-agents-2026-04-01") - it) }
+ .joinToString(","),
+ )
+ }
+ }
putAll(additionalHeaders)
}
.build()
diff --git a/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/environments/work/WorkListParams.kt b/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/environments/work/WorkListParams.kt
index 01154aba3..f9d45463b 100644
--- a/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/environments/work/WorkListParams.kt
+++ b/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/environments/work/WorkListParams.kt
@@ -245,7 +245,16 @@ private constructor(
override fun _headers(): Headers =
Headers.builder()
.apply {
- betas?.forEach { put("anthropic-beta", it.toString()) }
+ betas?.let {
+ if (it.isNotEmpty()) {
+ put(
+ "anthropic-beta",
+ it.map { it.toString() }
+ .let { it + (listOf("managed-agents-2026-04-01") - it) }
+ .joinToString(","),
+ )
+ }
+ }
putAll(additionalHeaders)
}
.build()
diff --git a/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/environments/work/WorkPollParams.kt b/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/environments/work/WorkPollParams.kt
index 9d30061cf..213bbe512 100644
--- a/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/environments/work/WorkPollParams.kt
+++ b/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/environments/work/WorkPollParams.kt
@@ -292,7 +292,16 @@ private constructor(
override fun _headers(): Headers =
Headers.builder()
.apply {
- betas?.forEach { put("anthropic-beta", it.toString()) }
+ betas?.let {
+ if (it.isNotEmpty()) {
+ put(
+ "anthropic-beta",
+ it.map { it.toString() }
+ .let { it + (listOf("managed-agents-2026-04-01") - it) }
+ .joinToString(","),
+ )
+ }
+ }
anthropicWorkerId?.let { put("Anthropic-Worker-ID", it) }
putAll(additionalHeaders)
}
diff --git a/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/environments/work/WorkRetrieveParams.kt b/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/environments/work/WorkRetrieveParams.kt
index 337fb52ab..dacd132cd 100644
--- a/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/environments/work/WorkRetrieveParams.kt
+++ b/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/environments/work/WorkRetrieveParams.kt
@@ -258,7 +258,16 @@ private constructor(
override fun _headers(): Headers =
Headers.builder()
.apply {
- betas?.forEach { put("anthropic-beta", it.toString()) }
+ betas?.let {
+ if (it.isNotEmpty()) {
+ put(
+ "anthropic-beta",
+ it.map { it.toString() }
+ .let { it + (listOf("managed-agents-2026-04-01") - it) }
+ .joinToString(","),
+ )
+ }
+ }
workspaceId?.let { put("anthropic-workspace-id", it) }
putAll(additionalHeaders)
}
diff --git a/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/environments/work/WorkStatsParams.kt b/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/environments/work/WorkStatsParams.kt
index c34886e5f..435a01fcc 100644
--- a/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/environments/work/WorkStatsParams.kt
+++ b/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/environments/work/WorkStatsParams.kt
@@ -231,7 +231,16 @@ private constructor(
override fun _headers(): Headers =
Headers.builder()
.apply {
- betas?.forEach { put("anthropic-beta", it.toString()) }
+ betas?.let {
+ if (it.isNotEmpty()) {
+ put(
+ "anthropic-beta",
+ it.map { it.toString() }
+ .let { it + (listOf("managed-agents-2026-04-01") - it) }
+ .joinToString(","),
+ )
+ }
+ }
workspaceId?.let { put("anthropic-workspace-id", it) }
putAll(additionalHeaders)
}
diff --git a/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/environments/work/WorkStopParams.kt b/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/environments/work/WorkStopParams.kt
index 3533bb1cf..7b31f6e9e 100644
--- a/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/environments/work/WorkStopParams.kt
+++ b/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/environments/work/WorkStopParams.kt
@@ -279,7 +279,16 @@ private constructor(
override fun _headers(): Headers =
Headers.builder()
.apply {
- betas?.forEach { put("anthropic-beta", it.toString()) }
+ betas?.let {
+ if (it.isNotEmpty()) {
+ put(
+ "anthropic-beta",
+ it.map { it.toString() }
+ .let { it + (listOf("managed-agents-2026-04-01") - it) }
+ .joinToString(","),
+ )
+ }
+ }
workspaceId?.let { put("anthropic-workspace-id", it) }
putAll(additionalHeaders)
}
diff --git a/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/environments/work/WorkUpdateParams.kt b/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/environments/work/WorkUpdateParams.kt
index 0b0cffa07..e1f616c71 100644
--- a/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/environments/work/WorkUpdateParams.kt
+++ b/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/environments/work/WorkUpdateParams.kt
@@ -279,7 +279,16 @@ private constructor(
override fun _headers(): Headers =
Headers.builder()
.apply {
- betas?.forEach { put("anthropic-beta", it.toString()) }
+ betas?.let {
+ if (it.isNotEmpty()) {
+ put(
+ "anthropic-beta",
+ it.map { it.toString() }
+ .let { it + (listOf("managed-agents-2026-04-01") - it) }
+ .joinToString(","),
+ )
+ }
+ }
workspaceId?.let { put("anthropic-workspace-id", it) }
putAll(additionalHeaders)
}
diff --git a/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/files/FileDeleteParams.kt b/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/files/FileDeleteParams.kt
index 3ee0da3f8..29bc32d9d 100644
--- a/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/files/FileDeleteParams.kt
+++ b/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/files/FileDeleteParams.kt
@@ -265,7 +265,11 @@ private constructor(
override fun _headers(): Headers =
Headers.builder()
.apply {
- betas?.forEach { put("anthropic-beta", it.toString()) }
+ betas?.let {
+ if (it.isNotEmpty()) {
+ put("anthropic-beta", it.joinToString(","))
+ }
+ }
workspaceId?.let { put("anthropic-workspace-id", it) }
putAll(additionalHeaders)
}
diff --git a/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/files/FileDownloadParams.kt b/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/files/FileDownloadParams.kt
index 2f3c36990..aa3940078 100644
--- a/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/files/FileDownloadParams.kt
+++ b/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/files/FileDownloadParams.kt
@@ -232,7 +232,11 @@ private constructor(
override fun _headers(): Headers =
Headers.builder()
.apply {
- betas?.forEach { put("anthropic-beta", it.toString()) }
+ betas?.let {
+ if (it.isNotEmpty()) {
+ put("anthropic-beta", it.joinToString(","))
+ }
+ }
workspaceId?.let { put("anthropic-workspace-id", it) }
putAll(additionalHeaders)
}
diff --git a/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/files/FileListParams.kt b/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/files/FileListParams.kt
index 04978cf2b..1a8f9a95d 100644
--- a/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/files/FileListParams.kt
+++ b/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/files/FileListParams.kt
@@ -303,7 +303,11 @@ private constructor(
override fun _headers(): Headers =
Headers.builder()
.apply {
- betas?.forEach { put("anthropic-beta", it.toString()) }
+ betas?.let {
+ if (it.isNotEmpty()) {
+ put("anthropic-beta", it.joinToString(","))
+ }
+ }
workspaceId?.let { put("anthropic-workspace-id", it) }
putAll(additionalHeaders)
}
diff --git a/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/files/FileRetrieveMetadataParams.kt b/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/files/FileRetrieveMetadataParams.kt
index 427cefdcd..705c4cbb9 100644
--- a/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/files/FileRetrieveMetadataParams.kt
+++ b/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/files/FileRetrieveMetadataParams.kt
@@ -234,7 +234,11 @@ private constructor(
override fun _headers(): Headers =
Headers.builder()
.apply {
- betas?.forEach { put("anthropic-beta", it.toString()) }
+ betas?.let {
+ if (it.isNotEmpty()) {
+ put("anthropic-beta", it.joinToString(","))
+ }
+ }
workspaceId?.let { put("anthropic-workspace-id", it) }
putAll(additionalHeaders)
}
diff --git a/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/files/FileUploadParams.kt b/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/files/FileUploadParams.kt
index ca41e681e..58ef3c188 100644
--- a/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/files/FileUploadParams.kt
+++ b/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/files/FileUploadParams.kt
@@ -361,7 +361,11 @@ private constructor(
override fun _headers(): Headers =
Headers.builder()
.apply {
- betas?.forEach { put("anthropic-beta", it.toString()) }
+ betas?.let {
+ if (it.isNotEmpty()) {
+ put("anthropic-beta", it.joinToString(","))
+ }
+ }
workspaceId?.let { put("anthropic-workspace-id", it) }
putAll(additionalHeaders)
}
diff --git a/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/memorystores/MemoryStoreArchiveParams.kt b/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/memorystores/MemoryStoreArchiveParams.kt
index b5e7215c3..ab5c415a5 100644
--- a/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/memorystores/MemoryStoreArchiveParams.kt
+++ b/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/memorystores/MemoryStoreArchiveParams.kt
@@ -275,7 +275,16 @@ private constructor(
override fun _headers(): Headers =
Headers.builder()
.apply {
- betas?.forEach { put("anthropic-beta", it.toString()) }
+ betas?.let {
+ if (it.isNotEmpty()) {
+ put(
+ "anthropic-beta",
+ it.map { it.toString() }
+ .let { it + (listOf("agent-memory-2026-07-22") - it) }
+ .joinToString(","),
+ )
+ }
+ }
workspaceId?.let { put("anthropic-workspace-id", it) }
putAll(additionalHeaders)
}
diff --git a/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/memorystores/MemoryStoreCreateParams.kt b/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/memorystores/MemoryStoreCreateParams.kt
index 14c00ec2d..122c4acee 100644
--- a/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/memorystores/MemoryStoreCreateParams.kt
+++ b/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/memorystores/MemoryStoreCreateParams.kt
@@ -370,7 +370,16 @@ private constructor(
override fun _headers(): Headers =
Headers.builder()
.apply {
- betas?.forEach { put("anthropic-beta", it.toString()) }
+ betas?.let {
+ if (it.isNotEmpty()) {
+ put(
+ "anthropic-beta",
+ it.map { it.toString() }
+ .let { it + (listOf("agent-memory-2026-07-22") - it) }
+ .joinToString(","),
+ )
+ }
+ }
workspaceId?.let { put("anthropic-workspace-id", it) }
putAll(additionalHeaders)
}
diff --git a/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/memorystores/MemoryStoreDeleteParams.kt b/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/memorystores/MemoryStoreDeleteParams.kt
index 0d5715ec1..5e4db8d18 100644
--- a/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/memorystores/MemoryStoreDeleteParams.kt
+++ b/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/memorystores/MemoryStoreDeleteParams.kt
@@ -273,7 +273,16 @@ private constructor(
override fun _headers(): Headers =
Headers.builder()
.apply {
- betas?.forEach { put("anthropic-beta", it.toString()) }
+ betas?.let {
+ if (it.isNotEmpty()) {
+ put(
+ "anthropic-beta",
+ it.map { it.toString() }
+ .let { it + (listOf("agent-memory-2026-07-22") - it) }
+ .joinToString(","),
+ )
+ }
+ }
workspaceId?.let { put("anthropic-workspace-id", it) }
putAll(additionalHeaders)
}
diff --git a/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/memorystores/MemoryStoreListParams.kt b/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/memorystores/MemoryStoreListParams.kt
index eb85dacea..2685a6dbb 100644
--- a/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/memorystores/MemoryStoreListParams.kt
+++ b/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/memorystores/MemoryStoreListParams.kt
@@ -329,7 +329,16 @@ private constructor(
override fun _headers(): Headers =
Headers.builder()
.apply {
- betas?.forEach { put("anthropic-beta", it.toString()) }
+ betas?.let {
+ if (it.isNotEmpty()) {
+ put(
+ "anthropic-beta",
+ it.map { it.toString() }
+ .let { it + (listOf("agent-memory-2026-07-22") - it) }
+ .joinToString(","),
+ )
+ }
+ }
workspaceId?.let { put("anthropic-workspace-id", it) }
putAll(additionalHeaders)
}
diff --git a/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/memorystores/MemoryStoreRetrieveParams.kt b/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/memorystores/MemoryStoreRetrieveParams.kt
index b89f2f17b..eb75707e2 100644
--- a/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/memorystores/MemoryStoreRetrieveParams.kt
+++ b/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/memorystores/MemoryStoreRetrieveParams.kt
@@ -241,7 +241,16 @@ private constructor(
override fun _headers(): Headers =
Headers.builder()
.apply {
- betas?.forEach { put("anthropic-beta", it.toString()) }
+ betas?.let {
+ if (it.isNotEmpty()) {
+ put(
+ "anthropic-beta",
+ it.map { it.toString() }
+ .let { it + (listOf("agent-memory-2026-07-22") - it) }
+ .joinToString(","),
+ )
+ }
+ }
workspaceId?.let { put("anthropic-workspace-id", it) }
putAll(additionalHeaders)
}
diff --git a/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/memorystores/MemoryStoreUpdateParams.kt b/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/memorystores/MemoryStoreUpdateParams.kt
index 62c30c0c9..1334ef5d9 100644
--- a/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/memorystores/MemoryStoreUpdateParams.kt
+++ b/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/memorystores/MemoryStoreUpdateParams.kt
@@ -388,7 +388,16 @@ private constructor(
override fun _headers(): Headers =
Headers.builder()
.apply {
- betas?.forEach { put("anthropic-beta", it.toString()) }
+ betas?.let {
+ if (it.isNotEmpty()) {
+ put(
+ "anthropic-beta",
+ it.map { it.toString() }
+ .let { it + (listOf("agent-memory-2026-07-22") - it) }
+ .joinToString(","),
+ )
+ }
+ }
workspaceId?.let { put("anthropic-workspace-id", it) }
putAll(additionalHeaders)
}
diff --git a/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/memorystores/memories/MemoryCreateParams.kt b/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/memorystores/memories/MemoryCreateParams.kt
index f5b6a0f33..50fcc4775 100644
--- a/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/memorystores/memories/MemoryCreateParams.kt
+++ b/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/memorystores/memories/MemoryCreateParams.kt
@@ -387,7 +387,16 @@ private constructor(
override fun _headers(): Headers =
Headers.builder()
.apply {
- betas?.forEach { put("anthropic-beta", it.toString()) }
+ betas?.let {
+ if (it.isNotEmpty()) {
+ put(
+ "anthropic-beta",
+ it.map { it.toString() }
+ .let { it + (listOf("agent-memory-2026-07-22") - it) }
+ .joinToString(","),
+ )
+ }
+ }
workspaceId?.let { put("anthropic-workspace-id", it) }
putAll(additionalHeaders)
}
diff --git a/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/memorystores/memories/MemoryDeleteParams.kt b/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/memorystores/memories/MemoryDeleteParams.kt
index ce1c0323b..70601dc5d 100644
--- a/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/memorystores/memories/MemoryDeleteParams.kt
+++ b/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/memorystores/memories/MemoryDeleteParams.kt
@@ -318,7 +318,16 @@ private constructor(
override fun _headers(): Headers =
Headers.builder()
.apply {
- betas?.forEach { put("anthropic-beta", it.toString()) }
+ betas?.let {
+ if (it.isNotEmpty()) {
+ put(
+ "anthropic-beta",
+ it.map { it.toString() }
+ .let { it + (listOf("agent-memory-2026-07-22") - it) }
+ .joinToString(","),
+ )
+ }
+ }
workspaceId?.let { put("anthropic-workspace-id", it) }
putAll(additionalHeaders)
}
diff --git a/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/memorystores/memories/MemoryListParams.kt b/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/memorystores/memories/MemoryListParams.kt
index ff1668c09..5892cccf1 100644
--- a/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/memorystores/memories/MemoryListParams.kt
+++ b/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/memorystores/memories/MemoryListParams.kt
@@ -349,7 +349,16 @@ private constructor(
override fun _headers(): Headers =
Headers.builder()
.apply {
- betas?.forEach { put("anthropic-beta", it.toString()) }
+ betas?.let {
+ if (it.isNotEmpty()) {
+ put(
+ "anthropic-beta",
+ it.map { it.toString() }
+ .let { it + (listOf("agent-memory-2026-07-22") - it) }
+ .joinToString(","),
+ )
+ }
+ }
workspaceId?.let { put("anthropic-workspace-id", it) }
putAll(additionalHeaders)
}
diff --git a/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/memorystores/memories/MemoryRetrieveParams.kt b/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/memorystores/memories/MemoryRetrieveParams.kt
index 4bbc799eb..2e5394463 100644
--- a/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/memorystores/memories/MemoryRetrieveParams.kt
+++ b/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/memorystores/memories/MemoryRetrieveParams.kt
@@ -280,7 +280,16 @@ private constructor(
override fun _headers(): Headers =
Headers.builder()
.apply {
- betas?.forEach { put("anthropic-beta", it.toString()) }
+ betas?.let {
+ if (it.isNotEmpty()) {
+ put(
+ "anthropic-beta",
+ it.map { it.toString() }
+ .let { it + (listOf("agent-memory-2026-07-22") - it) }
+ .joinToString(","),
+ )
+ }
+ }
workspaceId?.let { put("anthropic-workspace-id", it) }
putAll(additionalHeaders)
}
diff --git a/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/memorystores/memories/MemoryUpdateParams.kt b/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/memorystores/memories/MemoryUpdateParams.kt
index 971f23f67..31bc5eb14 100644
--- a/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/memorystores/memories/MemoryUpdateParams.kt
+++ b/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/memorystores/memories/MemoryUpdateParams.kt
@@ -437,7 +437,16 @@ private constructor(
override fun _headers(): Headers =
Headers.builder()
.apply {
- betas?.forEach { put("anthropic-beta", it.toString()) }
+ betas?.let {
+ if (it.isNotEmpty()) {
+ put(
+ "anthropic-beta",
+ it.map { it.toString() }
+ .let { it + (listOf("agent-memory-2026-07-22") - it) }
+ .joinToString(","),
+ )
+ }
+ }
workspaceId?.let { put("anthropic-workspace-id", it) }
putAll(additionalHeaders)
}
diff --git a/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/memorystores/memoryversions/MemoryVersionListParams.kt b/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/memorystores/memoryversions/MemoryVersionListParams.kt
index 94affd29f..9cf6e5a86 100644
--- a/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/memorystores/memoryversions/MemoryVersionListParams.kt
+++ b/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/memorystores/memoryversions/MemoryVersionListParams.kt
@@ -409,7 +409,16 @@ private constructor(
override fun _headers(): Headers =
Headers.builder()
.apply {
- betas?.forEach { put("anthropic-beta", it.toString()) }
+ betas?.let {
+ if (it.isNotEmpty()) {
+ put(
+ "anthropic-beta",
+ it.map { it.toString() }
+ .let { it + (listOf("agent-memory-2026-07-22") - it) }
+ .joinToString(","),
+ )
+ }
+ }
workspaceId?.let { put("anthropic-workspace-id", it) }
putAll(additionalHeaders)
}
diff --git a/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/memorystores/memoryversions/MemoryVersionRedactParams.kt b/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/memorystores/memoryversions/MemoryVersionRedactParams.kt
index 9340a7207..2ec4ca7f5 100644
--- a/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/memorystores/memoryversions/MemoryVersionRedactParams.kt
+++ b/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/memorystores/memoryversions/MemoryVersionRedactParams.kt
@@ -293,7 +293,16 @@ private constructor(
override fun _headers(): Headers =
Headers.builder()
.apply {
- betas?.forEach { put("anthropic-beta", it.toString()) }
+ betas?.let {
+ if (it.isNotEmpty()) {
+ put(
+ "anthropic-beta",
+ it.map { it.toString() }
+ .let { it + (listOf("agent-memory-2026-07-22") - it) }
+ .joinToString(","),
+ )
+ }
+ }
workspaceId?.let { put("anthropic-workspace-id", it) }
putAll(additionalHeaders)
}
diff --git a/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/memorystores/memoryversions/MemoryVersionRetrieveParams.kt b/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/memorystores/memoryversions/MemoryVersionRetrieveParams.kt
index 8608cbe37..05cf6c04b 100644
--- a/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/memorystores/memoryversions/MemoryVersionRetrieveParams.kt
+++ b/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/memorystores/memoryversions/MemoryVersionRetrieveParams.kt
@@ -284,7 +284,16 @@ private constructor(
override fun _headers(): Headers =
Headers.builder()
.apply {
- betas?.forEach { put("anthropic-beta", it.toString()) }
+ betas?.let {
+ if (it.isNotEmpty()) {
+ put(
+ "anthropic-beta",
+ it.map { it.toString() }
+ .let { it + (listOf("agent-memory-2026-07-22") - it) }
+ .joinToString(","),
+ )
+ }
+ }
workspaceId?.let { put("anthropic-workspace-id", it) }
putAll(additionalHeaders)
}
diff --git a/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/messages/BetaBrowserClickTarget.kt b/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/messages/BetaBrowserClickTarget.kt
new file mode 100644
index 000000000..55298c925
--- /dev/null
+++ b/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/messages/BetaBrowserClickTarget.kt
@@ -0,0 +1,416 @@
+package com.anthropic.models.beta.messages
+
+import com.anthropic.core.BaseDeserializer
+import com.anthropic.core.BaseSerializer
+import com.anthropic.core.Enum
+import com.anthropic.core.JsonField
+import com.anthropic.core.JsonMissing
+import com.anthropic.core.JsonValue
+import com.anthropic.core.getOrThrow
+import com.anthropic.errors.AnthropicInvalidDataException
+import com.fasterxml.jackson.annotation.JsonCreator
+import com.fasterxml.jackson.core.JsonGenerator
+import com.fasterxml.jackson.core.ObjectCodec
+import com.fasterxml.jackson.databind.JsonNode
+import com.fasterxml.jackson.databind.SerializerProvider
+import com.fasterxml.jackson.databind.annotation.JsonDeserialize
+import com.fasterxml.jackson.databind.annotation.JsonSerialize
+import com.fasterxml.jackson.module.kotlin.jacksonTypeRef
+import java.util.Objects
+import java.util.Optional
+import kotlin.jvm.optionals.getOrNull
+
+/** Where to act: either a viewport coordinate or an element reference. */
+@JsonDeserialize(using = BetaBrowserClickTarget.Deserializer::class)
+@JsonSerialize(using = BetaBrowserClickTarget.Serializer::class)
+class BetaBrowserClickTarget
+private constructor(
+ private val coordinate: BetaBrowserCoordinateTarget? = null,
+ private val ref: BetaBrowserRefTarget? = null,
+ private val _json: JsonValue? = null,
+) {
+
+ fun type(): Type =
+ when {
+ coordinate != null -> Type.COORDINATE
+ ref != null -> Type.REF
+ else -> Type.of(_json?.asObject()?.getOrNull()?.get("type") ?: JsonMissing.of())
+ }
+
+ /**
+ * A point in the browser viewport, in viewport pixels (the same frame as a full-viewport
+ * screenshot).
+ */
+ fun coordinate(): Optional = Optional.ofNullable(coordinate)
+
+ /**
+ * An element on the page, identified by a reference from a prior `read_page` or `find` result.
+ * References are scoped to the tab that produced them and become stale after navigation or a
+ * major re-render.
+ */
+ fun ref(): Optional = Optional.ofNullable(ref)
+
+ fun isCoordinate(): Boolean = coordinate != null
+
+ fun isRef(): Boolean = ref != null
+
+ /**
+ * A point in the browser viewport, in viewport pixels (the same frame as a full-viewport
+ * screenshot).
+ */
+ fun asCoordinate(): BetaBrowserCoordinateTarget = coordinate.getOrThrow("coordinate")
+
+ /**
+ * An element on the page, identified by a reference from a prior `read_page` or `find` result.
+ * References are scoped to the tab that produced them and become stale after navigation or a
+ * major re-render.
+ */
+ fun asRef(): BetaBrowserRefTarget = ref.getOrThrow("ref")
+
+ fun _json(): Optional = Optional.ofNullable(_json)
+
+ /**
+ * Maps this instance's current variant to a value of type [T] using the given [visitor].
+ *
+ * Note that this method is _not_ forwards compatible with new variants from the API, unless
+ * [visitor] overrides [Visitor.unknown]. To handle variants not known to this version of the
+ * SDK gracefully, consider overriding [Visitor.unknown]:
+ * ```java
+ * import com.anthropic.core.JsonValue;
+ * import java.util.Optional;
+ *
+ * Optional result = betaBrowserClickTarget.accept(new BetaBrowserClickTarget.Visitor>() {
+ * @Override
+ * public Optional visitCoordinate(BetaBrowserCoordinateTarget coordinate) {
+ * return Optional.of(coordinate.toString());
+ * }
+ *
+ * // ...
+ *
+ * @Override
+ * public Optional unknown(JsonValue json) {
+ * // Or inspect the `json`.
+ * return Optional.empty();
+ * }
+ * });
+ * ```
+ *
+ * @throws AnthropicInvalidDataException if [Visitor.unknown] is not overridden in [visitor] and
+ * the current variant is unknown.
+ */
+ fun accept(visitor: Visitor): T =
+ when {
+ coordinate != null -> visitor.visitCoordinate(coordinate)
+ ref != null -> visitor.visitRef(ref)
+ else -> visitor.unknown(_json)
+ }
+
+ private var validated: Boolean = false
+
+ /**
+ * Validates that the types of all values in this object match their expected types recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws AnthropicInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
+ fun validate(): BetaBrowserClickTarget = apply {
+ if (validated) {
+ return@apply
+ }
+
+ when {
+ coordinate != null -> coordinate.validate()
+ ref != null -> ref.validate()
+ else -> throw AnthropicInvalidDataException("Unknown BetaBrowserClickTarget: $_json")
+ }
+ validated = true
+ }
+
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: AnthropicInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ when {
+ coordinate != null -> coordinate.validity()
+ ref != null -> ref.validity()
+ else -> 0
+ }
+
+ override fun equals(other: Any?): Boolean {
+ if (this === other) {
+ return true
+ }
+
+ return other is BetaBrowserClickTarget && coordinate == other.coordinate && ref == other.ref
+ }
+
+ override fun hashCode(): Int = Objects.hash(coordinate, ref)
+
+ override fun toString(): String =
+ when {
+ coordinate != null -> "BetaBrowserClickTarget{coordinate=$coordinate}"
+ ref != null -> "BetaBrowserClickTarget{ref=$ref}"
+ _json != null -> "BetaBrowserClickTarget{_unknown=$_json}"
+ else -> throw IllegalStateException("Invalid BetaBrowserClickTarget")
+ }
+
+ companion object {
+
+ /**
+ * A point in the browser viewport, in viewport pixels (the same frame as a full-viewport
+ * screenshot).
+ */
+ @JvmStatic
+ fun ofCoordinate(coordinate: BetaBrowserCoordinateTarget) =
+ BetaBrowserClickTarget(coordinate = coordinate)
+
+ /**
+ * An element on the page, identified by a reference from a prior `read_page` or `find`
+ * result. References are scoped to the tab that produced them and become stale after
+ * navigation or a major re-render.
+ */
+ @JvmStatic fun ofRef(ref: BetaBrowserRefTarget) = BetaBrowserClickTarget(ref = ref)
+
+ /**
+ * Returns an immutable instance of [BetaBrowserClickTarget] whose [ofRef] variant is built
+ * from the given required [ref].
+ */
+ @JvmStatic fun ofRef(ref: String) = ofRef(BetaBrowserRefTarget.of(ref))
+ }
+
+ /**
+ * An interface that defines how to map each variant of [BetaBrowserClickTarget] to a value of
+ * type [T].
+ */
+ interface Visitor {
+
+ /**
+ * A point in the browser viewport, in viewport pixels (the same frame as a full-viewport
+ * screenshot).
+ */
+ fun visitCoordinate(coordinate: BetaBrowserCoordinateTarget): T
+
+ /**
+ * An element on the page, identified by a reference from a prior `read_page` or `find`
+ * result. References are scoped to the tab that produced them and become stale after
+ * navigation or a major re-render.
+ */
+ fun visitRef(ref: BetaBrowserRefTarget): T
+
+ /**
+ * Maps an unknown variant of [BetaBrowserClickTarget] to a value of type [T].
+ *
+ * An instance of [BetaBrowserClickTarget] can contain an unknown variant if it was
+ * deserialized from data that doesn't match any known variant. For example, if the SDK is
+ * on an older version than the API, then the API may respond with new variants that the SDK
+ * is unaware of.
+ *
+ * @throws AnthropicInvalidDataException in the default implementation.
+ */
+ fun unknown(json: JsonValue?): T {
+ throw AnthropicInvalidDataException("Unknown BetaBrowserClickTarget: $json")
+ }
+ }
+
+ internal class Deserializer :
+ BaseDeserializer(BetaBrowserClickTarget::class) {
+
+ override fun ObjectCodec.deserialize(node: JsonNode): BetaBrowserClickTarget {
+ val json = JsonValue.fromJsonNode(node)
+ val type = json.asObject().getOrNull()?.get("type")?.asString()?.getOrNull()
+
+ when (type) {
+ "coordinate" -> {
+ return tryDeserialize(node, jacksonTypeRef())
+ ?.let { BetaBrowserClickTarget(coordinate = it, _json = json) }
+ ?: BetaBrowserClickTarget(_json = json)
+ }
+ "ref" -> {
+ return tryDeserialize(node, jacksonTypeRef())?.let {
+ BetaBrowserClickTarget(ref = it, _json = json)
+ } ?: BetaBrowserClickTarget(_json = json)
+ }
+ }
+
+ return BetaBrowserClickTarget(_json = json)
+ }
+ }
+
+ internal class Serializer :
+ BaseSerializer(BetaBrowserClickTarget::class) {
+
+ override fun serialize(
+ value: BetaBrowserClickTarget,
+ generator: JsonGenerator,
+ provider: SerializerProvider,
+ ) {
+ when {
+ value.coordinate != null -> generator.writeObject(value.coordinate)
+ value.ref != null -> generator.writeObject(value.ref)
+ value._json != null -> generator.writeObject(value._json)
+ else -> throw IllegalStateException("Invalid BetaBrowserClickTarget")
+ }
+ }
+ }
+
+ class Type private constructor(private val value: JsonField