# Not able to call action server using rasa-sdk

**URL:** <https://forum.rasa.com/t/not-able-to-call-action-server-using-rasa-sdk/46723>\
**Category:** Rasa Open Source\
**Created:** [August 10, 2021, 12:16pm UTC](https://forum.rasa.com/t/not-able-to-call-action-server-using-rasa-sdk/46723 "2021-08-10T12:16:00Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![ermarkar](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/ermarkar/32/13716_2.png) [@ermarkar](https://forum.rasa.com/u/ermarkar)\
**Post date:** [August 10, 2021, 12:16pm UTC](https://forum.rasa.com/t/not-able-to-call-action-server-using-rasa-sdk/46723/1 "2021-08-10T12:16:00Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![koaning](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/koaning/32/6626_2.png) [@koaning](https://forum.rasa.com/u/koaning)\
**Post date:** [August 10, 2021, 1:16pm UTC](https://forum.rasa.com/t/not-able-to-call-action-server-using-rasa-sdk/46723/2 "2021-08-10T13:16:57Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![ermarkar](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/ermarkar/32/13716_2.png) [@ermarkar](https://forum.rasa.com/u/ermarkar)\
**Post date:** [August 11, 2021, 4:41am UTC](https://forum.rasa.com/t/not-able-to-call-action-server-using-rasa-sdk/46723/3 "2021-08-11T04:41:34Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![koaning](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/koaning/32/6626_2.png) [@koaning](https://forum.rasa.com/u/koaning)\
**Post date:** [August 11, 2021, 7:59am UTC](https://forum.rasa.com/t/not-able-to-call-action-server-using-rasa-sdk/46723/4 "2021-08-11T07:59:01Z")

</div>

Here’s a tutorial on the standard flow for custom actions: [Simple Introduction to Custom Actions | Rasa Tutorial - YouTube](https://www.youtube.com/watch?v=rvHg7N8ux2I&t=3s/)

---

<div class="post-metadata">

**Author:** ![ermarkar](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/ermarkar/32/13716_2.png) [@ermarkar](https://forum.rasa.com/u/ermarkar)\
**Post date:** [August 11, 2021, 1:51pm UTC](https://forum.rasa.com/t/not-able-to-call-action-server-using-rasa-sdk/46723/5 "2021-08-11T13:51:55Z")

</div>

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
