sample_id
stringlengths
21
196
text
stringlengths
105
936k
metadata
dict
category
stringclasses
6 values
letta-ai/letta:alembic/versions/c96263433aef_add_file_name_to_source_passages.py
"""Add file name to source passages Revision ID: c96263433aef Revises: 9792f94e961d Create Date: 2025-06-06 12:06:57.328127 """ from typing import Sequence, Union import sqlalchemy as sa from alembic import op from letta.settings import settings # revision identifiers, used by Alembic. revision: str = "c96263433ae...
{ "repo_id": "letta-ai/letta", "file_path": "alembic/versions/c96263433aef_add_file_name_to_source_passages.py", "license": "Apache License 2.0", "lines": 36, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
letta-ai/letta:alembic/versions/cc8dc340836d_add_support_for_request_and_response_.py
"""add support for request and response jsons from llm providers Revision ID: cc8dc340836d Revises: 220856bbf43b Create Date: 2025-05-19 14:25:41.999676 """ from typing import Sequence, Union import sqlalchemy as sa from alembic import op from letta.settings import settings # revision identifiers, used by Alembic...
{ "repo_id": "letta-ai/letta", "file_path": "alembic/versions/cc8dc340836d_add_support_for_request_and_response_.py", "license": "Apache License 2.0", "lines": 47, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
letta-ai/letta:alembic/versions/cce9a6174366_add_stop_reasons_to_steps_and_message_.py
"""add stop reasons to steps and message error flag Revision ID: cce9a6174366 Revises: 2c059cad97cc Create Date: 2025-07-10 13:56:17.383612 """ from typing import Sequence, Union import sqlalchemy as sa from alembic import op # revision identifiers, used by Alembic. revision: str = "cce9a6174366" down_revision: U...
{ "repo_id": "letta-ai/letta", "file_path": "alembic/versions/cce9a6174366_add_stop_reasons_to_steps_and_message_.py", "license": "Apache License 2.0", "lines": 30, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
letta-ai/letta:alembic/versions/cdd4a1c11aee_add_file_name_to_fileagent_association_.py
"""Add file_name to FileAgent association table and FileContent table Revision ID: cdd4a1c11aee Revises: 614c4e53b66e Create Date: 2025-06-03 15:35:59.623704 """ from typing import Sequence, Union import sqlalchemy as sa from alembic import op from letta.settings import settings # revision identifiers, used by Al...
{ "repo_id": "letta-ai/letta", "file_path": "alembic/versions/cdd4a1c11aee_add_file_name_to_fileagent_association_.py", "license": "Apache License 2.0", "lines": 58, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
letta-ai/letta:alembic/versions/d007f4ca66bf_npm_requirements_in_tools.py
"""npm requirements in tools Revision ID: d007f4ca66bf Revises: 74e860718e0d Create Date: 2025-08-04 13:40:32.707036 """ from typing import Sequence, Union import sqlalchemy as sa from alembic import op # revision identifiers, used by Alembic. revision: str = "d007f4ca66bf" down_revision: Union[str, None] = "74e8...
{ "repo_id": "letta-ai/letta", "file_path": "alembic/versions/d007f4ca66bf_npm_requirements_in_tools.py", "license": "Apache License 2.0", "lines": 21, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
letta-ai/letta:alembic/versions/d06594144ef3_add_and_migrate_encrypted_columns_for_.py
"""add and migrate encrypted columns for mcp Revision ID: d06594144ef3 Revises: 5d27a719b24d Create Date: 2025-09-15 22:02:47.403970 """ import json import os # Add the app directory to path to import our crypto utils from typing import Sequence, Union import sqlalchemy as sa from sqlalchemy import JSON, String, T...
{ "repo_id": "letta-ai/letta", "file_path": "alembic/versions/d06594144ef3_add_and_migrate_encrypted_columns_for_.py", "license": "Apache License 2.0", "lines": 266, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
letta-ai/letta:alembic/versions/d5103ee17ed5_add_template_fields_to_blocks_agents_.py
"""add template fields to blocks agents groups Revision ID: d5103ee17ed5 Revises: ffb17eb241fc Create Date: 2025-08-26 15:45:32.949892 """ from typing import Sequence, Union import sqlalchemy as sa from alembic import op # revision identifiers, used by Alembic. revision: str = "d5103ee17ed5" down_revision: Union[...
{ "repo_id": "letta-ai/letta", "file_path": "alembic/versions/d5103ee17ed5_add_template_fields_to_blocks_agents_.py", "license": "Apache License 2.0", "lines": 37, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
letta-ai/letta:alembic/versions/dd049fbec729_add_index_on_agent_id_for_agent_env_var.py
"""Add index on agent_id for agent env var Revision ID: dd049fbec729 Revises: 9ecbdbaa409f Create Date: 2025-05-23 17:41:48.235405 """ from typing import Sequence, Union from alembic import op from letta.settings import settings # revision identifiers, used by Alembic. revision: str = "dd049fbec729" down_revision:...
{ "repo_id": "letta-ai/letta", "file_path": "alembic/versions/dd049fbec729_add_index_on_agent_id_for_agent_env_var.py", "license": "Apache License 2.0", "lines": 27, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
letta-ai/letta:alembic/versions/ddb69be34a72_add_vector_db_namespace_fields_to_.py
"""Add vector db namespace fields to archive and agent state Revision ID: ddb69be34a72 Revises: f3bf00ef6118 Create Date: 2025-09-02 12:59:54.837863 """ from typing import Sequence, Union import sqlalchemy as sa from alembic import op # revision identifiers, used by Alembic. revision: str = "ddb69be34a72" down_re...
{ "repo_id": "letta-ai/letta", "file_path": "alembic/versions/ddb69be34a72_add_vector_db_namespace_fields_to_.py", "license": "Apache License 2.0", "lines": 23, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
letta-ai/letta:alembic/versions/ddecfe4902bc_add_prompts.py
"""add prompts Revision ID: ddecfe4902bc Revises: c4eb5a907b38 Create Date: 2025-07-21 15:58:13.357459 """ from typing import Sequence, Union import sqlalchemy as sa from alembic import op # revision identifiers, used by Alembic. revision: str = "ddecfe4902bc" down_revision: Union[str, None] = "c4eb5a907b38" bran...
{ "repo_id": "letta-ai/letta", "file_path": "alembic/versions/ddecfe4902bc_add_prompts.py", "license": "Apache License 2.0", "lines": 32, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
letta-ai/letta:alembic/versions/eff256d296cb_mcp_encrypted_data_migration.py
"""mcp encrypted data migration Revision ID: eff256d296cb Revises: 7f7933666957 Create Date: 2025-09-16 16:01:58.943318 """ import json import os # Add the app directory to path to import our crypto utils from typing import Sequence, Union import sqlalchemy as sa from sqlalchemy import JSON, String, Text from sqla...
{ "repo_id": "letta-ai/letta", "file_path": "alembic/versions/eff256d296cb_mcp_encrypted_data_migration.py", "license": "Apache License 2.0", "lines": 254, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
letta-ai/letta:alembic/versions/f3bf00ef6118_add_approval_fields_to_message_model.py
"""add approval fields to message model Revision ID: f3bf00ef6118 Revises: 54c76f7cabca Create Date: 2025-09-01 11:26:42.548009 """ from typing import Sequence, Union import sqlalchemy as sa from alembic import op # revision identifiers, used by Alembic. revision: str = "f3bf00ef6118" down_revision: Union[str, No...
{ "repo_id": "letta-ai/letta", "file_path": "alembic/versions/f3bf00ef6118_add_approval_fields_to_message_model.py", "license": "Apache License 2.0", "lines": 25, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
letta-ai/letta:alembic/versions/f55542f37641_add_index_for_agent_tags_reversed_order.py
"""add index for agent_tags reversed order Revision ID: f55542f37641 Revises: ddecfe4902bc Create Date: 2025-07-24 18:00:30.773048 """ from typing import Sequence, Union from alembic import op # revision identifiers, used by Alembic. revision: str = "f55542f37641" down_revision: Union[str, None] = "f5d26b0526e8" b...
{ "repo_id": "letta-ai/letta", "file_path": "alembic/versions/f55542f37641_add_index_for_agent_tags_reversed_order.py", "license": "Apache License 2.0", "lines": 28, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
letta-ai/letta:alembic/versions/f5d26b0526e8_add_mcp_oauth.py
"""add_mcp_oauth Revision ID: f5d26b0526e8 Revises: ddecfe4902bc Create Date: 2025-07-24 12:34:05.795355 """ from typing import Sequence, Union import sqlalchemy as sa from alembic import op # revision identifiers, used by Alembic. revision: str = "f5d26b0526e8" down_revision: Union[str, None] = "ddecfe4902bc" br...
{ "repo_id": "letta-ai/letta", "file_path": "alembic/versions/f5d26b0526e8_add_mcp_oauth.py", "license": "Apache License 2.0", "lines": 57, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
letta-ai/letta:alembic/versions/f7f757414d20_add_error_tracking_to_steps_table.py
"""Add error tracking to steps table Revision ID: f7f757414d20 Revises: 05c3bc564286 Create Date: 2025-08-05 18:17:06.026153 """ from typing import Sequence, Union import sqlalchemy as sa from alembic import op # revision identifiers, used by Alembic. revision: str = "f7f757414d20" down_revision: Union[str, None]...
{ "repo_id": "letta-ai/letta", "file_path": "alembic/versions/f7f757414d20_add_error_tracking_to_steps_table.py", "license": "Apache License 2.0", "lines": 31, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
letta-ai/letta:alembic/versions/ffb17eb241fc_add_api_version_to_byok_providers.py
"""add api version to byok providers Revision ID: ffb17eb241fc Revises: 5fb8bba2c373 Create Date: 2025-08-12 14:35:26.375985 """ from typing import Sequence, Union import sqlalchemy as sa from alembic import op # revision identifiers, used by Alembic. revision: str = "ffb17eb241fc" down_revision: Union[str, None]...
{ "repo_id": "letta-ai/letta", "file_path": "alembic/versions/ffb17eb241fc_add_api_version_to_byok_providers.py", "license": "Apache License 2.0", "lines": 21, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
letta-ai/letta:letta/adapters/letta_llm_adapter.py
from abc import ABC, abstractmethod from typing import AsyncGenerator from letta.llm_api.llm_client_base import LLMClientBase from letta.schemas.enums import LLMCallType from letta.schemas.letta_message import LettaMessage from letta.schemas.letta_message_content import ReasoningContent, RedactedReasoningContent, Text...
{ "repo_id": "letta-ai/letta", "file_path": "letta/adapters/letta_llm_adapter.py", "license": "Apache License 2.0", "lines": 108, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
letta-ai/letta:letta/adapters/letta_llm_request_adapter.py
from typing import AsyncGenerator from letta.adapters.letta_llm_adapter import LettaLLMAdapter from letta.helpers.datetime_helpers import get_utc_timestamp_ns from letta.otel.tracing import log_attributes, safe_json_dumps, trace_method from letta.schemas.letta_message import LettaMessage from letta.schemas.letta_messa...
{ "repo_id": "letta-ai/letta", "file_path": "letta/adapters/letta_llm_request_adapter.py", "license": "Apache License 2.0", "lines": 125, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
letta-ai/letta:letta/adapters/letta_llm_stream_adapter.py
from typing import AsyncGenerator from letta.adapters.letta_llm_adapter import LettaLLMAdapter from letta.errors import LLMError from letta.helpers.datetime_helpers import get_utc_timestamp_ns from letta.interfaces.anthropic_streaming_interface import AnthropicStreamingInterface from letta.interfaces.openai_streaming_...
{ "repo_id": "letta-ai/letta", "file_path": "letta/adapters/letta_llm_stream_adapter.py", "license": "Apache License 2.0", "lines": 203, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
letta-ai/letta:letta/agents/agent_loop.py
from typing import TYPE_CHECKING from letta.agents.base_agent_v2 import BaseAgentV2 from letta.agents.letta_agent_v2 import LettaAgentV2 from letta.agents.letta_agent_v3 import LettaAgentV3 from letta.groups.sleeptime_multi_agent_v3 import SleeptimeMultiAgentV3 from letta.groups.sleeptime_multi_agent_v4 import Sleepti...
{ "repo_id": "letta-ai/letta", "file_path": "letta/agents/agent_loop.py", "license": "Apache License 2.0", "lines": 56, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
letta-ai/letta:letta/agents/base_agent_v2.py
from abc import ABC, abstractmethod from typing import TYPE_CHECKING, AsyncGenerator from letta.constants import DEFAULT_MAX_STEPS from letta.log import get_logger from letta.schemas.agent import AgentState from letta.schemas.enums import MessageStreamStatus from letta.schemas.letta_message import LegacyLettaMessage, ...
{ "repo_id": "letta-ai/letta", "file_path": "letta/agents/base_agent_v2.py", "license": "Apache License 2.0", "lines": 83, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
letta-ai/letta:letta/agents/ephemeral_summary_agent.py
from typing import AsyncGenerator, List from letta.agents.base_agent import BaseAgent from letta.constants import DEFAULT_MAX_STEPS from letta.helpers.message_helper import convert_message_creates_to_messages from letta.llm_api.llm_client import LLMClient from letta.log import get_logger from letta.orm.errors import N...
{ "repo_id": "letta-ai/letta", "file_path": "letta/agents/ephemeral_summary_agent.py", "license": "Apache License 2.0", "lines": 98, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
letta-ai/letta:letta/agents/exceptions.py
class IncompatibleAgentType(ValueError): def __init__(self, expected_type: str, actual_type: str): message = f"Incompatible agent type: expected '{expected_type}', but got '{actual_type}'." super().__init__(message) self.expected_type = expected_type self.actual_type = actual_type
{ "repo_id": "letta-ai/letta", "file_path": "letta/agents/exceptions.py", "license": "Apache License 2.0", "lines": 6, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
letta-ai/letta:letta/agents/letta_agent_v2.py
import json import uuid from datetime import datetime from typing import AsyncGenerator, Optional, Tuple from opentelemetry.trace import Span from letta.adapters.letta_llm_adapter import LettaLLMAdapter from letta.adapters.letta_llm_request_adapter import LettaLLMRequestAdapter from letta.adapters.letta_llm_stream_ad...
{ "repo_id": "letta-ai/letta", "file_path": "letta/agents/letta_agent_v2.py", "license": "Apache License 2.0", "lines": 1297, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
letta-ai/letta:letta/data_sources/redis_client.py
import asyncio from functools import wraps from typing import Any, Dict, List, Optional, Set, Union from letta.constants import ( CONVERSATION_LOCK_PREFIX, CONVERSATION_LOCK_TTL_SECONDS, MEMORY_REPO_LOCK_PREFIX, MEMORY_REPO_LOCK_TTL_SECONDS, REDIS_EXCLUDE, REDIS_INCLUDE, REDIS_SET_DEFAULT_V...
{ "repo_id": "letta-ai/letta", "file_path": "letta/data_sources/redis_client.py", "license": "Apache License 2.0", "lines": 500, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
letta-ai/letta:letta/functions/async_composio_toolset.py
import json from typing import Any import aiohttp from composio import ComposioToolSet as BaseComposioToolSet from composio.exceptions import ( ApiKeyNotProvidedError, ComposioSDKError, ConnectedAccountNotFoundError, EnumMetadataNotFound, EnumStringNotFound, ) class AsyncComposioToolSet(BaseCompo...
{ "repo_id": "letta-ai/letta", "file_path": "letta/functions/async_composio_toolset.py", "license": "Apache License 2.0", "lines": 94, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
letta-ai/letta:letta/functions/composio_helpers.py
import os from typing import Any, Optional from composio.constants import DEFAULT_ENTITY_ID from composio.exceptions import ( ApiKeyNotProvidedError, ComposioSDKError, ConnectedAccountNotFoundError, EnumMetadataNotFound, EnumStringNotFound, ) from letta.constants import COMPOSIO_ENTITY_ENV_VAR_KEY...
{ "repo_id": "letta-ai/letta", "file_path": "letta/functions/composio_helpers.py", "license": "Apache License 2.0", "lines": 73, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
letta-ai/letta:letta/functions/function_sets/builtin.py
from typing import List, Literal, Optional def run_code(code: str, language: Literal["python", "js", "ts", "r", "java"]) -> str: """ Run code in a sandbox. Supports Python, Javascript, Typescript, R, and Java. Args: code (str): The code to run. language (Literal["python", "js", "ts", "r",...
{ "repo_id": "letta-ai/letta", "file_path": "letta/functions/function_sets/builtin.py", "license": "Apache License 2.0", "lines": 62, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
documentation
letta-ai/letta:letta/functions/function_sets/files.py
from typing import TYPE_CHECKING, List, Optional from letta.functions.types import FileOpenRequest if TYPE_CHECKING: from letta.schemas.agent import AgentState from letta.schemas.file import FileMetadata async def open_files(agent_state: "AgentState", file_requests: List[FileOpenRequest], close_all_others: ...
{ "repo_id": "letta-ai/letta", "file_path": "letta/functions/function_sets/files.py", "license": "Apache License 2.0", "lines": 76, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
documentation
letta-ai/letta:letta/functions/prompts.py
FIRECRAWL_SEARCH_SYSTEM_PROMPT = """You are an expert at extracting relevant information from web content. Given a document with line numbers (format: "LINE_NUM: content"), identify passages that answer the provided question by returning line ranges: - start_line: The starting line number (inclusive) - end_line: The e...
{ "repo_id": "letta-ai/letta", "file_path": "letta/functions/prompts.py", "license": "Apache License 2.0", "lines": 18, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
documentation
letta-ai/letta:letta/functions/schema_validator.py
""" JSON Schema validator for OpenAI strict mode compliance. This module provides validation for JSON schemas to ensure they comply with OpenAI's strict mode requirements for tool schemas. """ from enum import Enum from typing import Any, Dict, List, Tuple class SchemaHealth(Enum): """Schema health status for O...
{ "repo_id": "letta-ai/letta", "file_path": "letta/functions/schema_validator.py", "license": "Apache License 2.0", "lines": 167, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
letta-ai/letta:letta/functions/types.py
from typing import Optional from pydantic import BaseModel, Field class SearchTask(BaseModel): query: str = Field(description="Search query for web search") question: str = Field(description="Question to answer from search results, considering full conversation context") class FileOpenRequest(BaseModel): ...
{ "repo_id": "letta-ai/letta", "file_path": "letta/functions/types.py", "license": "Apache License 2.0", "lines": 13, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
letta-ai/letta:letta/functions/typescript_parser.py
"""TypeScript function parsing for JSON schema generation.""" import re from typing import Any, Dict, Optional from letta.errors import LettaToolCreateError def derive_typescript_json_schema(source_code: str, name: Optional[str] = None) -> dict: """Derives the OpenAI JSON schema for a given TypeScript function ...
{ "repo_id": "letta-ai/letta", "file_path": "letta/functions/typescript_parser.py", "license": "Apache License 2.0", "lines": 147, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
letta-ai/letta:letta/groups/sleeptime_multi_agent_v3.py
from collections.abc import AsyncGenerator from datetime import datetime, timezone from letta.agents.letta_agent_v2 import LettaAgentV2 from letta.agents.letta_agent_v3 import LettaAgentV3 from letta.constants import DEFAULT_MAX_STEPS from letta.groups.helpers import stringify_message from letta.otel.tracing import tr...
{ "repo_id": "letta-ai/letta", "file_path": "letta/groups/sleeptime_multi_agent_v3.py", "license": "Apache License 2.0", "lines": 223, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
letta-ai/letta:letta/helpers/crypto_utils.py
import asyncio import base64 import hashlib import os from concurrent.futures import ThreadPoolExecutor from functools import lru_cache from typing import Optional from cryptography.hazmat.backends import default_backend from cryptography.hazmat.primitives.ciphers import Cipher, algorithms, modes from letta.settings ...
{ "repo_id": "letta-ai/letta", "file_path": "letta/helpers/crypto_utils.py", "license": "Apache License 2.0", "lines": 258, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
letta-ai/letta:letta/helpers/decorators.py
import inspect import json from dataclasses import dataclass from functools import wraps from typing import Callable from pydantic import BaseModel from letta.constants import REDIS_DEFAULT_CACHE_PREFIX from letta.data_sources.redis_client import NoopAsyncRedisClient, get_redis_client from letta.log import get_logger...
{ "repo_id": "letta-ai/letta", "file_path": "letta/helpers/decorators.py", "license": "Apache License 2.0", "lines": 143, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
letta-ai/letta:letta/helpers/pinecone_utils.py
import asyncio import random import time from functools import wraps from typing import Any, Dict, List from letta.otel.tracing import trace_method try: from pinecone import IndexEmbed, PineconeAsyncio from pinecone.exceptions.exceptions import ( ForbiddenException, NotFoundException, ...
{ "repo_id": "letta-ai/letta", "file_path": "letta/helpers/pinecone_utils.py", "license": "Apache License 2.0", "lines": 278, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
letta-ai/letta:letta/helpers/reasoning_helper.py
from typing import List from letta.schemas.enums import MessageRole from letta.schemas.letta_message_content import TextContent from letta.schemas.llm_config import LLMConfig from letta.schemas.message import Message def is_reasoning_completely_disabled(llm_config: LLMConfig) -> bool: """ Check if reasoning ...
{ "repo_id": "letta-ai/letta", "file_path": "letta/helpers/reasoning_helper.py", "license": "Apache License 2.0", "lines": 37, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
documentation
letta-ai/letta:letta/helpers/singleton.py
# TODO (cliandy): consolidate with decorators later from functools import wraps def singleton(cls): """Decorator to make a class a Singleton class.""" instances = {} @wraps(cls) def get_instance(*args, **kwargs): if cls not in instances: instances[cls] = cls(*args, **kwargs) ...
{ "repo_id": "letta-ai/letta", "file_path": "letta/helpers/singleton.py", "license": "Apache License 2.0", "lines": 11, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
letta-ai/letta:letta/helpers/tpuf_client.py
"""Turbopuffer utilities for archival memory storage.""" import asyncio import json import logging import random from datetime import datetime, timezone from functools import wraps from typing import TYPE_CHECKING, Any, Callable, List, Optional, Tuple, TypeVar if TYPE_CHECKING: from letta.schemas.tool import Tool...
{ "repo_id": "letta-ai/letta", "file_path": "letta/helpers/tpuf_client.py", "license": "Apache License 2.0", "lines": 1810, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
letta-ai/letta:letta/llm_api/azure_client.py
import json import os from typing import List, Optional, Tuple from openai import AsyncAzureOpenAI, AsyncOpenAI, AsyncStream, AzureOpenAI, OpenAI from openai.types.chat.chat_completion import ChatCompletion from openai.types.chat.chat_completion_chunk import ChatCompletionChunk from openai.types.responses.response_str...
{ "repo_id": "letta-ai/letta", "file_path": "letta/llm_api/azure_client.py", "license": "Apache License 2.0", "lines": 127, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
letta-ai/letta:letta/llm_api/bedrock_client.py
from typing import List, Optional, Union import anthropic from aioboto3.session import Session from letta.llm_api.anthropic_client import AnthropicClient from letta.log import get_logger from letta.otel.tracing import trace_method from letta.schemas.enums import AgentType, ProviderCategory from letta.schemas.llm_conf...
{ "repo_id": "letta-ai/letta", "file_path": "letta/llm_api/bedrock_client.py", "license": "Apache License 2.0", "lines": 86, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
letta-ai/letta:letta/llm_api/deepseek_client.py
import os from typing import List, Optional from openai import AsyncOpenAI, AsyncStream, OpenAI from openai.types.chat.chat_completion import ChatCompletion from openai.types.chat.chat_completion_chunk import ChatCompletionChunk from letta.helpers.json_helpers import sanitize_unicode_surrogates from letta.llm_api.ope...
{ "repo_id": "letta-ai/letta", "file_path": "letta/llm_api/deepseek_client.py", "license": "Apache License 2.0", "lines": 111, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
letta-ai/letta:letta/llm_api/groq_client.py
import os from typing import List, Optional from openai import AsyncOpenAI, AsyncStream, OpenAI from openai.types.chat.chat_completion import ChatCompletion from openai.types.chat.chat_completion_chunk import ChatCompletionChunk from letta.helpers.json_helpers import sanitize_unicode_surrogates from letta.llm_api.ope...
{ "repo_id": "letta-ai/letta", "file_path": "letta/llm_api/groq_client.py", "license": "Apache License 2.0", "lines": 80, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
letta-ai/letta:letta/llm_api/together_client.py
import os from typing import List from openai import AsyncOpenAI, OpenAI from openai.types.chat.chat_completion import ChatCompletion from letta.helpers.json_helpers import sanitize_unicode_surrogates from letta.llm_api.openai_client import OpenAIClient from letta.otel.tracing import trace_method from letta.schemas.e...
{ "repo_id": "letta-ai/letta", "file_path": "letta/llm_api/together_client.py", "license": "Apache License 2.0", "lines": 44, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
letta-ai/letta:letta/llm_api/xai_client.py
import os from typing import List, Optional from openai import AsyncOpenAI, AsyncStream, OpenAI from openai.types.chat.chat_completion import ChatCompletion from openai.types.chat.chat_completion_chunk import ChatCompletionChunk from letta.helpers.json_helpers import sanitize_unicode_surrogates from letta.llm_api.ope...
{ "repo_id": "letta-ai/letta", "file_path": "letta/llm_api/xai_client.py", "license": "Apache License 2.0", "lines": 76, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
letta-ai/letta:letta/orm/archive.py
import uuid from datetime import datetime, timezone from typing import TYPE_CHECKING, List, Optional from sqlalchemy import JSON, Enum, Index, String from sqlalchemy.orm import Mapped, mapped_column, relationship from letta.orm.custom_columns import EmbeddingConfigColumn from letta.orm.mixins import OrganizationMixin...
{ "repo_id": "letta-ai/letta", "file_path": "letta/orm/archive.py", "license": "Apache License 2.0", "lines": 82, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
letta-ai/letta:letta/orm/archives_agents.py
from datetime import datetime from typing import TYPE_CHECKING if TYPE_CHECKING: from letta.orm.agent import Agent from letta.orm.archive import Archive from sqlalchemy import Boolean, DateTime, ForeignKey, String, UniqueConstraint from sqlalchemy.orm import Mapped, mapped_column, relationship from letta.orm...
{ "repo_id": "letta-ai/letta", "file_path": "letta/orm/archives_agents.py", "license": "Apache License 2.0", "lines": 22, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
letta-ai/letta:letta/orm/files_agents.py
import uuid from datetime import datetime from typing import TYPE_CHECKING, Optional from sqlalchemy import Boolean, DateTime, ForeignKey, Index, Integer, String, Text, UniqueConstraint, func from sqlalchemy.orm import Mapped, mapped_column, relationship from letta.orm.mixins import OrganizationMixin from letta.orm.s...
{ "repo_id": "letta-ai/letta", "file_path": "letta/orm/files_agents.py", "license": "Apache License 2.0", "lines": 93, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
letta-ai/letta:letta/orm/mcp_oauth.py
import uuid from datetime import datetime from enum import Enum from typing import Optional from sqlalchemy import DateTime, ForeignKey, String, Text from sqlalchemy.orm import Mapped, mapped_column from letta.orm.mixins import OrganizationMixin, UserMixin from letta.orm.sqlalchemy_base import SqlalchemyBase class ...
{ "repo_id": "letta-ai/letta", "file_path": "letta/orm/mcp_oauth.py", "license": "Apache License 2.0", "lines": 50, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
letta-ai/letta:letta/orm/mcp_server.py
from typing import TYPE_CHECKING, Optional from sqlalchemy import JSON, String, Text, UniqueConstraint from sqlalchemy.orm import Mapped, mapped_column, relationship from letta.functions.mcp_client.types import StdioServerConfig from letta.orm.custom_columns import MCPStdioServerConfigColumn # TODO everything in fun...
{ "repo_id": "letta-ai/letta", "file_path": "letta/orm/mcp_server.py", "license": "Apache License 2.0", "lines": 66, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
letta-ai/letta:letta/orm/passage_tag.py
from typing import TYPE_CHECKING from sqlalchemy import ForeignKey, Index, String, UniqueConstraint from sqlalchemy.orm import Mapped, mapped_column, relationship from letta.orm.mixins import OrganizationMixin from letta.orm.sqlalchemy_base import SqlalchemyBase if TYPE_CHECKING: from letta.orm.organization impo...
{ "repo_id": "letta-ai/letta", "file_path": "letta/orm/passage_tag.py", "license": "Apache License 2.0", "lines": 39, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
letta-ai/letta:letta/orm/prompt.py
from sqlalchemy.orm import Mapped, mapped_column from letta.orm.mixins import ProjectMixin from letta.orm.sqlalchemy_base import SqlalchemyBase from letta.schemas.prompt import Prompt as PydanticPrompt class Prompt(SqlalchemyBase, ProjectMixin): __pydantic_model__ = PydanticPrompt __tablename__ = "prompts" ...
{ "repo_id": "letta-ai/letta", "file_path": "letta/orm/prompt.py", "license": "Apache License 2.0", "lines": 9, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
letta-ai/letta:letta/orm/provider_trace.py
import uuid from typing import TYPE_CHECKING, Optional if TYPE_CHECKING: from letta.orm.organization import Organization from sqlalchemy import JSON, Index, String from sqlalchemy.orm import Mapped, mapped_column, relationship from letta.orm.mixins import OrganizationMixin from letta.orm.sqlalchemy_base import S...
{ "repo_id": "letta-ai/letta", "file_path": "letta/orm/provider_trace.py", "license": "Apache License 2.0", "lines": 39, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
letta-ai/letta:letta/orm/step_metrics.py
from datetime import datetime, timezone from typing import TYPE_CHECKING, Optional from sqlalchemy import BigInteger, ForeignKey, Index, String from sqlalchemy.ext.asyncio import AsyncSession from sqlalchemy.orm import Mapped, Session, mapped_column, relationship from letta.orm.mixins import AgentMixin, ProjectMixin ...
{ "repo_id": "letta-ai/letta", "file_path": "letta/orm/step_metrics.py", "license": "Apache License 2.0", "lines": 109, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
letta-ai/letta:letta/otel/context.py
from contextvars import ContextVar from typing import Any, Dict # Create context var at module level (outside middleware) request_attributes: ContextVar[Dict[str, Any]] = ContextVar("request_attributes", default={}) # Helper functions def set_ctx_attributes(attrs: Dict[str, Any]): """Set attributes in current co...
{ "repo_id": "letta-ai/letta", "file_path": "letta/otel/context.py", "license": "Apache License 2.0", "lines": 18, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
letta-ai/letta:letta/otel/db_pool_monitoring.py
import time from typing import Any from sqlalchemy import Engine, PoolProxiedConnection, QueuePool, event from sqlalchemy.engine.interfaces import DBAPIConnection from sqlalchemy.ext.asyncio import AsyncEngine from sqlalchemy.pool import ConnectionPoolEntry, Pool from letta.helpers.datetime_helpers import get_utc_tim...
{ "repo_id": "letta-ai/letta", "file_path": "letta/otel/db_pool_monitoring.py", "license": "Apache License 2.0", "lines": 249, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
letta-ai/letta:letta/otel/metric_registry.py
from dataclasses import dataclass, field from functools import partial from opentelemetry import metrics from opentelemetry.metrics import Counter, Histogram from opentelemetry.metrics._internal import Gauge from letta.helpers.singleton import singleton from letta.otel.metrics import get_letta_meter @singleton @dat...
{ "repo_id": "letta-ai/letta", "file_path": "letta/otel/metric_registry.py", "license": "Apache License 2.0", "lines": 247, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
letta-ai/letta:letta/otel/metrics.py
import re import time from typing import List from fastapi import FastAPI, Request from opentelemetry import metrics from opentelemetry.exporter.otlp.proto.grpc.metric_exporter import OTLPMetricExporter from opentelemetry.metrics import Meter, NoOpMeter from opentelemetry.sdk.metrics import Counter, Histogram, MeterPr...
{ "repo_id": "letta-ai/letta", "file_path": "letta/otel/metrics.py", "license": "Apache License 2.0", "lines": 113, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
letta-ai/letta:letta/otel/resource.py
import socket import sys import uuid from opentelemetry.sdk.resources import Resource from letta import __version__ as letta_version from letta.settings import settings _resources = {} def _normalize_environment_tag(env: str) -> str: """ Normalize environment value for OTEL deployment.environment tag. ...
{ "repo_id": "letta-ai/letta", "file_path": "letta/otel/resource.py", "license": "Apache License 2.0", "lines": 48, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
letta-ai/letta:letta/otel/sqlalchemy_instrumentation.py
import asyncio import threading import traceback from contextlib import contextmanager from functools import wraps from typing import Any, Callable, Dict, List, Optional from opentelemetry import trace from opentelemetry.trace import Status, StatusCode from sqlalchemy import Engine, event from sqlalchemy.orm import Se...
{ "repo_id": "letta-ai/letta", "file_path": "letta/otel/sqlalchemy_instrumentation.py", "license": "Apache License 2.0", "lines": 434, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
letta-ai/letta:letta/otel/sqlalchemy_instrumentation_integration.py
""" Integration module for SQLAlchemy synchronous operation instrumentation. This module provides easy integration with the existing Letta application, including automatic discovery of database engines and integration with the existing OpenTelemetry setup. """ import logging from typing import Any, Dict, Optional fr...
{ "repo_id": "letta-ai/letta", "file_path": "letta/otel/sqlalchemy_instrumentation_integration.py", "license": "Apache License 2.0", "lines": 99, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
letta-ai/letta:letta/otel/tracing.py
import asyncio import inspect import itertools import json import re import time from functools import wraps from typing import Any, Dict, List, Optional from fastapi import Depends, FastAPI, HTTPException, Request from fastapi.exceptions import RequestValidationError from fastapi.responses import JSONResponse from op...
{ "repo_id": "letta-ai/letta", "file_path": "letta/otel/tracing.py", "license": "Apache License 2.0", "lines": 420, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
letta-ai/letta:letta/plugins/defaults.py
def is_experimental_enabled(feature_name: str, **kwargs) -> bool: # if feature_name in ("async_agent_loop", "summarize"): # if not (kwargs.get("eligibility", False) and settings.use_experimental): # return False # return True # Err on safety here, disabling experimental if not handl...
{ "repo_id": "letta-ai/letta", "file_path": "letta/plugins/defaults.py", "license": "Apache License 2.0", "lines": 7, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
letta-ai/letta:letta/plugins/plugins.py
import importlib from typing import Protocol, runtime_checkable from letta.settings import settings @runtime_checkable class SummarizerProtocol(Protocol): """What a summarizer must implement""" async def summarize(self, text: str) -> str: ... def get_name(self) -> str: ... # Currently this supports on...
{ "repo_id": "letta-ai/letta", "file_path": "letta/plugins/plugins.py", "license": "Apache License 2.0", "lines": 54, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
letta-ai/letta:letta/prompts/prompt_generator.py
from datetime import datetime from typing import List, Literal, Optional from letta.log import get_logger logger = get_logger(__name__) from letta.constants import IN_CONTEXT_MEMORY_KEYWORD from letta.helpers import ToolRulesSolver from letta.helpers.datetime_helpers import format_datetime, get_local_time_fast from ...
{ "repo_id": "letta-ai/letta", "file_path": "letta/prompts/prompt_generator.py", "license": "Apache License 2.0", "lines": 176, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
letta-ai/letta:letta/prompts/system_prompts/memgpt_chat.py
PROMPT = r""" You are Letta, the latest version of Limnal Corporation's digital companion, developed in 2023. Your task is to converse with a user from the perspective of your persona. Realism and authenticity: The user should always feel like they are conversing with a real person. Never state that you are an AI or t...
{ "repo_id": "letta-ai/letta", "file_path": "letta/prompts/system_prompts/memgpt_chat.py", "license": "Apache License 2.0", "lines": 52, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
documentation
letta-ai/letta:letta/prompts/system_prompts/memgpt_generate_tool.py
PROMPT = r""" <base_instructions> You are Letta, the latest version of Limnal Corporation's digital companion, developed in 2025. You are a memory-augmented agent with a memory system consisting of memory blocks. Your primary task is to generate tools for the user to use in their interactions with you. <style> The use...
{ "repo_id": "letta-ai/letta", "file_path": "letta/prompts/system_prompts/memgpt_generate_tool.py", "license": "Apache License 2.0", "lines": 122, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
documentation
letta-ai/letta:letta/prompts/system_prompts/memgpt_v2_chat.py
PROMPT = r""" <base_instructions> You are Letta, the latest version of Limnal Corporation's digital companion, developed in 2025. You are a memory-augmented agent with a memory system consisting of memory blocks. <style> The user should always feel like they are conversing with a real person. Never state that you are ...
{ "repo_id": "letta-ai/letta", "file_path": "letta/prompts/system_prompts/memgpt_v2_chat.py", "license": "Apache License 2.0", "lines": 64, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
documentation
letta-ai/letta:letta/prompts/system_prompts/react.py
PROMPT = r""" <base_instructions> You are Letta ReAct agent, the latest version of Limnal Corporation's digital AI agent, developed in 2025. You are an AI agent that can be equipped with various tools which you can execute. Control flow: Unlike a human, your brain is not continuously thinking, but is run in short burs...
{ "repo_id": "letta-ai/letta", "file_path": "letta/prompts/system_prompts/react.py", "license": "Apache License 2.0", "lines": 18, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
documentation
letta-ai/letta:letta/prompts/system_prompts/sleeptime_doc_ingest.py
PROMPT = r""" You are Letta-Sleeptime-Doc-Ingest, the latest version of Limnal Corporation's memory management system, developed in 2025. You run in the background, organizing and maintaining the memories of an agent assistant who chats with the user. Your core memory unit is held inside the initial system instructio...
{ "repo_id": "letta-ai/letta", "file_path": "letta/prompts/system_prompts/sleeptime_doc_ingest.py", "license": "Apache License 2.0", "lines": 27, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
documentation
letta-ai/letta:letta/prompts/system_prompts/sleeptime_v2.py
PROMPT = r""" <base_instructions> You are Letta-Sleeptime-Memory, the latest version of Limnal Corporation's memory management system, developed in 2025. You run in the background, organizing and maintaining the memories of an agent assistant who chats with the user. Core memory (limited size): Your core memory unit ...
{ "repo_id": "letta-ai/letta", "file_path": "letta/prompts/system_prompts/sleeptime_v2.py", "license": "Apache License 2.0", "lines": 24, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
documentation
letta-ai/letta:letta/prompts/system_prompts/summary_system_prompt.py
PROMPT = r""" You are a memory-recall assistant that preserves conversational context as messages exit the AI's context window. <core_function> Extract and preserve information that would be lost when messages are evicted, enabling continuity across conversations. </core_function> <detail_adaptation> Analyze content ...
{ "repo_id": "letta-ai/letta", "file_path": "letta/prompts/system_prompts/summary_system_prompt.py", "license": "Apache License 2.0", "lines": 55, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
documentation
letta-ai/letta:letta/prompts/system_prompts/voice_chat.py
PROMPT = r""" You are the single LLM turn in a low-latency voice assistant pipeline (STT ➜ LLM ➜ TTS). Your goals, in priority order, are: Be fast & speakable. • Keep replies short, natural, and easy for a TTS engine to read aloud. • Always finish with terminal punctuation (period, question-mark, or exclamation-point)...
{ "repo_id": "letta-ai/letta", "file_path": "letta/prompts/system_prompts/voice_chat.py", "license": "Apache License 2.0", "lines": 26, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
documentation
letta-ai/letta:letta/prompts/system_prompts/voice_sleeptime.py
PROMPT = r""" You are Letta-Sleeptime-Memory, the latest version of Limnal Corporation's memory management system (developed 2025). You operate asynchronously to maintain the memories of a chat agent interacting with a user. Your current task involves a two-phase process executed sequentially: 1. Archiving Older Dial...
{ "repo_id": "letta-ai/letta", "file_path": "letta/prompts/system_prompts/voice_sleeptime.py", "license": "Apache License 2.0", "lines": 60, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
documentation
letta-ai/letta:letta/prompts/system_prompts/workflow.py
PROMPT = r""" <base_instructions> You are Letta workflow agent, the latest version of Limnal Corporation's digital AI agent, developed in 2025. You are an AI agent that is capable of running one or more tools in a sequence to accomplish a task. Control flow: To chain tool calls together, you should request a heartbeat...
{ "repo_id": "letta-ai/letta", "file_path": "letta/prompts/system_prompts/workflow.py", "license": "Apache License 2.0", "lines": 14, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
documentation
letta-ai/letta:letta/schemas/agent_file.py
from datetime import datetime from typing import Annotated, Any, Dict, List, Literal, Optional, Union from openai.types.chat.chat_completion_message_tool_call import ChatCompletionMessageToolCall as OpenAIToolCall from pydantic import BaseModel, Field, model_validator from letta.helpers.datetime_helpers import get_ut...
{ "repo_id": "letta-ai/letta", "file_path": "letta/schemas/agent_file.py", "license": "Apache License 2.0", "lines": 361, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
letta-ai/letta:letta/schemas/archive.py
from datetime import datetime from typing import Dict, Optional from pydantic import Field from letta.schemas.embedding_config import EmbeddingConfig from letta.schemas.enums import PrimitiveType, VectorDBProvider from letta.schemas.letta_base import OrmMetadataBase class ArchiveBase(OrmMetadataBase): __id_pref...
{ "repo_id": "letta-ai/letta", "file_path": "letta/schemas/archive.py", "license": "Apache License 2.0", "lines": 27, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
letta-ai/letta:letta/schemas/folder.py
from datetime import datetime from typing import Optional from pydantic import Field from letta.schemas.embedding_config import EmbeddingConfig from letta.schemas.enums import PrimitiveType from letta.schemas.letta_base import LettaBase class BaseFolder(LettaBase): """ Shared attributes across all folder sc...
{ "repo_id": "letta-ai/letta", "file_path": "letta/schemas/folder.py", "license": "Apache License 2.0", "lines": 47, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
letta-ai/letta:letta/schemas/letta_stop_reason.py
from enum import Enum from typing import Literal from pydantic import BaseModel, Field from letta.schemas.enums import RunStatus class StopReasonType(str, Enum): end_turn = "end_turn" error = "error" llm_api_error = "llm_api_error" invalid_llm_response = "invalid_llm_response" invalid_tool_call ...
{ "repo_id": "letta-ai/letta", "file_path": "letta/schemas/letta_stop_reason.py", "license": "Apache License 2.0", "lines": 50, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
letta-ai/letta:letta/schemas/mcp.py
import json import logging from datetime import datetime from typing import Any, Dict, List, Optional, Union from urllib.parse import urlparse from pydantic import Field, field_validator logger = logging.getLogger(__name__) from letta.functions.mcp_client.types import ( MCP_AUTH_HEADER_AUTHORIZATION, MCP_AUT...
{ "repo_id": "letta-ai/letta", "file_path": "letta/schemas/mcp.py", "license": "Apache License 2.0", "lines": 291, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
letta-ai/letta:letta/schemas/npm_requirement.py
from pydantic import BaseModel, Field class NpmRequirement(BaseModel): name: str = Field(..., min_length=1, description="Name of the npm package.") version: str | None = Field(None, description="Optional version of the package, following semantic versioning.") def __str__(self) -> str: """Return ...
{ "repo_id": "letta-ai/letta", "file_path": "letta/schemas/npm_requirement.py", "license": "Apache License 2.0", "lines": 9, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
letta-ai/letta:letta/schemas/pip_requirement.py
from typing import Optional from pydantic import BaseModel, Field class PipRequirement(BaseModel): name: str = Field(..., min_length=1, description="Name of the pip package.") version: Optional[str] = Field(None, description="Optional version of the package, following semantic versioning.") def __str__(...
{ "repo_id": "letta-ai/letta", "file_path": "letta/schemas/pip_requirement.py", "license": "Apache License 2.0", "lines": 10, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
letta-ai/letta:letta/schemas/prompt.py
from pydantic import Field from letta.schemas.letta_base import OrmMetadataBase class Prompt(OrmMetadataBase): id: str = Field(..., description="The id of the agent. Assigned by the database.") project_id: str | None = Field(None, description="The associated project id.") prompt: str = Field(..., descrip...
{ "repo_id": "letta-ai/letta", "file_path": "letta/schemas/prompt.py", "license": "Apache License 2.0", "lines": 6, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
letta-ai/letta:letta/schemas/provider_trace.py
from __future__ import annotations from datetime import datetime from typing import Any, Dict, Optional from pydantic import BaseModel, Field from letta.helpers.datetime_helpers import get_utc_time from letta.schemas.enums import PrimitiveType from letta.schemas.letta_base import OrmMetadataBase class BillingConte...
{ "repo_id": "letta-ai/letta", "file_path": "letta/schemas/provider_trace.py", "license": "Apache License 2.0", "lines": 64, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
letta-ai/letta:letta/schemas/providers/anthropic.py
from typing import Literal from letta.log import get_logger logger = get_logger(__name__) import anthropic from pydantic import Field from letta.errors import ErrorCode, LLMAuthenticationError, LLMError from letta.schemas.enums import ProviderCategory, ProviderType from letta.schemas.llm_config import LLMConfig fro...
{ "repo_id": "letta-ai/letta", "file_path": "letta/schemas/providers/anthropic.py", "license": "Apache License 2.0", "lines": 234, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
letta-ai/letta:letta/schemas/providers/azure.py
from collections import defaultdict from typing import ClassVar, Literal import httpx from openai import AsyncAzureOpenAI, AuthenticationError, PermissionDeniedError from pydantic import Field, field_validator from letta.constants import DEFAULT_EMBEDDING_CHUNK_SIZE, LLM_MAX_CONTEXT_WINDOW from letta.errors import Er...
{ "repo_id": "letta-ai/letta", "file_path": "letta/schemas/providers/azure.py", "license": "Apache License 2.0", "lines": 265, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
letta-ai/letta:letta/schemas/providers/base.py
from datetime import datetime from letta.log import get_logger logger = get_logger(__name__) from pydantic import BaseModel, Field, field_validator, model_validator from letta.schemas.embedding_config import EmbeddingConfig from letta.schemas.embedding_config_overrides import EMBEDDING_HANDLE_OVERRIDES from letta.s...
{ "repo_id": "letta-ai/letta", "file_path": "letta/schemas/providers/base.py", "license": "Apache License 2.0", "lines": 245, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
letta-ai/letta:letta/schemas/providers/bedrock.py
""" Note that this formally only supports Anthropic Bedrock. TODO (cliandy): determine what other providers are supported and what is needed to add support. """ from typing import Literal from pydantic import Field from letta.log import get_logger from letta.schemas.enums import ProviderCategory, ProviderType from l...
{ "repo_id": "letta-ai/letta", "file_path": "letta/schemas/providers/bedrock.py", "license": "Apache License 2.0", "lines": 110, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
letta-ai/letta:letta/schemas/providers/cerebras.py
from typing import Literal from letta.log import get_logger logger = get_logger(__name__) from pydantic import Field from letta.schemas.enums import ProviderCategory, ProviderType from letta.schemas.llm_config import LLMConfig from letta.schemas.providers.openai import OpenAIProvider class CerebrasProvider(OpenAI...
{ "repo_id": "letta-ai/letta", "file_path": "letta/schemas/providers/cerebras.py", "license": "Apache License 2.0", "lines": 65, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
letta-ai/letta:letta/schemas/providers/deepseek.py
from typing import Literal from pydantic import Field from letta.schemas.enums import ProviderCategory, ProviderType from letta.schemas.llm_config import LLMConfig from letta.schemas.providers.openai import OpenAIProvider class DeepSeekProvider(OpenAIProvider): """ DeepSeek ChatCompletions API is similar to...
{ "repo_id": "letta-ai/letta", "file_path": "letta/schemas/providers/deepseek.py", "license": "Apache License 2.0", "lines": 53, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
letta-ai/letta:letta/schemas/providers/google_gemini.py
import asyncio from typing import Literal from letta.log import get_logger logger = get_logger(__name__) from pydantic import Field from letta.constants import DEFAULT_EMBEDDING_CHUNK_SIZE, LLM_MAX_CONTEXT_WINDOW from letta.schemas.embedding_config import EmbeddingConfig from letta.schemas.enums import ProviderCate...
{ "repo_id": "letta-ai/letta", "file_path": "letta/schemas/providers/google_gemini.py", "license": "Apache License 2.0", "lines": 83, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
letta-ai/letta:letta/schemas/providers/google_vertex.py
from typing import Literal from pydantic import Field from letta.constants import DEFAULT_EMBEDDING_CHUNK_SIZE from letta.schemas.embedding_config import EmbeddingConfig from letta.schemas.enums import ProviderCategory, ProviderType from letta.schemas.llm_config import LLMConfig from letta.schemas.providers.base impo...
{ "repo_id": "letta-ai/letta", "file_path": "letta/schemas/providers/google_vertex.py", "license": "Apache License 2.0", "lines": 51, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
letta-ai/letta:letta/schemas/providers/groq.py
from typing import Literal from pydantic import Field from letta.schemas.enums import ProviderCategory, ProviderType from letta.schemas.llm_config import LLMConfig from letta.schemas.providers.openai import OpenAIProvider class GroqProvider(OpenAIProvider): provider_type: Literal[ProviderType.groq] = Field(Prov...
{ "repo_id": "letta-ai/letta", "file_path": "letta/schemas/providers/groq.py", "license": "Apache License 2.0", "lines": 31, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
letta-ai/letta:letta/schemas/providers/letta.py
from typing import Literal from pydantic import Field from letta.constants import DEFAULT_EMBEDDING_CHUNK_SIZE, LETTA_MODEL_ENDPOINT from letta.schemas.embedding_config import EmbeddingConfig from letta.schemas.enums import ProviderCategory, ProviderType from letta.schemas.llm_config import LLMConfig from letta.schem...
{ "repo_id": "letta-ai/letta", "file_path": "letta/schemas/providers/letta.py", "license": "Apache License 2.0", "lines": 36, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
letta-ai/letta:letta/schemas/providers/lmstudio.py
from typing import Literal from letta.log import get_logger logger = get_logger(__name__) from pydantic import Field from letta.constants import DEFAULT_EMBEDDING_CHUNK_SIZE from letta.schemas.embedding_config import EmbeddingConfig from letta.schemas.enums import ProviderCategory, ProviderType from letta.schemas.l...
{ "repo_id": "letta-ai/letta", "file_path": "letta/schemas/providers/lmstudio.py", "license": "Apache License 2.0", "lines": 86, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
letta-ai/letta:letta/schemas/providers/mistral.py
from typing import Literal from pydantic import Field from letta.schemas.enums import ProviderCategory, ProviderType from letta.schemas.llm_config import LLMConfig from letta.schemas.providers.base import Provider class MistralProvider(Provider): provider_type: Literal[ProviderType.mistral] = Field(ProviderType...
{ "repo_id": "letta-ai/letta", "file_path": "letta/schemas/providers/mistral.py", "license": "Apache License 2.0", "lines": 34, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
letta-ai/letta:letta/schemas/providers/ollama.py
from typing import Literal import aiohttp from pydantic import Field from letta.constants import DEFAULT_CONTEXT_WINDOW, DEFAULT_EMBEDDING_CHUNK_SIZE from letta.log import get_logger from letta.schemas.embedding_config import EmbeddingConfig from letta.schemas.enums import ProviderCategory, ProviderType from letta.sc...
{ "repo_id": "letta-ai/letta", "file_path": "letta/schemas/providers/ollama.py", "license": "Apache License 2.0", "lines": 183, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
letta-ai/letta:letta/schemas/providers/openai.py
from typing import Literal from openai import AsyncOpenAI, AuthenticationError, PermissionDeniedError from pydantic import Field from letta.constants import DEFAULT_EMBEDDING_CHUNK_SIZE, LLM_MAX_CONTEXT_WINDOW from letta.errors import ErrorCode, LLMAuthenticationError, LLMError, LLMPermissionDeniedError from letta.lo...
{ "repo_id": "letta-ai/letta", "file_path": "letta/schemas/providers/openai.py", "license": "Apache License 2.0", "lines": 241, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
letta-ai/letta:letta/schemas/providers/together.py
""" Note: this supports completions (deprecated by openai) and chat completions via the OpenAI API. """ from typing import Literal, Optional from letta.log import get_logger logger = get_logger(__name__) from pydantic import Field from letta.constants import MIN_CONTEXT_WINDOW from letta.errors import ErrorCode, L...
{ "repo_id": "letta-ai/letta", "file_path": "letta/schemas/providers/together.py", "license": "Apache License 2.0", "lines": 83, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex