Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using --print_agent leads to RecursionError: maximum recursion depth exceeded while calling a Python object #17

Open
motin opened this issue Aug 26, 2023 · 0 comments

Comments

@motin
Copy link

motin commented Aug 26, 2023

Environment:
Apple M1 Max
13.5 (22G74)

Steps to reproduce:

  1. Follow the GentPool readme to install GentPool:
conda create --name gentenv python=3.10
conda activate gentenv
pip install gentopia
git clone [email protected]:Gentopia-AI/GentPool.git
cd GentPool
touch .env
echo "OPENAI_API_KEY=<my_openai_api_key>" >> .env
  1. Then clone and assemble elon as per the README:
./clone_agent elon foo
python assemble.py foo --print_agent

Expected results:
No exception thrown.

Actual results:
Exception thrown:

$ python assemble.py foo --print_agent
╭───────────────────────────────────────────────────── Gentopia ──────────────────────────────────────────────────────╮
│ Welcome to Gentopia!                                                                                                │
╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
Traceback (most recent call last):
  File "/opt/homebrew/Caskroom/miniforge/base/envs/gentenv/lib/python3.10/site-packages/rich/console.py", line 1673, in print
    renderables = self._collect_renderables(
  File "/opt/homebrew/Caskroom/miniforge/base/envs/gentenv/lib/python3.10/site-packages/rich/console.py", line 1543, in _collect_renderables
    elif isinstance(renderable, ConsoleRenderable):
  File "/opt/homebrew/Caskroom/miniforge/base/envs/gentenv/lib/python3.10/typing.py", line 1503, in __instancecheck__
    issubclass(instance.__class__, cls)):
  File "/opt/homebrew/Caskroom/miniforge/base/envs/gentenv/lib/python3.10/abc.py", line 123, in __subclasscheck__
    return _abc_subclasscheck(cls, subclass)
RecursionError: maximum recursion depth exceeded in comparison

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/motin/Dev/Projects/generative-reality/reproduce-issue/GentPool/assemble.py", line 41, in <module>
    main()
  File "/Users/motin/Dev/Projects/generative-reality/reproduce-issue/GentPool/assemble.py", line 37, in main
    chat(agent, verbose=print_agent)
  File "/opt/homebrew/Caskroom/miniforge/base/envs/gentenv/lib/python3.10/site-packages/gentopia/__init__.py", line 12, in chat
    output.panel_print(str(agent), title="[red]Agent")
  File "/opt/homebrew/Caskroom/miniforge/base/envs/gentenv/lib/python3.10/site-packages/gentopia/agent/base_agent.py", line 77, in __str__
    rprint(self, file=result)
  File "/opt/homebrew/Caskroom/miniforge/base/envs/gentenv/lib/python3.10/site-packages/rich/__init__.py", line 74, in print
    return write_console.print(*objects, sep=sep, end=end)
  File "/opt/homebrew/Caskroom/miniforge/base/envs/gentenv/lib/python3.10/site-packages/rich/console.py", line 1673, in print
    renderables = self._collect_renderables(
  File "/opt/homebrew/Caskroom/miniforge/base/envs/gentenv/lib/python3.10/site-packages/rich/console.py", line 1550, in _collect_renderables
    append_text(_highlighter(str(renderable)))
  File "/opt/homebrew/Caskroom/miniforge/base/envs/gentenv/lib/python3.10/site-packages/gentopia/agent/base_agent.py", line 77, in __str__
    rprint(self, file=result)
  File "/opt/homebrew/Caskroom/miniforge/base/envs/gentenv/lib/python3.10/site-packages/rich/__init__.py", line 74, in print
    return write_console.print(*objects, sep=sep, end=end)
  File "/opt/homebrew/Caskroom/miniforge/base/envs/gentenv/lib/python3.10/site-packages/rich/console.py", line 1673, in print
    renderables = self._collect_renderables(
  File "/opt/homebrew/Caskroom/miniforge/base/envs/gentenv/lib/python3.10/site-packages/rich/console.py", line 1550, in _collect_renderables
    append_text(_highlighter(str(renderable)))
  File "/opt/homebrew/Caskroom/miniforge/base/envs/gentenv/lib/python3.10/site-packages/gentopia/agent/base_agent.py", line 77, in __str__
    rprint(self, file=result)
  File "/opt/homebrew/Caskroom/miniforge/base/envs/gentenv/lib/python3.10/site-packages/rich/__init__.py", line 74, in print
    return write_console.print(*objects, sep=sep, end=end)
  File "/opt/homebrew/Caskroom/miniforge/base/envs/gentenv/lib/python3.10/site-packages/rich/console.py", line 1673, in print
    renderables = self._collect_renderables(
  File "/opt/homebrew/Caskroom/miniforge/base/envs/gentenv/lib/python3.10/site-packages/rich/console.py", line 1550, in _collect_renderables
    append_text(_highlighter(str(renderable)))
  File "/opt/homebrew/Caskroom/miniforge/base/envs/gentenv/lib/python3.10/site-packages/gentopia/agent/base_agent.py", line 77, in __str__
    rprint(self, file=result)
  File "/opt/homebrew/Caskroom/miniforge/base/envs/gentenv/lib/python3.10/site-packages/rich/__init__.py", line 74, in print
    return write_console.print(*objects, sep=sep, end=end)
  File "/opt/homebrew/Caskroom/miniforge/base/envs/gentenv/lib/python3.10/site-packages/rich/console.py", line 1673, in print
    renderables = self._collect_renderables(
  File "/opt/homebrew/Caskroom/miniforge/base/envs/gentenv/lib/python3.10/site-packages/rich/console.py", line 1550, in _collect_renderables
    append_text(_highlighter(str(renderable)))
  File "/opt/homebrew/Caskroom/miniforge/base/envs/gentenv/lib/python3.10/site-packages/gentopia/agent/base_agent.py", line 
........ <--- lots of repetitions removed for brevity
77, in __str__
    rprint(self, file=result)
  File "/opt/homebrew/Caskroom/miniforge/base/envs/gentenv/lib/python3.10/site-packages/rich/__init__.py", line 74, in print
    return write_console.print(*objects, sep=sep, end=end)
  File "/opt/homebrew/Caskroom/miniforge/base/envs/gentenv/lib/python3.10/site-packages/rich/console.py", line 1673, in print
    renderables = self._collect_renderables(
  File "/opt/homebrew/Caskroom/miniforge/base/envs/gentenv/lib/python3.10/site-packages/rich/console.py", line 1550, in _collect_renderables
    append_text(_highlighter(str(renderable)))
  File "/opt/homebrew/Caskroom/miniforge/base/envs/gentenv/lib/python3.10/site-packages/gentopia/agent/base_agent.py", line 77, in __str__
    rprint(self, file=result)
  File "/opt/homebrew/Caskroom/miniforge/base/envs/gentenv/lib/python3.10/site-packages/rich/__init__.py", line 74, in print
    return write_console.print(*objects, sep=sep, end=end)
  File "/opt/homebrew/Caskroom/miniforge/base/envs/gentenv/lib/python3.10/site-packages/rich/console.py", line 1672, in print
    with self:
  File "/opt/homebrew/Caskroom/miniforge/base/envs/gentenv/lib/python3.10/site-packages/rich/console.py", line 864, in __exit__
    self._exit_buffer()
  File "/opt/homebrew/Caskroom/miniforge/base/envs/gentenv/lib/python3.10/site-packages/rich/console.py", line 822, in _exit_buffer
    self._check_buffer()
  File "/opt/homebrew/Caskroom/miniforge/base/envs/gentenv/lib/python3.10/site-packages/rich/console.py", line 2057, in _check_buffer
    text = self._render_buffer(self._buffer[:])
  File "/opt/homebrew/Caskroom/miniforge/base/envs/gentenv/lib/python3.10/site-packages/rich/console.py", line 2073, in _render_buffer
    not_terminal = not self.is_terminal
  File "/opt/homebrew/Caskroom/miniforge/base/envs/gentenv/lib/python3.10/site-packages/rich/console.py", line 952, in is_terminal
    force_color = self._environ.get("FORCE_COLOR")
  File "/opt/homebrew/Caskroom/miniforge/base/envs/gentenv/lib/python3.10/_collections_abc.py", line 824, in get
    return self[key]
  File "/opt/homebrew/Caskroom/miniforge/base/envs/gentenv/lib/python3.10/os.py", line 677, in __getitem__
    value = self._data[self.encodekey(key)]
  File "/opt/homebrew/Caskroom/miniforge/base/envs/gentenv/lib/python3.10/os.py", line 756, in encode
    if not isinstance(value, str):
RecursionError: maximum recursion depth exceeded while calling a Python object

Note that the same command without --print_agent does not throw an exception.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant