Skip to content

Latest commit

 

History

History
5307 lines (3632 loc) · 51.7 KB

reference.md

File metadata and controls

5307 lines (3632 loc) · 51.7 KB

Reference

Tools

client.tools.get(toolId) -> Letta.LettaSchemasToolTool

📝 Description

Get a tool by ID

🔌 Usage

await client.tools.get("tool_id");

⚙️ Parameters

toolId: string

requestOptions: Tools.RequestOptions

client.tools.delete(toolId) -> unknown

📝 Description

Delete a tool by name

🔌 Usage

await client.tools.delete("tool_id");

⚙️ Parameters

toolId: string

requestOptions: Tools.RequestOptions

client.tools.update(toolId, { ...params }) -> Letta.LettaSchemasToolTool

📝 Description

Update an existing tool

🔌 Usage

await client.tools.update("tool_id");

⚙️ Parameters

toolId: string

request: Letta.ToolUpdate

requestOptions: Tools.RequestOptions

client.tools.getByName(toolName) -> string

📝 Description

Get a tool ID by name

🔌 Usage

await client.tools.getByName("tool_name");

⚙️ Parameters

toolName: string

requestOptions: Tools.RequestOptions

client.tools.list({ ...params }) -> Letta.LettaSchemasToolTool[]

📝 Description

Get a list of all tools available to agents belonging to the org of the user

🔌 Usage

await client.tools.list();

⚙️ Parameters

request: Letta.ToolsListRequest

requestOptions: Tools.RequestOptions

client.tools.create({ ...params }) -> Letta.LettaSchemasToolTool

📝 Description

Create a new tool

🔌 Usage

await client.tools.create({
    sourceCode: "source_code",
});

⚙️ Parameters

request: Letta.ToolCreate

requestOptions: Tools.RequestOptions

client.tools.upsert({ ...params }) -> Letta.LettaSchemasToolTool

📝 Description

Create or update a tool

🔌 Usage

await client.tools.upsert({
    sourceCode: "source_code",
});

⚙️ Parameters

request: Letta.ToolCreate

requestOptions: Tools.RequestOptions

client.tools.addBaseTool() -> Letta.LettaSchemasToolTool[]

📝 Description

Upsert base tools

🔌 Usage

await client.tools.addBaseTool();

⚙️ Parameters

requestOptions: Tools.RequestOptions

client.tools.runToolFromSource({ ...params }) -> Letta.ToolReturnMessage

📝 Description

Attempt to build a tool from source, then run it on the provided arguments

🔌 Usage

await client.tools.runToolFromSource({
    sourceCode: "source_code",
    args: {
        key: "value",
    },
});

⚙️ Parameters

request: Letta.ToolRunFromSource

requestOptions: Tools.RequestOptions

client.tools.listComposioApps() -> Letta.AppModel[]

📝 Description

Get a list of all Composio apps

🔌 Usage

await client.tools.listComposioApps();

⚙️ Parameters

requestOptions: Tools.RequestOptions

client.tools.listComposioActionsByApp(composioAppName) -> Letta.ActionModel[]

📝 Description

Get a list of all Composio actions for a specific app

🔌 Usage

await client.tools.listComposioActionsByApp("composio_app_name");

⚙️ Parameters

composioAppName: string

requestOptions: Tools.RequestOptions

client.tools.addComposioTool(composioActionName) -> Letta.LettaSchemasToolTool

📝 Description

Add a new Composio tool by action name (Composio refers to each tool as an Action)

🔌 Usage

await client.tools.addComposioTool("composio_action_name");

⚙️ Parameters

composioActionName: string

requestOptions: Tools.RequestOptions

Sources

client.sources.get(sourceId) -> Letta.Source

📝 Description

Get all sources

🔌 Usage

await client.sources.get("source_id");

⚙️ Parameters

sourceId: string

requestOptions: Sources.RequestOptions

client.sources.delete(sourceId) -> unknown

📝 Description

Delete a data source.

🔌 Usage

await client.sources.delete("source_id");

⚙️ Parameters

sourceId: string

requestOptions: Sources.RequestOptions

client.sources.update(sourceId, { ...params }) -> Letta.Source

📝 Description

Update the name or documentation of an existing data source.

🔌 Usage

await client.sources.update("source_id");

⚙️ Parameters

sourceId: string

request: Letta.SourceUpdate

requestOptions: Sources.RequestOptions

client.sources.getByName(sourceName) -> string

📝 Description

Get a source by name

🔌 Usage

await client.sources.getByName("source_name");

⚙️ Parameters

sourceName: string

requestOptions: Sources.RequestOptions

client.sources.list() -> Letta.Source[]

📝 Description

List all data sources created by a user.

🔌 Usage

await client.sources.list();

⚙️ Parameters

requestOptions: Sources.RequestOptions

client.sources.create({ ...params }) -> Letta.Source

📝 Description

Create a new data source.

🔌 Usage

await client.sources.create({
    name: "name",
});

⚙️ Parameters

request: Letta.SourceCreate

requestOptions: Sources.RequestOptions

client.sources.attach(sourceId, { ...params }) -> Letta.Source

📝 Description

Attach a data source to an existing agent.

🔌 Usage

await client.sources.attach("source_id", {
    agentId: "agent_id",
});

⚙️ Parameters

sourceId: string

request: Letta.SourcesAttachRequest

requestOptions: Sources.RequestOptions

client.sources.detach(sourceId, { ...params }) -> Letta.Source

📝 Description

Detach a data source from an existing agent.

🔌 Usage

await client.sources.detach("source_id", {
    agentId: "agent_id",
});

⚙️ Parameters

sourceId: string

request: Letta.SourcesDetachRequest

requestOptions: Sources.RequestOptions

Agents

client.agents.list({ ...params }) -> Letta.AgentState[]

📝 Description

List all agents associated with a given user. This endpoint retrieves a list of all agents and their configurations associated with the specified user ID.

🔌 Usage

await client.agents.list();

⚙️ Parameters

request: Letta.AgentsListRequest

requestOptions: Agents.RequestOptions

client.agents.create({ ...params }) -> Letta.AgentState

📝 Description

Create a new agent with the specified configuration.

🔌 Usage

await client.agents.create({
    memoryBlocks: [
        {
            value: "value",
            label: "label",
        },
    ],
});

⚙️ Parameters

request: Letta.CreateAgentRequest

requestOptions: Agents.RequestOptions

client.agents.get(agentId) -> Letta.AgentState

📝 Description

Get the state of the agent.

🔌 Usage

await client.agents.get("agent_id");

⚙️ Parameters

agentId: string

requestOptions: Agents.RequestOptions

client.agents.delete(agentId) -> unknown

📝 Description

Delete an agent.

🔌 Usage

await client.agents.delete("agent_id");

⚙️ Parameters

agentId: string

requestOptions: Agents.RequestOptions

client.agents.update(agentId, { ...params }) -> Letta.AgentState

📝 Description

Update an exsiting agent

🔌 Usage

await client.agents.update("agent_id");

⚙️ Parameters

agentId: string

request: Letta.UpdateAgent

requestOptions: Agents.RequestOptions

client.agents.resetMessages(agentId, { ...params }) -> Letta.AgentState

📝 Description

Resets the messages for an agent

🔌 Usage

await client.agents.resetMessages("agent_id");

⚙️ Parameters

agentId: string

request: Letta.ResetMessagesRequest

requestOptions: Agents.RequestOptions

client.agents.search({ ...params }) -> void

📝 Description

This endpoint is only available on Letta Cloud.

Search deployed agents.

🔌 Usage

await client.agents.search();

⚙️ Parameters

request: Letta.AgentsSearchRequest

requestOptions: Agents.RequestOptions

Models

client.models.listLlms() -> Letta.LlmConfig[]

🔌 Usage

await client.models.listLlms();

⚙️ Parameters

requestOptions: Models.RequestOptions

client.models.listEmbeddingModels() -> Letta.EmbeddingConfig[]

🔌 Usage

await client.models.listEmbeddingModels();

⚙️ Parameters

requestOptions: Models.RequestOptions

Blocks

client.blocks.list({ ...params }) -> Letta.Block[]

🔌 Usage

await client.blocks.list();

⚙️ Parameters

request: Letta.BlocksListRequest

requestOptions: Blocks.RequestOptions

client.blocks.create({ ...params }) -> Letta.Block

🔌 Usage

