AIAgent

expect abstract class AIAgent<Input, Output> : Closeable(source)

Represents a basic interface for AI agent.

Inheritors

actual abstract class AIAgent<Input, Output> : Closeable(source)
actual abstract class AIAgent<Input, Output> : Closeable(source)

Constructors

Link copied to clipboard
expect constructor()
constructor()
constructor()

Types

Link copied to clipboard
expect object Companion

The companion object for the AIAgent class, providing functionality to instantiate an AI agent with a flexible configuration, input/output types, and execution strategy.

actual object Companion
actual object Companion

Properties

Link copied to clipboard
expect abstract val agentConfig: AIAgentConfig

The configuration for the AI agent.

actual abstract val agentConfig: AIAgentConfig
actual abstract val agentConfig: AIAgentConfig
Link copied to clipboard
expect abstract val id: String

Represents the unique identifier for the AI agent.

actual abstract val id: String
actual abstract val id: String

Functions

Link copied to clipboard
inline fun <Input, Output> AIAgent<Input, Output>.asTool(agentName: String, agentDescription: String, inputDescription: String? = null, inputSerializer: KSerializer<Input> = serializer(), outputSerializer: KSerializer<Output> = serializer(), json: Json = Json.Default): Tool<Input, AIAgentTool.AgentToolResult<Output>>

Converts the current AI agent into a tool to allow using it in other agents as a tool.

Link copied to clipboard
abstract suspend fun close()
abstract suspend fun close()
abstract suspend fun close()
Link copied to clipboard
expect abstract fun createSession(sessionId: String? = null): AIAgentRunSession<Input, Output, out AIAgentContext>

Creates a new session for executing the agent with the given input.

actual abstract fun createSession(sessionId: String?): AIAgentRunSession<Input, Output, out AIAgentContext>
actual abstract fun createSession(sessionId: String?): AIAgentRunSession<Input, Output, out AIAgentContext>
Link copied to clipboard
fun javaNonSuspendRun(agentInput: Input, sessionId: String? = null, executorService: ERROR CLASS: Symbol not found for ExecutorService?? = null): Output

Executes the AI agent task based on the provided input and an optional executor service.

Link copied to clipboard
expect abstract suspend fun run(agentInput: Input, sessionId: String? = null): Output

Executes the AI agent with the given input and retrieves the resulting output.

actual abstract suspend fun run(agentInput: Input, sessionId: String?): Output
actual abstract suspend fun run(agentInput: Input, sessionId: String?): Output