fetchai / uAgents

A fast and lightweight framework for creating decentralized agents with ease.
Apache License 2.0
995 stars 241 forks source link

KeyboardInterrupt raises error in Agent and Bureau #447

Closed Archento closed 4 months ago

Archento commented 4 months ago

Prerequisites

Category

Bug (unexpected behavior)

Expected Behavior

KeyboardInterrupt should be handled gracefully and non-verbose during development.

Observed Behavior

▶ python testing.py
INFO:     [alice]: Hello World!
INFO:     [alice]: Starting server on http://0.0.0.0:8000 (Press CTRL+C to quit)
^CTraceback (most recent call last):
  File "/Users/_/git/uAgents/python/testing.py", line 12, in <module>
    alice.run()
  File "/Users/_/git/uAgents/python/src/uagents/agent.py", line 1010, in run
    self._loop.run_until_complete(self._server.serve())
  File "/opt/homebrew/Cellar/python@3.11/3.11.9/Frameworks/Python.framework/Versions/3.11/lib/python3.11/asyncio/base_events.py", line 641, in run_until_complete
    self.run_forever()
  File "/opt/homebrew/Cellar/python@3.11/3.11.9/Frameworks/Python.framework/Versions/3.11/lib/python3.11/asyncio/base_events.py", line 608, in run_forever
    self._run_once()
  File "/opt/homebrew/Cellar/python@3.11/3.11.9/Frameworks/Python.framework/Versions/3.11/lib/python3.11/asyncio/base_events.py", line 1936, in _run_once
    handle._run()
  File "/opt/homebrew/Cellar/python@3.11/3.11.9/Frameworks/Python.framework/Versions/3.11/lib/python3.11/asyncio/events.py", line 84, in _run
    self._context.run(self._callback, *self._args)
  File "/Users/_/git/uAgents/python/src/uagents/asgi.py", line 161, in serve
    await self._server.serve()
  File "/Users/_/Library/Caches/pypoetry/virtualenvs/uagents-1OuOmH4j-py3.11/lib/python3.11/site-packages/uvicorn/server.py", line 68, in serve
    with self.capture_signals():
  File "/opt/homebrew/Cellar/python@3.11/3.11.9/Frameworks/Python.framework/Versions/3.11/lib/python3.11/contextlib.py", line 144, in __exit__
    next(self.gen)
  File "/Users/_/Library/Caches/pypoetry/virtualenvs/uagents-1OuOmH4j-py3.11/lib/python3.11/site-packages/uvicorn/server.py", line 328, in capture_signals
    signal.raise_signal(captured_signal)
KeyboardInterrupt

To Reproduce

Start an agent and invoke a KeyboardInterrupt (CTRL+C).

Version

0.13.0

Environment Details (Optional)

No response

Failure Logs (Optional)

No response

Additional Information (Optional)

No response