Platform for stateful agents: AI with advanced memory that can learn and self-improve over time.
feat: add ID format validation to group schemas (#9152)
Kian Jonesdd8be95142e1
diff --git a/fern/openapi.json b/fern/openapi.jsonindex 1dd961590..43ec694bd 100644--- a/fern/openapi.json+++ b/fern/openapi.json@@ -31842,8 +31842,12 @@},"manager_agent_id": {"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}$","title": "Manager Agent Id",- "description": ""+ "description": "",+ "examples": ["agent-123e4567-e89b-42d3-8456-426614174000"]},"termination_token": {"anyOf": [@@ -31887,7 +31891,12 @@"manager_agent_id": {"anyOf": [{- "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": "null"@@ -33825,7 +33834,12 @@"properties": {"agent_ids": {"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","title": "Agent Ids",@@ -33884,7 +33898,12 @@},"shared_block_ids": {"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","title": "Shared Block Ids",@@ -33913,7 +33932,12 @@"properties": {"agent_ids": {"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","title": "Agent Ids",@@ -33972,7 +33996,12 @@},"shared_block_ids": {"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","title": "Shared Block Ids",@@ -34009,7 +34038,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"},@@ -34086,7 +34120,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"},@@ -35621,7 +35660,12 @@"properties": {"agent_ids": {"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","title": "Agent Ids",@@ -35680,7 +35724,12 @@},"shared_block_ids": {"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","title": "Shared Block Ids",@@ -41440,8 +41489,12 @@},"manager_agent_id": {"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}$","title": "Manager Agent Id",- "description": ""+ "description": "",+ "examples": ["agent-123e4567-e89b-42d3-8456-426614174000"]},"sleeptime_agent_frequency": {"anyOf": [@@ -41472,7 +41525,12 @@"manager_agent_id": {"anyOf": [{- "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": "null"@@ -42776,8 +42834,12 @@},"manager_agent_id": {"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}$","title": "Manager Agent Id",- "description": ""+ "description": "",+ "examples": ["agent-123e4567-e89b-42d3-8456-426614174000"]}},"type": "object",@@ -42796,7 +42858,12 @@"manager_agent_id": {"anyOf": [{- "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": "null"@@ -45756,8 +45823,12 @@},"manager_agent_id": {"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}$","title": "Manager Agent Id",- "description": ""+ "description": "",+ "examples": ["agent-123e4567-e89b-42d3-8456-426614174000"]},"max_message_buffer_length": {"anyOf": [@@ -45800,7 +45871,12 @@"manager_agent_id": {"anyOf": [{- "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": "null"diff --git a/letta/schemas/group.py b/letta/schemas/group.pyindex 0006c17e5..ef7760a84 100644--- a/letta/schemas/group.py+++ b/letta/schemas/group.py@@ -5,6 +5,7 @@ from pydantic import BaseModel, Fieldfrom letta.schemas.enums import PrimitiveTypefrom letta.schemas.letta_base import LettaBase+from letta.validators import AgentId, BlockIdclass ManagerType(str, Enum):@@ -93,43 +94,43 @@ class RoundRobinManagerUpdate(ManagerConfig):class SupervisorManager(ManagerConfig):manager_type: Literal[ManagerType.supervisor] = Field(ManagerType.supervisor, description="")- manager_agent_id: str = Field(..., description="")+ manager_agent_id: AgentId = Field(..., description="")class SupervisorManagerUpdate(ManagerConfig):manager_type: Literal[ManagerType.supervisor] = Field(ManagerType.supervisor, description="")- manager_agent_id: Optional[str] = Field(..., description="")+ manager_agent_id: Optional[AgentId] = Field(..., description="")class DynamicManager(ManagerConfig):manager_type: Literal[ManagerType.dynamic] = Field(ManagerType.dynamic, description="")- manager_agent_id: str = Field(..., description="")+ manager_agent_id: AgentId = Field(..., description="")termination_token: Optional[str] = Field("DONE!", description="")max_turns: Optional[int] = Field(None, description="")class DynamicManagerUpdate(ManagerConfig):manager_type: Literal[ManagerType.dynamic] = Field(ManagerType.dynamic, description="")- manager_agent_id: Optional[str] = Field(None, description="")+ manager_agent_id: Optional[AgentId] = Field(None, description="")termination_token: Optional[str] = Field(None, description="")max_turns: Optional[int] = Field(None, description="")class SleeptimeManager(ManagerConfig):manager_type: Literal[ManagerType.sleeptime] = Field(ManagerType.sleeptime, description="")- manager_agent_id: str = Field(..., description="")+ manager_agent_id: AgentId = Field(..., description="")sleeptime_agent_frequency: Optional[int] = Field(None, description="")class SleeptimeManagerUpdate(ManagerConfig):manager_type: Literal[ManagerType.sleeptime] = Field(ManagerType.sleeptime, description="")- manager_agent_id: Optional[str] = Field(None, description="")+ manager_agent_id: Optional[AgentId] = Field(None, description="")sleeptime_agent_frequency: Optional[int] = Field(None, description="")class VoiceSleeptimeManager(ManagerConfig):manager_type: Literal[ManagerType.voice_sleeptime] = Field(ManagerType.voice_sleeptime, description="")- manager_agent_id: str = Field(..., description="")+ manager_agent_id: AgentId = Field(..., description="")max_message_buffer_length: Optional[int] = Field(None,description="The desired maximum length of messages in the context window of the convo agent. This is a best effort, and may be off slightly due to user/assistant interleaving.",@@ -142,7 +143,7 @@ class VoiceSleeptimeManager(ManagerConfig):class VoiceSleeptimeManagerUpdate(ManagerConfig):manager_type: Literal[ManagerType.voice_sleeptime] = Field(ManagerType.voice_sleeptime, description="")- manager_agent_id: Optional[str] = Field(None, description="")+ manager_agent_id: Optional[AgentId] = Field(None, description="")max_message_buffer_length: Optional[int] = Field(None,description="The desired maximum length of messages in the context window of the convo agent. This is a best effort, and may be off slightly due to user/assistant interleaving.",@@ -170,11 +171,11 @@ ManagerConfigUpdateUnion = Annotated[class GroupCreate(BaseModel):- agent_ids: List[str] = Field(..., description="")+ agent_ids: List[AgentId] = Field(..., description="")description: str = Field(..., description="")manager_config: ManagerConfigUnion = Field(RoundRobinManager(), description="")project_id: Optional[str] = Field(None, description="The associated project id.")- shared_block_ids: List[str] = Field([], description="", deprecated=True)+ shared_block_ids: List[BlockId] = Field([], description="", deprecated=True)hidden: Optional[bool] = Field(None,description="If set to True, the group will be hidden.",@@ -190,8 +191,8 @@ class InternalTemplateGroupCreate(GroupCreate):class GroupUpdate(BaseModel):- agent_ids: Optional[List[str]] = Field(None, description="")+ agent_ids: Optional[List[AgentId]] = Field(None, description="")description: Optional[str] = Field(None, description="")manager_config: Optional[ManagerConfigUpdateUnion] = Field(None, description="")project_id: Optional[str] = Field(None, description="The associated project id.")- shared_block_ids: Optional[List[str]] = Field(None, description="", deprecated=True)+ shared_block_ids: Optional[List[BlockId]] = Field(None, description="", deprecated=True)