Class SupervisorInvocation
-
- All Implemented Interfaces:
-
com.embabel.agent.api.invocation.BaseInvocation,com.embabel.agent.api.invocation.ScopedInvocation,com.embabel.agent.api.invocation.TypedInvocation
public final class SupervisorInvocation<T extends Object> implements TypedInvocation<T, SupervisorInvocation<T>>, ScopedInvocation<SupervisorInvocation<T>>
Invoker for supervisor-orchestrated agents.
Uses an LLM to orchestrate actions from
@EmbabelComponentand@Agentannotated classes to achieve a specified goal type. The supervisor sees type schemas and decides which actions to call based on available artifacts on the blackboard.Unlike UtilityInvocation, this requires a goal type to work toward.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public classSupervisorInvocation.Companion
-
Field Summary
Fields Modifier and Type Field Description private final Class<T>resultTypepublic final static SupervisorInvocation.CompanionCompanion
-
Constructor Summary
Constructors Constructor Description SupervisorInvocation(AgentPlatform agentPlatform, Class<T> goalType, String goalDescription, ProcessOptions processOptions, AgentScopeBuilder agentScopeBuilder, String agentName)SupervisorInvocation(AgentPlatform agentPlatform, Class<T> goalType, String goalDescription, ProcessOptions processOptions, AgentScopeBuilder agentScopeBuilder)SupervisorInvocation(AgentPlatform agentPlatform, Class<T> goalType, String goalDescription, ProcessOptions processOptions)SupervisorInvocation(AgentPlatform agentPlatform, Class<T> goalType, String goalDescription)SupervisorInvocation(AgentPlatform agentPlatform, Class<T> goalType)
-
Method Summary
Modifier and Type Method Description Class<T>getResultType()SupervisorInvocation<T>withProcessOptions(ProcessOptions options)final <U extends Any> SupervisorInvocation<U>returning(Class<U> resultType)final SupervisorInvocation<T>withGoalDescription(String description)SupervisorInvocation<T>withScope(AgentScopeBuilder agentScopeBuilder)Set the scope of actions and goals. SupervisorInvocation<T>withAgentName(String name)Set a custom name for the created agent. CompletableFuture<AgentProcess>runAsync(Object obj, Object objs)Runs the agent asynchronously with one or more arguments CompletableFuture<AgentProcess>runAsync(Map<String, Object> map)Runs the agent asynchronously with a map of named inputs. final AgentcreateSupervisorAgent()Create a supervisor agent from platform actions. final static <T extends Any> SupervisorInvocation<T>on(AgentPlatform agentPlatform, Class<T> goalType)Create a SupervisorInvocation targeting the specified goal type. final static SupervisorInvocation<Object>on(AgentPlatform agentPlatform)-
Methods inherited from class com.embabel.agent.api.invocation.TypedInvocation
invoke, invoke, invokeAsync, invokeAsync -
Methods inherited from class com.embabel.agent.api.invocation.BaseInvocation
run, run -
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
Constructor Detail
-
SupervisorInvocation
SupervisorInvocation(AgentPlatform agentPlatform, Class<T> goalType, String goalDescription, ProcessOptions processOptions, AgentScopeBuilder agentScopeBuilder, String agentName)
- Parameters:
agentPlatform- the agent platform to create and manage agent processesgoalType- the type of object to produce as the goalgoalDescription- description of the goal for the supervisor LLMprocessOptions- options to configure the agent processagentScopeBuilder- emits the scope to create the supervisor agent in
-
SupervisorInvocation
SupervisorInvocation(AgentPlatform agentPlatform, Class<T> goalType, String goalDescription, ProcessOptions processOptions, AgentScopeBuilder agentScopeBuilder)
- Parameters:
agentPlatform- the agent platform to create and manage agent processesgoalType- the type of object to produce as the goalgoalDescription- description of the goal for the supervisor LLMprocessOptions- options to configure the agent processagentScopeBuilder- emits the scope to create the supervisor agent in
-
SupervisorInvocation
SupervisorInvocation(AgentPlatform agentPlatform, Class<T> goalType, String goalDescription, ProcessOptions processOptions)
- Parameters:
agentPlatform- the agent platform to create and manage agent processesgoalType- the type of object to produce as the goalgoalDescription- description of the goal for the supervisor LLMprocessOptions- options to configure the agent process
-
SupervisorInvocation
SupervisorInvocation(AgentPlatform agentPlatform, Class<T> goalType, String goalDescription)
- Parameters:
agentPlatform- the agent platform to create and manage agent processesgoalType- the type of object to produce as the goalgoalDescription- description of the goal for the supervisor LLM
-
SupervisorInvocation
SupervisorInvocation(AgentPlatform agentPlatform, Class<T> goalType)
- Parameters:
agentPlatform- the agent platform to create and manage agent processesgoalType- the type of object to produce as the goal
-
-
Method Detail
-
getResultType
Class<T> getResultType()
-
withProcessOptions
SupervisorInvocation<T> withProcessOptions(ProcessOptions options)
-
withGoalDescription
final SupervisorInvocation<T> withGoalDescription(String description)
-
withScope
SupervisorInvocation<T> withScope(AgentScopeBuilder agentScopeBuilder)
Set the scope of actions and goals.
-
withAgentName
SupervisorInvocation<T> withAgentName(String name)
Set a custom name for the created agent. If not set, a default name based on the platform will be used.
-
runAsync
CompletableFuture<AgentProcess> runAsync(Object obj, Object objs)
Runs the agent asynchronously with one or more arguments
- Parameters:
obj- the first (and possibly only) input value to be added to the blackboardobjs- additional input values to add to the blackboard- Returns:
the future agent process
-
runAsync
CompletableFuture<AgentProcess> runAsync(Map<String, Object> map)
Runs the agent asynchronously with a map of named inputs.
- Parameters:
map- A Map that initializes the blackboard- Returns:
the future agent process
-
createSupervisorAgent
final Agent createSupervisorAgent()
Create a supervisor agent from platform actions.
This wraps all available actions in a SupervisorAction that uses an LLM to orchestrate them toward the goal.
-
on
final static <T extends Any> SupervisorInvocation<T> on(AgentPlatform agentPlatform, Class<T> goalType)
Create a SupervisorInvocation targeting the specified goal type.
- Parameters:
agentPlatform- the platform containing actions to orchestrategoalType- the type of object to produce
-
on
final static SupervisorInvocation<Object> on(AgentPlatform agentPlatform)
-
-
-
-