# asyncio.exceptions.CancelledError on deployment when runtime reaches 5 minutes +

**URL:** <https://forum.langchain.com/t/asyncio-exceptions-cancellederror-on-deployment-when-runtime-reaches-5-minutes/2840>\
**Category:** LangSmith Product Help\
**Tags:** python-help\
**Created:** [January 30, 2026, 3:48am UTC](https://forum.langchain.com/t/asyncio-exceptions-cancellederror-on-deployment-when-runtime-reaches-5-minutes/2840 "2026-01-30T03:48:05Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![HcDev-Maku](https://yyz1.discourse-cdn.com/flex007/user_avatar/forum.langchain.com/hcdev-maku/32/2279_2.png) [@HcDev-Maku](https://forum.langchain.com/u/HcDev-Maku)\
**Post date:** [January 30, 2026, 3:48am UTC](https://forum.langchain.com/t/asyncio-exceptions-cancellederror-on-deployment-when-runtime-reaches-5-minutes/2840/1 "2026-01-30T03:48:05Z")

</div>

Is there any way to solve this problem? The agent/flow that I designed may usually take 2 minutes or probably 10 minutes for it to finish.

However on langsmith deployment, I always come across this problem “ **asyncio.exceptions.CancelledError”** if it took more than 5 minutes\*\*,\*\* whereas tasks that takes less than 5 minutes doesn’t have much problem.. I’ve also tried doing client.runs.create() as oppose to client.runs.stream(), and adding BG\_JOB\_SHUTDOWN\_GRACE\_PERIOD\_SECS, but I still get the error regardless

I’ve noticed that it somehow finishes the task since it retries it if it encounters that problem, but the tokens are wasted as a result… Really appreciate it if someone could help, thanks!

 ![Screenshot_531](https://canada1.discourse-cdn.com/flex007/uploads/langchain/original/2X/1/121a66ed694f9dca74c24c0be1c37b44fd630b3b.png)

---

<div class="post-metadata">

**Author:** ![keenborder786](https://yyz1.discourse-cdn.com/flex007/user_avatar/forum.langchain.com/keenborder786/32/1757_2.png) [@keenborder786](https://forum.langchain.com/u/keenborder786)\
**Post date:** [March 10, 2026, 3:22pm UTC](https://forum.langchain.com/t/asyncio-exceptions-cancellederror-on-deployment-when-runtime-reaches-5-minutes/2840/2 "2026-03-10T15:22:32Z")

</div>

> [@HcDev-Maku](#):
>
> client.runs.stream(

@HcDev-Maku When you are initiating your [`Langgraph SDK Client`](https://reference.langchain.com/python/langgraph-sdk/_async/client/get_client)Increase the timeout.

Otherwise, rather than directly using the langgraph-sdk, can you try interacting with your Langgraph Deployment using [RemoteGraph](https://docs.langchain.com/langsmith/use-remote-graph?_gl=1*6v2vhh*_gcl_au*ODUwNTUzNzg4LjE3Njc2Mjg2MDk.*_ga*OTg4MjMwMDQxLjE3NTk3OTg3NzI.*_ga_47WX3HKKY2*czE3NzMxNTQ0MzYkbzczJGcxJHQxNzczMTU1ODc1JGo2MCRsMCRoMA..).
