microsoft / autogen

A programming framework for agentic AI 🤖
https://microsoft.github.io/autogen/
Creative Commons Attribution 4.0 International
34.7k stars 5.01k forks source link

[Bug]: Autogen recreated all default skills, models, agents and workflows upon restart #3447

Open ianbruton opened 2 months ago

ianbruton commented 2 months ago

Describe the bug

I don't need any of the default materials that come with autogen, it is just clutter that get's in the way, so I always delete all of it, this was never an issue until today when I updated to autogen studio v0.1.4. Now, every time I restart autogen studio it recreates all of the default skills, models, agents and workflows.

This is quite annoying, especially since if i create anything manually, that is unaffected and persists between restarts, it just refuses to launch without recreating all of the default items.

Steps to reproduce

  1. install latest autogen studio
  2. launch it
  3. delete something or everything in the build tab
  4. restart autogen
  5. see previously deleted item recreated

Model Used

didn't even get this far

Expected Behavior

deleted items should remain deleted

Screenshots and logs

`❯ pip list Package Version


aiohappyeyeballs 2.4.0 aiohttp 3.10.5 aiosignal 1.3.1 alembic 1.13.2 annotated-types 0.7.0 anyio 4.4.0 arxiv 2.1.3 asttokens 2.4.1 attrs 24.2.0 autogenstudio 0.1.4 backoff 2.2.1 beautifulsoup4 4.12.3 cachetools 5.5.0 certifi 2024.7.4 cffi 1.17.0 charset-normalizer 3.3.2 click 8.1.7 contourpy 1.3.0 coolname 2.2.0 cryptography 43.0.0 cycler 0.12.1 decorator 5.1.1 Deprecated 1.2.14 diskcache 5.6.3 distro 1.9.0 docker 7.1.0 docstring_parser 0.16 executing 2.0.1 fastapi 0.112.2 feedparser 6.0.11 FLAML 2.2.0 fonttools 4.53.1 frozendict 2.4.4 frozenlist 1.4.1 google-ai-generativelanguage 0.6.6 google-api-core 2.19.2 google-api-python-client 2.143.0 google-auth 2.34.0 google-auth-httplib2 0.2.0 google-cloud-aiplatform 1.64.0 google-cloud-bigquery 3.25.0 google-cloud-core 2.4.1 google-cloud-resource-manager 1.12.5 google-cloud-storage 2.18.2 google-crc32c 1.5.0 google-generativeai 0.7.2 google-resumable-media 2.7.2 googleapis-common-protos 1.65.0 grpc-google-iam-v1 0.13.1 grpcio 1.66.1 grpcio-status 1.62.3 h11 0.14.0 html5lib 1.1 httpcore 1.0.5 httplib2 0.22.0 httpx 0.27.2 idna 3.8 instructor 1.4.0 ipython 8.26.0 jedi 0.19.1 jiter 0.4.2 kiwisolver 1.4.5 langfuse 2.45.0 langwatch 0.1.24 loguru 0.7.2 lxml 5.3.0 Mako 1.3.5 markdown-it-py 3.0.0 MarkupSafe 2.1.5 matplotlib 3.9.2 matplotlib-inline 0.1.7 mdurl 0.1.2 multidict 6.0.5 multitasking 0.0.11 nanoid 2.0.0 numpy 1.26.4 openai 1.42.0 packaging 23.2 pandas 2.2.2 parso 0.8.4 peewee 3.17.6 pexpect 4.9.0 pillow 10.4.0 pip 24.2 platformdirs 4.2.2 prompt_toolkit 3.0.47 proto-plus 1.24.0 protobuf 4.25.4 psycopg 3.2.1 ptyprocess 0.7.0 pure_eval 0.2.3 py 1.11.0 pyasn1 0.6.0 pyasn1_modules 0.4.0 pyautogen 0.2.35 pycparser 2.22 pydantic 2.8.2 pydantic_core 2.20.1 pygame 2.5.2 PyGithub 2.4.0 Pygments 2.18.0 PyJWT 2.9.0 PyNaCl 1.5.0 pyparsing 3.1.4 python-dateutil 2.9.0.post0 python-dotenv 1.0.1 pytz 2024.1 regex 2024.7.24 requests 2.32.3 retry 0.9.2 rich 13.8.0 rsa 4.9 setuptools 69.5.1 sgmllib3k 1.0.0 shapely 2.0.6 shellingham 1.5.4 six 1.16.0 sniffio 1.3.1 soupsieve 2.6 SQLAlchemy 2.0.32 sqlmodel 0.0.21 stack-data 0.6.3 starlette 0.38.2 tenacity 8.5.0 termcolor 2.4.0 tiktoken 0.7.0 tqdm 4.66.5 traitlets 5.14.3 typer 0.12.5 typing_extensions 4.12.2 tzdata 2024.1 uritemplate 4.1.1 urllib3 2.2.2 uvicorn 0.30.6 wcwidth 0.2.13 webencodings 0.5.1 websockets 13.0.1 wheel 0.43.0 wrapt 1.16.0 yarl 1.9.4 yfinance 0.2.43 ❯ autogenstudio ui 2024-08-29 11:19:04.527 | INFO | autogenstudio.utils.utils:get_db_uri:253 - Using database URI: sqlite:////Users/ian/.autogenstudio/database.sqlite 2024-08-29 11:19:04.528 | INFO | autogenstudio.utils.utils:init_app_folders:288 - Initialized application data folder: /Users/ian/.autogenstudio INFO: Started server process [71799] INFO: Waiting for application startup. App started 2024-08-29 11:19:04.554 | INFO | autogenstudio.database.utils:init_db_samples:150 - Initializing database with Default and Travel Planning Workflows 2024-08-29 11:19:04.593 | INFO | autogenstudio.database.utils:init_db_samples:353 - Successfully initialized database with Default and Travel Planning Workflows INFO: Application startup complete. INFO: Uvicorn running on http://127.0.0.1:8081 (Press CTRL+C to quit) INFO: 127.0.0.1:62102 - "GET /build/ HTTP/1.1" 304 Not Modified INFO: 127.0.0.1:62102 - "GET /build/ HTTP/1.1" 304 Not Modified INFO: 127.0.0.1:62102 - "GET /api/workflows?user_id=guestuser@gmail.com HTTP/1.1" 200 OK INFO: 127.0.0.1:62107 - "GET /api/version HTTP/1.1" 200 OK INFO: 127.0.0.1:62127 - "DELETE /api/workflows/delete?user_id=guestuser@gmail.com&workflow_id=11 HTTP/1.1" 200 OK INFO: 127.0.0.1:62127 - "GET /api/workflows?user_id=guestuser@gmail.com HTTP/1.1" 200 OK INFO: 127.0.0.1:62127 - "DELETE /api/workflows/delete?user_id=guestuser@gmail.com&workflow_id=10 HTTP/1.1" 200 OK INFO: 127.0.0.1:62127 - "GET /api/workflows?user_id=guestuser@gmail.com HTTP/1.1" 200 OK INFO: 127.0.0.1:62156 - "GET /api/agents?user_id=guestuser@gmail.com HTTP/1.1" 200 OK INFO: 127.0.0.1:62156 - "DELETE /api/agents/delete?user_id=guestuser@gmail.com&agent_id=28 HTTP/1.1" 200 OK INFO: 127.0.0.1:62156 - "GET /api/agents?user_id=guestuser@gmail.com HTTP/1.1" 200 OK INFO: 127.0.0.1:62156 - "DELETE /api/agents/delete?user_id=guestuser@gmail.com&agent_id=27 HTTP/1.1" 200 OK INFO: 127.0.0.1:62156 - "GET /api/agents?user_id=guestuser@gmail.com HTTP/1.1" 200 OK INFO: 127.0.0.1:62156 - "DELETE /api/agents/delete?user_id=guestuser@gmail.com&agent_id=29 HTTP/1.1" 200 OK INFO: 127.0.0.1:62156 - "GET /api/agents?user_id=guestuser@gmail.com HTTP/1.1" 200 OK INFO: 127.0.0.1:62156 - "DELETE /api/agents/delete?user_id=guestuser@gmail.com&agent_id=32 HTTP/1.1" 200 OK INFO: 127.0.0.1:62156 - "GET /api/agents?user_id=guestuser@gmail.com HTTP/1.1" 200 OK INFO: 127.0.0.1:62156 - "DELETE /api/agents/delete?user_id=guestuser@gmail.com&agent_id=31 HTTP/1.1" 200 OK INFO: 127.0.0.1:62156 - "GET /api/agents?user_id=guestuser@gmail.com HTTP/1.1" 200 OK INFO: 127.0.0.1:62156 - "DELETE /api/agents/delete?user_id=guestuser@gmail.com&agent_id=30 HTTP/1.1" 200 OK INFO: 127.0.0.1:62156 - "GET /api/agents?user_id=guestuser@gmail.com HTTP/1.1" 200 OK INFO: 127.0.0.1:62171 - "GET /api/models?user_id=guestuser@gmail.com HTTP/1.1" 200 OK INFO: 127.0.0.1:62171 - "DELETE /api/models/delete?user_id=guestuser@gmail.com&model_id=21 HTTP/1.1" 200 OK INFO: 127.0.0.1:62171 - "GET /api/models?user_id=guestuser@gmail.com HTTP/1.1" 200 OK INFO: 127.0.0.1:62171 - "DELETE /api/models/delete?user_id=guestuser@gmail.com&model_id=18 HTTP/1.1" 200 OK INFO: 127.0.0.1:62171 - "GET /api/models?user_id=guestuser@gmail.com HTTP/1.1" 200 OK INFO: 127.0.0.1:62171 - "DELETE /api/models/delete?user_id=guestuser@gmail.com&model_id=20 HTTP/1.1" 200 OK INFO: 127.0.0.1:62171 - "GET /api/models?user_id=guestuser@gmail.com HTTP/1.1" 200 OK INFO: 127.0.0.1:62171 - "DELETE /api/models/delete?user_id=guestuser@gmail.com&model_id=19 HTTP/1.1" 200 OK INFO: 127.0.0.1:62171 - "GET /api/models?user_id=guestuser@gmail.com HTTP/1.1" 200 OK INFO: 127.0.0.1:62171 - "GET /api/skills?user_id=guestuser@gmail.com HTTP/1.1" 200 OK INFO: 127.0.0.1:62171 - "DELETE /api/skills/delete?user_id=guestuser@gmail.com&skill_id=10 HTTP/1.1" 200 OK INFO: 127.0.0.1:62171 - "GET /api/skills?user_id=guestuser@gmail.com HTTP/1.1" 200 OK INFO: 127.0.0.1:62171 - "DELETE /api/skills/delete?user_id=guestuser@gmail.com&skill_id=11 HTTP/1.1" 200 OK INFO: 127.0.0.1:62171 - "GET /api/skills?user_id=guestuser@gmail.com HTTP/1.1" 200 OK ^CINFO: Shutting down INFO: Waiting for application shutdown. App stopped INFO: Application shutdown complete. INFO: Finished server process [71799] ❯ autogenstudio ui 2024-08-29 11:19:35.417 | INFO | autogenstudio.utils.utils:get_db_uri:253 - Using database URI: sqlite:////Users/ian/.autogenstudio/database.sqlite 2024-08-29 11:19:35.417 | INFO | autogenstudio.utils.utils:init_app_folders:288 - Initialized application data folder: /Users/ian/.autogenstudio INFO: Started server process [72835] INFO: Waiting for application startup. App started 2024-08-29 11:19:35.443 | INFO | autogenstudio.database.utils:init_db_samples:150 - Initializing database with Default and Travel Planning Workflows 2024-08-29 11:19:35.490 | INFO | autogenstudio.database.utils:init_db_samples:353 - Successfully initialized database with Default and Travel Planning Workflows INFO: Application startup complete. INFO: Uvicorn running on http://127.0.0.1:8081 (Press CTRL+C to quit) `

Additional Information

No response

oceanzhang2014 commented 2 months ago

I also encountered the same Bug.

davekirby commented 2 months ago

I have this bug too - autogenstudio 0.1.5.

Looking at the code I see that samples/apps/autogen-studio/autogenstudio/database/utils.py:init_db_samples is always executed at startup unless both the "Default Workflow" and "Travel Planning Workflow" already exist. This is bloody annoying if you do not want to use the default workflows, agents etc. It should really only be called if the database is empty. This also means that if you delete either of those workflows then you will get the agents and models duplicated on restart.