client.tools.get(...)
-
-
-
Get a tool by ID
-
-
-
from letta_client import Letta client = Letta( token="YOUR_TOKEN", ) client.tools.get( tool_id="tool_id", )
-
-
-
tool_id:
str
-
request_options:
typing.Optional[RequestOptions]
β Request-specific configuration.
-
-
client.tools.delete(...)
-
-
-
Delete a tool by name
-
-
-
from letta_client import Letta client = Letta( token="YOUR_TOKEN", ) client.tools.delete( tool_id="tool_id", )
-
-
-
tool_id:
str
-
request_options:
typing.Optional[RequestOptions]
β Request-specific configuration.
-
-
client.tools.update(...)
-
-
-
Update an existing tool
-
-
-
from letta_client import Letta client = Letta( token="YOUR_TOKEN", ) client.tools.update( tool_id="tool_id", )
-
-
-
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(...)
-
-
-
Get a tool ID by name
-
-
-
from letta_client import Letta client = Letta( token="YOUR_TOKEN", ) client.tools.get_by_name( tool_name="tool_name", )
-
-
-
tool_name:
str
-
request_options:
typing.Optional[RequestOptions]
β Request-specific configuration.
-
-
client.tools.list(...)
-
-
-
Get a list of all tools available to agents belonging to the org of the user
-
-
-
from letta_client import Letta client = Letta( token="YOUR_TOKEN", ) client.tools.list()
-
-
-
cursor:
typing.Optional[str]
-
limit:
typing.Optional[int]
-
request_options:
typing.Optional[RequestOptions]
β Request-specific configuration.
-
-
client.tools.create(...)
-
-
-
Create a new tool
-
-
-
from letta_client import Letta client = Letta( token="YOUR_TOKEN", ) client.tools.create( source_code="source_code", )
-
-
-
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(...)
-
-
-
Create or update a tool
-
-
-
from letta_client import Letta client = Letta( token="YOUR_TOKEN", ) client.tools.upsert( source_code="source_code", )
-
-
-
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()
-
-
-
Upsert base tools
-
-
-
from letta_client import Letta client = Letta( token="YOUR_TOKEN", ) client.tools.add_base_tool()
-
-
-
request_options:
typing.Optional[RequestOptions]
β Request-specific configuration.
-
-
client.tools.run_tool_from_source(...)
-
-
-
Attempt to build a tool from source, then run it on the provided arguments
-
-
-
from letta_client import Letta client = Letta( token="YOUR_TOKEN", ) client.tools.run_tool_from_source( source_code="source_code", args={"key": "value"}, )
-
-
-
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()
-
-
-
Get a list of all Composio apps
-
-
-
from letta_client import Letta client = Letta( token="YOUR_TOKEN", ) client.tools.list_composio_apps()
-
-
-
request_options:
typing.Optional[RequestOptions]
β Request-specific configuration.
-
-
client.tools.list_composio_actions_by_app(...)
-
-
-
Get a list of all Composio actions for a specific app
-
-
-
from letta_client import Letta client = Letta( token="YOUR_TOKEN", ) client.tools.list_composio_actions_by_app( composio_app_name="composio_app_name", )
-
-
-
composio_app_name:
str
-
request_options:
typing.Optional[RequestOptions]
β Request-specific configuration.
-
-
client.tools.add_composio_tool(...)
-
-
-
Add a new Composio tool by action name (Composio refers to each tool as an
Action
)
-
-
-
from letta_client import Letta client = Letta( token="YOUR_TOKEN", ) client.tools.add_composio_tool( composio_action_name="composio_action_name", )
-
-
-
composio_action_name:
str
-
request_options:
typing.Optional[RequestOptions]
β Request-specific configuration.
-
-
client.sources.get(...)
-
-
-
Get all sources
-
-
-
from letta_client import Letta client = Letta( token="YOUR_TOKEN", ) client.sources.get( source_id="source_id", )
-
-
-
source_id:
str
-
request_options:
typing.Optional[RequestOptions]
β Request-specific configuration.
-
-
client.sources.delete(...)
-
-
-
Delete a data source.
-
-
-
from letta_client import Letta client = Letta( token="YOUR_TOKEN", ) client.sources.delete( source_id="source_id", )
-
-
-
source_id:
str
-
request_options:
typing.Optional[RequestOptions]
β Request-specific configuration.
-
-
client.sources.update(...)
-
-
-
Update the name or documentation of an existing data source.
-
-
-
from letta_client import Letta client = Letta( token="YOUR_TOKEN", ) client.sources.update( source_id="source_id", )
-
-
-
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(...)
-
-
-
Get a source by name
-
-
-
from letta_client import Letta client = Letta( token="YOUR_TOKEN", ) client.sources.get_by_name( source_name="source_name", )
-
-
-
source_name:
str
-
request_options:
typing.Optional[RequestOptions]
β Request-specific configuration.
-
-
client.sources.list()
-
-
-
List all data sources created by a user.
-
-
-
from letta_client import Letta client = Letta( token="YOUR_TOKEN", ) client.sources.list()
-
-
-
request_options:
typing.Optional[RequestOptions]
β Request-specific configuration.
-
-
client.sources.create(...)
-
-
-
Create a new data source.
-
-
-
from letta_client import Letta client = Letta( token="YOUR_TOKEN", ) client.sources.create( name="name", )
-
-
-
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(...)
-
-
-
Attach a data source to an existing agent.
-
-
-
from letta_client import Letta client = Letta( token="YOUR_TOKEN", ) client.sources.attach( source_id="source_id", agent_id="agent_id", )
-
-
-
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(...)
-
-
-
Detach a data source from an existing agent.
-
-
-
from letta_client import Letta client = Letta( token="YOUR_TOKEN", ) client.sources.detach( source_id="source_id", agent_id="agent_id", )
-
-
-
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.
-
-
client.agents.list(...)
-
-
-
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.
-
-
-
from letta_client import Letta client = Letta( token="YOUR_TOKEN", ) client.agents.list()
-
-
-
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(...)
-
-
-
Create a new agent with the specified configuration.
-
-
-
from letta_client import Letta client = Letta( token="YOUR_TOKEN", ) client.agents.create()
-
-
-
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(...)
-
-
-
Get the state of the agent.
-
-
-
from letta_client import Letta client = Letta( token="YOUR_TOKEN", ) client.agents.get( agent_id="agent_id", )
-
-
-
agent_id:
str
-
request_options:
typing.Optional[RequestOptions]
β Request-specific configuration.
-
-
client.agents.delete(...)
-
-
-
Delete an agent.
-
-
-
from letta_client import Letta client = Letta( token="YOUR_TOKEN", ) client.agents.delete( agent_id="agent_id", )
-
-
-
agent_id:
str
-
request_options:
typing.Optional[RequestOptions]
β Request-specific configuration.
-
-
client.agents.update(...)
-
-
-
Update an exsiting agent
-
-
-
from letta_client import Letta client = Letta( token="YOUR_TOKEN", ) client.agents.update( agent_id="agent_id", )
-
-
-
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(...)
-
-
-
Resets the messages for an agent
-
-
-
from letta_client import Letta client = Letta( token="YOUR_TOKEN", ) client.agents.reset_messages( agent_id="agent_id", )
-
-
-
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(...)
-
-
-
This endpoint is only available on Letta Cloud.
Search deployed agents.
-
-
-
from letta_client import Letta client = Letta( token="YOUR_TOKEN", ) client.agents.search()
-
-
-
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.
-
-
client.models.list_llms()
-
-
-
from letta_client import Letta client = Letta( token="YOUR_TOKEN", ) client.models.list_llms()
-
-
-
request_options:
typing.Optional[RequestOptions]
β Request-specific configuration.
-
-
client.models.list_embedding_models()
-
-
-
from letta_client import Letta client = Letta( token="YOUR_TOKEN", ) client.models.list_embedding_models()
-
-
-
request_options:
typing.Optional[RequestOptions]
β Request-specific configuration.
-
-
client.blocks.list(...)
-
-
-
from letta_client import Letta client = Letta( token="YOUR_TOKEN", ) client.blocks.list()
-
-
-
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(...)
-
-
-
from letta_client import Letta client = Letta( token="YOUR_TOKEN", ) client.blocks.create( value="value", label="label", )
-
-
-
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(...)
-
-
-
from letta_client import Letta client = Letta( token="YOUR_TOKEN", ) client.blocks.get( block_id="block_id", )
-
-
-
block_id:
str
-
request_options:
typing.Optional[RequestOptions]
β Request-specific configuration.
-
-
client.blocks.delete(...)
-
-
-
from letta_client import Letta client = Letta( token="YOUR_TOKEN", ) client.blocks.delete( block_id="block_id", )
-
-
-
block_id:
str
-
request_options:
typing.Optional[RequestOptions]
β Request-specific configuration.
-
-
client.blocks.update(...)
-
-
-
from letta_client import Letta client = Letta( token="YOUR_TOKEN", ) client.blocks.update( block_id="block_id", )
-
-
-
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(...)
-
-
-
Link a memory block to an agent.
-
-
-
from letta_client import Letta client = Letta( token="YOUR_TOKEN", ) client.blocks.link_agent_memory_block( block_id="block_id", agent_id="agent_id", )
-
-
-
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(...)
-
-
-
Unlink a memory block from an agent
-
-
-
from letta_client import Letta client = Letta( token="YOUR_TOKEN", ) client.blocks.unlink_agent_memory_block( block_id="block_id", agent_id="agent_id", )
-
-
-
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.jobs.list(...)
-
-
-
List all jobs.
-
-
-
from letta_client import Letta client = Letta( token="YOUR_TOKEN", ) client.jobs.list()
-
-
-
source_id:
typing.Optional[str]
β Only list jobs associated with the source.
-
request_options:
typing.Optional[RequestOptions]
β Request-specific configuration.
-
-
client.jobs.list_active()
-
-
-
List all active jobs.
-
-
-
from letta_client import Letta client = Letta( token="YOUR_TOKEN", ) client.jobs.list_active()
-
-
-
request_options:
typing.Optional[RequestOptions]
β Request-specific configuration.
-
-
client.jobs.get(...)
-
-
-
Get the status of a job.
-
-
-
from letta_client import Letta client = Letta( token="YOUR_TOKEN", ) client.jobs.get( job_id="job_id", )
-
-
-
job_id:
str
-
request_options:
typing.Optional[RequestOptions]
β Request-specific configuration.
-
-
client.jobs.delete(...)
-
-
-
Delete a job by its job_id.
-
-
-
from letta_client import Letta client = Letta( token="YOUR_TOKEN", ) client.jobs.delete( job_id="job_id", )
-
-
-
job_id:
str
-
request_options:
typing.Optional[RequestOptions]
β Request-specific configuration.
-
-
client.health.check()
-
-
-
from letta_client import Letta client = Letta( token="YOUR_TOKEN", ) client.health.check()
-
-
-
request_options:
typing.Optional[RequestOptions]
β Request-specific configuration.
-
-
client.providers.list_providers(...)
-
-
-
Get a list of all custom providers in the database
-
-
-
from letta_client import Letta client = Letta( token="YOUR_TOKEN", ) client.providers.list_providers()
-
-
-
cursor:
typing.Optional[str]
-
limit:
typing.Optional[int]
-
request_options:
typing.Optional[RequestOptions]
β Request-specific configuration.
-
-
client.providers.create_provider(...)
-
-
-
Create a new custom provider
-
-
-
from letta_client import Letta client = Letta( token="YOUR_TOKEN", ) client.providers.create_provider( name="name", api_key="api_key", )
-
-
-
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(...)
-
-
-
Update an existing custom provider
-
-
-
from letta_client import Letta client = Letta( token="YOUR_TOKEN", ) client.providers.update_provider( id="id", api_key="api_key", )
-
-
-
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(...)
-
-
-
Delete an existing custom provider
-
-
-
from letta_client import Letta client = Letta( token="YOUR_TOKEN", ) client.providers.delete_provider( provider_id="provider_id", )
-
-
-
provider_id:
str
β The provider_id key to be deleted.
-
request_options:
typing.Optional[RequestOptions]
β Request-specific configuration.
-
-
client.runs.list_runs()
-
-
-
List all runs.
-
-
-
from letta_client import Letta client = Letta( token="YOUR_TOKEN", ) client.runs.list_runs()
-
-
-
request_options:
typing.Optional[RequestOptions]
β Request-specific configuration.
-
-
client.runs.list_active_runs()
-
-
-
List all active runs.
-
-
-
from letta_client import Letta client = Letta( token="YOUR_TOKEN", ) client.runs.list_active_runs()
-
-
-
request_options:
typing.Optional[RequestOptions]
β Request-specific configuration.
-
-
client.runs.get_run(...)
-
-
-
Get the status of a run.
-
-
-
from letta_client import Letta client = Letta( token="YOUR_TOKEN", ) client.runs.get_run( run_id="run_id", )
-
-
-
run_id:
str
-
request_options:
typing.Optional[RequestOptions]
β Request-specific configuration.
-
-
client.runs.delete_run(...)
-
-
-
Delete a run by its run_id.
-
-
-
from letta_client import Letta client = Letta( token="YOUR_TOKEN", ) client.runs.delete_run( run_id="run_id", )
-
-
-
run_id:
str
-
request_options:
typing.Optional[RequestOptions]
β Request-specific configuration.
-
-
client.runs.get_run_messages(...)
-
-
-
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].
-
-
-
from letta_client import Letta client = Letta( token="YOUR_TOKEN", ) client.runs.get_run_messages( run_id="run_id", )
-
-
-
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(...)
-
-
-
Get usage statistics for a run.
-
-
-
from letta_client import Letta client = Letta( token="YOUR_TOKEN", ) client.runs.get_run_usage( run_id="run_id", )
-
-
-
run_id:
str
-
request_options:
typing.Optional[RequestOptions]
β Request-specific configuration.
-
-
client.tag.list_tags(...)
-
-
-
Get a list of all tags in the database
-
-
-
from letta_client import Letta client = Letta( token="YOUR_TOKEN", ) client.tag.list_tags()
-
-
-
cursor:
typing.Optional[str]
-
limit:
typing.Optional[int]
-
query_text:
typing.Optional[str]
-
request_options:
typing.Optional[RequestOptions]
β Request-specific configuration.
-
-
client.agents.context.get(...)
-
-
-
Retrieve the context window of a specific agent.
-
-
-
from letta_client import Letta client = Letta( token="YOUR_TOKEN", ) client.agents.context.get( agent_id="agent_id", )
-
-
-
agent_id:
str
-
request_options:
typing.Optional[RequestOptions]
β Request-specific configuration.
-
-
client.agents.tools.list(...)
-
-
-
Get tools from an existing agent
-
-
-
from letta_client import Letta client = Letta( token="YOUR_TOKEN", ) client.agents.tools.list( agent_id="agent_id", )
-
-
-
agent_id:
str
-
request_options:
typing.Optional[RequestOptions]
β Request-specific configuration.
-
-
client.agents.tools.add(...)
-
-
-
Add tools to an existing agent
-
-
-
from letta_client import Letta client = Letta( token="YOUR_TOKEN", ) client.agents.tools.add( agent_id="agent_id", tool_id="tool_id", )
-
-
-
agent_id:
str
-
tool_id:
str
-
request_options:
typing.Optional[RequestOptions]
β Request-specific configuration.
-
-
client.agents.tools.remove(...)
-
-
-
Add tools to an existing agent
-
-
-
from letta_client import Letta client = Letta( token="YOUR_TOKEN", ) client.agents.tools.remove( agent_id="agent_id", tool_id="tool_id", )
-
-
-
agent_id:
str
-
tool_id:
str
-
request_options:
typing.Optional[RequestOptions]
β Request-specific configuration.
-
-
client.agents.sources.get(...)
-
-
-
Get the sources associated with an agent.
-
-
-
from letta_client import Letta client = Letta( token="YOUR_TOKEN", ) client.agents.sources.get( agent_id="agent_id", )
-
-
-
agent_id:
str
-
request_options:
typing.Optional[RequestOptions]
β Request-specific configuration.
-
-
client.agents.core_memory.list_in_context(...)
-
-
-
Retrieve the messages in the context of a specific agent.
-
-
-
from letta_client import Letta client = Letta( token="YOUR_TOKEN", ) client.agents.core_memory.list_in_context( agent_id="agent_id", )
-
-
-
agent_id:
str
-
request_options:
typing.Optional[RequestOptions]
β Request-specific configuration.
-
-
client.agents.core_memory.get(...)
-
-
-
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.
-
-
-
from letta_client import Letta client = Letta( token="YOUR_TOKEN", ) client.agents.core_memory.get( agent_id="agent_id", )
-
-
-
agent_id:
str
-
request_options:
typing.Optional[RequestOptions]
β Request-specific configuration.
-
-
client.agents.core_memory.get_block(...)
-
-
-
Retrieve a memory block from an agent.
-
-
-
from letta_client import Letta client = Letta( token="YOUR_TOKEN", ) client.agents.core_memory.get_block( agent_id="agent_id", block_label="block_label", )
-
-
-
agent_id:
str
-
block_label:
str
-
request_options:
typing.Optional[RequestOptions]
β Request-specific configuration.
-
-
client.agents.core_memory.remove_block(...)
-
-
-
Removes a memory block from an agent by unlnking it. If the block is not linked to any other agent, it is deleted.
-
-
-
from letta_client import Letta client = Letta( token="YOUR_TOKEN", ) client.agents.core_memory.remove_block( agent_id="agent_id", block_label="block_label", )
-
-
-
agent_id:
str
-
block_label:
str
-
request_options:
typing.Optional[RequestOptions]
β Request-specific configuration.
-
-
client.agents.core_memory.update_block(...)
-
-
-
Removes a memory block from an agent by unlnking it. If the block is not linked to any other agent, it is deleted.
-
-
-
from letta_client import Letta client = Letta( token="YOUR_TOKEN", ) client.agents.core_memory.update_block( agent_id="agent_id", block_label="block_label", )
-
-
-
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(...)
-
-
-
Retrieve the memory blocks of a specific agent.
-
-
-
from letta_client import Letta client = Letta( token="YOUR_TOKEN", ) client.agents.core_memory.get_blocks( agent_id="agent_id", )
-
-
-
agent_id:
str
-
request_options:
typing.Optional[RequestOptions]
β Request-specific configuration.
-
-
client.agents.core_memory.add_block(...)
-
-
-
Creates a memory block and links it to the agent.
-
-
-
from letta_client import Letta client = Letta( token="YOUR_TOKEN", ) client.agents.core_memory.add_block( agent_id="agent_id", value="value", label="label", )
-
-
-
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.
-
-
client.agents.recall_memory.get_summary(...)
-
-
-
Retrieve the summary of the recall memory of a specific agent.
-
-
-
from letta_client import Letta client = Letta( token="YOUR_TOKEN", ) client.agents.recall_memory.get_summary( agent_id="agent_id", )
-
-
-
agent_id:
str
-
request_options:
typing.Optional[RequestOptions]
β Request-specific configuration.
-
-
client.agents.archival_memory.get_summary(...)
-
-
-
Retrieve the summary of the archival memory of a specific agent.
-
-
-
from letta_client import Letta client = Letta( token="YOUR_TOKEN", ) client.agents.archival_memory.get_summary( agent_id="agent_id", )
-
-
-
agent_id:
str
-
request_options:
typing.Optional[RequestOptions]
β Request-specific configuration.
-
-
client.agents.archival_memory.list(...)
-
-
-
Retrieve the memories in an agent's archival memory store (paginated query).
-
-
-
from letta_client import Letta client = Letta( token="YOUR_TOKEN", ) client.agents.archival_memory.list( agent_id="agent_id", )
-
-
-
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(...)
-
-
-
Insert a memory into an agent's archival memory store.
-
-
-
from letta_client import Letta client = Letta( token="YOUR_TOKEN", ) client.agents.archival_memory.create( agent_id="agent_id", text="text", )
-
-
-
agent_id:
str
-
text:
str
β Text to write to archival memory.
-
request_options:
typing.Optional[RequestOptions]
β Request-specific configuration.
-
-
client.agents.archival_memory.delete(...)
-
-
-
Delete a memory from an agent's archival memory store.
-
-
-
from letta_client import Letta client = Letta( token="YOUR_TOKEN", ) client.agents.archival_memory.delete( agent_id="agent_id", memory_id="memory_id", )
-
-
-
agent_id:
str
-
memory_id:
str
-
request_options:
typing.Optional[RequestOptions]
β Request-specific configuration.
-
-
client.agents.messages.list(...)
-
-
-
Retrieve message history for an agent.
-
-
-
from letta_client import Letta client = Letta( token="YOUR_TOKEN", ) client.agents.messages.list( agent_id="agent_id", )
-
-
-
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(...)
-
-
-
Process a user message and return the agent's response. This endpoint accepts a message from a user and processes it through the agent.
-
-
-
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", ) ], )
-
-
-
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(...)
-
-
-
Update the details of a message associated with an agent.
-
-
-
from letta_client import Letta client = Letta( token="YOUR_TOKEN", ) client.agents.messages.update( agent_id="agent_id", message_id="message_id", )
-
-
-
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(...)
-
-
-
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.
-
-
-
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
-
-
-
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(...)
-
-
-
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.
-
-
-
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", ) ], )
-
-
-
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.templates.create_version(...)
-
-
-
This endpoint is only available on Letta Cloud.
Creates a new version of the template version of the agent.
-
-
-
from letta_client import Letta client = Letta( token="YOUR_TOKEN", ) client.agents.templates.create_version( agent_id="agent_id", )
-
-
-
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(...)
-
-
-
This endpoint is only available on Letta Cloud.
Migrate an agent to a new versioned agent template.
-
-
-
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, )
-
-
-
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(...)
-
-
-
This endpoint is only available on Letta Cloud.
Creates a template from an agent.
-
-
-
from letta_client import Letta client = Letta( token="YOUR_TOKEN", ) client.agents.templates.create( agent_id="agent_id", )
-
-
-
agent_id:
str
-
project:
typing.Optional[str]
-
request_options:
typing.Optional[RequestOptions]
β Request-specific configuration.
-
-
client.agents.memory_variables.get(...)
-
-
-
This endpoint is only available on Letta Cloud.
Returns the memory variables associated with an agent.
-
-
-
from letta_client import Letta client = Letta( token="YOUR_TOKEN", ) client.agents.memory_variables.get( agent_id="agent_id", )
-
-
-
agent_id:
str
-
request_options:
typing.Optional[RequestOptions]
β Request-specific configuration.
-
-
client.sources.files.upload(...)
-
-
-
Upload a file to a data source.
-
-
-
from letta_client import Letta client = Letta( token="YOUR_TOKEN", ) client.sources.files.upload( source_id="source_id", )
-
-
-
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(...)
-
-
-
List paginated files associated with a data source.
-
-
-
from letta_client import Letta client = Letta( token="YOUR_TOKEN", ) client.sources.files.list( source_id="source_id", )
-
-
-
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(...)
-
-
-
Delete a data source.
-
-
-
from letta_client import Letta client = Letta( token="YOUR_TOKEN", ) client.sources.files.delete( source_id="source_id", file_id="file_id", )
-
-
-
source_id:
str
-
file_id:
str
-
request_options:
typing.Optional[RequestOptions]
β Request-specific configuration.
-
-
client.sources.passages.list(...)
-
-
-
List all passages associated with a data source.
-
-
-
from letta_client import Letta client = Letta( token="YOUR_TOKEN", ) client.sources.passages.list( source_id="source_id", )
-
-
-
source_id:
str
-
request_options:
typing.Optional[RequestOptions]
β Request-specific configuration.
-
-