Interface TaskRepository

All Known Implementing Classes:
DefaultTaskRepository

public interface TaskRepository
Repository for managing background tasks.

Inspired by spring ai TaskRepository, enables the main agent to launch sub-agents in the background and retrieve results later via TaskOutputTool.

Author:
Spring AI Alibaba
  • Method Details

    • getTask

      BackgroundTask getTask(String taskId)
      Get a background task by its ID.
      Parameters:
      taskId - the task identifier
      Returns:
      the background task, or null if not found
    • putTask

      BackgroundTask putTask(String taskId, Supplier<String> taskExecution)
      Add a new background task to the repository.
      Parameters:
      taskId - the task identifier
      taskExecution - the supplier that executes the task and returns its output
      Returns:
      the created background task
    • removeTask

      void removeTask(String taskId)
      Remove a background task from the repository.
      Parameters:
      taskId - the task identifier
    • clear

      void clear()
      Clear all tasks from the repository.