Interface AgentProcess

  • All Implemented Interfaces:
    com.embabel.agent.core.Bindable , com.embabel.agent.core.Blackboard , com.embabel.agent.core.LlmInvocationHistory , com.embabel.agent.core.MayHaveLastResult , com.embabel.agent.core.OperationStatus , com.embabel.common.core.types.HasInfoString , com.embabel.common.core.types.Timed , com.embabel.common.core.types.Timestamped

    
    public interface AgentProcess
     implements Blackboard, Timestamped, Timed, OperationStatus<AgentProcessStatusCode>, LlmInvocationHistory
                        

    Run of an agent

    • Field Summary

      Fields 
      Modifier and Type Field Description
    • Constructor Summary

      Constructors 
      Constructor Description
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • Method Summary

      Modifier and Type Method Description
      AgentProcessStatusReport statusReport() Return a serializable status report for this process.
      abstract ProcessKilledEvent kill() Kill this process and return an event describing the kill if we are successful
      abstract Unit recordLlmInvocation(LlmInvocation llmInvocation)
      abstract AgentProcess tick() Perform the next step only.
      abstract AgentProcess run() Run the process as far as we can.
      <O extends Any> O resultOfType(Class<O> outputClass)
      Object getValue(String variable, String type) Get a variable value.
      abstract String getId() Unique id of this process.
      abstract Blackboard getBlackboard() The blackboard for this process.
      abstract String getParentId() ID of the parent AgentProcess, if any.
      abstract ProcessOptions getProcessOptions() Options this process was started with
      abstract Planner<?, ?, ?> getPlanner() Get the planner for this process
      abstract List<ActionInvocation> getHistory() History of actions taken by this process
      abstract Goal getGoal() Goal of this process.
      Boolean getFinished()
      abstract Object getFailureInfo() If we failed, this may contain the reason for the failure.
      abstract WorldState getLastWorldState() The last world state that was used to plan the next action Will be non-null if the process is running
      abstract ProcessContext getProcessContext()
      abstract Agent getAgent() The agent that this process is running.
      Duration getRunningTime()
      • Methods inherited from class com.embabel.agent.core.Blackboard

        clear, count, expressionEvaluationModel, get, getBlackboardId, getCondition, getObjects, getOrPut, getValue, hasValue, hide, last, lastResult, objectsOfType, setCondition, spawn
      • Methods inherited from class com.embabel.agent.core.Bindable

        addAll, addObject, bind, bindAll, bindProtected, plusAssign, plusAssign, plusAssign, set
      • Methods inherited from class com.embabel.common.core.types.HasInfoString

        infoString
      • Methods inherited from class com.embabel.common.core.types.Timestamped

        getTimestamp, isLaterThan
      • Methods inherited from class com.embabel.agent.core.LlmInvocationHistory

        cost, costInfoString, getLlmInvocations, getToolsStats, modelsUsed, usage
      • Methods inherited from class com.embabel.agent.core.OperationStatus

        getStatus
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

    • Method Detail

      • kill

         abstract ProcessKilledEvent kill()

        Kill this process and return an event describing the kill if we are successful

      • tick

         abstract AgentProcess tick()

        Perform the next step only. Return when an action has been completed and the process is ready to plan, regardless of the result of the action.

        Returns:

        status code of the action. Side effects may have occurred in Blackboard

      • run

         abstract AgentProcess run()

        Run the process as far as we can. Might complete, fail, get stuck or hit a waiting state. This is a slow operation. We may wish to run this async. Events will be emitted as the process runs, so we can track progress.

        Returns:

        status code of the process. Side effects may have occurred in Blackboard

      • getValue

         Object getValue(String variable, String type)

        Get a variable value. Handles "it" default type specially, because it could be an "it" of different variables, defined as the most recently added entry.

      • getId

         abstract String getId()

        Unique id of this process. Set on creation.

      • getBlackboard

         abstract Blackboard getBlackboard()

        The blackboard for this process. Implementations should delegate to it to implement the Blackboard interface for convenience, but explicitly separating it simplifies persistence.

      • getGoal

         abstract Goal getGoal()

        Goal of this process. Utility processes may not have a goal.

      • getFailureInfo

         abstract Object getFailureInfo()

        If we failed, this may contain the reason for the failure.

      • getLastWorldState

         abstract WorldState getLastWorldState()

        The last world state that was used to plan the next action Will be non-null if the process is running

      • getAgent

         abstract Agent getAgent()

        The agent that this process is running. Many processes can run the same agent.