Closed
Description
Describe the bug
I´m trying to create any tool, but it doesn´t work. I try this tool from the Deeplearning example:
def task_queue_push(self: "Agent", task_description: str):
"""
Push to a task queue stored in core memory.
Args:
task_description (str): A description of the next task you must accomplish.
Returns:
Optional[str]: None is always returned as this function
does not produce a response.
"""
import json
tasks = json.loads(self.memory.get_block("tasks").value)
tasks.append(task_description)
self.memory.update_block_value("tasks", json.dumps(tasks))
return None
When agent is working it always return me error like this:
Request
{
"task_description": "Create project directory and necessary files for Calendar app.",
"request_heartbeat": true
}
Response
{
"status": "Failed",
"message": "Error executing function task_queue_push: TypeError: task_queue_push() missing 1 required positional argument: 'self'",
"time": "2025-01-05 03:49:44 PM WET+0000"
}
Whenever I add any other tool, it always has issues with ´self´:
def create_file(self: "Agent", relative_path: str, initial_content: str = "") -> str:
"""
Creates a new file at '/Users/Shared/Projects/<project_name>/<relative_path>'
and optionally writes initial content.
If the file already exists, it will be overwritten.
Args:
relative_path (str): The path (relative to the project directory).
initial_content (str): Optional string content to write into the newly created file.
Returns:
str: A success or error message.
"""
import os
# Retrieve the project name from memory (adapt if your memory system differs).
project_name = self.memory.get_block("project_name").value
base_dir = "/Users/Shared/Projects"
full_path = os.path.join(base_dir, project_name, relative_path)
try:
os.makedirs(os.path.dirname(full_path), exist_ok=True)
with open(full_path, "w", encoding="utf-8") as f:
f.write(initial_content)
return f"File created at '{full_path}' with initial content."
except Exception as e:
return f"Failed to create file '{full_path}': {str(e)}"
Request
{
"relative_path": "Main.storyboard",
"initial_content": "<storyboard version=\"3.0\"></storyboard>",
"request_heartbeat": true
}
Response
{
"status": "Failed",
"message": "Error executing function create_file: TypeError: create_file() missing 1 required positional argument: 'self'",
"time": "2025-01-05 03:49:49 PM WET+0000"
}
Please describe your setup
- How did you install letta?
pip install letta
- Describe your setup
-
What's your OS (Windows/MacOS/Linux)?
MacOS -
How are you running
letta
? (cmd.exe
/Powershell/Anaconda Shell/Terminal)
Terminal
-
Letta Config
[defaults]
preset = memgpt_chat
persona = sam_pov
human = basic
[archival_storage]
type = sqlite
path = /Users/user/.letta
[recall_storage]
type = sqlite
path = /Users/user/.letta
[metadata_storage]
type = sqlite
path = /Users/user/.letta
[version]
letta_version = 0.6.7