Annotation Interface HumanInTheLoop
Marks a method as a human-in-the-loop agent. The method can be invoked to get input or feedback from a human during the execution of a workflow.
The annotated method can have any number of parameters, which will be provided by the workflow context when the method is invoked.
Example:
public interface AudienceRetriever {
@HumanInTheLoop(description = "Generate a story based on the given topic", outputName = "audience", async = true)
static void request(@V("topic") String topic) {
request.set("Which audience for topic " + topic + "?");
}
@HumanInTheLoopResponseSupplier
static String response() {
return System.console().readLine();
}
}
-
Optional Element Summary
Optional ElementsModifier and TypeOptional ElementDescriptionboolean
If true, the agent will be invoked in an asynchronous manner, allowing the workflow to continue without waiting for the agent's result.Description of the agent.Name of the agent.Name of the output variable that will be used to store the result of the agent's invocation.Description of the agent.
-
Element Details
-
name
String nameName of the agent. If not provided, method name will be used.- Returns:
- name of the agent.
- Default:
""
-
value
String valueDescription of the agent. This is an alias of thedescription
attribute, and it is possible to use either. It should be clear and descriptive to allow language model to understand the agent's purpose and its intended use.- Returns:
- description of the agent.
- Default:
""
-
description
String descriptionDescription of the agent. This is an alias of thevalue
attribute, and it is possible to use either. It should be clear and descriptive to allow language model to understand the agent's purpose and its intended use.- Returns:
- description of the agent.
- Default:
""
-
outputName
String outputNameName of the output variable that will be used to store the result of the agent's invocation.- Returns:
- name of the output variable.
- Default:
""
-
async
boolean asyncIf true, the agent will be invoked in an asynchronous manner, allowing the workflow to continue without waiting for the agent's result.- Returns:
- true if the agent should be invoked in an asynchronous manner, false otherwise.
- Default:
false
-