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.

feat: add project slug to request header for create agent (#993)

cthomas019b589a3751
diff --git a/letta/schemas/agent.py b/letta/schemas/agent.py
index 032b9aab7..30c9ed678 100644
--- a/letta/schemas/agent.py
+++ b/letta/schemas/agent.py
@@ -143,7 +143,11 @@ class CreateAgent(BaseModel, validate_assignment=True): #
embedding_chunk_size: Optional[int] = Field(DEFAULT_EMBEDDING_CHUNK_SIZE, description="The embedding chunk size used by the agent.")
from_template: Optional[str] = Field(None, description="The template id used to configure the agent")
template: bool = Field(False, description="Whether the agent is a template")
- project: Optional[str] = Field(None, description="The project slug that the agent will be associated with.")
+ project: Optional[str] = Field(
+ None,
+ deprecated=True,
+ description="Deprecated: Project should now be passed via the project-slug header instead of in the request body. If using the sdk, this can be done via the new project_slug field below.",
+ )
tool_exec_environment_variables: Optional[Dict[str, str]] = Field(
None, description="The environment variables for tool execution specific to this agent."
)
diff --git a/letta/server/rest_api/routers/v1/agents.py b/letta/server/rest_api/routers/v1/agents.py
index 9a5661a69..cd57e02e2 100644
--- a/letta/server/rest_api/routers/v1/agents.py
+++ b/letta/server/rest_api/routers/v1/agents.py
@@ -111,6 +111,7 @@ def create_agent(
agent: CreateAgentRequest = Body(...),
server: "SyncServer" = Depends(get_letta_server),
user_id: Optional[str] = Header(None, alias="user_id"), # Extract user_id from header, default to None if not present
+ project_slug: Optional[str] = Header(None, alias="project-slug"), # Only handled by next js middleware
):
"""
Create a new agent with the specified configuration.