Class WaitAsyncResultsTool

java.lang.Object
io.agentscope.harness.agent.tool.WaitAsyncResultsTool

public class WaitAsyncResultsTool extends Object
Tool that blocks until async results arrive in the session's inbox, or until a timeout is reached. This gives the LLM the option to wait for background results within a single call() invocation instead of returning and relying on a wakeup.

After this tool returns, the next reasoning step's InboxMiddleware will drain the inbox and inject the results into context.

Guardrails prevent unbounded blocking:

  • Timeout is clamped to 120s regardless of the LLM-supplied value.
  • After 2 consecutive timeouts with no results, the tool refuses further blocking waits and directs the LLM to use non-blocking alternatives.
  • Constructor Details

    • WaitAsyncResultsTool

      public WaitAsyncResultsTool(MessageBus messageBus)
    • WaitAsyncResultsTool

      public WaitAsyncResultsTool(MessageBus messageBus, TaskRepository taskRepository)
  • Method Details

    • waitForResults

      @Tool(name="wait_async_results", description="Wait for background async tool or subagent results to arrive. Call this when you have launched async tasks and want to wait for their completion instead of returning to the user. After this tool returns successfully, continue reasoning \u2014 the results will be automatically injected into your context. Max timeout is 120 seconds. If you have already waited without results, use task_list or task_output(block=false) to check status instead of waiting again.", readOnly=true) public String waitForResults(@ToolParam(name="timeout_seconds",description="Maximum seconds to wait. Default 60, max 120. Values above 120 are clamped.") Integer timeoutSeconds, io.agentscope.core.agent.RuntimeContext runtimeContext) throws InterruptedException
      Throws:
      InterruptedException