Interface Planner
- All Known Implementing Classes:
BDIPlanner, BlackboardPlanner, ConditionalPlanner, DebatePlanner, GoalOrientedPlanner, LoopPlanner, P2PPlanner, ParallelMapperPlanner, ParallelPlanner, SequentialPlanner, SupervisorPlanner, VotingPlanner
public interface Planner
-
Method Summary
Modifier and TypeMethodDescriptiondefault <T extends AgentInstance>
Tas(Class<T> agentInstanceClass, AgentInstance agentInstance) default Actioncall(AgentInstance... agents) Returns an action that invokes the given agents.default Actioncall(List<AgentInstance> agents) Returns an action that invokes the given agents.default Actiondone()Returns an action signaling that the planner has completed with no explicit result.default ActionReturns an action signaling that the planner has completed with the given result.Returns the planner's current execution state as a map of serializable values.default ActionfirstAction(PlanningContext planningContext) Returns the first action to execute when the planner starts (or resumes).default voidinit(InitPlanningContext initPlanningContext) nextAction(PlanningContext planningContext) Determines the next action to execute based on the result of the previous agent invocation.default ActionnoOp()Returns a no-op action that yields control without invoking any agent.default voidrestoreExecutionState(Map<String, Object> state) Restores the planner's execution state from a previously saved map.default Actionsuspend()Returns an action signaling that the agentic system should suspend.default booleanReturnstrueif the planner has reached a terminal state and will not produce further actions.default AgenticSystemTopologytopology()Returns the topology of the agentic system managed by this planner.
-
Method Details
-
init
-
executionState
Returns the planner's current execution state as a map of serializable values. This state is persisted to theAgenticScopeafter each agent invocation, enabling the planner to resume from the correct position after a crash.The returned state must be such that, when passed to
restoreExecutionState(Map)andfirstAction(PlanningContext)is called, the planner produces the correct resume action.Stateless planners (e.g., parallel, conditional) can use the default empty implementation.
- Returns:
- a map of state entries to persist, or an empty map if no state needs saving
-
restoreExecutionState
Restores the planner's execution state from a previously saved map. Called by the execution loop beforefirstAction(PlanningContext)when recovering from a persisted scope.- Parameters:
state- the previously saved execution state
-
firstAction
Returns the first action to execute when the planner starts (or resumes). Defaults to delegating tonextAction(PlanningContext).- Parameters:
planningContext- the current planning context- Returns:
- the first action to execute
-
topology
Returns the topology of the agentic system managed by this planner.- Returns:
- the topology (defaults to
AgenticSystemTopology.SEQUENCE)
-
nextAction
Determines the next action to execute based on the result of the previous agent invocation.- Parameters:
planningContext- the current planning context, including the previous agent's result- Returns:
- the next action to execute
-
terminated
default boolean terminated()Returnstrueif the planner has reached a terminal state and will not produce further actions.- Returns:
trueif the planner is terminated
-
noOp
Returns a no-op action that yields control without invoking any agent.- Returns:
- a no-op action
-
call
Returns an action that invokes the given agents. Multiple agents are dispatched in parallel.- Parameters:
agents- the agents to invoke- Returns:
- an agent call action
-
call
Returns an action that invokes the given agents. Multiple agents are dispatched in parallel.- Parameters:
agents- the agents to invoke- Returns:
- an agent call action
-
done
Returns an action signaling that the planner has completed with no explicit result.- Returns:
- a done action
-
done
-
suspend
Returns an action signaling that the agentic system should suspend. The execution loop will checkpoint the scope state and release the calling thread.- Returns:
- a suspend action
-
as
-