Platform for stateful agents: AI with advanced memory that can learn and self-improve over time.
feat: add ID format validation to identity schemas (#9153)
Kian Joneseaaca141f70a
diff --git a/fern/openapi.json b/fern/openapi.jsonindex 43ec694bd..9eaed96cc 100644--- a/fern/openapi.json+++ b/fern/openapi.json@@ -34392,7 +34392,12 @@"anyOf": [{"items": {- "type": "string"+ "type": "string",+ "maxLength": 42,+ "minLength": 42,+ "pattern": "^agent-[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",+ "description": "The ID of the agent in the format 'agent-<uuid4>'",+ "examples": ["agent-123e4567-e89b-42d3-8456-426614174000"]},"type": "array"},@@ -34408,7 +34413,12 @@"anyOf": [{"items": {- "type": "string"+ "type": "string",+ "maxLength": 42,+ "minLength": 42,+ "pattern": "^block-[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",+ "description": "The ID of the block in the format 'block-<uuid4>'",+ "examples": ["block-123e4567-e89b-42d3-8456-426614174000"]},"type": "array"},@@ -34534,7 +34544,12 @@"anyOf": [{"items": {- "type": "string"+ "type": "string",+ "maxLength": 42,+ "minLength": 42,+ "pattern": "^agent-[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",+ "description": "The ID of the agent in the format 'agent-<uuid4>'",+ "examples": ["agent-123e4567-e89b-42d3-8456-426614174000"]},"type": "array"},@@ -34550,7 +34565,12 @@"anyOf": [{"items": {- "type": "string"+ "type": "string",+ "maxLength": 42,+ "minLength": 42,+ "pattern": "^block-[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",+ "description": "The ID of the block in the format 'block-<uuid4>'",+ "examples": ["block-123e4567-e89b-42d3-8456-426614174000"]},"type": "array"},@@ -34614,7 +34634,12 @@"anyOf": [{"items": {- "type": "string"+ "type": "string",+ "maxLength": 42,+ "minLength": 42,+ "pattern": "^agent-[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",+ "description": "The ID of the agent in the format 'agent-<uuid4>'",+ "examples": ["agent-123e4567-e89b-42d3-8456-426614174000"]},"type": "array"},@@ -34630,7 +34655,12 @@"anyOf": [{"items": {- "type": "string"+ "type": "string",+ "maxLength": 42,+ "minLength": 42,+ "pattern": "^block-[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",+ "description": "The ID of the block in the format 'block-<uuid4>'",+ "examples": ["block-123e4567-e89b-42d3-8456-426614174000"]},"type": "array"},diff --git a/letta/schemas/identity.py b/letta/schemas/identity.pyindex bb4f429d2..c5602be45 100644--- a/letta/schemas/identity.py+++ b/letta/schemas/identity.py@@ -5,6 +5,7 @@ from pydantic import Fieldfrom letta.schemas.enums import PrimitiveTypefrom letta.schemas.letta_base import LettaBase+from letta.validators import AgentId, BlockIdclass IdentityType(str, Enum):@@ -57,8 +58,8 @@ class IdentityCreate(LettaBase):name: str = Field(..., description="The name of the identity.")identity_type: IdentityType = Field(..., description="The type of the identity.")project_id: Optional[str] = Field(None, description="The project id of the identity, if applicable.")- agent_ids: Optional[List[str]] = Field(None, description="The agent ids that are associated with the identity.", deprecated=True)- block_ids: Optional[List[str]] = Field(None, description="The IDs of the blocks associated with the identity.", deprecated=True)+ agent_ids: Optional[List[AgentId]] = Field(None, description="The agent ids that are associated with the identity.", deprecated=True)+ block_ids: Optional[List[BlockId]] = Field(None, description="The IDs of the blocks associated with the identity.", deprecated=True)properties: Optional[List[IdentityProperty]] = Field(None, description="List of properties associated with the identity.")@@ -67,8 +68,8 @@ class IdentityUpsert(LettaBase):name: str = Field(..., description="The name of the identity.")identity_type: IdentityType = Field(..., description="The type of the identity.")project_id: Optional[str] = Field(None, description="The project id of the identity, if applicable.")- agent_ids: Optional[List[str]] = Field(None, description="The agent ids that are associated with the identity.", deprecated=True)- block_ids: Optional[List[str]] = Field(None, description="The IDs of the blocks associated with the identity.", deprecated=True)+ agent_ids: Optional[List[AgentId]] = Field(None, description="The agent ids that are associated with the identity.", deprecated=True)+ block_ids: Optional[List[BlockId]] = Field(None, description="The IDs of the blocks associated with the identity.", deprecated=True)properties: Optional[List[IdentityProperty]] = Field(None, description="List of properties associated with the identity.")@@ -76,8 +77,8 @@ class IdentityUpdate(LettaBase):identifier_key: Optional[str] = Field(None, description="External, user-generated identifier key of the identity.")name: Optional[str] = Field(None, description="The name of the identity.")identity_type: Optional[IdentityType] = Field(None, description="The type of the identity.")- agent_ids: Optional[List[str]] = Field(None, description="The agent ids that are associated with the identity.", deprecated=True)- block_ids: Optional[List[str]] = Field(None, description="The IDs of the blocks associated with the identity.", deprecated=True)+ agent_ids: Optional[List[AgentId]] = Field(None, description="The agent ids that are associated with the identity.", deprecated=True)+ block_ids: Optional[List[BlockId]] = Field(None, description="The IDs of the blocks associated with the identity.", deprecated=True)properties: Optional[List[IdentityProperty]] = Field(None, description="List of properties associated with the identity.")