await client.blocks.create({
    value: "value",
    label: "label",
});

⚙️ Parameters

request: Letta.CreateBlock

requestOptions: Blocks.RequestOptions

client.blocks.get(blockId) -> Letta.Block

🔌 Usage

await client.blocks.get("block_id");

⚙️ Parameters

blockId: string

requestOptions: Blocks.RequestOptions

client.blocks.delete(blockId) -> Letta.Block

🔌 Usage

await client.blocks.delete("block_id");

⚙️ Parameters

blockId: string

requestOptions: Blocks.RequestOptions

client.blocks.update(blockId, { ...params }) -> Letta.Block

🔌 Usage

await client.blocks.update("block_id", {});

⚙️ Parameters

blockId: string

request: Letta.BlockUpdate

requestOptions: Blocks.RequestOptions

client.blocks.linkAgentMemoryBlock(blockId, { ...params }) -> void

📝 Description

Link a memory block to an agent.

🔌 Usage

await client.blocks.linkAgentMemoryBlock("block_id", {
    agentId: "agent_id",
});

⚙️ Parameters

blockId: string

request: Letta.LinkAgentMemoryBlockRequest

requestOptions: Blocks.RequestOptions

client.blocks.unlinkAgentMemoryBlock(blockId, { ...params }) -> void

📝 Description

Unlink a memory block from an agent

🔌 Usage

await client.blocks.unlinkAgentMemoryBlock("block_id", {
    agentId: "agent_id",
});

⚙️ Parameters

blockId: string

request: Letta.UnlinkAgentMemoryBlockRequest

requestOptions: Blocks.RequestOptions

Jobs

client.jobs.list({ ...params }) -> Letta.Job[]

📝 Description

List all jobs.

🔌 Usage

await client.jobs.list();

⚙️ Parameters

request: Letta.JobsListRequest

requestOptions: Jobs.RequestOptions

client.jobs.listActive() -> Letta.Job[]

📝 Description

List all active jobs.

🔌 Usage

await client.jobs.listActive();

⚙️ Parameters

requestOptions: Jobs.RequestOptions

client.jobs.get(jobId) -> Letta.Job

📝 Description

Get the status of a job.

🔌 Usage

await client.jobs.get("job_id");

⚙️ Parameters

jobId: string

requestOptions: Jobs.RequestOptions

client.jobs.delete(jobId) -> Letta.Job

📝 Description

Delete a job by its job_id.

🔌 Usage

await client.jobs.delete("job_id");

⚙️ Parameters

jobId: string

requestOptions: Jobs.RequestOptions

Health

client.health.check() -> Letta.Health

🔌 Usage

await client.health.check();

⚙️ Parameters

requestOptions: Health.RequestOptions

Providers

client.providers.listProviders({ ...params }) -> Letta.Provider[]

📝 Description

Get a list of all custom providers in the database

🔌 Usage

await client.providers.listProviders();

⚙️ Parameters

request: Letta.ListProvidersRequest

requestOptions: Providers.RequestOptions

client.providers.createProvider({ ...params }) -> Letta.Provider

📝 Description

Create a new custom provider

🔌 Usage

await client.providers.createProvider({
    name: "name",
    apiKey: "api_key",
});

⚙️ Parameters

request: Letta.ProviderCreate

requestOptions: Providers.RequestOptions

client.providers.updateProvider({ ...params }) -> Letta.Provider

📝 Description

Update an existing custom provider

🔌 Usage

await client.providers.updateProvider({
    id: "id",
    apiKey: "api_key",
});

⚙️ Parameters

request: Letta.ProviderUpdate

requestOptions: Providers.RequestOptions

client.providers.deleteProvider({ ...params }) -> unknown

📝 Description

Delete an existing custom provider

🔌 Usage

await client.providers.deleteProvider({
    providerId: "provider_id",
});

⚙️ Parameters

request: Letta.DeleteProviderRequest

requestOptions: Providers.RequestOptions

Runs

client.runs.listRuns() -> Letta.Run[]

📝 Description

List all runs.

🔌 Usage

await client.runs.listRuns();

⚙️ Parameters

requestOptions: Runs.RequestOptions

client.runs.listActiveRuns() -> Letta.Run[]

📝 Description

List all active runs.

🔌 Usage

await client.runs.listActiveRuns();

⚙️ Parameters

requestOptions: Runs.RequestOptions

client.runs.getRun(runId) -> Letta.Run

📝 Description

Get the status of a run.

🔌 Usage

await client.runs.getRun("run_id");

⚙️ Parameters

runId: string

requestOptions: Runs.RequestOptions

client.runs.deleteRun(runId) -> Letta.Run

📝 Description

Delete a run by its run_id.

🔌 Usage

await client.runs.deleteRun("run_id");

⚙️ Parameters

runId: string

requestOptions: Runs.RequestOptions

client.runs.getRunMessages(runId, { ...params }) -> Letta.LettaSchemasMessageMessage[]

📝 Description

Get messages associated with a run with filtering options.

Args: run_id: ID of the run cursor: Cursor for pagination start_date: Filter messages after this date end_date: Filter messages before this date limit: Maximum number of messages to return query_text: Search text in message content ascending: Sort order by creation time tags: Filter by message tags match_all_tags: If true, match all tags. If false, match any tag role: Filter by message role (user/assistant/system/tool) tool_name: Filter by tool call name user_id: ID of the user making the request

🔌 Usage

await client.runs.getRunMessages("run_id");

⚙️ Parameters

runId: string

request: Letta.GetRunMessagesRequest

requestOptions: Runs.RequestOptions

client.runs.getRunUsage(runId) -> Letta.UsageStatistics

📝 Description

Get usage statistics for a run.

🔌 Usage

await client.runs.getRunUsage("run_id");

⚙️ Parameters

runId: string

requestOptions: Runs.RequestOptions

Agents Context

client.agents.context.get(agentId) -> Letta.ContextWindowOverview

📝 Description

Retrieve the context window of a specific agent.

🔌 Usage

await client.agents.context.get("agent_id");

⚙️ Parameters

agentId: string

requestOptions: Context.RequestOptions

Agents Tools

client.agents.tools.list(agentId) -> Letta.LettaSchemasToolTool[]

📝 Description

Get tools from an existing agent

🔌 Usage

await client.agents.tools.list("agent_id");

⚙️ Parameters

agentId: string

requestOptions: Tools.RequestOptions

client.agents.tools.add(agentId, toolId) -> Letta.AgentState

📝 Description

Add tools to an existing agent

🔌 Usage

await client.agents.tools.add("agent_id", "tool_id");

⚙️ Parameters

agentId: string

toolId: string

requestOptions: Tools.RequestOptions

client.agents.tools.remove(agentId, toolId) -> Letta.AgentState

📝 Description

Add tools to an existing agent

🔌 Usage

await client.agents.tools.remove("agent_id", "tool_id");

⚙️ Parameters

agentId: string

toolId: string

requestOptions: Tools.RequestOptions

Agents Sources

client.agents.sources.get(agentId) -> Letta.Source[]

📝 Description

Get the sources associated with an agent.

🔌 Usage

await client.agents.sources.get("agent_id");

⚙️ Parameters

agentId: string

requestOptions: Sources.RequestOptions

Agents CoreMemory

client.agents.coreMemory.listInContext(agentId) -> Letta.LettaSchemasMessageMessage[]

📝 Description

Retrieve the messages in the context of a specific agent.

🔌 Usage

await client.agents.coreMemory.listInContext("agent_id");

⚙️ Parameters

agentId: string

requestOptions: CoreMemory.RequestOptions

client.agents.coreMemory.get(agentId) -> Letta.Memory

📝 Description

Retrieve the memory state of a specific agent. This endpoint fetches the current memory state of the agent identified by the user ID and agent ID.

🔌 Usage

await client.agents.coreMemory.get("agent_id");

⚙️ Parameters

agentId: string

requestOptions: CoreMemory.RequestOptions

client.agents.coreMemory.getBlock(agentId, blockLabel) -> Letta.Block

📝 Description

Retrieve a memory block from an agent.

🔌 Usage

await client.agents.coreMemory.getBlock("agent_id", "block_label");

⚙️ Parameters

agentId: string

blockLabel: string

requestOptions: CoreMemory.RequestOptions

client.agents.coreMemory.removeBlock(agentId, blockLabel) -> Letta.Memory

📝 Description

