Skip to content

armgit / letta

Public Imported from GitHub
0

Platform for stateful agents: AI with advanced memory that can learn and self-improve over time.

fix: async decrypt environment variable on create agent (#8367)

jnjpng4cb037f28e18
diff --git a/letta/services/agent_manager.py b/letta/services/agent_manager.py
index 2599e80dc..76a0b705e 100644
--- a/letta/services/agent_manager.py
+++ b/letta/services/agent_manager.py
@@ -593,8 +593,10 @@ class AgentManager:
result = await new_agent.to_pydantic_async(include_relationships=include_relationships)
if agent_secrets and env_rows:
- result.tool_exec_environment_variables = [AgentEnvironmentVariable(**row) for row in env_rows]
- result.secrets = [AgentEnvironmentVariable(**row) for row in env_rows]
+ # Populate value from original plaintext (agent_secrets) to avoid sync decryption in model validator
+ env_vars = [AgentEnvironmentVariable(**{**row, "value": agent_secrets[row["key"]]}) for row in env_rows]
+ result.tool_exec_environment_variables = env_vars
+ result.secrets = env_vars
# initial message sequence (skip if _init_with_no_messages is True)
if not _init_with_no_messages: