Not able to call action server using rasa-sdk

I am using rasa as python library so i have loaded model by creating agent like this

ACTION_ENDPOINT = "http://localhost:8082/api/v1/webhook"
 agent = Agent.load(
               model_path,
               action_endpoint=EndpointConfig(ACTION_ENDPOINT)
)

and I have exposed my actions webhook like this

@router.post("/webhook")
async def webhook(request):
    """Webhook to retrieve action calls."""
    actionCall = await request.json()
    try:
        response = await executor.run(actionCall)
    except ActionExecutionRejection as e:
        response = {"error": str(e), "action_name": e.action_name}
        response.status_code = 400
        return response
    return JSONResponse(response)

what when i use

queryResponseList = await agent.handle_text(query)

it shows

INFO: 127.0.0.1:60254 - "POST /api/v1/webhook HTTP/1.1" 422 Unprocessable Entity

what could be the issue and how can i solve this?

Why aren’t you running an action server via rasa run ?

i will try that too, is it possible by this mean?

Here’s a tutorial on the standard flow for custom actions: Simple Introduction to Custom Actions | Rasa Tutorial - YouTube

I am using FastAPI, if I use Any or omit the data type it expects the passed param as a query param, but rasa handle_text calls the api with certain object, so it was showing 422.

So I defined the proper data type of reqeuest object and it worked

async def webhook(request: ActionCall):

and somehow it was not taking rasa’s ActionCall object , so i created like this

class ActionCall(BaseModel):
    """
    A dictionary representation of an action to be executed.
    """
    # the name of the next action to be executed
    next_action: Optional[Text]
    # id of the source of the messages
    sender_id: Text
    # current dictionary representation of the state of a conversation
    tracker: Dict
    # dictionary representation of the domain
    domain: Dict
    # rasa version
    version: Text

then only it worked