import type { RequestInit, RequestInfo } from "./internal/builtin-types.js"; import type { PromiseOrValue, MergedRequestInit, FinalizedRequestInit } from "./internal/types.js"; export type { Logger, LogLevel } from "./internal/utils/log.js"; import * as Opts from "./internal/request-options.js"; import * as Errors from "./core/error.js"; import * as Pagination from "./core/pagination.js"; import { type ArrayPageParams, ArrayPageResponse, type NextFilesPageParams, NextFilesPageResponse, type ObjectPageParams, ObjectPageResponse } from "./core/pagination.js"; import * as Uploads from "./core/uploads.js"; import * as API from "./resources/index.js"; import * as TopLevelAPI from "./resources/top-level.js"; import { HealthResponse } from "./resources/top-level.js"; import { APIPromise } from "./core/api-promise.js"; import { AccessTokenCreateParams, AccessTokenCreateResponse, AccessTokenDeleteParams, AccessTokenDeleteResponse, AccessTokenListParams, AccessTokenListResponse, AccessTokens } from "./resources/access-tokens.js"; import { EnvironmentListParams, EnvironmentListResponse, EnvironmentRetrieveResponse, EnvironmentSendMessageParams, EnvironmentSendMessageResponse, Environments } from "./resources/environments.js"; import { MessageListParams, MessageListResponse, MessageRetrieveResponse, MessageSearchParams, MessageSearchRequest, MessageSearchResponse, MessageSearchResult, Messages } from "./resources/messages.js"; import { Passage, PassageSearchParams, PassageSearchResponse, Passages } from "./resources/passages.js"; import { TagListParams, TagListResponse, Tags } from "./resources/tags.js"; import { NpmRequirement, PipRequirement, Tool, ToolCreate, ToolCreateParams, ToolDeleteResponse, ToolListParams, ToolReturnMessage, ToolSearchParams, ToolSearchRequest, ToolSearchResponse, ToolSearchResult, ToolType, ToolUpdateParams, ToolUpsertParams, Tools, ToolsArrayPage } from "./resources/tools.js"; import { AgentCreateParams, AgentDeleteResponse, AgentEnvironmentVariable, AgentExportFileParams, AgentExportFileResponse, AgentImportFileParams, AgentImportFileResponse, AgentListParams, AgentRecompileParams, AgentRecompileResponse, AgentRetrieveParams, AgentState, AgentStatesArrayPage, AgentType, AgentUpdateParams, Agents, AnthropicModelSettings, AzureModelSettings, BedrockModelSettings, ChildToolRule, ConditionalToolRule, ContinueToolRule, DeepseekModelSettings, GoogleAIModelSettings, GoogleVertexModelSettings, GroqModelSettings, InitToolRule, JsonObjectResponseFormat, JsonSchemaResponseFormat, LettaMessageContentUnion, MaxCountPerStepToolRule, MessageCreate, OpenAIModelSettings, ParentToolRule, RequiredBeforeExitToolRule, RequiresApprovalToolRule, TerminalToolRule, TextResponseFormat, TogetherModelSettings, XaiModelSettings } from "./resources/agents/agents.js"; import { Archive, ArchiveCreateParams, ArchiveListParams, ArchiveUpdateParams, Archives, ArchivesArrayPage, VectorDBProvider } from "./resources/archives/archives.js"; import { BlockCreateParams, BlockDeleteResponse, BlockListParams, BlockResponse, BlockResponsesArrayPage, BlockUpdateParams, Blocks, CreateBlock } from "./resources/blocks/blocks.js"; import { Conversation, ConversationCancelParams, ConversationCancelResponse, ConversationCreateParams, ConversationDeleteResponse, ConversationForkParams, ConversationListParams, ConversationListResponse, ConversationRecompileParams, ConversationRecompileResponse, ConversationUpdateParams, Conversations, CreateConversation, UpdateConversation } from "./resources/conversations/conversations.js"; import { Folder, FolderCreateParams, FolderDeleteResponse, FolderListParams, FolderUpdateParams, Folders, FoldersArrayPage } from "./resources/folders/folders.js"; import { CreateSseMcpServer, CreateStdioMcpServer, CreateStreamableHTTPMcpServer, McpServerCreateParams, McpServerCreateResponse, McpServerListResponse, McpServerRefreshParams, McpServerRefreshResponse, McpServerRetrieveResponse, McpServerUpdateParams, McpServerUpdateResponse, McpServers, SseMcpServer, StdioMcpServer, StreamableHTTPMcpServer, UpdateSseMcpServer, UpdateStdioMcpServer, UpdateStreamableHTTPMcpServer } from "./resources/mcp-servers/mcp-servers.js"; import { EmbeddingConfig, EmbeddingModel, LlmConfig, Model, ModelListParams, ModelListResponse, Models, ProviderCategory, ProviderType } from "./resources/models/models.js"; import { Job, RunListParams, Runs, StopReasonType } from "./resources/runs/runs.js"; import { ProviderTrace, Step, StepListParams, Steps, StepsArrayPage } from "./resources/steps/steps.js"; import { TemplateCreateParams, TemplateCreateResponse, TemplateDeleteParams, TemplateDeleteResponse, TemplateRollbackParams, TemplateRollbackResponse, TemplateSaveParams, TemplateSaveResponse, TemplateUpdateParams, TemplateUpdateResponse, Templates } from "./resources/templates/templates.js"; import { type Fetch } from "./internal/builtin-types.js"; import { HeadersLike, NullableHeaders } from "./internal/headers.js"; import { FinalRequestOptions, RequestOptions } from "./internal/request-options.js"; import { type LogLevel, type Logger } from "./internal/utils/log.js"; declare const environments: { cloud: string; local: string; }; type Environment = keyof typeof environments; export interface ClientOptions { /** * Defaults to process.env['LETTA_API_KEY']. */ apiKey?: string | null | undefined; projectID?: string | null | undefined; /** * Deprecated, please use project_id instead. */ project?: string | null | undefined; /** * Specifies the environment to use for the API. * * Each environment maps to a different base URL: * - `cloud` corresponds to `https://api.letta.com` * - `local` corresponds to `http://localhost:8283` */ environment?: Environment | undefined; /** * Override the default base URL for the API, e.g., "https://api.example.com/v2/" * * Defaults to process.env['LETTA_BASE_URL']. */ baseURL?: string | null | undefined; /** * The maximum amount of time (in milliseconds) that the client should wait for a response * from the server before timing out a single request. * * Note that request timeouts are retried by default, so in a worst-case scenario you may wait * much longer than this timeout before the promise succeeds or fails. * * @unit milliseconds */ timeout?: number | undefined; /** * Additional `RequestInit` options to be passed to `fetch` calls. * Properties will be overridden by per-request `fetchOptions`. */ fetchOptions?: MergedRequestInit | undefined; /** * Specify a custom `fetch` function implementation. * * If not provided, we expect that `fetch` is defined globally. */ fetch?: Fetch | undefined; /** * The maximum number of times that the client will retry a request in case of a * temporary failure, like a network error or a 5XX error from the server. * * @default 2 */ maxRetries?: number | undefined; /** * Default headers to include with every request to the API. * * These can be removed in individual requests by explicitly setting the * header to `null` in request options. */ defaultHeaders?: HeadersLike | undefined; /** * Default query parameters to include with every request to the API. * * These can be removed in individual requests by explicitly setting the * param to `undefined` in request options. */ defaultQuery?: Record | undefined; /** * Set the log level. * * Defaults to process.env['LETTA_LOG'] or 'warn' if it isn't set. */ logLevel?: LogLevel | undefined; /** * Set the logger. * * Defaults to globalThis.console. */ logger?: Logger | undefined; } /** * API Client for interfacing with the Letta API. */ export declare class Letta { #private; apiKey: string | null; projectID: string | null; project: string | null; baseURL: string; maxRetries: number; timeout: number; logger: Logger; logLevel: LogLevel | undefined; fetchOptions: MergedRequestInit | undefined; private fetch; protected idempotencyHeader?: string; private _options; /** * API Client for interfacing with the Letta API. * * @param {string | null | undefined} [opts.apiKey=process.env['LETTA_API_KEY'] ?? null] * @param {string | null | undefined} [opts.projectID] * @param {string | null | undefined} [opts.project] * @param {Environment} [opts.environment=cloud] - Specifies the environment URL to use for the API. * @param {string} [opts.baseURL=process.env['LETTA_BASE_URL'] ?? https://api.letta.com] - Override the default base URL for the API. * @param {number} [opts.timeout=1 minute] - The maximum amount of time (in milliseconds) the client will wait for a response before timing out. * @param {MergedRequestInit} [opts.fetchOptions] - Additional `RequestInit` options to be passed to `fetch` calls. * @param {Fetch} [opts.fetch] - Specify a custom `fetch` function implementation. * @param {number} [opts.maxRetries=2] - The maximum number of times the client will retry a request. * @param {HeadersLike} opts.defaultHeaders - Default headers to include with every request to the API. * @param {Record} opts.defaultQuery - Default query parameters to include with every request to the API. */ constructor({ baseURL, apiKey, projectID, project, ...opts }?: ClientOptions); /** * Create a new client instance re-using the same options given to the current client with optional overriding. */ withOptions(options: Partial): this; /** * Liveness endpoint; returns 200 when process is responsive. */ health(options?: RequestOptions): APIPromise; protected defaultQuery(): Record | undefined; protected validateHeaders({ values, nulls }: NullableHeaders): void; protected authHeaders(opts: FinalRequestOptions): Promise; protected stringifyQuery(query: object | Record): string; private getUserAgent; protected defaultIdempotencyKey(): string; protected makeStatusError(status: number, error: Object, message: string | undefined, headers: Headers): Errors.APIError; buildURL(path: string, query: Record | null | undefined, defaultBaseURL?: string | undefined): string; /** * Used as a callback for mutating the given `FinalRequestOptions` object. */ protected prepareOptions(options: FinalRequestOptions): Promise; /** * Used as a callback for mutating the given `RequestInit` object. * * This is useful for cases where you want to add certain headers based off of * the request properties, e.g. `method` or `url`. */ protected prepareRequest(request: RequestInit, { url, options }: { url: string; options: FinalRequestOptions; }): Promise; get(path: string, opts?: PromiseOrValue): APIPromise; post(path: string, opts?: PromiseOrValue): APIPromise; patch(path: string, opts?: PromiseOrValue): APIPromise; put(path: string, opts?: PromiseOrValue): APIPromise; delete(path: string, opts?: PromiseOrValue): APIPromise; private methodRequest; request(options: PromiseOrValue, remainingRetries?: number | null): APIPromise; private makeRequest; getAPIList = Pagination.AbstractPage>(path: string, Page: new (...args: any[]) => PageClass, opts?: PromiseOrValue): Pagination.PagePromise; requestAPIList = Pagination.AbstractPage>(Page: new (...args: ConstructorParameters) => PageClass, options: PromiseOrValue): Pagination.PagePromise; fetchWithTimeout(url: RequestInfo, init: RequestInit | undefined, ms: number, controller: AbortController): Promise; private shouldRetry; private retryRequest; private calculateDefaultRetryTimeoutMillis; buildRequest(inputOptions: FinalRequestOptions, { retryCount }?: { retryCount?: number; }): Promise<{ req: FinalizedRequestInit; url: string; timeout: number; }>; private buildHeaders; private _makeAbort; private buildBody; static Letta: typeof Letta; static DEFAULT_TIMEOUT: number; static LettaError: typeof Errors.LettaError; static APIError: typeof Errors.APIError; static APIConnectionError: typeof Errors.APIConnectionError; static APIConnectionTimeoutError: typeof Errors.APIConnectionTimeoutError; static APIUserAbortError: typeof Errors.APIUserAbortError; static NotFoundError: typeof Errors.NotFoundError; static ConflictError: typeof Errors.ConflictError; static RateLimitError: typeof Errors.RateLimitError; static BadRequestError: typeof Errors.BadRequestError; static AuthenticationError: typeof Errors.AuthenticationError; static InternalServerError: typeof Errors.InternalServerError; static PermissionDeniedError: typeof Errors.PermissionDeniedError; static UnprocessableEntityError: typeof Errors.UnprocessableEntityError; static toFile: typeof Uploads.toFile; agents: API.Agents; tools: API.Tools; blocks: API.Blocks; archives: API.Archives; folders: API.Folders; models: API.Models; mcpServers: API.McpServers; runs: API.Runs; steps: API.Steps; templates: API.Templates; tags: API.Tags; messages: API.Messages; passages: API.Passages; conversations: API.Conversations; environments: API.Environments; accessTokens: API.AccessTokens; } export declare namespace Letta { export type RequestOptions = Opts.RequestOptions; export import ArrayPage = Pagination.ArrayPage; export { type ArrayPageParams as ArrayPageParams, type ArrayPageResponse as ArrayPageResponse }; export import ObjectPage = Pagination.ObjectPage; export { type ObjectPageParams as ObjectPageParams, type ObjectPageResponse as ObjectPageResponse }; export import NextFilesPage = Pagination.NextFilesPage; export { type NextFilesPageParams as NextFilesPageParams, type NextFilesPageResponse as NextFilesPageResponse, }; export { type HealthResponse as HealthResponse }; export { Agents as Agents, type AgentEnvironmentVariable as AgentEnvironmentVariable, type AgentState as AgentState, type AgentType as AgentType, type AnthropicModelSettings as AnthropicModelSettings, type AzureModelSettings as AzureModelSettings, type BedrockModelSettings as BedrockModelSettings, type ChildToolRule as ChildToolRule, type ConditionalToolRule as ConditionalToolRule, type ContinueToolRule as ContinueToolRule, type DeepseekModelSettings as DeepseekModelSettings, type GoogleAIModelSettings as GoogleAIModelSettings, type GoogleVertexModelSettings as GoogleVertexModelSettings, type GroqModelSettings as GroqModelSettings, type InitToolRule as InitToolRule, type JsonObjectResponseFormat as JsonObjectResponseFormat, type JsonSchemaResponseFormat as JsonSchemaResponseFormat, type LettaMessageContentUnion as LettaMessageContentUnion, type MaxCountPerStepToolRule as MaxCountPerStepToolRule, type MessageCreate as MessageCreate, type OpenAIModelSettings as OpenAIModelSettings, type ParentToolRule as ParentToolRule, type RequiredBeforeExitToolRule as RequiredBeforeExitToolRule, type RequiresApprovalToolRule as RequiresApprovalToolRule, type TerminalToolRule as TerminalToolRule, type TextResponseFormat as TextResponseFormat, type TogetherModelSettings as TogetherModelSettings, type XaiModelSettings as XaiModelSettings, type AgentDeleteResponse as AgentDeleteResponse, type AgentExportFileResponse as AgentExportFileResponse, type AgentImportFileResponse as AgentImportFileResponse, type AgentRecompileResponse as AgentRecompileResponse, type AgentStatesArrayPage as AgentStatesArrayPage, type AgentCreateParams as AgentCreateParams, type AgentRetrieveParams as AgentRetrieveParams, type AgentUpdateParams as AgentUpdateParams, type AgentListParams as AgentListParams, type AgentExportFileParams as AgentExportFileParams, type AgentImportFileParams as AgentImportFileParams, type AgentRecompileParams as AgentRecompileParams, }; export { Tools as Tools, type NpmRequirement as NpmRequirement, type PipRequirement as PipRequirement, type Tool as Tool, type ToolCreate as ToolCreate, type ToolReturnMessage as ToolReturnMessage, type ToolSearchRequest as ToolSearchRequest, type ToolSearchResult as ToolSearchResult, type ToolType as ToolType, type ToolDeleteResponse as ToolDeleteResponse, type ToolSearchResponse as ToolSearchResponse, type ToolsArrayPage as ToolsArrayPage, type ToolCreateParams as ToolCreateParams, type ToolUpdateParams as ToolUpdateParams, type ToolListParams as ToolListParams, type ToolSearchParams as ToolSearchParams, type ToolUpsertParams as ToolUpsertParams, }; export { Blocks as Blocks, type BlockResponse as BlockResponse, type CreateBlock as CreateBlock, type BlockDeleteResponse as BlockDeleteResponse, type BlockResponsesArrayPage as BlockResponsesArrayPage, type BlockCreateParams as BlockCreateParams, type BlockUpdateParams as BlockUpdateParams, type BlockListParams as BlockListParams, }; export { Archives as Archives, type Archive as Archive, type VectorDBProvider as VectorDBProvider, type ArchivesArrayPage as ArchivesArrayPage, type ArchiveCreateParams as ArchiveCreateParams, type ArchiveUpdateParams as ArchiveUpdateParams, type ArchiveListParams as ArchiveListParams, }; export { Folders as Folders, type Folder as Folder, type FolderDeleteResponse as FolderDeleteResponse, type FoldersArrayPage as FoldersArrayPage, type FolderCreateParams as FolderCreateParams, type FolderUpdateParams as FolderUpdateParams, type FolderListParams as FolderListParams, }; export { Models as Models, type EmbeddingConfig as EmbeddingConfig, type EmbeddingModel as EmbeddingModel, type LlmConfig as LlmConfig, type Model as Model, type ProviderCategory as ProviderCategory, type ProviderType as ProviderType, type ModelListResponse as ModelListResponse, type ModelListParams as ModelListParams, }; export { McpServers as McpServers, type CreateSseMcpServer as CreateSseMcpServer, type CreateStdioMcpServer as CreateStdioMcpServer, type CreateStreamableHTTPMcpServer as CreateStreamableHTTPMcpServer, type SseMcpServer as SseMcpServer, type StdioMcpServer as StdioMcpServer, type StreamableHTTPMcpServer as StreamableHTTPMcpServer, type UpdateSseMcpServer as UpdateSseMcpServer, type UpdateStdioMcpServer as UpdateStdioMcpServer, type UpdateStreamableHTTPMcpServer as UpdateStreamableHTTPMcpServer, type McpServerCreateResponse as McpServerCreateResponse, type McpServerRetrieveResponse as McpServerRetrieveResponse, type McpServerUpdateResponse as McpServerUpdateResponse, type McpServerListResponse as McpServerListResponse, type McpServerRefreshResponse as McpServerRefreshResponse, type McpServerCreateParams as McpServerCreateParams, type McpServerUpdateParams as McpServerUpdateParams, type McpServerRefreshParams as McpServerRefreshParams, }; export { Runs as Runs, type Job as Job, type StopReasonType as StopReasonType, type RunListParams as RunListParams, }; export { Steps as Steps, type ProviderTrace as ProviderTrace, type Step as Step, type StepsArrayPage as StepsArrayPage, type StepListParams as StepListParams, }; export { Templates as Templates, type TemplateCreateResponse as TemplateCreateResponse, type TemplateUpdateResponse as TemplateUpdateResponse, type TemplateDeleteResponse as TemplateDeleteResponse, type TemplateRollbackResponse as TemplateRollbackResponse, type TemplateSaveResponse as TemplateSaveResponse, type TemplateCreateParams as TemplateCreateParams, type TemplateUpdateParams as TemplateUpdateParams, type TemplateDeleteParams as TemplateDeleteParams, type TemplateRollbackParams as TemplateRollbackParams, type TemplateSaveParams as TemplateSaveParams, }; export { Tags as Tags, type TagListResponse as TagListResponse, type TagListParams as TagListParams }; export { Messages as Messages, type MessageSearchRequest as MessageSearchRequest, type MessageSearchResult as MessageSearchResult, type MessageRetrieveResponse as MessageRetrieveResponse, type MessageListResponse as MessageListResponse, type MessageSearchResponse as MessageSearchResponse, type MessageListParams as MessageListParams, type MessageSearchParams as MessageSearchParams, }; export { Passages as Passages, type Passage as Passage, type PassageSearchResponse as PassageSearchResponse, type PassageSearchParams as PassageSearchParams, }; export { Conversations as Conversations, type Conversation as Conversation, type CreateConversation as CreateConversation, type UpdateConversation as UpdateConversation, type ConversationListResponse as ConversationListResponse, type ConversationDeleteResponse as ConversationDeleteResponse, type ConversationCancelResponse as ConversationCancelResponse, type ConversationRecompileResponse as ConversationRecompileResponse, type ConversationCreateParams as ConversationCreateParams, type ConversationUpdateParams as ConversationUpdateParams, type ConversationListParams as ConversationListParams, type ConversationCancelParams as ConversationCancelParams, type ConversationForkParams as ConversationForkParams, type ConversationRecompileParams as ConversationRecompileParams, }; export { Environments as Environments, type EnvironmentRetrieveResponse as EnvironmentRetrieveResponse, type EnvironmentListResponse as EnvironmentListResponse, type EnvironmentSendMessageResponse as EnvironmentSendMessageResponse, type EnvironmentListParams as EnvironmentListParams, type EnvironmentSendMessageParams as EnvironmentSendMessageParams, }; export { AccessTokens as AccessTokens, type AccessTokenCreateResponse as AccessTokenCreateResponse, type AccessTokenListResponse as AccessTokenListResponse, type AccessTokenDeleteResponse as AccessTokenDeleteResponse, type AccessTokenCreateParams as AccessTokenCreateParams, type AccessTokenListParams as AccessTokenListParams, type AccessTokenDeleteParams as AccessTokenDeleteParams, }; } //# sourceMappingURL=client.d.ts.map