[BUG] from strands_tools import use_llm,mem0_memory is not working
Checks
- [x] I have updated to the lastest minor and patch version of Strands
- [x] I have checked the documentation and this is not expected behavior
- [x] I have searched ./issues and there are no duplicates of my issue
Strands Version
0.1.0
Python Version
3.11
Operating System
windows
Installation Method
pip
Steps to Reproduce
from strands_tools import use_llm,mem0_memory - It says mem0_memory is not available
Expected Behavior
I should be able to import mem0_memory
Actual Behavior
not able to import
Additional Context
No response
Possible Solution
No response
Related Issues
No response
Even the KB based memory is not working. Says agent has no module "memory"
from strands import Agent
from strands_tools.memory import memory
agent = Agent(tools=[memory])
# Store content in Knowledge Base
agent.memory(
action="store",
content="Important information to remember",
title="Meeting Notes",
STRANDS_KNOWLEDGE_BASE_ID="my1234kb"
)
# Retrieve content using semantic search
agent.memory(
action="retrieve",
query="meeting information",
min_score=0.7,
STRANDS_KNOWLEDGE_BASE_ID="my1234kb"
)
# List all documents
agent.memory(
action="list",
max_results=50,
STRANDS_KNOWLEDGE_BASE_ID="my1234kb"
)
Thank you for reporting this issue @rajib76.
We just released v0.1.1 of strands-agents-tools that includes the mem0_memory tool. Upgrade your version with:
pip install strands-agents-tools -U
You will then be able to use the mem0_memory tool in your Strands agents:
from strands import Agent
from strands_tools import mem0_memory
agent = Agent(tools=[mem0_memory])
For the second issue, your import path is incorrect. It should be:
from strands_tools import memory
Changed to from strands_tools import memory
Still getting the error
/Users/joyeed/strands_examples/aws_strands_examples/venv/bin/python /Users/joyeed/strands_examples/aws_strands_examples/examples/07_memory_kb.py
Warning: Input is not a terminal (fd=0).
Traceback (most recent call last):
File "/Users/joyeed/strands_examples/aws_strands_examples/examples/07_memory_kb.py", line 12, in
@rajib76 please share the full updated code paste that reproduces the issue.
from strands import Agent
from strands_tools import use_llm
from strands_tools import memory
agent = Agent(tools=[memory])
memory_agent = Agent(
tools=[memory, use_llm],
)
# Store content in Knowledge Base
memory_agent.memory(
action="store",
content="Important information to remember",
title="Meeting Notes",
STRANDS_KNOWLEDGE_BASE_ID="BDRKXXIEYH"
)
# Retrieve content using semantic search
memory_agent.memory(
action="retrieve",
query="meeting information",
min_score=0.7,
STRANDS_KNOWLEDGE_BASE_ID="BDRKXXIEYH"
)
# List all documents
memory_agent.memory(
action="list",
max_results=50,
STRANDS_KNOWLEDGE_BASE_ID="BDRKXXIEYH"
)
Got it - thank you!
Direct tool calls are made with agent.tool.<tool_name>(), for example memory_agent.tool.memory(). The .tool is missing in your sample.
https://strandsagents.com/0.1.x/user-guide/concepts/tools/tools_overview/#direct-method-calls
This is the working version
`from strands import Agent from strands_tools import use_llm from strands_tools import memory
agent = Agent(tools=[memory])
memory_agent = Agent( tools=[memory, use_llm], )
memory_agent.tool.memory( action="store", content="Important information to remember", title="Meeting Notes", STRANDS_KNOWLEDGE_BASE_ID="BDRKXXIEYH" )
memory_agent.tool.memory( action="retrieve", query="meeting information", min_score=0.7, STRANDS_KNOWLEDGE_BASE_ID="BDRKXXIEYH" )
memory_agent.tool.memory( action="list", max_results=50, STRANDS_KNOWLEDGE_BASE_ID="BDRKXXIEYH" ) `
This is a design choice to namespace tool methods and avoid conflicts with other agent methods.
Awesome, pleased to hear that it's working 🚀
I noticed our direct tool call inserts and docstrings indicates old agent.X pattern instead of agent.tool.X pattern.
That leads to direct tool calls announced as agent.tool_name ... which agents tend to use as context, which is clearly misleading to old version here ^^.
PR for fix: https://github.com/strands-agents/sdk-python/pull/56