feat: add support for projects and templates in create agent (#858)

This commit is contained in:
cthomas
2025-02-03 10:19:41 -08:00
committed by GitHub
parent 66644199ed
commit e91a38d33d
2 changed files with 12 additions and 0 deletions

View File

@@ -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

View File

@@ -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