# Cannot pass inputs into Flow when using kickoff\_async()

**URL:** <https://community.crewai.com/t/cannot-pass-inputs-into-flow-when-using-kickoff-async/3506>\
**Category:** Crews\
**Tags:** crewai, agent\
**Created:** [February 4, 2025, 11:20am UTC](https://community.crewai.com/t/cannot-pass-inputs-into-flow-when-using-kickoff-async/3506 "2025-02-04T11:20:09Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![sanso\_jonas](https://avatars.discourse-cdn.com/v4/letter/s/9f8e36/32.png) [@sanso\_jonas](https://community.crewai.com/u/sanso_jonas)\
**Post date:** [February 4, 2025, 11:20am UTC](https://community.crewai.com/t/cannot-pass-inputs-into-flow-when-using-kickoff-async/3506/1 "2025-02-04T11:20:09Z")

</div>

I am packaging a crewai Flow into a FastAPI endpoint that I want to run async.

When doing so, the inputs arguments I am giving in kickoff\_async() are not properly passed when the Flow state is initialized.

When I call this endpoint, sentence\_count is properly propagated into the EmailFlow State:

```auto
@app.post("/process_email")
def process_email(
    uuid: str, 
    sentence_count: int
    ):
    try:
        result = EmailFlow().kickoff(inputs={"sentence_count": sentence_count})

```

When I call this **async** endpoint, sentence\_count is **not propagated** into the EmailFlow state:

```auto
@app.post("/process_email")
async def process_email(
    uuid: str, 
    sentence_count: int
    ):
    try:
        result = await EmailFlow().kickoff_async(inputs={"sentence_count": sentence_count})

```

Why are inputs not processed properly in the context of an async call?

---

<div class="post-metadata">

**Author:** ![zinyando](https://sea1.discourse-cdn.com/flex025/user_avatar/community.crewai.com/zinyando/32/4435_2.png) [@zinyando](https://community.crewai.com/u/zinyando)\
**Post date:** [February 5, 2025, 9:42am UTC](https://community.crewai.com/t/cannot-pass-inputs-into-flow-when-using-kickoff-async/3506/2 "2025-02-05T09:42:40Z")

</div>

I have ran into this problem before with a setup similar to yours. I ended up doing this

```auto
class YourFlow(Flow[YourFlowState]):
    def __init__ (self):
        .....
        super(). __init__ ()

    def kickoff_async(self, inputs=None):
        if inputs:
            for key, value in inputs.items():
                if hasattr(self.state, key):
                    setattr(self.state, key, value)

        return super().kickoff_async()

```

This seems to work, try it and let me know how it goes

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex025/uploads/crewai/original/1X/ecda97e72f77c7100e0a761444b1c991925cc789.png) [@system](https://community.crewai.com/u/system)\
**Post date:** [February 13, 2025, 8:51am UTC](https://community.crewai.com/t/cannot-pass-inputs-into-flow-when-using-kickoff-async/3506/3 "2025-02-13T08:51:33Z")

</div>

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.
