diff --git a/autogpt_platform/backend/backend/api/features/chat/config.py b/autogpt_platform/backend/backend/api/features/chat/config.py index 82b50e4166..9a5a3a7cda 100644 --- a/autogpt_platform/backend/backend/api/features/chat/config.py +++ b/autogpt_platform/backend/backend/api/features/chat/config.py @@ -97,18 +97,19 @@ class ChatConfig(BaseSettings): default=True, description="Use Claude Agent SDK for chat completions", ) - sdk_model: str | None = Field( + claude_agent_model: str | None = Field( default=None, - description="Model for SDK path. If None, derives from the `model` field " - "by stripping the OpenRouter provider prefix.", + description="Model for the Claude Agent SDK path. If None, derives from " + "the `model` field by stripping the OpenRouter provider prefix.", ) - sdk_max_budget_usd: float | None = Field( + claude_agent_max_budget_usd: float | None = Field( default=None, - description="Max budget in USD per SDK session (None = unlimited)", + gt=0, + description="Max budget in USD per Claude Agent SDK session (None = unlimited)", ) - sdk_max_buffer_size: int = Field( + claude_agent_max_buffer_size: int = Field( default=10 * 1024 * 1024, # 10MB (default SDK is 1MB) - description="Max buffer size in bytes for SDK JSON message parsing. " + description="Max buffer size in bytes for Claude Agent SDK JSON message parsing. " "Increase if tool outputs exceed the limit.", ) diff --git a/autogpt_platform/backend/backend/api/features/chat/sdk/service.py b/autogpt_platform/backend/backend/api/features/chat/sdk/service.py index f65239ab47..5a115d7ca7 100644 --- a/autogpt_platform/backend/backend/api/features/chat/sdk/service.py +++ b/autogpt_platform/backend/backend/api/features/chat/sdk/service.py @@ -67,14 +67,14 @@ interpreters (python, node) are NOT available. def _resolve_sdk_model() -> str | None: - """Resolve the model name for the SDK CLI. + """Resolve the model name for the Claude Agent SDK CLI. - Uses ``config.sdk_model`` if set, otherwise derives from ``config.model`` - by stripping the OpenRouter provider prefix (e.g., + Uses ``config.claude_agent_model`` if set, otherwise derives from + ``config.model`` by stripping the OpenRouter provider prefix (e.g., ``"anthropic/claude-opus-4.6"`` → ``"claude-opus-4.6"``). """ - if config.sdk_model: - return config.sdk_model + if config.claude_agent_model: + return config.claude_agent_model model = config.model if "/" in model: return model.split("/", 1)[1] @@ -370,11 +370,11 @@ async def stream_chat_completion_sdk( allowed_tools=COPILOT_TOOL_NAMES, hooks=combined_hooks, # type: ignore[arg-type] cwd=sdk_cwd, - max_buffer_size=config.sdk_max_buffer_size, + max_buffer_size=config.claude_agent_max_buffer_size, model=sdk_model, env=_build_sdk_env(), user=user_id or None, - max_budget_usd=config.sdk_max_budget_usd, + max_budget_usd=config.claude_agent_max_budget_usd, ) adapter = SDKResponseAdapter(message_id=message_id)