Skip to content

Latest commit

Β 

History

History
6887 lines (4739 loc) Β· 75.1 KB

reference.md

File metadata and controls

6887 lines (4739 loc) Β· 75.1 KB

Reference

Tools

client.tools.get(...)

πŸ“ Description

Get a tool by ID

πŸ”Œ Usage

from letta_client import Letta

client = Letta(
    token="YOUR_TOKEN",
)
client.tools.get(
    tool_id="tool_id",
)

βš™οΈ Parameters

tool_id: str

request_options: typing.Optional[RequestOptions] β€” Request-specific configuration.

client.tools.delete(...)

πŸ“ Description

Delete a tool by name

πŸ”Œ Usage

from letta_client import Letta

client = Letta(
    token="YOUR_TOKEN",
)
client.tools.delete(
    tool_id="tool_id",
)

βš™οΈ Parameters

tool_id: str

request_options: typing.Optional[RequestOptions] β€” Request-specific configuration.

client.tools.update(...)

πŸ“ Description

Update an existing tool

πŸ”Œ Usage

from letta_client import Letta

client = Letta(
    token="YOUR_TOKEN",
)
client.tools.update(
    tool_id="tool_id",
)

βš™οΈ Parameters

tool_id: str

description: typing.Optional[str] β€” The description of the tool.

name: typing.Optional[str] β€” The name of the function.

tags: typing.Optional[typing.Sequence[str]] β€” Metadata tags.

source_code: typing.Optional[str] β€” The source code of the function.

source_type: typing.Optional[str] β€” The type of the source code.

json_schema: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] β€” The JSON schema of the function (auto-generated from source_code if not provided)

return_char_limit: typing.Optional[int] β€” The maximum number of characters in the response.

request_options: typing.Optional[RequestOptions] β€” Request-specific configuration.

client.tools.get_by_name(...)

πŸ“ Description

Get a tool ID by name

πŸ”Œ Usage

from letta_client import Letta

client = Letta(
    token="YOUR_TOKEN",
)
client.tools.get_by_name(
    tool_name="tool_name",
)

βš™οΈ Parameters

tool_name: str

request_options: typing.Optional[RequestOptions] β€” Request-specific configuration.

client.tools.list(...)

πŸ“ Description

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

πŸ”Œ Usage

from letta_client import Letta

client = Letta(
    token="YOUR_TOKEN",
)
client.tools.list()

βš™οΈ Parameters

cursor: typing.Optional[str]

limit: typing.Optional[int]

request_options: typing.Optional[RequestOptions] β€” Request-specific configuration.

client.tools.create(...)

πŸ“ Description

Create a new tool

πŸ”Œ Usage

from letta_client import Letta

client = Letta(
    token="YOUR_TOKEN",
)
client.tools.create(
    source_code="source_code",
)

βš™οΈ Parameters

source_code: str β€” The source code of the function.

name: typing.Optional[str] β€” The name of the function (auto-generated from source_code if not provided).

description: typing.Optional[str] β€” The description of the tool.

tags: typing.Optional[typing.Sequence[str]] β€” Metadata tags.

source_type: typing.Optional[str] β€” The source type of the function.

json_schema: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] β€” The JSON schema of the function (auto-generated from source_code if not provided)

return_char_limit: typing.Optional[int] β€” The maximum number of characters in the response.

request_options: typing.Optional[RequestOptions] β€” Request-specific configuration.

client.tools.upsert(...)

πŸ“ Description

Create or update a tool

πŸ”Œ Usage

from letta_client import Letta

client = Letta(
    token="YOUR_TOKEN",
)
client.tools.upsert(
    source_code="source_code",
)

βš™οΈ Parameters

source_code: str β€” The source code of the function.

name: typing.Optional[str] β€” The name of the function (auto-generated from source_code if not provided).

description: typing.Optional[str] β€” The description of the tool.

tags: typing.Optional[typing.Sequence[str]] β€” Metadata tags.

source_type: typing.Optional[str] β€” The source type of the function.

json_schema: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] β€” The JSON schema of the function (auto-generated from source_code if not provided)

return_char_limit: typing.Optional[int] β€” The maximum number of characters in the response.

request_options: typing.Optional[RequestOptions] β€” Request-specific configuration.

client.tools.add_base_tool()

πŸ“ Description

Upsert base tools

πŸ”Œ Usage

from letta_client import Letta

client = Letta(
    token="YOUR_TOKEN",
)
client.tools.add_base_tool()

βš™οΈ Parameters

request_options: typing.Optional[RequestOptions] β€” Request-specific configuration.

client.tools.run_tool_from_source(...)

πŸ“ Description

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

πŸ”Œ Usage

from letta_client import Letta

client = Letta(
    token="YOUR_TOKEN",
)
client.tools.run_tool_from_source(
    source_code="source_code",
    args={"key": "value"},
)

βš™οΈ Parameters

source_code: str β€” The source code of the function.

args: typing.Dict[str, typing.Optional[typing.Any]] β€” The arguments to pass to the tool.

env_vars: typing.Optional[typing.Dict[str, str]] β€” The environment variables to pass to the tool.

name: typing.Optional[str] β€” The name of the tool to run.

source_type: typing.Optional[str] β€” The type of the source code.

request_options: typing.Optional[RequestOptions] β€” Request-specific configuration.

client.tools.list_composio_apps()

πŸ“ Description

Get a list of all Composio apps

πŸ”Œ Usage

from letta_client import Letta

client = Letta(
    token="YOUR_TOKEN",
)
client.tools.list_composio_apps()

βš™οΈ Parameters

request_options: typing.Optional[RequestOptions] β€” Request-specific configuration.

client.tools.list_composio_actions_by_app(...)

πŸ“ Description

Get a list of all Composio actions for a specific app

πŸ”Œ Usage

from letta_client import Letta

client = Letta(
    token="YOUR_TOKEN",
)
client.tools.list_composio_actions_by_app(
    composio_app_name="composio_app_name",
)

βš™οΈ Parameters

composio_app_name: str

request_options: typing.Optional[RequestOptions] β€” Request-specific configuration.

client.tools.add_composio_tool(...)

πŸ“ Description

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

πŸ”Œ Usage

from letta_client import Letta

client = Letta(
    token="YOUR_TOKEN",
)
client.tools.add_composio_tool(
    composio_action_name="composio_action_name",
)

βš™οΈ Parameters

composio_action_name: str

request_options: typing.Optional[RequestOptions] β€” Request-specific configuration.

Sources

client.sources.get(...)

πŸ“ Description

Get all sources

πŸ”Œ Usage

from letta_client import Letta

client = Letta(
    token="YOUR_TOKEN",
)
client.sources.get(
    source_id="source_id",
)

βš™οΈ Parameters

source_id: str

request_options: typing.Optional[RequestOptions] β€” Request-specific configuration.

client.sources.delete(...)

πŸ“ Description

Delete a data source.

πŸ”Œ Usage

from letta_client import Letta

client = Letta(
    token="YOUR_TOKEN",
)
client.sources.delete(
    source_id="source_id",
)

βš™οΈ Parameters

source_id: str

request_options: typing.Optional[RequestOptions] β€” Request-specific configuration.

client.sources.update(...)

πŸ“ Description

Update the name or documentation of an existing data source.

πŸ”Œ Usage

from letta_client import Letta

client = Letta(
    token="YOUR_TOKEN",
)
client.sources.update(
    source_id="source_id",
)

βš™οΈ Parameters

source_id: str

name: typing.Optional[str] β€” The name of the source.

description: typing.Optional[str] β€” The description of the source.

metadata: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] β€” Metadata associated with the source.

embedding_config: typing.Optional[EmbeddingConfig] β€” The embedding configuration used by the source.

request_options: typing.Optional[RequestOptions] β€” Request-specific configuration.

client.sources.get_by_name(...)

πŸ“ Description

Get a source by name

πŸ”Œ Usage

from letta_client import Letta

client = Letta(
    token="YOUR_TOKEN",
)
client.sources.get_by_name(
    source_name="source_name",
)

βš™οΈ Parameters

source_name: str

request_options: typing.Optional[RequestOptions] β€” Request-specific configuration.

client.sources.list()

πŸ“ Description

List all data sources created by a user.

πŸ”Œ Usage

from letta_client import Letta

client = Letta(
    token="YOUR_TOKEN",
)
client.sources.list()

βš™οΈ Parameters

request_options: typing.Optional[RequestOptions] β€” Request-specific configuration.

client.sources.create(...)

πŸ“ Description

Create a new data source.

πŸ”Œ Usage

from letta_client import Letta

client = Letta(
    token="YOUR_TOKEN",
)
client.sources.create(
    name="name",
)

βš™οΈ Parameters

name: str β€” The name of the source.

embedding_config: typing.Optional[EmbeddingConfig] β€” The embedding configuration used by the source.

description: typing.Optional[str] β€” The description of the source.

metadata: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] β€” Metadata associated with the source.

request_options: typing.Optional[RequestOptions] β€” Request-specific configuration.

client.sources.attach(...)

πŸ“ Description

Attach a data source to an existing agent.

πŸ”Œ Usage

from letta_client import Letta

client = Letta(
    token="YOUR_TOKEN",
)
client.sources.attach(
    source_id="source_id",
    agent_id="agent_id",
)

βš™οΈ Parameters

source_id: str

agent_id: str β€” The unique identifier of the agent to attach the source to.

request_options: typing.Optional[RequestOptions] β€” Request-specific configuration.

client.sources.detach(...)

πŸ“ Description

Detach a data source from an existing agent.

πŸ”Œ Usage

from letta_client import Letta

client = Letta(
    token="YOUR_TOKEN",
)
client.sources.detach(
    source_id="source_id",
    agent_id="agent_id",
)

βš™οΈ Parameters

source_id: str

agent_id: str β€” The unique identifier of the agent to detach the source from.

request_options: typing.Optional[RequestOptions] β€” Request-specific configuration.

Agents

client.agents.list(...)

πŸ“ 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

from letta_client import Letta

client = Letta(
    token="YOUR_TOKEN",
)
client.agents.list()

βš™οΈ Parameters

name: typing.Optional[str] β€” Name of the agent

tags: typing.Optional[typing.Union[str, typing.Sequence[str]]] β€” List of tags to filter agents by

match_all_tags: typing.Optional[bool] β€” If True, only returns agents that match ALL given tags. Otherwise, return agents that have ANY of the passed in tags.

cursor: typing.Optional[str] β€” Cursor for pagination

limit: typing.Optional[int] β€” Limit for pagination

query_text: typing.Optional[str] β€” Search agents by name

request_options: typing.Optional[RequestOptions] β€” Request-specific configuration.

client.agents.create(...)

πŸ“ Description

Create a new agent with the specified configuration.

πŸ”Œ Usage

from letta_client import Letta

client = Letta(
    token="YOUR_TOKEN",
)
client.agents.create()

βš™οΈ Parameters

name: typing.Optional[str] β€” The name of the agent.

memory_blocks: typing.Optional[typing.Sequence[CreateBlock]] β€” The blocks to create in the agent's in-context memory.

tools: typing.Optional[typing.Sequence[str]] β€” The tools used by the agent.

tool_ids: typing.Optional[typing.Sequence[str]] β€” The ids of the tools used by the agent.

source_ids: typing.Optional[typing.Sequence[str]] β€” The ids of the sources used by the agent.

block_ids: typing.Optional[typing.Sequence[str]] β€” The ids of the blocks used by the agent.

tool_rules: typing.Optional[typing.Sequence[CreateAgentRequestToolRulesItem]] β€” The tool rules governing the agent.

tags: typing.Optional[typing.Sequence[str]] β€” The tags associated with the agent.

system: typing.Optional[str] β€” The system prompt used by the agent.

agent_type: typing.Optional[AgentType] β€” The type of agent.

llm_config: typing.Optional[LlmConfig] β€” The LLM configuration used by the agent.

embedding_config: typing.Optional[EmbeddingConfig] β€” The embedding configuration used by the agent.

initial_message_sequence: typing.Optional[typing.Sequence[MessageCreate]] β€” The initial set of messages to put in the agent's in-context memory.

include_base_tools: typing.Optional[bool] β€” If true, attaches the Letta core tools (e.g. archival_memory and core_memory related functions).

include_multi_agent_tools: typing.Optional[bool] β€” If true, attaches the Letta multi-agent tools (e.g. sending a message to another agent).

description: typing.Optional[str] β€” The description of the agent.

metadata: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] β€” The metadata of the agent.

llm: typing.Optional[str] β€” The LLM configuration handle used by the agent, specified in the format provider/model-name, as an alternative to specifying llm_config.

embedding: typing.Optional[str] β€” The embedding configuration handle used by the agent, specified in the format provider/model-name.

context_window_limit: typing.Optional[int] β€” The context window limit used by the agent.

embedding_chunk_size: typing.Optional[int] β€” The embedding chunk size used by the agent.

from_template: typing.Optional[str] β€” The template id used to configure the agent

template: typing.Optional[bool] β€” Whether the agent is a template

project: typing.Optional[str] β€” The project slug that the agent will be associated with.

tool_exec_environment_variables: typing.Optional[typing.Dict[str, typing.Optional[str]]] β€” The environment variables for tool execution specific to this agent.

variables: typing.Optional[typing.Dict[str, typing.Optional[str]]] β€” The variables that should be set for the agent.

request_options: typing.Optional[RequestOptions] β€” Request-specific configuration.

client.agents.get(...)

πŸ“ Description

Get the state of the agent.

πŸ”Œ Usage

from letta_client import Letta

client = Letta(
    token="YOUR_TOKEN",
)
client.agents.get(
    agent_id="agent_id",
)

βš™οΈ Parameters

agent_id: str

request_options: typing.Optional[RequestOptions] β€” Request-specific configuration.

client.agents.delete(...)

πŸ“ Description

Delete an agent.

πŸ”Œ Usage

from letta_client import Letta

client = Letta(
    token="YOUR_TOKEN",
)
client.agents.delete(
    agent_id="agent_id",
)

βš™οΈ Parameters

agent_id: str

request_options: typing.Optional[RequestOptions] β€” Request-specific configuration.

client.agents.update(...)

πŸ“ Description

Update an exsiting agent

πŸ”Œ Usage

from letta_client import Letta

client = Letta(
    token="YOUR_TOKEN",
)
client.agents.update(
    agent_id="agent_id",
)

βš™οΈ Parameters

agent_id: str

name: typing.Optional[str] β€” The name of the agent.

tool_ids: typing.Optional[typing.Sequence[str]] β€” The ids of the tools used by the agent.

source_ids: typing.Optional[typing.Sequence[str]] β€” The ids of the sources used by the agent.

block_ids: typing.Optional[typing.Sequence[str]] β€” The ids of the blocks used by the agent.

tags: typing.Optional[typing.Sequence[str]] β€” The tags associated with the agent.

system: typing.Optional[str] β€” The system prompt used by the agent.

tool_rules: typing.Optional[typing.Sequence[UpdateAgentToolRulesItem]] β€” The tool rules governing the agent.

llm_config: typing.Optional[LlmConfig] β€” The LLM configuration used by the agent.

embedding_config: typing.Optional[EmbeddingConfig] β€” The embedding configuration used by the agent.

message_ids: typing.Optional[typing.Sequence[str]] β€” The ids of the messages in the agent's in-context memory.

description: typing.Optional[str] β€” The description of the agent.

metadata: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] β€” The metadata of the agent.

tool_exec_environment_variables: typing.Optional[typing.Dict[str, typing.Optional[str]]] β€” The environment variables for tool execution specific to this agent.

request_options: typing.Optional[RequestOptions] β€” Request-specific configuration.

client.agents.reset_messages(...)

πŸ“ Description

Resets the messages for an agent

πŸ”Œ Usage

from letta_client import Letta

client = Letta(
    token="YOUR_TOKEN",
)
client.agents.reset_messages(
    agent_id="agent_id",
)

βš™οΈ Parameters

agent_id: str

add_default_initial_messages: typing.Optional[bool] β€” If true, adds the default initial messages after resetting.

request_options: typing.Optional[RequestOptions] β€” Request-specific configuration.

client.agents.search(...)

πŸ“ Description

This endpoint is only available on Letta Cloud.

Search deployed agents.

πŸ”Œ Usage

from letta_client import Letta

client = Letta(
    token="YOUR_TOKEN",
)
client.agents.search()

βš™οΈ Parameters

search: typing.Optional[typing.Sequence[AgentsSearchRequestSearchItem]]

project_id: typing.Optional[str]

combinator: typing.Optional[AgentsSearchRequestCombinator]

limit: typing.Optional[float]

offset: typing.Optional[float]

request_options: typing.Optional[RequestOptions] β€” Request-specific configuration.

Models

client.models.list_llms()

πŸ”Œ Usage

from letta_client import Letta

client = Letta(
    token="YOUR_TOKEN",
)
client.models.list_llms()

βš™οΈ Parameters

request_options: typing.Optional[RequestOptions] β€” Request-specific configuration.

client.models.list_embedding_models()

πŸ”Œ Usage

from letta_client import Letta

client = Letta(
    token="YOUR_TOKEN",
)
client.models.list_embedding_models()

βš™οΈ Parameters

request_options: typing.Optional[RequestOptions] β€” Request-specific configuration.

Blocks

client.blocks.list(...)

πŸ”Œ Usage

from letta_client import Letta

client = Letta(
    token="YOUR_TOKEN",
)
client.blocks.list()

βš™οΈ Parameters

label: typing.Optional[str] β€” Labels to include (e.g. human, persona)

templates_only: typing.Optional[bool] β€” Whether to include only templates

name: typing.Optional[str] β€” Name of the block

request_options: typing.Optional[RequestOptions] β€” Request-specific configuration.

client.blocks.create(...)

πŸ”Œ Usage

from letta_client import Letta

client = Letta(
    token="YOUR_TOKEN",
)
client.blocks.create(
    value="value",
    label="label",
)

βš™οΈ Parameters

value: str β€” Value of the block.

label: str β€” Label of the block.

limit: typing.Optional[int] β€” Character limit of the block.

name: typing.Optional[str] β€” Name of the block if it is a template.

is_template: typing.Optional[bool]

description: typing.Optional[str] β€” Description of the block.

metadata: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] β€” Metadata of the block.

request_options: typing.Optional[RequestOptions] β€” Request-specific configuration.

client.blocks.get(...)

πŸ”Œ Usage

from letta_client import Letta

client = Letta(
    token="YOUR_TOKEN",
)
client.blocks.get(
    block_id="block_id",
)

βš™οΈ Parameters

block_id: str

request_options: typing.Optional[RequestOptions] β€” Request-specific configuration.

client.blocks.delete(...)

πŸ”Œ Usage

from letta_client import Letta

client = Letta(
    token="YOUR_TOKEN",
)
client.blocks.delete(
    block_id="block_id",
)

βš™οΈ Parameters

block_id: str

request_options: typing.Optional[RequestOptions] β€” Request-specific configuration.

client.blocks.update(...)

πŸ”Œ Usage

from letta_client import Letta

client = Letta(
    token="YOUR_TOKEN",
)
client.blocks.update(
    block_id="block_id",
)

βš™οΈ Parameters

block_id: str

value: typing.Optional[str] β€” Value of the block.

limit: typing.Optional[int] β€” Character limit of the block.

name: typing.Optional[str] β€” Name of the block if it is a template.

is_template: typing.Optional[bool] β€” Whether the block is a template (e.g. saved human/persona options).

label: typing.Optional[str] β€” Label of the block (e.g. 'human', 'persona') in the context window.

description: typing.Optional[str] β€” Description of the block.

metadata: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] β€” Metadata of the block.

request_options: typing.Optional[RequestOptions] β€” Request-specific configuration.

client.blocks.link_agent_memory_block(...)

πŸ“ Description

Link a memory block to an agent.

πŸ”Œ Usage

from letta_client import Letta

client = Letta(
    token="YOUR_TOKEN",
)
client.blocks.link_agent_memory_block(
    block_id="block_id",
    agent_id="agent_id",
)

βš™οΈ Parameters

block_id: str

agent_id: str β€” The unique identifier of the agent to attach the source to.

request_options: typing.Optional[RequestOptions] β€” Request-specific configuration.

client.blocks.unlink_agent_memory_block(...)

πŸ“ Description

Unlink a memory block from an agent

πŸ”Œ Usage

from letta_client import Letta

client = Letta(
    token="YOUR_TOKEN",
)
client.blocks.unlink_agent_memory_block(
    block_id="block_id",
    agent_id="agent_id",
)

βš™οΈ Parameters

block_id: str

agent_id: str β€” The unique identifier of the agent to attach the source to.

request_options: typing.Optional[RequestOptions] β€” Request-specific configuration.

Jobs

client.jobs.list(...)

πŸ“ Description

List all jobs.

πŸ”Œ Usage

from letta_client import Letta

client = Letta(
    token="YOUR_TOKEN",
)
client.jobs.list()

βš™οΈ Parameters

source_id: typing.Optional[str] β€” Only list jobs associated with the source.

request_options: typing.Optional[RequestOptions] β€” Request-specific configuration.

client.jobs.list_active()

πŸ“ Description

List all active jobs.

πŸ”Œ Usage

from letta_client import Letta

client = Letta(
    token="YOUR_TOKEN",
)
client.jobs.list_active()

βš™οΈ Parameters

request_options: typing.Optional[RequestOptions] β€” Request-specific configuration.

client.jobs.get(...)

πŸ“ Description

Get the status of a job.

πŸ”Œ Usage

from letta_client import Letta

client = Letta(
    token="YOUR_TOKEN",
)
client.jobs.get(
    job_id="job_id",
)

βš™οΈ Parameters

job_id: str

request_options: typing.Optional[RequestOptions] β€” Request-specific configuration.

client.jobs.delete(...)

πŸ“ Description

Delete a job by its job_id.

πŸ”Œ Usage

from letta_client import Letta

client = Letta(
    token="YOUR_TOKEN",
)
client.jobs.delete(
    job_id="job_id",
)

βš™οΈ Parameters

job_id: str

request_options: typing.Optional[RequestOptions] β€” Request-specific configuration.

Health

client.health.check()

πŸ”Œ Usage

from letta_client import Letta

client = Letta(
    token="YOUR_TOKEN",
)
client.health.check()

βš™οΈ Parameters

request_options: typing.Optional[RequestOptions] β€” Request-specific configuration.

Providers

client.providers.list_providers(...)

πŸ“ Description

Get a list of all custom providers in the database

πŸ”Œ Usage

from letta_client import Letta

client = Letta(
    token="YOUR_TOKEN",
)
client.providers.list_providers()

βš™οΈ Parameters

cursor: typing.Optional[str]

limit: typing.Optional[int]

request_options: typing.Optional[RequestOptions] β€” Request-specific configuration.

client.providers.create_provider(...)

πŸ“ Description

Create a new custom provider

πŸ”Œ Usage

from letta_client import Letta

client = Letta(
    token="YOUR_TOKEN",
)
client.providers.create_provider(
    name="name",
    api_key="api_key",
)

βš™οΈ Parameters

name: str β€” The name of the provider.

api_key: str β€” API key used for requests to the provider.

request_options: typing.Optional[RequestOptions] β€” Request-specific configuration.

client.providers.update_provider(...)

πŸ“ Description

Update an existing custom provider

πŸ”Œ Usage

from letta_client import Letta

client = Letta(
    token="YOUR_TOKEN",
)
client.providers.update_provider(
    id="id",
    api_key="api_key",
)

βš™οΈ Parameters

id: str β€” The id of the provider to update.

api_key: str β€” API key used for requests to the provider.

request_options: typing.Optional[RequestOptions] β€” Request-specific configuration.

client.providers.delete_provider(...)

πŸ“ Description

Delete an existing custom provider

πŸ”Œ Usage

from letta_client import Letta

client = Letta(
    token="YOUR_TOKEN",
)
client.providers.delete_provider(
    provider_id="provider_id",
)

βš™οΈ Parameters

provider_id: str β€” The provider_id key to be deleted.

request_options: typing.Optional[RequestOptions] β€” Request-specific configuration.

Runs

client.runs.list_runs()

πŸ“ Description

List all runs.

πŸ”Œ Usage

from letta_client import Letta

client = Letta(
    token="YOUR_TOKEN",
)
client.runs.list_runs()

βš™οΈ Parameters

request_options: typing.Optional[RequestOptions] β€” Request-specific configuration.

client.runs.list_active_runs()

πŸ“ Description

List all active runs.

πŸ”Œ Usage

from letta_client import Letta

client = Letta(
    token="YOUR_TOKEN",
)
client.runs.list_active_runs()

βš™οΈ Parameters

request_options: typing.Optional[RequestOptions] β€” Request-specific configuration.

client.runs.get_run(...)

πŸ“ Description

Get the status of a run.

πŸ”Œ Usage

from letta_client import Letta

client = Letta(
    token="YOUR_TOKEN",
)
client.runs.get_run(
    run_id="run_id",
)

βš™οΈ Parameters

run_id: str

request_options: typing.Optional[RequestOptions] β€” Request-specific configuration.

client.runs.delete_run(...)

πŸ“ Description

Delete a run by its run_id.

πŸ”Œ Usage

from letta_client import Letta

client = Letta(
    token="YOUR_TOKEN",
)
client.runs.delete_run(
    run_id="run_id",
)

βš™οΈ Parameters

run_id: str

request_options: typing.Optional[RequestOptions] β€” Request-specific configuration.

client.runs.get_run_messages(...)

πŸ“ Description

Get messages associated with a run with filtering options.

Args: run_id: ID of the run cursor: Cursor for pagination limit: Maximum number of messages to return ascending: Sort order by creation time role: Filter by role (user/assistant/system/tool) return_message_object: Whether to return Message objects or LettaMessage objects user_id: ID of the user making the request

Returns: A list of messages associated with the run. Default is List[LettaMessage].

πŸ”Œ Usage

from letta_client import Letta

client = Letta(
    token="YOUR_TOKEN",
)
client.runs.get_run_messages(
    run_id="run_id",
)

βš™οΈ Parameters

run_id: str

cursor: typing.Optional[str] β€” Cursor for pagination

limit: typing.Optional[int] β€” Maximum number of messages to return

ascending: typing.Optional[bool] β€” Sort order by creation time

role: typing.Optional[MessageRole] β€” Filter by role

request_options: typing.Optional[RequestOptions] β€” Request-specific configuration.

client.runs.get_run_usage(...)

πŸ“ Description

Get usage statistics for a run.

πŸ”Œ Usage

from letta_client import Letta

client = Letta(
    token="YOUR_TOKEN",
)
client.runs.get_run_usage(
    run_id="run_id",
)

βš™οΈ Parameters

run_id: str

request_options: typing.Optional[RequestOptions] β€” Request-specific configuration.

Tag

client.tag.list_tags(...)

πŸ“ Description

Get a list of all tags in the database

πŸ”Œ Usage

from letta_client import Letta

client = Letta(
    token="YOUR_TOKEN",
)
client.tag.list_tags()

βš™οΈ Parameters

cursor: typing.Optional[str]

limit: typing.Optional[int]

query_text: typing.Optional[str]

request_options: typing.Optional[RequestOptions] β€” Request-specific configuration.

Agents Context

client.agents.context.get(...)

πŸ“ Description

Retrieve the context window of a specific agent.

πŸ”Œ Usage

from letta_client import Letta

client = Letta(
    token="YOUR_TOKEN",
)
client.agents.context.get(
    agent_id="agent_id",
)

βš™οΈ Parameters

agent_id: str

request_options: typing.Optional[RequestOptions] β€” Request-specific configuration.

Agents Tools

client.agents.tools.list(...)

πŸ“ Description

Get tools from an existing agent

πŸ”Œ Usage

from letta_client import Letta

client = Letta(
    token="YOUR_TOKEN",
)
client.agents.tools.list(
    agent_id="agent_id",
)

βš™οΈ Parameters

agent_id: str

request_options: typing.Optional[RequestOptions] β€” Request-specific configuration.

client.agents.tools.add(...)

πŸ“ Description

Add tools to an existing agent

πŸ”Œ Usage

from letta_client import Letta

client = Letta(
    token="YOUR_TOKEN",
)
client.agents.tools.add(
    agent_id="agent_id",
    tool_id="tool_id",
)

βš™οΈ Parameters

agent_id: str

tool_id: str

request_options: typing.Optional[RequestOptions] β€” Request-specific configuration.

client.agents.tools.remove(...)

πŸ“ Description

Add tools to an existing agent

πŸ”Œ Usage

from letta_client import Letta

client = Letta(
    token="YOUR_TOKEN",
)
client.agents.tools.remove(
    agent_id="agent_id",
    tool_id="tool_id",
)

βš™οΈ Parameters

agent_id: str

tool_id: str

request_options: typing.Optional[RequestOptions] β€” Request-specific configuration.

Agents Sources

client.agents.sources.get(...)

πŸ“ Description

Get the sources associated with an agent.

πŸ”Œ Usage

from letta_client import Letta

client = Letta(
    token="YOUR_TOKEN",
)
client.agents.sources.get(
    agent_id="agent_id",
)

βš™οΈ Parameters

agent_id: str

request_options: typing.Optional[RequestOptions] β€” Request-specific configuration.

Agents CoreMemory

client.agents.core_memory.list_in_context(...)

πŸ“ Description

Retrieve the messages in the context of a specific agent.

πŸ”Œ Usage

from letta_client import Letta

client = Letta(
    token="YOUR_TOKEN",
)
client.agents.core_memory.list_in_context(
    agent_id="agent_id",
)

βš™οΈ Parameters

agent_id: str

request_options: typing.Optional[RequestOptions] β€” Request-specific configuration.

client.agents.core_memory.get(...)

πŸ“ 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

from letta_client import Letta

client = Letta(
    token="YOUR_TOKEN",
)
client.agents.core_memory.get(
    agent_id="agent_id",
)

βš™οΈ Parameters

agent_id: str

request_options: typing.Optional[RequestOptions] β€” Request-specific configuration.

client.agents.core_memory.get_block(...)

πŸ“ Description

Retrieve a memory block from an agent.

πŸ”Œ Usage

from letta_client import Letta

client = Letta(
    token="YOUR_TOKEN",
)
client.agents.core_memory.get_block(
    agent_id="agent_id",
    block_label="block_label",
)

βš™οΈ Parameters

agent_id: str

block_label: str

request_options: typing.Optional[RequestOptions] β€” Request-specific configuration.

client.agents.core_memory.remove_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

from letta_client import Letta

client = Letta(
    token="YOUR_TOKEN",
)
client.agents.core_memory.remove_block(
    agent_id="agent_id",
    block_label="block_label",
)

βš™οΈ Parameters

agent_id: str

block_label: str

request_options: typing.Optional[RequestOptions] β€” Request-specific configuration.

client.agents.core_memory.update_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

from letta_client import Letta

client = Letta(
    token="YOUR_TOKEN",
)
client.agents.core_memory.update_block(
    agent_id="agent_id",
    block_label="block_label",
)

βš™οΈ Parameters

agent_id: str

block_label: str

value: typing.Optional[str] β€” Value of the block.

limit: typing.Optional[int] β€” Character limit of the block.

name: typing.Optional[str] β€” Name of the block if it is a template.

is_template: typing.Optional[bool] β€” Whether the block is a template (e.g. saved human/persona options).

label: typing.Optional[str] β€” Label of the block (e.g. 'human', 'persona') in the context window.

description: typing.Optional[str] β€” Description of the block.

metadata: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] β€” Metadata of the block.

request_options: typing.Optional[RequestOptions] β€” Request-specific configuration.

client.agents.core_memory.get_blocks(...)

πŸ“ Description

Retrieve the memory blocks of a specific agent.

πŸ”Œ Usage

from letta_client import Letta

client = Letta(
    token="YOUR_TOKEN",
)
client.agents.core_memory.get_blocks(
    agent_id="agent_id",
)

βš™οΈ Parameters

agent_id: str

request_options: typing.Optional[RequestOptions] β€” Request-specific configuration.

client.agents.core_memory.add_block(...)

πŸ“ Description

Creates a memory block and links it to the agent.

πŸ”Œ Usage

from letta_client import Letta

client = Letta(
    token="YOUR_TOKEN",
)
client.agents.core_memory.add_block(
    agent_id="agent_id",
    value="value",
    label="label",
)

βš™οΈ Parameters

agent_id: str

value: str β€” Value of the block.

label: str β€” Label of the block.

limit: typing.Optional[int] β€” Character limit of the block.

name: typing.Optional[str] β€” Name of the block if it is a template.

is_template: typing.Optional[bool]

description: typing.Optional[str] β€” Description of the block.

metadata: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] β€” Metadata of the block.

request_options: typing.Optional[RequestOptions] β€” Request-specific configuration.

Agents RecallMemory

client.agents.recall_memory.get_summary(...)

πŸ“ Description

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

πŸ”Œ Usage

from letta_client import Letta

client = Letta(
    token="YOUR_TOKEN",
)
client.agents.recall_memory.get_summary(
    agent_id="agent_id",
)

βš™οΈ Parameters

agent_id: str

request_options: typing.Optional[RequestOptions] β€” Request-specific configuration.

Agents ArchivalMemory

client.agents.archival_memory.get_summary(...)

πŸ“ Description

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

πŸ”Œ Usage

from letta_client import Letta

client = Letta(
    token="YOUR_TOKEN",
)
client.agents.archival_memory.get_summary(
    agent_id="agent_id",
)

βš™οΈ Parameters

agent_id: str

request_options: typing.Optional[RequestOptions] β€” Request-specific configuration.

client.agents.archival_memory.list(...)

πŸ“ Description

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

πŸ”Œ Usage

from letta_client import Letta

client = Letta(
    token="YOUR_TOKEN",
)
client.agents.archival_memory.list(
    agent_id="agent_id",
)

βš™οΈ Parameters

agent_id: str

after: typing.Optional[int] β€” Unique ID of the memory to start the query range at.

before: typing.Optional[int] β€” Unique ID of the memory to end the query range at.

limit: typing.Optional[int] β€” How many results to include in the response.

request_options: typing.Optional[RequestOptions] β€” Request-specific configuration.

client.agents.archival_memory.create(...)

πŸ“ Description

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

πŸ”Œ Usage

from letta_client import Letta

client = Letta(
    token="YOUR_TOKEN",
)
client.agents.archival_memory.create(
    agent_id="agent_id",
    text="text",
)

βš™οΈ Parameters

agent_id: str

text: str β€” Text to write to archival memory.

request_options: typing.Optional[RequestOptions] β€” Request-specific configuration.

client.agents.archival_memory.delete(...)

πŸ“ Description

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

πŸ”Œ Usage

from letta_client import Letta

client = Letta(
    token="YOUR_TOKEN",
)
client.agents.archival_memory.delete(
    agent_id="agent_id",
    memory_id="memory_id",
)

βš™οΈ Parameters

agent_id: str

memory_id: str

request_options: typing.Optional[RequestOptions] β€” Request-specific configuration.

Agents Messages

client.agents.messages.list(...)

πŸ“ Description

Retrieve message history for an agent.

πŸ”Œ Usage

from letta_client import Letta

client = Letta(
    token="YOUR_TOKEN",
)
client.agents.messages.list(
    agent_id="agent_id",
)

βš™οΈ Parameters

agent_id: str

before: typing.Optional[str] β€” Message before which to retrieve the returned messages.

limit: typing.Optional[int] β€” Maximum number of messages to retrieve.

msg_object: typing.Optional[bool] β€” If true, returns Message objects. If false, return LettaMessage objects.

assistant_message_tool_name: typing.Optional[str] β€” The name of the designated message tool.

assistant_message_tool_kwarg: typing.Optional[str] β€” The name of the message argument in the designated message tool.

request_options: typing.Optional[RequestOptions] β€” Request-specific configuration.

client.agents.messages.send(...)

πŸ“ 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

from letta_client import Letta, MessageCreate

client = Letta(
    token="YOUR_TOKEN",
)
client.agents.messages.send(
    agent_id="agent_id",
    messages=[
        MessageCreate(
            role="user",
            text="text",
        )
    ],
)

βš™οΈ Parameters

agent_id: str

messages: typing.Sequence[MessageCreate] β€” The messages to be sent to the agent.

config: typing.Optional[LettaRequestConfig] β€” Configuration options for the LettaRequest.

request_options: typing.Optional[RequestOptions] β€” Request-specific configuration.

client.agents.messages.update(...)

πŸ“ Description

Update the details of a message associated with an agent.

πŸ”Œ Usage

from letta_client import Letta

client = Letta(
    token="YOUR_TOKEN",
)
client.agents.messages.update(
    agent_id="agent_id",
    message_id="message_id",
)

βš™οΈ Parameters

agent_id: str

message_id: str

role: typing.Optional[MessageRole] β€” The role of the participant.

text: typing.Optional[str] β€” The text of the message.

name: typing.Optional[str] β€” The name of the participant.

tool_calls: typing.Optional[typing.Sequence[LettaSchemasOpenaiChatCompletionsToolCallInput]] β€” The list of tool calls requested.

tool_call_id: typing.Optional[str] β€” The id of the tool call.

request_options: typing.Optional[RequestOptions] β€” Request-specific configuration.

client.agents.messages.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

from letta_client import Letta, MessageCreate

client = Letta(
    token="YOUR_TOKEN",
)
response = client.agents.messages.stream(
    agent_id="agent_id",
    messages=[
        MessageCreate(
            role="user",
            text="text",
        )
    ],
)
for chunk in response:
    yield chunk

βš™οΈ Parameters

agent_id: str

messages: typing.Sequence[MessageCreate] β€” The messages to be sent to the agent.

config: typing.Optional[LettaRequestConfig] β€” Configuration options for the LettaRequest.

stream_tokens: typing.Optional[bool] β€” Flag to determine if individual tokens should be streamed. Set to True for token streaming (requires stream_steps = True).

request_options: typing.Optional[RequestOptions] β€” Request-specific configuration.

client.agents.messages.send_async(...)

πŸ“ Description

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

πŸ”Œ Usage

from letta_client import Letta, MessageCreate

client = Letta(
    token="YOUR_TOKEN",
)
client.agents.messages.send_async(
    agent_id="agent_id",
    messages=[
        MessageCreate(
            role="user",
            text="text",
        )
    ],
)

βš™οΈ Parameters

agent_id: str

messages: typing.Sequence[MessageCreate] β€” The messages to be sent to the agent.

config: typing.Optional[LettaRequestConfig] β€” Configuration options for the LettaRequest.

request_options: typing.Optional[RequestOptions] β€” Request-specific configuration.

Agents Templates

client.agents.templates.create_version(...)

πŸ“ Description

This endpoint is only available on Letta Cloud.

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

πŸ”Œ Usage

from letta_client import Letta

client = Letta(
    token="YOUR_TOKEN",
)
client.agents.templates.create_version(
    agent_id="agent_id",
)

βš™οΈ Parameters

agent_id: str β€” 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

return_agent_state: typing.Optional[bool]

migrate_deployed_agents: typing.Optional[bool]

request_options: typing.Optional[RequestOptions] β€” Request-specific configuration.

client.agents.templates.migrate(...)

πŸ“ Description

This endpoint is only available on Letta Cloud.

Migrate an agent to a new versioned agent template.

πŸ”Œ Usage

from letta_client import Letta

client = Letta(
    token="YOUR_TOKEN",
)
client.agents.templates.migrate(
    agent_id="agent_id",
    to_template="to_template",
    preserve_core_memories=True,
)

βš™οΈ Parameters

agent_id: str

to_template: str

preserve_core_memories: bool

variables: typing.Optional[typing.Dict[str, str]] β€” If you chose to not preserve core memories, you should provide the new variables for the core memories

request_options: typing.Optional[RequestOptions] β€” Request-specific configuration.

client.agents.templates.create(...)

πŸ“ Description

This endpoint is only available on Letta Cloud.

Creates a template from an agent.

πŸ”Œ Usage

from letta_client import Letta

client = Letta(
    token="YOUR_TOKEN",
)
client.agents.templates.create(
    agent_id="agent_id",
)

βš™οΈ Parameters

agent_id: str

project: typing.Optional[str]

request_options: typing.Optional[RequestOptions] β€” Request-specific configuration.

Agents MemoryVariables

client.agents.memory_variables.get(...)

πŸ“ Description

This endpoint is only available on Letta Cloud.

Returns the memory variables associated with an agent.

πŸ”Œ Usage

from letta_client import Letta

client = Letta(
    token="YOUR_TOKEN",
)
client.agents.memory_variables.get(
    agent_id="agent_id",
)

βš™οΈ Parameters

agent_id: str

request_options: typing.Optional[RequestOptions] β€” Request-specific configuration.

Sources Files

client.sources.files.upload(...)

πŸ“ Description

Upload a file to a data source.

πŸ”Œ Usage

from letta_client import Letta

client = Letta(
    token="YOUR_TOKEN",
)
client.sources.files.upload(
    source_id="source_id",
)

βš™οΈ Parameters

source_id: str

file: `from future import annotations

core.File` β€” See core.File for more documentation

request_options: typing.Optional[RequestOptions] β€” Request-specific configuration.

client.sources.files.list(...)

πŸ“ Description

List paginated files associated with a data source.

πŸ”Œ Usage

from letta_client import Letta

client = Letta(
    token="YOUR_TOKEN",
)
client.sources.files.list(
    source_id="source_id",
)

βš™οΈ Parameters

source_id: str

limit: typing.Optional[int] β€” Number of files to return

cursor: typing.Optional[str] β€” Pagination cursor to fetch the next set of results

request_options: typing.Optional[RequestOptions] β€” Request-specific configuration.

client.sources.files.delete(...)

πŸ“ Description

Delete a data source.

πŸ”Œ Usage

from letta_client import Letta

client = Letta(
    token="YOUR_TOKEN",
)
client.sources.files.delete(
    source_id="source_id",
    file_id="file_id",
)

βš™οΈ Parameters

source_id: str

file_id: str

request_options: typing.Optional[RequestOptions] β€” Request-specific configuration.

Sources Passages

client.sources.passages.list(...)

πŸ“ Description

List all passages associated with a data source.

πŸ”Œ Usage

from letta_client import Letta

client = Letta(
    token="YOUR_TOKEN",
)
client.sources.passages.list(
    source_id="source_id",
)

βš™οΈ Parameters

source_id: str

request_options: typing.Optional[RequestOptions] β€” Request-specific configuration.