Removes a memory block from an agent by unlnking it. If the block is not linked to any other agent, it is deleted.

🔌 Usage

await client.agents.coreMemory.removeBlock("agent_id", "block_label");

⚙️ Parameters

agentId: string

blockLabel: string

requestOptions: CoreMemory.RequestOptions

client.agents.coreMemory.updateBlock(agentId, blockLabel, { ...params }) -> Letta.Block

📝 Description

Removes a memory block from an agent by unlnking it. If the block is not linked to any other agent, it is deleted.

🔌 Usage

await client.agents.coreMemory.updateBlock("agent_id", "block_label", {});

⚙️ Parameters

agentId: string

blockLabel: string

request: Letta.BlockUpdate

requestOptions: CoreMemory.RequestOptions

client.agents.coreMemory.getBlocks(agentId) -> Letta.Block[]

📝 Description

Retrieve the memory blocks of a specific agent.

🔌 Usage

await client.agents.coreMemory.getBlocks("agent_id");

⚙️ Parameters

agentId: string

requestOptions: CoreMemory.RequestOptions

client.agents.coreMemory.addBlock(agentId, { ...params }) -> Letta.Memory

📝 Description

Creates a memory block and links it to the agent.

🔌 Usage

await client.agents.coreMemory.addBlock("agent_id", {
    value: "value",
    label: "label",
});

⚙️ Parameters

agentId: string

request: Letta.CreateBlock

requestOptions: CoreMemory.RequestOptions

Agents RecallMemory

client.agents.recallMemory.getSummary(agentId) -> Letta.RecallMemorySummary

📝 Description

Retrieve the summary of the recall memory of a specific agent.

🔌 Usage

await client.agents.recallMemory.getSummary("agent_id");

⚙️ Parameters

agentId: string

requestOptions: RecallMemory.RequestOptions

Agents ArchivalMemory

client.agents.archivalMemory.getSummary(agentId) -> Letta.ArchivalMemorySummary

📝 Description

Retrieve the summary of the archival memory of a specific agent.

🔌 Usage

await client.agents.archivalMemory.getSummary("agent_id");

⚙️ Parameters

agentId: string

requestOptions: ArchivalMemory.RequestOptions

client.agents.archivalMemory.list(agentId, { ...params }) -> Letta.Passage[]

📝 Description

Retrieve the memories in an agent's archival memory store (paginated query).

🔌 Usage

await client.agents.archivalMemory.list("agent_id");

⚙️ Parameters

agentId: string

request: Letta.agents.ArchivalMemoryListRequest

requestOptions: ArchivalMemory.RequestOptions

client.agents.archivalMemory.create(agentId, { ...params }) -> Letta.Passage[]

📝 Description

Insert a memory into an agent's archival memory store.

🔌 Usage

await client.agents.archivalMemory.create("agent_id", {
    text: "text",
});

⚙️ Parameters

agentId: string

request: Letta.agents.CreateArchivalMemory

requestOptions: ArchivalMemory.RequestOptions

client.agents.archivalMemory.delete(agentId, memoryId) -> unknown

📝 Description

Delete a memory from an agent's archival memory store.

🔌 Usage

await client.agents.archivalMemory.delete("agent_id", "memory_id");

⚙️ Parameters

agentId: string

memoryId: string

requestOptions: ArchivalMemory.RequestOptions

Agents Messages

client.agents.messages.list(agentId, { ...params }) -> Letta.MessagesListResponse

📝 Description

Retrieve message history for an agent.

🔌 Usage

await client.agents.messages.list("agent_id");

⚙️ Parameters

agentId: string

request: Letta.agents.MessagesListRequest

requestOptions: Messages.RequestOptions

client.agents.messages.create(agentId, { ...params }) -> Letta.LettaResponse

📝 Description

Process a user message and return the agent's response. This endpoint accepts a message from a user and processes it through the agent.

🔌 Usage

await client.agents.messages.create("agent_id", {
    messages: [
        {
            role: "user",
            text: "text",
        },
    ],
});

⚙️ Parameters

agentId: string

request: Letta.LettaRequest

requestOptions: Messages.RequestOptions

client.agents.messages.update(agentId, messageId, { ...params }) -> Letta.LettaSchemasMessageMessage

📝 Description

Update the details of a message associated with an agent.

