Description
The current async agent example showcases the basic usage of AgentCore async task management capability. It demonstrate the use of addAsyncTask and completeAsyncTask which effectively update the agent ping state from Healthy to HealthyBusy. These work very well for non-blocking I/O tasks in nodejs event loop.
This new example will demonstrate how you can use define a tool that will spawn a new thread and use message passing to notify AsyncTask completion. This is beneficial for CPU-blocking operation using a separate thread to keep the agent responding even while doing a CPU blocking operation (e.g. analyzing a file or resizing an image).
Use case
This new example will demonstrate the use of CPU-blocking operation using a separate thread to keep the agent responding even while doing a CPU blocking operation (e.g. analyzing a file or resizing an image).
Description
The current async agent example showcases the basic usage of AgentCore async task management capability. It demonstrate the use of addAsyncTask and completeAsyncTask which effectively update the agent ping state from Healthy to HealthyBusy. These work very well for non-blocking I/O tasks in nodejs event loop.
This new example will demonstrate how you can use define a tool that will spawn a new thread and use message passing to notify AsyncTask completion. This is beneficial for CPU-blocking operation using a separate thread to keep the agent responding even while doing a CPU blocking operation (e.g. analyzing a file or resizing an image).
Use case
This new example will demonstrate the use of CPU-blocking operation using a separate thread to keep the agent responding even while doing a CPU blocking operation (e.g. analyzing a file or resizing an image).