Package-level declarations

Types

Link copied to clipboard
abstract class AbstractAwaitable<P : Any, R : AwaitableResponse>(val payload: P, val id: String = UUID.randomUUID().toString(), val timestamp: Instant = Instant.now(), persistent: Boolean = false) : Awaitable<P, R>

Convenient support for implementing Awaitable

Link copied to clipboard

Something awaited by an agent process, such as a request for user input. Added to the Blackboard and treated specially.

Link copied to clipboard
fun interface AwaitableFactory<I : Any, P : Any>

Factory for creating awaitable decisions based on tool execution context.

Link copied to clipboard

Response to an Awaitable

Link copied to clipboard

Not an error, but gets special treatment in the platform. Implements ToolControlFlowSignal so it propagates through com.embabel.agent.api.tool.TypedTool.call.

Link copied to clipboard
abstract class AwaitableTypedTool<I : Any, O : Any, P : Any> constructor(name: String, description: String, inputType: Class<I>, outputType: Class<O>, metadata: Tool.Metadata = Tool.Metadata.DEFAULT, objectMapper: <Error class: unknown class> = jacksonObjectMapper()) : TypedTool<I, O>

Abstract typed tool that supports Human-in-the-Loop (HITL) interactions.

Link copied to clipboard
data class AwaitContext(val input: String, val agentProcess: AgentProcess, val tool: Tool)

Context provided to awaiting decision functions.

Link copied to clipboard
fun interface AwaitDecider

Functional interface for deciding whether to await before tool execution.

Link copied to clipboard
class ConditionalAwaitingTool(val delegate: Tool, decider: AwaitDecider) : DelegatingTool

Tool decorator that conditionally requires awaiting before execution.

Link copied to clipboard
class ConfirmationRequest<P : Any> constructor(payload: P, val message: String, persistent: Boolean = false) : AbstractAwaitable<P, ConfirmationResponse>

Request confirmation from the user before promoting an object to the blackboard. Rejection will hold back a flow.

Link copied to clipboard
data class ConfirmationResponse(val id: String = UUID.randomUUID().toString(), val awaitableId: String, val accepted: Boolean, persistent: Boolean = false, val timestamp: Instant = Instant.now()) : AwaitableResponse
Link copied to clipboard
class ConfirmingTool(val delegate: Tool, messageProvider: (String) -> String) : DelegatingTool

Tool decorator that always requires confirmation before executing the delegate.

Link copied to clipboard
class FormBindingRequest<O : Any> constructor(form: Form, val outputClass: Class<O>, val population: O? = null, val validationErrors: List<ValidationError> = emptyList(), persistent: Boolean = false) : AbstractAwaitable<Form, FormResponse>

Present the user with a form and bind it to the given class

Link copied to clipboard
data class FormResponse(val id: String = UUID.randomUUID().toString(), val awaitableId: String, val formSubmission: FormSubmission, persistent: Boolean = false, val timestamp: Instant = Instant.now()) : AwaitableResponse

Response from the UX

Link copied to clipboard

Response of handling an Awaitable

Link copied to clipboard
class SimpleAwaitableTypedTool<I : Any, O : Any, P : Any> constructor(name: String, description: String, inputType: Class<I>, outputType: Class<O>, awaitableFactory: AwaitableFactory<I, P>, executor: (I) -> O, metadata: Tool.Metadata = Tool.Metadata.DEFAULT, objectMapper: <Error class: unknown class> = jacksonObjectMapper()) : TypedTool<I, O>

Simple implementation of AwaitableTypedTool using functional factories.

Link copied to clipboard
class TypeRequest<T : Any> constructor(val type: Class<T>, val message: String? = null, val hint: T? = null, persistent: Boolean = false) : AbstractAwaitable<Class<T>, TypeResponse<T>>

Request a value of type T from the user.

Link copied to clipboard
class TypeRequestingTool<T : Any>(val delegate: Tool, type: Class<T>, messageProvider: (String) -> String? = { null }) : DelegatingTool

Tool decorator that requires a value of type T from the user before execution.

Link copied to clipboard
data class TypeResponse<T : Any>(val value: T, val awaitableId: String, val id: String = UUID.randomUUID().toString(), val timestamp: Instant = Instant.now(), persistent: Boolean = false) : AwaitableResponse

Response providing a value of the requested type.

Link copied to clipboard
interface ValidationError
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
inline fun <T : Any> Tool.requireType(message: String? = null): Tool

Wrap this tool to require a value of type T before execution (reified).

fun <T : Any> Tool.requireType(type: Class<T>, messageProvider: (String) -> String? = { null }): Tool

Wrap this tool to require a value of type T before execution.

Link copied to clipboard
inline fun <T : Any> typeRequest(message: String? = null, hint: T? = null, persistent: Boolean = false): TypeRequest<T>

Kotlin-friendly factory for creating TypeRequest with reified type.

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.

Link copied to clipboard

Wrap this tool to conditionally await before execution.

Link copied to clipboard
fun Tool.withConfirmation(messageProvider: (String) -> String): Tool

Wrap this tool to always require confirmation before execution.