diff --git a/letta/schemas/agent.py b/letta/schemas/agent.py index ec9880d4..35cbb4a7 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") @classmethod diff --git a/letta/services/agent_manager.py b/letta/services/agent_manager.py index f4aa4726..6098e0f0 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