Platform for stateful agents: AI with advanced memory that can learn and self-improve over time.
feat: parallel tool calling in model settings [LET-6239] (#6262)
Ari Webbd4178705375e
diff --git a/.github/workflows/send-message-integration-tests.yml b/.github/workflows/send-message-integration-tests.ymlindex 43df7c48c..d60a75e16 100644--- a/.github/workflows/send-message-integration-tests.yml+++ b/.github/workflows/send-message-integration-tests.yml@@ -37,12 +37,10 @@ jobs:"matrix": {"config_file": ["openai-gpt-4o-mini.json",+ "openai-gpt-4.1.json",+ "openai-gpt-5.json","claude-4-5-sonnet.json",- "claude-4-sonnet-extended.json",- "claude-3-7-sonnet-extended.json",- "gemini-1.5-pro.json","gemini-2.5-pro.json",- "gemini-2.5-flash.json"]}}diff --git a/fern/openapi.json b/fern/openapi.jsonindex b16d2fe13..3fb4e7d22 100644--- a/fern/openapi.json+++ b/fern/openapi.json@@ -23748,8 +23748,7 @@}],"title": "Parallel Tool Calls",- "description": "Deprecated: Use `model` field to configure parallel tool calls instead. If set to True, enables parallel tool calling.",- "default": false,+ "description": "Deprecated: Use `model_settings` to configure parallel tool calls instead. If set to True, enables parallel tool calling.","deprecated": true}},@@ -27948,8 +27947,7 @@}],"title": "Parallel Tool Calls",- "description": "Deprecated: Use `model` field to configure parallel tool calls instead. If set to True, enables parallel tool calling.",- "default": false,+ "description": "Deprecated: Use `model_settings` to configure parallel tool calls instead. If set to True, enables parallel tool calling.","deprecated": true},"deployment_id": {@@ -28703,8 +28701,9 @@}],"title": "Parallel Tool Calls",- "description": "If set to True, enables parallel tool calling. Defaults to False.",- "default": false+ "description": "Deprecated: Use model_settings to configure parallel tool calls instead. If set to True, enables parallel tool calling. Defaults to False.",+ "default": false,+ "deprecated": true}},"type": "object",@@ -36493,8 +36492,7 @@}],"title": "Parallel Tool Calls",- "description": "Deprecated: Use `model` field to configure parallel tool calls instead. If set to True, enables parallel tool calling.",- "default": false,+ "description": "Deprecated: Use `model_settings` to configure parallel tool calls instead. If set to True, enables parallel tool calling.","deprecated": true},"response_format": {@@ -37937,8 +37935,7 @@}],"title": "Parallel Tool Calls",- "description": "Deprecated: Use `model` field to configure parallel tool calls instead. If set to True, enables parallel tool calling.",- "default": false,+ "description": "Deprecated: Use `model_settings` to configure parallel tool calls instead. If set to True, enables parallel tool calling.","deprecated": true},"id": {diff --git a/letta/schemas/agent.py b/letta/schemas/agent.pyindex ee7a94b36..7a8c52c93 100644--- a/letta/schemas/agent.py+++ b/letta/schemas/agent.py@@ -315,8 +315,8 @@ class CreateAgent(BaseModel, validate_assignment=True): #deprecated=True,)parallel_tool_calls: Optional[bool] = Field(- False,- description="Deprecated: Use `model` field to configure parallel tool calls instead. If set to True, enables parallel tool calling.",+ None,+ description="Deprecated: Use `model_settings` to configure parallel tool calls instead. If set to True, enables parallel tool calling.",deprecated=True,)@@ -441,8 +441,8 @@ class UpdateAgent(BaseModel):)embedding_config: Optional[EmbeddingConfig] = Field(None, description="The embedding configuration used by the agent.")parallel_tool_calls: Optional[bool] = Field(- False,- description="Deprecated: Use `model` field to configure parallel tool calls instead. If set to True, enables parallel tool calling.",+ None,+ description="Deprecated: Use `model_settings` to configure parallel tool calls instead. If set to True, enables parallel tool calling.",deprecated=True,)response_format: Optional[ResponseFormatUnion] = Field(diff --git a/letta/schemas/llm_config.py b/letta/schemas/llm_config.pyindex 9fe0292bd..8e8508601 100644--- a/letta/schemas/llm_config.py+++ b/letta/schemas/llm_config.py@@ -90,7 +90,11 @@ class LLMConfig(BaseModel):# FIXME hack to silence pydantic protected namespace warningmodel_config = ConfigDict(protected_namespaces=())- parallel_tool_calls: Optional[bool] = Field(False, description="If set to True, enables parallel tool calling. Defaults to False.")+ parallel_tool_calls: Optional[bool] = Field(+ False,+ description="Deprecated: Use model_settings to configure parallel tool calls instead. If set to True, enables parallel tool calling. Defaults to False.",+ deprecated=True,+ )@model_validator(mode="before")@classmethoddiff --git a/letta/schemas/model.py b/letta/schemas/model.pyindex 63731e70a..7c0364b4e 100644--- a/letta/schemas/model.py+++ b/letta/schemas/model.py@@ -354,6 +354,7 @@ class GroqModelSettings(ModelSettings):"temperature": self.temperature,"max_tokens": self.max_output_tokens,"response_format": self.response_format,+ "parallel_tool_calls": self.parallel_tool_calls,}diff --git a/letta/server/server.py b/letta/server/server.pyindex 07348978a..e58bc3ac8 100644--- a/letta/server/server.py+++ b/letta/server/server.py@@ -461,6 +461,11 @@ class SyncServer(object):f"LLM config handle {request.llm_config.handle} does not match request handle {request.model}")+ # update with model_settings+ if request.model_settings is not None:+ update_llm_config_params = request.model_settings._to_legacy_config_params()+ request.llm_config = request.llm_config.model_copy(update=update_llm_config_params)+# Copy parallel_tool_calls from request to llm_config if providedif request.parallel_tool_calls is not None:request.llm_config.parallel_tool_calls = request.parallel_tool_callsdiff --git a/tests/sdk_v1/integration/integration_test_send_message_v2.py b/tests/sdk_v1/integration/integration_test_send_message_v2.pyindex 4089ef699..e50873612 100644--- a/tests/sdk_v1/integration/integration_test_send_message_v2.py+++ b/tests/sdk_v1/integration/integration_test_send_message_v2.py@@ -644,17 +644,14 @@ async def test_parallel_tool_calls(if provider_type in ["google_ai", "google_vertex"]:pytest.skip("Gemini models are flaky for this test so we disable them for now")- # # Update model_settings to enable parallel tool calling- # modified_model_settings = model_settings.copy()- # modified_model_settings["parallel_tool_calls"] = True+ # Update model_settings to enable parallel tool calling+ modified_model_settings = model_settings.copy()+ modified_model_settings["parallel_tool_calls"] = True- # IMPORTANT: Set parallel_tool_calls at BOTH the agent level and in model_settings- # Even though the agent-level parameter is deprecated, it may still be neededagent_state = await client.agents.update(agent_id=agent_state.id,model=model_handle,- model_settings=model_settings,- parallel_tool_calls=True, # Set at agent level as well+ model_settings=modified_model_settings,)if send_type == "step":