Action

@Target(allowedTargets = [AnnotationTarget.FUNCTION])
annotation class Action(val description: String = "", val pre: Array<String> = [], val post: Array<String> = [], val canRerun: Boolean = false, val clearBlackboard: Boolean = false, val outputBinding: String = IoBinding.DEFAULT_BINDING, val cost: <Error class: unknown class> = 0.0, val value: <Error class: unknown class> = 0.0, val costMethod: String = "", val valueMethod: String = "", val toolGroups: Array<String> = [], val toolGroupRequirements: Array<ToolGroup> = [], val trigger: KClass<*> = Unit::class)

Annotation to indicate a method implementing an Action. Methods can have any number of parameters, which represent necessary input types. Methods can return any type. The return type will become an effect.

Parameters

description

Description of the action. Less important than for goals as a planner chooses actions based on preconditions and effects rather than by description. The description property is used for documentation purposes, having the advantage over comments that it can appear in logs. Description defaults to name

pre

Preconditions for the action

post

Postconditions for the action

canRerun

can we rerun this action? If false, the action will not be rerun if it has already run in the current process

clearBlackboard

If true, all previous state will be cleared from the blackboard, leaving only the outputs of this action.

outputBinding

Output binding for the action. Only required for a custom binding: a specific variable name for the returned value.

cost

Static cost of executing the action. Ignored if costMethod is specified.

value

Static value of performing the action. Ignored if valueMethod is specified.

costMethod

Name of a @Cost method to compute dynamic cost at planning time. When specified, overrides the static cost field.

valueMethod

Name of a @Cost method to compute dynamic value at planning time. When specified, overrides the static value field.

toolGroups

Tool groups that this action requires. These are well known tools from the server.

toolGroupRequirements

Tool groups required, with explicit metadata such as QoS requirements.

trigger

The type that must be the last result on the blackboard for this action to fire. This enables reactive behavior where an action only fires when a specific type is freshly added, even when multiple parameters of various types are available. Defaults to Unit::class (no trigger). A trigger is an additional precondition: it must be satisfied in addition to any preconditions listed in pre and the action method's input parameters.

Properties

Link copied to clipboard
val canRerun: Boolean = false
Link copied to clipboard
Link copied to clipboard
val cost: <Error class: unknown class> = 0.0
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
val trigger: KClass<*>
Link copied to clipboard
val value: <Error class: unknown class> = 0.0
Link copied to clipboard