Module 3: Tool use
Ungraded Lab: Email Assistant Workflow
The last task in this lab, “6.5. Targeted action: Delete the “Happy Hour” email ” has a prompt to delete the email using just the text.
The default prompt did not work for me, even after several runs.
I am sharing the prompt that actually worked for me
Delete the email with subject happy hour
Delete the "Happy Hour” email
It seems that using the word “subject” might be confusing the LLM in this case and affecting its understanding of the prompt.
mnjrrz
April 18, 2026, 5:32pm
3
Did your failure result in spew starting like this?
ValidationError Traceback (most recent call last)
File /usr/local/lib/python3.11/site-packages/aisuite/utils/tools.py:271, in Tools.execute_tool(self, tool_calls)
270 try:
--> 271 validated_args = param_model(**arguments)
272 result = tool_func(**validated_args.model_dump())
File /usr/local/lib/python3.11/site-packages/pydantic/main.py:253, in BaseModel.__init__(self, **data)
252 __tracebackhide__ = True
--> 253 validated_self = self.__pydantic_validator__.validate_python(data, self_instance=self)
254 if self is not validated_self:
mnjrrz
April 18, 2026, 5:36pm
4
The spew above was from the provided prompt (“Delete the happy hour email”). A prompt that worked for me:
“Find the happy hour email and delete it”
My sense is that the real fix would be in the docstring.
mnjrrz
April 18, 2026, 5:59pm
5
I was also able to resolve the issue by changing the definition of the tool to (pardon the accursed formatting):
def find_emails_matching_query(query: str) → list:
“”"
Find emails containing the query in subject, body, or sender.
Args:
query (str): A keyword or phrase to search for.
Returns:
List[dict]: A list of emails matching the query string.
"""
return requests.get(f"{BASE_URL}/emails/search", params={"q": query}).json()