🔌 Usage

await client.agents.messages.update("agent_id", "message_id");

⚙️ Parameters

agentId: string

messageId: string

request: Letta.agents.MessageUpdate

requestOptions: Messages.RequestOptions

client.agents.messages.stream(agentId, { ...params }) -> core.Stream

📝 Description

Process a user message and return the agent's response. This endpoint accepts a message from a user and processes it through the agent. It will stream the steps of the response always, and stream the tokens if 'stream_tokens' is set to True.

🔌 Usage

const response = await client.agents.messages.stream("agent_id", {
    messages: [
        {
            role: "user",
            text: "text",
        },
    ],
});
for await (const item of response) {
    console.log(item);
}

⚙️ Parameters

agentId: string

request: Letta.agents.LettaStreamingRequest

requestOptions: Messages.RequestOptions

client.agents.messages.createAsync(agentId, { ...params }) -> Letta.Run

📝 Description

Asynchronously process a user message and return a job ID. The actual processing happens in the background, and the status can be checked using the job ID.

🔌 Usage

await client.agents.messages.createAsync("agent_id", {
    messages: [
        {
            role: "user",
            text: "text",
        },
    ],
});

⚙️ Parameters

agentId: string

request: Letta.LettaRequest

requestOptions: Messages.RequestOptions

Agents Templates

client.agents.templates.createVersion(agentId, { ...params }) -> void

📝 Description

This endpoint is only available on Letta Cloud.

Creates a new version of the template version of the agent.

🔌 Usage

await client.agents.templates.createVersion("agent_id");

⚙️ Parameters

agentId: string — The agent ID of the agent to migrate, if this agent is not a template, it will create a agent template from the agent provided as well

request: Letta.agents.TemplatesCreateVersionRequest

requestOptions: Templates.RequestOptions

client.agents.templates.migrate(agentId, { ...params }) -> Letta.TemplatesMigrateResponse

📝 Description

This endpoint is only available on Letta Cloud.

Migrate an agent to a new versioned agent template.

🔌 Usage

await client.agents.templates.migrate("agent_id", {
    toTemplate: "to_template",
    preserveCoreMemories: true,
});

⚙️ Parameters

agentId: string

request: Letta.agents.TemplatesMigrateRequest

requestOptions: Templates.RequestOptions

client.agents.templates.create(agentId, { ...params }) -> void

📝 Description

This endpoint is only available on Letta Cloud.

Creates a template from an agent.

🔌 Usage

await client.agents.templates.create("agent_id");

⚙️ Parameters

agentId: string

request: Letta.agents.TemplatesCreateRequest

requestOptions: Templates.RequestOptions

Agents MemoryVariables

client.agents.memoryVariables.get(agentId) -> Letta.MemoryVariablesGetResponse

📝 Description

This endpoint is only available on Letta Cloud.

Returns the memory variables associated with an agent.

🔌 Usage

await client.agents.memoryVariables.get("agent_id");

⚙️ Parameters

agentId: string

requestOptions: MemoryVariables.RequestOptions

Sources Files

client.sources.files.upload(file, sourceId) -> Letta.Job

📝 Description

Upload a file to a data source.

🔌 Usage

await client.sources.files.upload(fs.createReadStream("/path/to/your/file"), "source_id");

⚙️ Parameters

file: File | fs.ReadStream | Blob

sourceId: string

requestOptions: Files.RequestOptions

client.sources.files.list(sourceId, { ...params }) -> Letta.FileMetadata[]

📝 Description

List paginated files associated with a data source.

🔌 Usage

await client.sources.files.list("source_id");

⚙️ Parameters

sourceId: string

request: Letta.sources.FilesListRequest

requestOptions: Files.RequestOptions

client.sources.files.delete(sourceId, fileId) -> void

📝 Description

Delete a data source.

🔌 Usage

await client.sources.files.delete("source_id", "file_id");

⚙️ Parameters

sourceId: string

fileId: string

requestOptions: Files.RequestOptions

Sources Passages

client.sources.passages.list(sourceId) -> Letta.Passage[]

📝 Description

List all passages associated with a data source.

🔌 Usage

await client.sources.passages.list("source_id");

⚙️ Parameters

sourceId: string

requestOptions: Passages.RequestOptions