Package-level declarations

Types

Link copied to clipboard
Annotation that can be added to an @Action method to indicate that its execution achieves a goal See com.embabel.agent.core.Goal for more details.
Link copied to clipboard
@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.

Link copied to clipboard
@Target(allowedTargets = [AnnotationTarget.CLASS])
annotation class Agent(val name: String = "", val provider: String = "", val description: String, val version: String = DEFAULT_VERSION, val planner: PlannerType = PlannerType.GOAP, val scan: Boolean = true, val beanName: String = "", val opaque: Boolean = false)

Indicates that this class is an agent. It doesn't just contribute actions, goals and conditions: it is an agent in itself. This is a Spring stereotype annotation, so annotated classes will be picked up on the classpath and injected Either @Agent or @AgentCapabilities should be used: not both

Link copied to clipboard
@Target(allowedTargets = [AnnotationTarget.CLASS])
annotation class AgentCapabilities(val scan: Boolean = true)
Link copied to clipboard

Not an error, but gets special treatment in the platform.

Link copied to clipboard
@Target(allowedTargets = [AnnotationTarget.FUNCTION])
annotation class Condition(val name: String = "", val cost: <Error class: unknown class> = 0.0)

Annotates a method that evaluates a condition. This will have access to the processContext and also can use any other state.

Link copied to clipboard
@Target(allowedTargets = [AnnotationTarget.FUNCTION])
annotation class Cost(val name: String = "")

Annotates a method that computes the dynamic cost or value of an action at planning time. Similar to @Condition, this method can take domain object parameters from the blackboard. Unlike @Condition, all domain object parameters must be nullable. If a parameter is not available on the blackboard, null will be passed.

Link copied to clipboard
@Target(allowedTargets = [AnnotationTarget.CLASS])
annotation class EmbabelComponent(val scan: Boolean = true)

Indicates that this class exposes actions, goals and conditions that may be used by agents, but is not an agent in itself. This is a Spring stereotype annotation, so annotated classes will be picked up on the classpath and injected

Link copied to clipboard
annotation class Export
How a goal should be exposed
Link copied to clipboard
@Target(allowedTargets = [AnnotationTarget.FUNCTION])
annotation class LlmTool(val name: String = "", val description: String, val returnDirect: Boolean = false)

Marks a method as a tool that can be invoked by an LLM. Use with com.embabel.agent.api.tool.Tool.Companion.fromInstance or com.embabel.agent.api.tool.Tool.Companion.fromMethod to create Tool instances.

Link copied to clipboard
annotation class RequireNameMatch(val value: String = "")

Annotation that can added to parameters of an @Action method to indicate that the parameter name must match the input binding. Otherwise, it can match the latest ("it") value. Must be combined with the outputBinding method on Action for the action producing the input

Link copied to clipboard

Convenience methods for nesting agents for use with annotation model.

Link copied to clipboard
abstract class SpecialReturnException(message: String, val type: Class<*>) : RuntimeException

Superclass for exceptions thrown by special return mechanisms like subagent execution. These exceptions are caught by the agent runtime to handle the special return. Throwing exceptions allows us to retain strong typing in the action method signatures.

Link copied to clipboard
@Target(allowedTargets = [AnnotationTarget.CLASS])
annotation class State

Marks a class representing a state within a flow. States do not trigger subflows but hold a subset of actions. Returning a State from an action indicates a transition to that state and creates the effects of the state's ultimate goals.

Link copied to clipboard
class SubagentExecutionRequest(val instance: Any, val type: Class<*>) : SpecialReturnException

Internal exception to signal sub-agent execution.

Link copied to clipboard
annotation class ToolGroup(val role: String)
Link copied to clipboard
open class WaitFor
Java syntax sugar for HITL

Functions

Link copied to clipboard
fun <P : Any> confirm(what: P, description: String): P
Link copied to clipboard
inline fun <P : Any> fromForm(title: String): P

fun <P : Any> fromForm(title: String? = null, dataClass: Class<P>): P

Bind input to the data class

Link copied to clipboard
fun <P : Any> waitFor(awaitable: Awaitable<P, *>): P

Call when the current AgentProcess should wait for a response from the user.