Platform for stateful agents: AI with advanced memory that can learn and self-improve over time.
feat: add project and template support for modify agent (#892)
cthomasb36945a6c798
diff --git a/letta/schemas/agent.py b/letta/schemas/agent.pyindex 35cbb4a77..9269742de 100644--- a/letta/schemas/agent.py+++ b/letta/schemas/agent.py@@ -213,6 +213,9 @@ class UpdateAgent(BaseModel):tool_exec_environment_variables: Optional[Dict[str, str]] = Field(None, description="The environment variables for tool execution specific to this agent.")+ project_id: Optional[str] = Field(None, description="The id of the project the agent belongs to.")+ template_id: Optional[str] = Field(None, description="The id of the template the agent belongs to.")+ base_template_id: Optional[str] = Field(None, description="The base template id of the agent.")class Config:extra = "ignore" # Ignores extra fieldsdiff --git a/letta/services/agent_manager.py b/letta/services/agent_manager.pyindex 6098e0f09..3faf50fc6 100644--- a/letta/services/agent_manager.py+++ b/letta/services/agent_manager.py@@ -251,7 +251,19 @@ class AgentManager:agent = AgentModel.read(db_session=session, identifier=agent_id, actor=actor)# Update scalar fields directly- scalar_fields = {"name", "system", "llm_config", "embedding_config", "message_ids", "tool_rules", "description", "metadata"}+ scalar_fields = {+ "name",+ "system",+ "llm_config",+ "embedding_config",+ "message_ids",+ "tool_rules",+ "description",+ "metadata",+ "project_id",+ "template_id",+ "base_template_id",+ }for field in scalar_fields:value = getattr(agent_update, field, None)if value is not None: