Tools

Tools allow agents to take actions by executing Python code. Letta uses tools to manage memory and even to send messages to the end user. You can add custom tools to Letta by defining your own tools, and also customize the execution environment of the tools. You can import external tool libraries like Composio.

Default Tools

By default, agents in Letta are created with the following tools:

ToolDescription
send_messageSends a message to the human user.
core_memory_appendAppend to the contents of a block in core memory.
core_memory_replaceReplace the contents of a block in core memory.
conversation_searchSearch prior conversation history (recall memory)
archival_memory_insertAdd a memory to archival memory
archival_memory_searchSearch archival memory via embedding search

Letta also includes a set of pre-made tools designed for multi-agent interaction. See our guide on multi-agent for more information.

You can disable the default tools by passing include_base_tools=False to the agent creation.

Defining Custom Tools

You can create custom tools in Letta using the SDKs, as well as via the ADE tool builder. See more on defining custom tools here.

Once the tool is created, you can add it to an agent by passing the tool name to the tools parameter in the agent creation.

python
1# create a new agent
2agent = client.agents.create(
3 memory_blocks=[
4 {"label": "human", "limit": 2000, "value": "Name: Bob"},
5 {"label": "persona", "limit": 2000, "value": "You are a friendly agent"}
6 ],
7 model="openai/gpt-4o-mini",
8 embedding="openai/text-embedding-3-small",
9 tools=["my_custom_tool_name"]
10)

Tool Execution

You can custom the enviornment that your tool runs in (the Python package dependencies and environment variables) by setting a tool execution environment. See more here.

Tool Environment Variables

You can set agent-scoped environment variables for your tools. These environment variables will be accessible in the sandboxed environment that any of the agent tools are run in.

For example, if you define a custom tool that requires an API key to run (e.g. EXAMPLE_TOOL_API_KEY), you can set the variable at time of agent creation by using the tool_exec_environment_variables parameter:

python
1# create an agent with no tools
2agent = client.agents.create(
3 memory_blocks=[
4 {"label": "human", "limit": 2000, "value": "Name: Bob"},
5 {"label": "persona", "limit": 2000, "value": "You are a friendly agent"}
6 ],
7 model="openai/gpt-4o-mini",
8 embedding="openai/text-embedding-3-small",
9 tool_exec_environment_variables={
10 "EXAMPLE_TOOL_API_KEY": "banana"
11 }
12)

Tool Rules

Tool rules allow you to define graph-like constrains on your tools, such as requiring that a tool terminate agent execution or be followed by another tool.

Read more about tool rules here.

External Tool Libraries

Letta also has early support for adding tools from external tool libraries via MCP and Composio.

For more information on setting up MCP servers, see our MCP guide.

For more information on setting up Composio tools, see our Composio guide.