AgentBuilder

class AgentBuilder(val name: String, val provider: String = "embabel", val version: <Error class: unknown class> = Semver(), val description: String, promptContributors: List<<Error class: unknown class>> = emptyList())

Instances of this are usually created via the convenient agent() function.

Constructors

Link copied to clipboard
constructor(name: String, provider: String = "embabel", version: <Error class: unknown class> = Semver(), description: String, promptContributors: List<<Error class: unknown class>> = emptyList())

Types

Link copied to clipboard
class ConditionDelegate(condition: Condition)
Link copied to clipboard
class ConditionDelegateProvider(specifiedName: String? = null, factory: (name: String) -> Condition, conditions: MutableSet<Condition>)

Properties

Link copied to clipboard
val actions: <Error class: unknown class>
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
open val promptContributors: List<<Error class: unknown class>>
Link copied to clipboard
Link copied to clipboard
val version: <Error class: unknown class>

Functions

Link copied to clipboard
fun action(block: AgentBuilder.() -> Action)

Create an action

Link copied to clipboard
fun add(agentScope: AgentScope)
Link copied to clipboard
fun build(): Agent

Build the agent

Link copied to clipboard
fun condition(block: AgentBuilder.() -> Condition)
fun condition(name: String? = null, cost: <Error class: unknown class> = 0.0, block: ConditionPredicate): AgentBuilder.ConditionDelegateProvider

fun condition(name: String? = null, prompt: (context: OperationContext) -> String, llm: LlmCall = LlmCall()): AgentBuilder.ConditionDelegateProvider

Declare a condition determined with an LLM. Assign it a name to ensure type safe access val myCondition = condition("custom prompt")

Link copied to clipboard
fun flow(block: AgentBuilder.() -> AgentScopeBuilder<*>)

Add a pattern builder, such as an aggregation flow, to the agent. Must be used if you have multiple actions

Link copied to clipboard
fun goal(name: String, description: String, satisfiedBy: KClass<*>? = null, requires: Set<KClass<*>> = if (satisfiedBy != null) { setOf(satisfiedBy) } else { emptySet() }, inputs: Set<IoBinding> = requires.map { IoBinding( // name = it.simpleName, type = it, ) }.toSet(), pre: List<Condition> = emptyList(), value: <Error class: unknown class> = 0.0, export: Export = Export())

Add a goal to the agent.

Link copied to clipboard
inline fun <I, O : Any> localAgentAction(agent: Agent)

Add an action is an anonymous agent. This is valuable because the agent will be private and will not pollute the global action space.

Link copied to clipboard
inline fun <I, O : Any> promptedTransformer(name: String, description: String = name, pre: List<Condition> = emptyList(), post: List<Condition> = emptyList(), inputVarName: String = IoBinding.DEFAULT_BINDING, outputVarName: String = IoBinding.DEFAULT_BINDING, cost: <Error class: unknown class> = 0.0, toolGroups: Set<ToolGroupRequirement> = emptySet(), qos: ActionQos = ActionQos(), referencedInputProperties: Set<String>? = null, llm: <Error class: unknown class> = LlmOptions(), promptContributors: List<<Error class: unknown class>> = emptyList(), canRerun: Boolean = false, toolCallbacks: Collection<<Error class: unknown class>> = emptyList(), noinline prompt: (actionContext: TransformationActionContext<I, O>) -> String)

Add an action that is a transformation using an LLM.

Link copied to clipboard
inline fun <I, O : Any> referencedAgentAction(agentName: String)

Add an action that references the agent with a given name

Link copied to clipboard
fun registerPromptContributors(vararg promptContributors: <Error class: unknown class>)

Require prompt contributors at agent level

Link copied to clipboard
inline fun <I, O : Any> transformation(name: String = "-", description: String = name, preConditions: List<Condition> = emptyList(), pre: List<String> = emptyList(), post: List<Condition> = emptyList(), inputVarName: String = IoBinding.DEFAULT_BINDING, outputVarName: String? = IoBinding.DEFAULT_BINDING, cost: <Error class: unknown class> = 0.0, toolGroups: Set<ToolGroupRequirement> = emptySet(), qos: ActionQos = ActionQos(), referencedInputProperties: Set<String>? = null, block: Transformation<I, O>)

Add an action that is a transformation NOT using an LLM.