From 3aaab90b4c366de5742905d97f44d72a3cc73e0c Mon Sep 17 00:00:00 2001 From: cthomas Date: Mon, 5 Jan 2026 16:12:51 -0800 Subject: [PATCH] feat: use bounded concurrency for decryption (#8296) --- letta/orm/agent.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/letta/orm/agent.py b/letta/orm/agent.py index 4c325253..1c086cb5 100644 --- a/letta/orm/agent.py +++ b/letta/orm/agent.py @@ -22,7 +22,7 @@ from letta.schemas.llm_config import LLMConfig from letta.schemas.memory import Memory from letta.schemas.response_format import ResponseFormatUnion from letta.schemas.tool_rule import ToolRule -from letta.utils import calculate_file_defaults_based_on_context_window +from letta.utils import bounded_gather, calculate_file_defaults_based_on_context_window if TYPE_CHECKING: from letta.orm.agents_tags import AgentsTags @@ -434,9 +434,7 @@ class Agent(SqlalchemyBase, OrganizationMixin, ProjectMixin, TemplateEntityMixin state["multi_agent_group"] = multi_agent_group state["managed_group"] = multi_agent_group # Convert ORM env vars to Pydantic with async decryption - env_vars_pydantic = [] - for e in tool_exec_environment_variables: - env_vars_pydantic.append(await PydanticAgentEnvVar.from_orm_async(e)) + env_vars_pydantic = await bounded_gather([PydanticAgentEnvVar.from_orm_async(e) for e in tool_exec_environment_variables]) state["tool_exec_environment_variables"] = env_vars_pydantic state["secrets"] = env_vars_pydantic state["model"] = self.llm_config.handle if self.llm_config else None