# Wait on EAM Agent Task to complete in script

**URL:** <https://forum.inductiveautomation.com/t/wait-on-eam-agent-task-to-complete-in-script/103506>\
**Category:** Ignition\
**Tags:** ignition81, scripting, python\
**Created:** [March 11, 2025, 1:23pm UTC](https://forum.inductiveautomation.com/t/wait-on-eam-agent-task-to-complete-in-script/103506 "2025-03-11T13:23:32Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sean\_O\_Neil](https://avatars.discourse-cdn.com/v4/letter/s/df788c/32.png) [@Sean\_O\_Neil](https://forum.inductiveautomation.com/u/Sean_O_Neil)\
**Post date:** [March 11, 2025, 1:23pm UTC](https://forum.inductiveautomation.com/t/wait-on-eam-agent-task-to-complete-in-script/103506/1 "2025-03-11T13:23:32Z")

</div>

I have a script on an EAM Controller that triggers a "Collect Backup" agent task using `system.eam.runTask()` and I want to wait until that task completes before executing the next part of the script. Is there any way to do this? I have tried `system.eam.queryAgentHistory()` with no arguments (default) and it returns `None` so it is not helpful.

---

<div class="post-metadata">

**Author:** ![bschroeder](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/bschroeder/32/13260_2.png) [@bschroeder](https://forum.inductiveautomation.com/u/bschroeder)\
**Post date:** [March 11, 2025, 1:29pm UTC](https://forum.inductiveautomation.com/t/wait-on-eam-agent-task-to-complete-in-script/103506/2 "2025-03-11T13:29:37Z")

</div>

Maybe you want to use [system.eam.queryAgentStatus | Ignition User Manual](https://docs.inductiveautomation.com/docs/8.1/appendix/scripting-functions/system-eam/system-eam-queryAgentStatus) instead of queryAgentHistory?

Also, it looks like from the manual [system.eam.runTask | Ignition User Manual](https://docs.inductiveautomation.com/docs/8.1/appendix/scripting-functions/system-eam/system-eam-runTask) returns a UIResponse you might be able to inspect for information.

---

<div class="post-metadata">

**Author:** ![Sean\_O\_Neil](https://avatars.discourse-cdn.com/v4/letter/s/df788c/32.png) [@Sean\_O\_Neil](https://forum.inductiveautomation.com/u/Sean_O_Neil)\
**Post date:** [March 11, 2025, 2:02pm UTC](https://forum.inductiveautomation.com/t/wait-on-eam-agent-task-to-complete-in-script/103506/3 "2025-03-11T14:02:15Z")

</div>

That is a good thought but unfortunately the UIResponse from runTask does not give me any information in the warnings, errors, or info lists when the task successfully completes.  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/d/9/d9dd301ca615092d49947dc587f8623b623fb8fe.png)

`system.eam.queryAgentStatus()` does provide the dataset output that its documentation promises but none of those fields are relevant to the agent's tasks completion. They mostly give general information regarding the general status of the agent gateway.

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [March 11, 2025, 3:13pm UTC](https://forum.inductiveautomation.com/t/wait-on-eam-agent-task-to-complete-in-script/103506/4 "2025-03-11T15:13:54Z")

</div>

There's no (supported) way to get live status of a running task, unfortunately. It would theoretically be possible to do something with the backend by going into unsupported SDK only methods to retrieve task status, but you'll be off in the weeds and I can pretty much guarantee anything you write will be broken in 8.3, so it may not be worth the effort.

---

<div class="post-metadata">

**Author:** ![Sean\_O\_Neil](https://avatars.discourse-cdn.com/v4/letter/s/df788c/32.png) [@Sean\_O\_Neil](https://forum.inductiveautomation.com/u/Sean_O_Neil)\
**Post date:** [March 14, 2025, 7:17pm UTC](https://forum.inductiveautomation.com/t/wait-on-eam-agent-task-to-complete-in-script/103506/5 "2025-03-14T19:17:36Z")

</div>

Thank you, that is helpful to know. I was originally hoping for some java functions easily accessible via Jython but I don't think I'm willing to dive into the SDK for this, especially when it will break upon upgrading to 8.3.

For now, I will either make this backup step a manual part of the process or create a process that waits until a new file is added before continuing.
