AbstractAgentProcess

abstract class AbstractAgentProcess(val id: String, val parentId: String?, val agent: Agent, processOptions: ProcessOptions, blackboard: Blackboard, platformServices: PlatformServices, val timestamp: Instant = Instant.now()) : AgentProcess, Blackboard

Abstract implementation of AgentProcess that provides common functionality

Constructors

Link copied to clipboard
constructor(id: String, parentId: String?, agent: Agent, processOptions: ProcessOptions, blackboard: Blackboard, platformServices: PlatformServices, timestamp: Instant = Instant.now())

Properties

Link copied to clipboard
open override val agent: Agent

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

Link copied to clipboard
open override val blackboardId: String

Unique identifier of this blackboard. Blackboard doesn't extend StableIdentified to avoid conflict with implementations that are otherwise identified

Link copied to clipboard
open override val failureInfo: Any?

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

Link copied to clipboard
open override val goal: Goal?

Goal of this process.

Link copied to clipboard
open override val history: List<ActionInvocation>
Link copied to clipboard
open override val id: String

Unique id of this process

Link copied to clipboard
open override val lastWorldState: WorldState?

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

Link copied to clipboard
Link copied to clipboard
open override val objects: List<Any>

Entries in the order they were added. The default instance of any type is the last one Objects are immutable and may not be removed.

Link copied to clipboard
open override val parentId: String?
Link copied to clipboard
abstract val planner: Planner<*, *, *>

Get the planner for this process

Link copied to clipboard
open override val processContext: ProcessContext
Link copied to clipboard

How long this process has been running

Link copied to clipboard
open override val status: AgentProcessStatusCode

Status of this operation

Link copied to clipboard
open val timestamp: Instant
Link copied to clipboard
open override val toolsStats: ToolsStats

Functions

Link copied to clipboard
open override fun addAll(objects: List<Any>)
Link copied to clipboard
open override fun addObject(value: Any): Bindable

Add to entries without binding to a variable name. Implementations must respect the order in which entities were added. This is equivalent to using the default binding name as the key. For example, if you add a Dog to the blackboard without a key, it will be bound to the default binding name "it" and will be the last entry in the list of objects. Equivalent:

Link copied to clipboard
inline fun <T> Blackboard.all(): List<T>

Return all entries of a specific type

fun <T> Blackboard.all(clazz: Class<T>): List<T>
Link copied to clipboard
open override fun bind(key: String, value: Any): Bindable
Link copied to clipboard
open override fun bindAll(bindings: Map<String, Any>)
Link copied to clipboard
open fun cost(): Double
Link copied to clipboard
open fun costInfoString(verbose: Boolean): String
Link copied to clipboard
open override fun <T> count(clazz: Class<T>): Int
Link copied to clipboard
inline fun <T> Blackboard.count(): Int

Count entries of the given type

Link copied to clipboard
open override fun expressionEvaluationModel(): Map<String, Any>

Expose the model data for use in prompts Prefer more strongly typed usage patterns

Link copied to clipboard
open operator override fun get(name: String): Any?

Return the value of a variable, if it is set. Does not limit return via type information.

Link copied to clipboard
open override fun getCondition(key: String): Boolean?
Link copied to clipboard
open override fun getValue(variable: String, type: String, dataDictionary: DataDictionary): Any?

Resolve the value of a variable, if it is set. Resolve superclasses For example, getValue("it", "Animal") will match a Dog if Dog extends Animal

Link copied to clipboard
open override fun kill(): ProcessKilledEvent?

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

Link copied to clipboard
open override fun <T> last(clazz: Class<T>): T?

Last entry of the given type, if there is one

Link copied to clipboard
inline fun <T> Blackboard.last(): T?

Last entry of the given type, if there is one

Link copied to clipboard
inline fun <T> Blackboard.lastOrNull(predicate: (t: T) -> Boolean): T?
fun <T> Blackboard.lastOrNull(clazz: Class<T>, predicate: (t: T) -> Boolean): T?
Link copied to clipboard
open override fun lastResult(): Any?

Last result, of any type, if there is one.

Link copied to clipboard
open fun modelsUsed(): List<<Error class: unknown class>>

Distinct list of LLMs use, sorted by name.

Link copied to clipboard
open operator override fun plusAssign(pair: <Error class: unknown class><String, Any>)
open operator override fun plusAssign(value: Any)
Link copied to clipboard
abstract fun recordLlmInvocation(llmInvocation: LlmInvocation)
Link copied to clipboard
open fun <O> resultOfType(outputClass: Class<O>): O
Link copied to clipboard
inline fun <O> AgentProcess.resultOfType(): O

Convenience function to get the result of a specific type

Link copied to clipboard
open override fun run(): AgentProcess

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.

Link copied to clipboard
open operator override fun set(key: String, value: Any)

Bind a value to a name

Link copied to clipboard
open override fun setCondition(key: String, value: Boolean): Blackboard

Explicitly set the condition value Used in planning.

Link copied to clipboard
open override fun spawn(): Blackboard

Spawn an independent child blackboard based on the content of this

Link copied to clipboard

Return a serializable status report for this process.

Link copied to clipboard
open override fun tick(): AgentProcess

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.

Link copied to clipboard
open fun usage(): <Error class: unknown class>

Note that this is not apples to apples: The usage may be across different LLMs, and the cost may be different. Cost will correctly reflect this. Look in the list for more details about what tokens were spent where.