Platform for stateful agents: AI with advanced memory that can learn and self-improve over time.
feat: add support for projects and templates in create agent (#858)
cthomase91a38d33d58
diff --git a/letta/schemas/agent.py b/letta/schemas/agent.pyindex ec9880d42..35cbb4a77 100644--- a/letta/schemas/agent.py+++ b/letta/schemas/agent.py@@ -143,6 +143,9 @@ class CreateAgent(BaseModel, validate_assignment=True): #None, description="The environment variables for tool execution specific to this agent.")memory_variables: Optional[Dict[str, str]] = Field(None, description="The variables that should be set for the 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.")@field_validator("name")@classmethoddiff --git a/letta/services/agent_manager.py b/letta/services/agent_manager.pyindex f4aa47265..6098e0f09 100644--- a/letta/services/agent_manager.py+++ b/letta/services/agent_manager.py@@ -120,6 +120,9 @@ class AgentManager:metadata=agent_create.metadata,tool_rules=agent_create.tool_rules,actor=actor,+ project_id=agent_create.project_id,+ template_id=agent_create.template_id,+ base_template_id=agent_create.base_template_id,)# If there are provided environment variables, add them in@@ -179,6 +182,9 @@ class AgentManager:description: Optional[str] = None,metadata: Optional[Dict] = None,tool_rules: Optional[List[PydanticToolRule]] = None,+ project_id: Optional[str] = None,+ template_id: Optional[str] = None,+ base_template_id: Optional[str] = None,) -> PydanticAgentState:"""Create a new agent."""with self.session_maker() as session:@@ -193,6 +199,9 @@ class AgentManager:"description": description,"metadata_": metadata,"tool_rules": tool_rules,+ "project_id": project_id,+ "template_id": template_id,+ "base_template_id": base_template_id,}# Create the new agent using SqlalchemyBase.create