422 Unprocessable Entity with playground using default code

I am using the default code to use playground and there are no indicators of reasons of error or resolution steps: 422 implies some input being incorrect. Since I copied the code from phidata hosted sample, I need some insights as how to proceed.

(agent-env) amit@MAC agent % python -m src.playground
DEBUG Debug logs enabled
DEBUG Function: get_current_stock_price registered with yfinance_tools
DEBUG Function: get_company_info registered with yfinance_tools
DEBUG Function: get_analyst_recommendations registered with yfinance_tools
DEBUG Function: get_company_news registered with yfinance_tools
DEBUG *********** Agent ID: 7498d7f8-2898-473e-afa8-db50bc1b210f ***********
DEBUG *********** Session ID: 08fa93f2-fba4-4cd2-b150-28ffb8dcef8f ***********
DEBUG Debug logs enabled
DEBUG --**-- Creating Playground Endpoint
INFO Starting playground on http://localhost:7777
┏━━━━━━━━━━━━━━━━━━━━━━━ Agent Playground ━━━━━━━━━━━━━━━━━━━━━━━━┓
┃ ┃
┃ ┃
┃ URL: ┃
┃ ┃
┃ ┃
┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
INFO: Will watch for changes in these directories: [‘aiproj-py/agent’]
INFO: Uvicorn running on http://localhost:7777 (Press CTRL+C to quit)
INFO: Started reloader process [55074] using WatchFiles
DEBUG Debug logs enabled
DEBUG Function: get_current_stock_price registered with yfinance_tools
DEBUG Function: get_company_info registered with yfinance_tools
DEBUG Function: get_analyst_recommendations registered with yfinance_tools
DEBUG Function: get_company_news registered with yfinance_tools
DEBUG *********** Agent ID: 14372983-c247-4642-ae64-1f9d41ada27c ***********
DEBUG *********** Session ID: b05cd0b2-23d7-4543-a39b-28e37b7c559d ***********
DEBUG Debug logs enabled
DEBUG Function: duckduckgo_search registered with duckduckgo
DEBUG Function: duckduckgo_news registered with duckduckgo
DEBUG *********** Agent ID: 7ff99e90-77c4-437c-91bf-cd3e376f1799 ***********
DEBUG *********** Session ID: 61b6ee2f-58be-4155-a45b-30d79ef75919 ***********
DEBUG Debug logs enabled
DEBUG Function: get_current_stock_price registered with yfinance_tools
DEBUG Function: get_company_info registered with yfinance_tools
DEBUG Function: get_analyst_recommendations registered with yfinance_tools
DEBUG Function: get_company_news registered with yfinance_tools
DEBUG *********** Agent ID: 9429ae20-2feb-4410-840c-14c6bfb1a934 ***********
DEBUG *********** Session ID: f010606c-5e7b-4200-bd65-05f9361f8e1a ***********
DEBUG Debug logs enabled
INFO: Started server process [55130]
INFO: Waiting for application startup.
INFO: Application startup complete.
INFO: 127.0.0.1:57417 - “POST /v1/playground/agent/run HTTP/1.1” 422 Unprocessable Entity

Hi @amit
Thank you for reaching out and using Phidata! I’ve tagged the relevant engineers to assist you with your query. We aim to respond within 48 hours.
If this is urgent, please feel free to let us know, and we’ll do our best to prioritize it.
Thanks for your patience!

Hi @amit
did you get the 422 after doing a request from the playground app?

@Dirk yah I also can confirm the same for default code. It worked about two weeks before. when I try today it is not working.

Log on python end

INFO:     127.0.0.1:53787 - "POST /v1/playground/agent/run HTTP/1.1" 422 Unprocessable Content

Response as logged in Chrome dev console

{
    "detail": [
        {
            "type": "model_attributes_type",
            "loc": [
                "body"
            ],
            "msg": "Input should be a valid dictionary or object to extract fields from",
            "input": "[REMOVED]"
        }
    ]
}

Can you try running your code in a virtual environment? This solved the issue for me (not sure whether you’re already doing this ;))

thanks for the reply.
However I figured the issue. As per my understanding there have been some update in www.phidata.app agent UI, which is not compatible the previous version of sample code. So once I updated it, it is working fine.

pip install -U phidata

updated from 2.7.5 → 2.7.8

I suggest there should be a version check to avoid similar cases.