Required prerequisites
What version of camel are you using?
0.2.91a7 (master fc27907e)
System information
Source checkout of master fc27907e, Python 3.11.16 on Linux, python:3.11-slim container, deps installed with pip.
Problem description
ChatAgent.clone() builds the new agent with message_window_size=getattr(self.memory, "window_size", None) (camel/agents/chat_agent.py:6233). ChatHistoryMemory stores the window as self._window_size and only exposes agent_id as a property, so there is no public window_size to read and that getattr always takes its default. Every clone comes back with an unbounded window.
The line right below it does resolve, which is what makes this look like an oversight rather than a decision: token_limit=getattr(self.memory.get_context_creator(), "token_limit", None) reads a real property on ScoreBasedContextCreator.
CriticAgent.clone() is the worse one. Its default is 6 (camel/agents/critic_agent.py:250), so a critic built with message_window_size=3 clones into a critic with a window of 6.
Five call sites read the same missing attribute: chat_agent.py:6233, critic_agent.py:250, toolkits/agent_toolkit.py:179, societies/workforce/workforce.py:447 and :514. That is the complete set from an ast walk over camel/ for getattr(_, "window_size", _), and the same walk finds no def window_size and no self.window_size = ... anywhere in the package.
Reproducible example code
The Python snippets:
from camel.agents import ChatAgent, CriticAgent
a = ChatAgent("You are helpful.", message_window_size=2)
print(a.memory._window_size) # 2
print(getattr(a.memory, "window_size", "DEFAULT_RETURNED")) # DEFAULT_RETURNED
print(a.clone().memory._window_size) # None
print(a.clone(with_memory=True).memory._window_size) # None
c = CriticAgent("You are a critic.", message_window_size=3)
print(c.clone().memory._window_size) # 6
Command lines:
OPENAI_API_KEY=sk-dummy python repro.py
Extra dependencies:
none beyond a source checkout
Steps to reproduce:
- Check out master
fc27907e.
- Run the snippet above.
- The parent has a window of 2 and both clones report
None.
Expected behavior
clone() keeps the parent's message window, the way it already keeps token_limit.
Additional context
A read-only window_size property on ChatHistoryMemory returning self._window_size repairs all five call sites at once, and MemantoMemory inherits it. VectorDBMemory and LongtermAgentMemory take no window argument, so the None default stays correct for them. I have that change and its tests ready and will open the PR against this issue.
Required prerequisites
What version of camel are you using?
0.2.91a7 (master
fc27907e)System information
Source checkout of master
fc27907e, Python 3.11.16 on Linux,python:3.11-slimcontainer, deps installed with pip.Problem description
ChatAgent.clone()builds the new agent withmessage_window_size=getattr(self.memory, "window_size", None)(camel/agents/chat_agent.py:6233).ChatHistoryMemorystores the window asself._window_sizeand only exposesagent_idas a property, so there is no publicwindow_sizeto read and that getattr always takes its default. Every clone comes back with an unbounded window.The line right below it does resolve, which is what makes this look like an oversight rather than a decision:
token_limit=getattr(self.memory.get_context_creator(), "token_limit", None)reads a real property onScoreBasedContextCreator.CriticAgent.clone()is the worse one. Its default is 6 (camel/agents/critic_agent.py:250), so a critic built withmessage_window_size=3clones into a critic with a window of 6.Five call sites read the same missing attribute:
chat_agent.py:6233,critic_agent.py:250,toolkits/agent_toolkit.py:179,societies/workforce/workforce.py:447and:514. That is the complete set from an ast walk overcamel/forgetattr(_, "window_size", _), and the same walk finds nodef window_sizeand noself.window_size = ...anywhere in the package.Reproducible example code
The Python snippets:
Command lines:
Extra dependencies:
Steps to reproduce:
fc27907e.None.Expected behavior
clone()keeps the parent's message window, the way it already keepstoken_limit.Additional context
A read-only
window_sizeproperty onChatHistoryMemoryreturningself._window_sizerepairs all five call sites at once, andMemantoMemoryinherits it.VectorDBMemoryandLongtermAgentMemorytake no window argument, so theNonedefault stays correct for them. I have that change and its tests ready and will open the PR against this issue.