Skip to content

Automate browser based workflows with AI

SKY-10936: Add Claude Fable 5 model support (#6539)

Andrew Neilson5ad7d68d8be2
diff --git a/.env.example b/.env.example
index d95ee4f41..3ae199976 100644
--- a/.env.example
+++ b/.env.example
@@ -86,8 +86,9 @@ YUTORI_TOOL_SET=""
# LLM_KEY: The chosen language model to use. This should be one of the models
# provided by the enabled LLM providers (e.g., OPENAI_GPT5_5, OPENAI_GPT5_4,
-# ANTHROPIC_CLAUDE4.7_OPUS, ANTHROPIC_CLAUDE4.6_SONNET, GEMINI_3_PRO,
-# BEDROCK_ANTHROPIC_CLAUDE4.7_OPUS_INFERENCE_PROFILE).
+# ANTHROPIC_CLAUDE5_FABLE, ANTHROPIC_CLAUDE4.7_OPUS, ANTHROPIC_CLAUDE4.6_SONNET,
+# GEMINI_3_PRO, BEDROCK_ANTHROPIC_CLAUDE5_FABLE_INFERENCE_PROFILE,
+# BEDROCK_ANTHROPIC_CLAUDE5_FABLE_WITH_FALLBACK).
# See docs: https://www.skyvern.com/docs/self-hosted/llm-configuration
LLM_KEY=""
# a cheaper LLM providers to help finishing some small tasks, like custom selection or svg conversion. If empty, it will be the same as LLM_KEY
diff --git a/skyvern/cli/llm_setup.py b/skyvern/cli/llm_setup.py
index 2db1ebe10..3d8eb96a4 100644
--- a/skyvern/cli/llm_setup.py
+++ b/skyvern/cli/llm_setup.py
@@ -130,6 +130,7 @@ def setup_llm_providers(env_path: Path | str | None = None) -> None:
enabled_providers.append("anthropic")
model_options.extend(
[
+ "ANTHROPIC_CLAUDE5_FABLE",
"ANTHROPIC_CLAUDE4.7_OPUS",
"ANTHROPIC_CLAUDE4.6_OPUS",
"ANTHROPIC_CLAUDE4.6_SONNET",
diff --git a/skyvern/config.py b/skyvern/config.py
index a15c2076e..fff9ea9e7 100644
--- a/skyvern/config.py
+++ b/skyvern/config.py
@@ -755,6 +755,18 @@ class Settings(BaseSettings):
"label": "Anthropic Claude 4.6 Opus",
}
+ # Anthropic Claude Fable 5: prefer Bedrock when enabled, fall back to direct API
+ if self.ENABLE_BEDROCK_ANTHROPIC:
+ mapping["claude-fable-5"] = {
+ "llm_key": "BEDROCK_ANTHROPIC_CLAUDE5_FABLE_INFERENCE_PROFILE",
+ "label": "Anthropic Claude Fable 5",
+ }
+ else:
+ mapping["claude-fable-5"] = {
+ "llm_key": "ANTHROPIC_CLAUDE5_FABLE",
+ "label": "Anthropic Claude Fable 5",
+ }
+
return mapping
def model_post_init(self, __context: Any) -> None: # type: ignore[override]
diff --git a/skyvern/forge/sdk/api/llm/api_handler_factory.py b/skyvern/forge/sdk/api/llm/api_handler_factory.py
index 8690fb278..55dfdbabc 100644
--- a/skyvern/forge/sdk/api/llm/api_handler_factory.py
+++ b/skyvern/forge/sdk/api/llm/api_handler_factory.py
@@ -639,10 +639,14 @@ class LLMAPIHandlerFactory:
@staticmethod
def requires_adaptive_thinking(model_name: str | None) -> bool:
- # Claude Opus 4.7 rejects `thinking.type=enabled` and requires
+ # Newer direct Anthropic models reject `thinking.type=enabled` and require
# `thinking.type=adaptive` + `output_config.effort`. Bedrock's translator
# does not yet accept the new shape, so gate to direct Anthropic.
- return model_name == "anthropic/claude-opus-4-7"
+ return model_name in {
+ "anthropic/claude-opus-4-7",
+ "anthropic/claude-opus-4-8",
+ "anthropic/claude-fable-5",
+ }
@staticmethod
def _apply_anthropic_thinking_optimization(
diff --git a/skyvern/forge/sdk/api/llm/config_registry.py b/skyvern/forge/sdk/api/llm/config_registry.py
index abcef9f92..9d10639a4 100644
--- a/skyvern/forge/sdk/api/llm/config_registry.py
+++ b/skyvern/forge/sdk/api/llm/config_registry.py
@@ -486,6 +486,17 @@ if settings.ENABLE_ANTHROPIC:
temperature=1,
),
)
+ LLMConfigRegistry.register_config(
+ "ANTHROPIC_CLAUDE5_FABLE",
+ LLMConfig(
+ "anthropic/claude-fable-5",
+ ["ANTHROPIC_API_KEY"],
+ supports_vision=True,
+ add_assistant_prefix=False,
+ max_completion_tokens=128000,
+ temperature=1,
+ ),
+ )
if settings.ENABLE_BEDROCK:
# Supported through AWS IAM authentication
LLMConfigRegistry.register_config(
@@ -594,6 +605,17 @@ if settings.ENABLE_BEDROCK:
temperature=1,
),
)
+ LLMConfigRegistry.register_config(
+ "BEDROCK_ANTHROPIC_CLAUDE5_FABLE_INFERENCE_PROFILE",
+ LLMConfig(
+ "bedrock/us.anthropic.claude-fable-5",
+ ["AWS_REGION"],
+ supports_vision=True,
+ add_assistant_prefix=False,
+ max_completion_tokens=128000,
+ temperature=1,
+ ),
+ )
if settings.ENABLE_AZURE:
diff --git a/skyvern/forge/sdk/copilot/model_resolver.py b/skyvern/forge/sdk/copilot/model_resolver.py
index 64f5f4826..73a9fcb6d 100644
--- a/skyvern/forge/sdk/copilot/model_resolver.py
+++ b/skyvern/forge/sdk/copilot/model_resolver.py
@@ -6,11 +6,12 @@ Known limitations:
``prompt_name`` input, so prompt-specific thinking-budget tuning applied by
``api_handler_factory`` for certain prompt / model combinations cannot be
reproduced here.
-* ``LLMRouterConfig`` (fallback chains) is accepted by degrading to the
- ``main_model_group`` entry as a direct ``LLMConfig``. Load-balancing across
- ``model_list``, cross-provider fallbacks, and Redis-coordinated cooldowns
- are not applied on the copilot-v2 path. Proper router support through the
- Agents SDK model interface is tracked in SKY-9256.
+* ``LLMRouterConfig`` (fallback chains) is accepted by resolving the
+ ``main_model_group`` entry as the primary ``LLMConfig`` and passing the
+ remaining provider model names through LiteLLM's ``fallbacks`` argument.
+ Load-balancing across multiple deployments for the same router group and
+ Redis-coordinated cooldowns are not applied on the copilot-v2 path. Proper
+ router support through the Agents SDK model interface is tracked in SKY-9256.
"""
from __future__ import annotations
@@ -56,6 +57,7 @@ _EXTRA_ARGS_FIELDS = frozenset(
"timeout",
"thinking",
"service_tier",
+ "fallbacks",
}
)
@@ -69,16 +71,36 @@ _DROP_FIELDS = frozenset({"thinking_level"})
_WARNED_DROP_KEYS: set[str] = set()
+def _router_model_name(config: LLMRouterConfig, model_group: str) -> str:
+ """Return the concrete provider model for a router group alias."""
+ entry = next((m for m in config.model_list if m.model_name == model_group), None)
+ if entry is None:
+ return model_group
+ return str(entry.litellm_params.get("model") or entry.model_name)
+
+
+def _router_fallback_models(config: LLMRouterConfig) -> list[str]:
+ if not config.fallback_model_group:
+ return []
+ if isinstance(config.fallback_model_group, str):
+ fallback_groups = [config.fallback_model_group]
+ else:
+ fallback_groups = list(config.fallback_model_group)
+ return [_router_model_name(config, group) for group in fallback_groups]
+
+
def _degrade_router_to_direct(llm_key: str, config: LLMRouterConfig) -> LLMConfig:
- """Collapse an LLMRouterConfig down to its main_model_group entry as a direct LLMConfig.
+ """Resolve an LLMRouterConfig to its primary direct model plus LiteLLM fallbacks.
The Agents SDK model interface takes a single model, not a router; until the
full bridge lands (SKY-9256), the copilot-v2 path needs a way to run on
orgs whose configured llm_key resolves to a router. We use the entry whose
``model_name`` matches ``main_model_group``; if none match we fall back to
- ``model_list[0]`` and warn.
+ ``model_list[0]`` and warn. Fallback groups are converted to concrete
+ provider model strings and passed to LiteLLM's plain ``acompletion``
+ fallback path via ModelSettings.extra_args.
- The happy-path degradation is the expected code path on every copilot-v2
+ The happy-path resolution is the expected code path on every copilot-v2
call in staging/prod, so it logs at INFO. WARN is reserved for the
main_model_group-miss misconfig case.
"""
@@ -102,12 +124,16 @@ def _degrade_router_to_direct(llm_key: str, config: LLMRouterConfig) -> LLMConfi
# entry.model_name is just a router group alias.
params = dict(selected.litellm_params)
direct_model_name = params.pop("model", None) or selected.model_name
+ fallback_models = _router_fallback_models(config)
+ if fallback_models:
+ params["fallbacks"] = fallback_models
LOG.info(
- "Degrading LLMRouterConfig to main model on copilot-v2 path; fallbacks/load-balancing not applied",
+ "Resolved LLMRouterConfig to primary model on copilot-v2 path",
llm_key=llm_key,
main_model_group=config.main_model_group,
selected_model_name=direct_model_name,
+ fallback_models=fallback_models,
)
return LLMConfig(
diff --git a/skyvern/forge/sdk/enterprise_features.py b/skyvern/forge/sdk/enterprise_features.py
index 0b57ef719..7c6e2a2fe 100644
--- a/skyvern/forge/sdk/enterprise_features.py
+++ b/skyvern/forge/sdk/enterprise_features.py
@@ -12,6 +12,7 @@ ENTERPRISE_GATED_MODEL_NAMES: dict[str, str] = {
"claude-opus-4-6": "Anthropic Claude 4.6 Opus",
"claude-opus-4-7": "Anthropic Claude 4.7 Opus",
"claude-opus-4-8": "Anthropic Claude 4.8 Opus",
+ "claude-fable-5": "Anthropic Claude Fable 5",
}
diff --git a/tests/unit/test_api_handler_factory.py b/tests/unit/test_api_handler_factory.py
index 7137c27dd..34c9a535c 100644
--- a/tests/unit/test_api_handler_factory.py
+++ b/tests/unit/test_api_handler_factory.py
@@ -240,6 +240,58 @@ def test_normalize_llm_model_strips_provider_prefix() -> None:
assert api_handler_factory._normalize_llm_model(None) is None
+ "model_name",
+ [
+ "anthropic/claude-opus-4-7",
+ "anthropic/claude-opus-4-8",
+ "anthropic/claude-fable-5",
+ ],
+)
+def test_requires_adaptive_thinking_for_direct_anthropic_models(model_name: str) -> None:
+ assert LLMAPIHandlerFactory.requires_adaptive_thinking(model_name) is True
+
+
+ "model_name",
+ [
+ "bedrock/us.anthropic.claude-opus-4-8",
+ "bedrock/us.anthropic.claude-fable-5",
+ "anthropic/claude-sonnet-4-6",
+ None,
+ ],
+)
+def test_requires_adaptive_thinking_does_not_rewrite_other_providers(model_name: str | None) -> None:
+ assert LLMAPIHandlerFactory.requires_adaptive_thinking(model_name) is False
+
+
+ "model_name",
+ [
+ "anthropic/claude-opus-4-8",
+ "anthropic/claude-fable-5",
+ ],
+)
+def test_apply_anthropic_thinking_optimization_uses_adaptive_shape(model_name: str) -> None:
+ llm_config = LLMConfig(
+ model_name=model_name,
+ required_env_vars=[],
+ supports_vision=True,
+ add_assistant_prefix=False,
+ )
+ params: dict[str, Any] = {}
+
+ LLMAPIHandlerFactory._apply_anthropic_thinking_optimization(
+ params,
+ new_budget=2048,
+ llm_config=llm_config,
+ prompt_name="workflow-copilot-request-policy",
+ )
+
+ assert params["thinking"] == {"type": "adaptive"}
+ assert params["output_config"] == {"effort": LLMAPIHandlerFactory.ADAPTIVE_THINKING_EFFORT}
+
+
def test_assert_step_thought_block_exclusive_rejects_both_set() -> None:
with pytest.raises(ValueError, match="mutually exclusive"):
api_handler_factory._assert_step_thought_block_exclusive(MagicMock(), MagicMock(), None)
diff --git a/tests/unit/test_copilot_model_resolver.py b/tests/unit/test_copilot_model_resolver.py
index 3ce3a3a14..17731ed01 100644
--- a/tests/unit/test_copilot_model_resolver.py
+++ b/tests/unit/test_copilot_model_resolver.py
@@ -35,9 +35,13 @@ class TestModelResolver:
with pytest.raises(InvalidLLMConfigError, match="empty model_list"):
resolve_model_config(handler)
- def test_router_config_degrades_to_main_model_entry(self, monkeypatch: pytest.MonkeyPatch) -> None:
- """Shim for SKY-9257: a router key resolves to its main_model_group entry as a direct
- LLMConfig so copilot-v2 can run until SKY-9256 lands the real bridge.
+ def test_router_config_resolves_primary_model_with_litellm_fallbacks(self, monkeypatch: pytest.MonkeyPatch) -> None:
+ """Router keys resolve to a primary model while preserving LiteLLM fallbacks.
+
+ This is still not full router parity: deployment load-balancing and
+ cooldowns remain outside the Agents SDK path until SKY-9256. The
+ fallback chain itself must be carried through so Bedrock-primary
+ Copilot keys can fall through when the primary provider is unavailable.
"""
from skyvern.schemas.llm import LLMRouterConfig, LLMRouterModelConfig
@@ -53,14 +57,18 @@ class TestModelResolver:
model_name="gpt-4-1-mini-fallback",
litellm_params={"model": "azure/gpt-4-1-mini"},
)
+ final_fallback = LLMRouterModelConfig(
+ model_name="claude-fallback",
+ litellm_params={"model": "anthropic/claude-sonnet-4-20250514"},
+ )
router_config = LLMRouterConfig(
model_name="gemini-2.5-flash-fallback-router",
- model_list=[main, fallback],
+ model_list=[main, fallback, final_fallback],
required_env_vars=["VERTEX_CREDENTIALS"],
supports_vision=True,
add_assistant_prefix=False,
main_model_group="vertex-gemini-2.5-flash",
- fallback_model_group="gpt-4-1-mini-fallback",
+ fallback_model_group=["gpt-4-1-mini-fallback", "claude-fallback"],
temperature=0.3,
max_completion_tokens=8192,
)
@@ -84,6 +92,10 @@ class TestModelResolver:
assert run_config.model_settings.max_tokens == 8192
assert run_config.model_settings.extra_args is not None
assert run_config.model_settings.extra_args["timeout"] == 900.0
+ assert run_config.model_settings.extra_args["fallbacks"] == [
+ "azure/gpt-4-1-mini",
+ "anthropic/claude-sonnet-4-20250514",
+ ]
def test_router_config_no_main_group_match_falls_back_to_first_entry(self, monkeypatch: pytest.MonkeyPatch) -> None:
from skyvern.schemas.llm import LLMRouterConfig, LLMRouterModelConfig
diff --git a/tests/unit/workflow/test_enterprise_feature_gating.py b/tests/unit/workflow/test_enterprise_feature_gating.py
index 28bef0eef..f3f7c8bd0 100644
--- a/tests/unit/workflow/test_enterprise_feature_gating.py
+++ b/tests/unit/workflow/test_enterprise_feature_gating.py
@@ -165,9 +165,10 @@ def test_ignores_stale_model_on_task_v2_block() -> None:
("claude-opus-4-6", "Anthropic Claude 4.6 Opus"),
("claude-opus-4-7", "Anthropic Claude 4.7 Opus"),
("claude-opus-4-8", "Anthropic Claude 4.8 Opus"),
+ ("claude-fable-5", "Anthropic Claude Fable 5"),
],
)
-def test_collects_opus_model_alias_enterprise_features(model_name: str, feature_name: str) -> None:
+def test_collects_enterprise_model_alias_features(model_name: str, feature_name: str) -> None:
assert collect_enterprise_gated_run_features(model={"model_name": model_name}) == {feature_name}