Open NovaBro opened 1 week ago
Sorry that documentation has an error because of our latest release - you now need to specify the LLMConfig
or EmbeddingConfig
when creating an agent, or set a default config for the client:
from letta import EmbeddingConfig, LLMConfig
client.set_default_embedding_config(EmbeddingConfig.default_config(provider="openai"))
client.set_default_llm_config(LLMConfig.default_config(model_name="gpt-4"))
Thanks for reporting this issue, and we'll make sure to fix the docs. Let me know if things still aren't working thought!
Hello!
Thank you for your response, I tried using the agent I had created through python, however, I am getting an error related to the openai api key. It seems that key is not found. I am not sure where to put my key now that the config file is depreicated?
from letta import create_client
from letta import EmbeddingConfig, LLMConfig
client = create_client()
client.set_default_embedding_config(EmbeddingConfig.default_config(provider="openai"))
client.set_default_llm_config(LLMConfig.default_config(model_name="gpt-4"))
def query_birthday_db(self, name: str):
"""
This tool queries an external database to
lookup the birthday of someone given their name.
Args:
name (str): The name to look up
Returns:
birthday (str): The birthday in mm-dd-yyyy format
"""
my_fake_data = {
"bob": "03-06-1997",
"sarah": "03-06-1997"
}
name = name.lower()
if name not in my_fake_data:
return None
else:
return my_fake_data[name]
birthday_tool = client.create_tool(query_birthday_db)
agentName = "testing_agent"
agent_1 = client.create_agent(
name=agentName,
)
Error message when then using Letta Run:
(my_letta) (base) williamzheng@WilliamsMBP258 MemGPT_Letta % letta run
Initializing database...
? Would you like to select an existing agent? Yes
? Select agent: testing_agent
🔁 Using existing agent testing_agent
Hit enter to begin (will request first Letta message)
An exception occurred when running agent.step():
Traceback (most recent call last):
File "/Users/williamzheng/Documents/UmichFolder/2025 Fall Semester /Research 499/MemGPT_Letta/my_letta/lib/python3.12/site-packages/letta/main.py", line 413, in run_agent_loop
new_messages, user_message, skip_next_user_input = process_agent_step(user_message, no_verify)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/williamzheng/Documents/UmichFolder/2025 Fall Semester /Research 499/MemGPT_Letta/my_letta/lib/python3.12/site-packages/letta/main.py", line 365, in process_agent_step
step_response = letta_agent.step(
^^^^^^^^^^^^^^^^^
File "/Users/williamzheng/Documents/UmichFolder/2025 Fall Semester /Research 499/MemGPT_Letta/my_letta/lib/python3.12/site-packages/letta/agent.py", line 874, in step
raise e
File "/Users/williamzheng/Documents/UmichFolder/2025 Fall Semester /Research 499/MemGPT_Letta/my_letta/lib/python3.12/site-packages/letta/agent.py", line 770, in step
response = self._get_ai_reply(
^^^^^^^^^^^^^^^^^^^
File "/Users/williamzheng/Documents/UmichFolder/2025 Fall Semester /Research 499/MemGPT_Letta/my_letta/lib/python3.12/site-packages/letta/agent.py", line 495, in _get_ai_reply
raise e
File "/Users/williamzheng/Documents/UmichFolder/2025 Fall Semester /Research 499/MemGPT_Letta/my_letta/lib/python3.12/site-packages/letta/agent.py", line 464, in _get_ai_reply
response = create(
^^^^^^^
File "/Users/williamzheng/Documents/UmichFolder/2025 Fall Semester /Research 499/MemGPT_Letta/my_letta/lib/python3.12/site-packages/letta/llm_api/llm_api_tools.py", line 101, in wrapper
raise e
File "/Users/williamzheng/Documents/UmichFolder/2025 Fall Semester /Research 499/MemGPT_Letta/my_letta/lib/python3.12/site-packages/letta/llm_api/llm_api_tools.py", line 70, in wrapper
return func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "/Users/williamzheng/Documents/UmichFolder/2025 Fall Semester /Research 499/MemGPT_Letta/my_letta/lib/python3.12/site-packages/letta/llm_api/llm_api_tools.py", line 147, in create
raise ValueError(f"OpenAI key is missing from letta config file")
ValueError: OpenAI key is missing from letta config file
? Retry agent.step()? (Y/n)
I am assuming this issue is appearing from line 127 llm_api_tools.py which has:
model_settings: Optional[dict] = None, # TODO: eventually pass from server
moedel_settings is not defined when calling create on line 464 file agent.py:
response = create(
# agent_state=self.agent_state,
llm_config=self.agent_state.llm_config,
user_id=self.agent_state.user_id,
messages=message_sequence,
functions=self.functions,
functions_python=self.functions_python,
function_call=function_call,
# hint
first_message=first_message,
# streaming
stream=stream,
stream_interface=self.interface,
# putting inner thoughts in func args or not
inner_thoughts_in_kwargs_option=inner_thoughts_in_kwargs_option,
)
I am now using the letta free model:
from letta import create_client
from letta import EmbeddingConfig, LLMConfig
client = create_client()
client.set_default_embedding_config(EmbeddingConfig.default_config(model_name="letta"))
client.set_default_llm_config(LLMConfig.default_config(model_name="letta"))
def query_birthday_db(self, name: str):
"""
This tool queries an external database to
lookup the birthday of someone given their name.
Args:
name (str): The name to look up
Returns:
birthday (str): The birthday in mm-dd-yyyy format
"""
my_fake_data = {
"bob": "03-06-1997",
"sarah": "03-06-1997"
}
name = name.lower()
if name not in my_fake_data:
return None
else:
return my_fake_data[name]
birthday_tool = client.create_tool(query_birthday_db)
But now I wanted to add all tools to my agent,
agentName = "testing_agent"
agent_1 = client.create_agent(
name=agentName,
tools=[x.name for x in client.list_tools()]
)
but there seems to be a different number of tools, 18 vs 10 on the website:
Other than this, the letta model is able to use custom tools
Describe the bug When following lettas tutorial, letta tutorial, on adding custom tools to letta, I get an error. Adding tools to the agent throught he online server website also presents weird behavior. i.e. the tool does not run and it removes default tools. It seems that I can either have the default tools OR only my custom tool.
Is there a way to add tools to existing agents? Where is the html code for the website? i.e. "http://localhost:8283/"
Please describe your setup
I have created a python 3.12 virtual environment
I then did pip install letta
Followed the quickstart guide
macOS 14.6.1, m1 chip,
VSCODE
Running letta though terminal
Here is what happens when I add a tool through python using lettas tutorial on adding custom tools: (my_letta) (base) williamzheng@WilliamsMBP258 MemGPT_Letta % "/Users/williamzheng/Documents/UmichFolder/2025 Fall Semester /Research 499/MemGPT_Lett a/my_letta/bin/python" "/Users/williamzheng/Documents/UmichFolder/2025 Fall Semester /Research 499/MemGPT_Letta/delete_tool.py" Initializing database... Traceback (most recent call last): File "/Users/williamzheng/Documents/UmichFolder/2025 Fall Semester /Research 499/MemGPT_Letta/delete_tool.py", line 6, in
agent_state = client.create_agent(name="test_agent")
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/williamzheng/Documents/UmichFolder/2025 Fall Semester /Research 499/MemGPT_Letta/my_letta/lib/python3.12/site-packages/letta/client/client.py", line 1555, in create_agent
assert embedding_config or self._default_embedding_config, f"Embedding config must be provided"
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: Embedding config must be provided
(my_letta) (base) williamzheng@WilliamsMBP258 MemGPT_Letta %
Here is when I add a tool through the website. This is the website I am talking about. Additionally, you can see here that only 1 tool is added, all default tools are removed. I think this prevents letta from returning response.