Platform for stateful agents: AI with advanced memory that can learn and self-improve over time.
chore: clean up deprecated code
Andy Li3364e92e10f2
diff --git a/letta/otel/db_pool_monitoring.py b/letta/otel/db_pool_monitoring.pyindex 2208ac8fd..358e84655 100644--- a/letta/otel/db_pool_monitoring.py+++ b/letta/otel/db_pool_monitoring.py@@ -252,7 +252,7 @@ class DatabasePoolMonitor:logger.info(f"Failed to record detach event metric: {e}")@event.listens_for(pool, "reset")- def on_reset(dbapi_connection: DBAPIConnection, connection_record: ConnectionPoolEntry):+ def on_reset(dbapi_connection: DBAPIConnection, connection_record: ConnectionPoolEntry, reset_state):"""Called when a connection is reset."""try:from letta.otel.metric_registry import MetricRegistrydiff --git a/letta/schemas/agent.py b/letta/schemas/agent.pyindex 0b654a1de..952ab4bf2 100644--- a/letta/schemas/agent.py+++ b/letta/schemas/agent.py@@ -2,7 +2,7 @@ from datetime import datetimefrom enum import Enumfrom typing import Dict, List, Optional-from pydantic import BaseModel, Field, field_validator, model_validator+from pydantic import BaseModel, ConfigDict, Field, field_validator, model_validatorfrom letta.constants import CORE_MEMORY_LINE_NUMBER_WARNING, DEFAULT_EMBEDDING_CHUNK_SIZEfrom letta.schemas.block import CreateBlock@@ -355,8 +355,7 @@ class UpdateAgent(BaseModel):description="If set to True, the agent will be hidden.",)- class Config:- extra = "ignore" # Ignores extra fields+ model_config = ConfigDict(extra="ignore") # Ignores extra fieldsclass AgentStepResponse(BaseModel):diff --git a/letta/schemas/block.py b/letta/schemas/block.pyindex 4dd315f0e..5fc2f4cc0 100644--- a/letta/schemas/block.py+++ b/letta/schemas/block.py@@ -1,7 +1,7 @@from datetime import datetimefrom typing import Optional-from pydantic import Field, model_validator+from pydantic import ConfigDict, Field, model_validatorfrom typing_extensions import Selffrom letta.constants import CORE_MEMORY_BLOCK_CHAR_LIMIT, DEFAULT_HUMAN_BLOCK_DESCRIPTION, DEFAULT_PERSONA_BLOCK_DESCRIPTION@@ -38,8 +38,7 @@ class BaseBlock(LettaBase, validate_assignment=True):# def __len__(self):# return len(self.value)- class Config:- extra = "ignore" # Ignores extra fields+ model_config = ConfigDict(extra="ignore") # Ignores extra fields@model_validator(mode="after")def verify_char_limit(self) -> Self:@@ -115,8 +114,7 @@ class BlockUpdate(BaseBlock):value: Optional[str] = Field(None, description="Value of the block.")project_id: Optional[str] = Field(None, description="The associated project id.")- class Config:- extra = "ignore" # Ignores extra fields+ model_config = ConfigDict(extra="ignore") # Ignores extra fieldsclass CreateBlock(BaseBlock):diff --git a/letta/schemas/job.py b/letta/schemas/job.pyindex 9eff28bbc..645b332d3 100644--- a/letta/schemas/job.py+++ b/letta/schemas/job.py@@ -1,7 +1,7 @@from datetime import datetimefrom typing import List, Optional-from pydantic import BaseModel, Field+from pydantic import BaseModel, ConfigDict, Fieldfrom letta.constants import DEFAULT_MESSAGE_TOOL, DEFAULT_MESSAGE_TOOL_KWARGfrom letta.schemas.enums import JobStatus, JobType@@ -81,8 +81,7 @@ class BatchJob(JobBase):class JobUpdate(JobBase):status: Optional[JobStatus] = Field(None, description="The status of the job.")- class Config:- extra = "ignore" # Ignores extra fields+ model_config = ConfigDict(extra="ignore") # Ignores extra fieldsclass LettaRequestConfig(BaseModel):diff --git a/letta/settings.py b/letta/settings.pyindex f914fe02d..0aeae09c0 100644--- a/letta/settings.py+++ b/letta/settings.py@@ -340,7 +340,7 @@ class Settings(BaseSettings):class TestSettings(Settings):model_config = SettingsConfigDict(env_prefix="letta_test_", extra="ignore")- letta_dir: Path | None = Field(Path.home() / ".letta/test", env="LETTA_TEST_DIR")+ letta_dir: Path | None = Field(Path.home() / ".letta/test", alias="LETTA_TEST_DIR")class LogSettings(BaseSettings):diff --git a/letta/templates/sandbox_code_file.py.j2 b/letta/templates/sandbox_code_file.py.j2index 3f4c45175..13204c3a4 100644--- a/letta/templates/sandbox_code_file.py.j2+++ b/letta/templates/sandbox_code_file.py.j2@@ -28,15 +28,13 @@ _function_result = {{ invoke_function_call }}{# Use a temporary Pydantic wrapper to recursively serialize any nested Pydantic objects #}try:- from pydantic import BaseModel+ from pydantic import BaseModel, ConfigDictfrom typing import Anyclass _TempResultWrapper(BaseModel):+ model_config = ConfigDict(arbitrary_types_allowed=True)result: Any- class Config:- arbitrary_types_allowed = True-_wrapped = _TempResultWrapper(result=_function_result)_serialized_result = _wrapped.model_dump()['result']except ImportError:diff --git a/letta/templates/sandbox_code_file_async.py.j2 b/letta/templates/sandbox_code_file_async.py.j2index 33c8971da..72e18cb19 100644--- a/letta/templates/sandbox_code_file_async.py.j2+++ b/letta/templates/sandbox_code_file_async.py.j2@@ -30,15 +30,13 @@ async def _async_wrapper():{# Use a temporary Pydantic wrapper to recursively serialize any nested Pydantic objects #}try:- from pydantic import BaseModel+ from pydantic import BaseModel, ConfigDictfrom typing import Anyclass _TempResultWrapper(BaseModel):+ model_config = ConfigDict(arbitrary_types_allowed=True)result: Any- class Config:- arbitrary_types_allowed = True-_wrapped = _TempResultWrapper(result=_function_result)_serialized_result = _wrapped.model_dump()['result']except ImportError: