AIAgentService

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

AIAgentService is a core interface for managing AI agents. The service allows creation, removal, and management of AI agents and provides functionalities to list agents based on their statuses.

A single instance of AIAgentService manages one kind of uniform AI Agents serving same purpose and solving the same type of user task. It's useful to create, manage, and track the progress of running agents solving similar user tasks in parallel.

Type Parameters

Input

Type parameter for the input data for the agents.

Output

Type parameter for the output data generated by the agents.

Inheritors

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

AIAgentService is a core interface for managing AI agents. The service allows creation, removal, and management of AI agents and provides functionalities to list agents based on their statuses.

A single instance of AIAgentService manages one kind of uniform AI Agents serving same purpose and solving the same type of user task. It's useful to create, manage, and track the progress of running agents solving similar user tasks in parallel.

Type Parameters

Input

Type parameter for the input data for the agents.

Output

Type parameter for the output data generated by the agents.

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

AIAgentService is a core interface for managing AI agents. The service allows creation, removal, and management of AI agents and provides functionalities to list agents based on their statuses.

A single instance of AIAgentService manages one kind of uniform AI Agents serving same purpose and solving the same type of user task. It's useful to create, manage, and track the progress of running agents solving similar user tasks in parallel.

Type Parameters

Input

Type parameter for the input data for the agents.

Output

Type parameter for the output data generated by the agents.

Constructors

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

Types

Link copied to clipboard
expect object Companion

Companion object that provides factory methods for creating instances of GraphAIAgentService with various configurations.

actual object Companion

Companion object that provides factory methods for creating instances of GraphAIAgentService with various configurations.

actual object Companion

Companion object that provides factory methods for creating instances of GraphAIAgentService with various configurations.

Properties

Link copied to clipboard
expect abstract val agentConfig: AIAgentConfig

Holds the configuration details for an AI agent.

actual abstract val agentConfig: AIAgentConfig

Holds the configuration details for an AI agent.

actual abstract val agentConfig: AIAgentConfig

Holds the configuration details for an AI agent.

Link copied to clipboard
expect abstract val promptExecutor: PromptExecutor

Represents an instance of PromptExecutor responsible for executing prompt-based operations.

actual abstract val promptExecutor: PromptExecutor

Represents an instance of PromptExecutor responsible for executing prompt-based operations.

actual abstract val promptExecutor: PromptExecutor

Represents an instance of PromptExecutor responsible for executing prompt-based operations.

Link copied to clipboard
expect abstract val toolRegistry: ToolRegistry

Represents the central repository or registry for managing tools within the system.

actual abstract val toolRegistry: ToolRegistry

Represents the central repository or registry for managing tools within the system.

actual abstract val toolRegistry: ToolRegistry

Represents the central repository or registry for managing tools within the system.

Functions

Link copied to clipboard
expect abstract suspend fun agentById(id: String): TAgent?

Retrieves an AI agent based on its unique identifier.

actual abstract suspend fun agentById(id: String): TAgent?

Retrieves an AI agent based on its unique identifier.

fun agentById(id: String, executorService: ExecutorService? = null): TAgent?

Fetches an agent by its unique identifier.

actual abstract suspend fun agentById(id: String): TAgent?

Retrieves an AI agent based on its unique identifier.

Link copied to clipboard
expect abstract suspend fun createAgent(id: String? = null, additionalToolRegistry: ToolRegistry = ToolRegistry.EMPTY, agentConfig: AIAgentConfig = this.agentConfig, clock: Clock = Clock.System): TAgent

Creates a new AI agent with the specified configuration, tool registry, and optional parameters.

actual abstract suspend fun createAgent(id: String?, additionalToolRegistry: ERROR CLASS: Symbol not found for ToolRegistry, agentConfig: AIAgentConfig, clock: ERROR CLASS: Symbol not found for Clock): TAgent

fun createAgent(id: String? = null, additionalToolRegistry: ERROR CLASS: Symbol not found for ToolRegistry = ToolRegistry.EMPTY, agentConfig: AIAgentConfig = this.agentConfig, executorService: ExecutorService? = null, clock: ERROR CLASS: Symbol not found for Clock = Clock.System): TAgent

Creates a new agent with the specified configuration and settings.

actual abstract suspend fun createAgent(id: String?, additionalToolRegistry: ToolRegistry, agentConfig: AIAgentConfig, clock: Clock): TAgent

Creates a new AI agent with the specified configuration, tool registry, and optional parameters.

Link copied to clipboard
expect abstract suspend fun createAgentAndRun(agentInput: Input, id: String? = null, additionalToolRegistry: ToolRegistry = this.toolRegistry, agentConfig: AIAgentConfig = this.agentConfig, clock: Clock = Clock.System): Output

Creates an AI agent with the specified configuration and runs it using the provided input.

actual abstract suspend fun createAgentAndRun(agentInput: Input, id: String?, additionalToolRegistry: ERROR CLASS: Symbol not found for ToolRegistry, agentConfig: AIAgentConfig, clock: ERROR CLASS: Symbol not found for Clock): Output

fun createAgentAndRun(agentInput: Input, id: String?, additionalToolRegistry: ERROR CLASS: Symbol not found for ToolRegistry = ToolRegistry.EMPTY, agentConfig: AIAgentConfig = this.agentConfig, executorService: ExecutorService? = null, clock: ERROR CLASS: Symbol not found for Clock): Output

Creates an AI agent using the specified parameters and immediately runs it with the provided input.

actual abstract suspend fun createAgentAndRun(agentInput: Input, id: String?, additionalToolRegistry: ToolRegistry, agentConfig: AIAgentConfig, clock: Clock): Output

Creates an AI agent with the specified configuration and runs it using the provided input.

Link copied to clipboard
inline fun <Input, Output> AIAgentService<Input, Output, *>.createAgentTool(agentName: String, agentDescription: String, inputDescription: String? = null, inputType: TypeToken = typeToken<Input>(), outputType: TypeToken = typeToken<Output>(), parentAgentId: String? = null, clock: Clock = Clock.System): Tool<AIAgentTool.AgentToolInput<Input>, AIAgentTool.AgentToolResult<Output>>
inline fun <Input, Output> AIAgentService<Input, Output, *>.createAgentTool(agentName: String, agentDescription: String, inputDescription: String? = null, inputSerializer: KSerializer<Input>, outputSerializer: KSerializer<Output>, parentAgentId: String? = null, clock: Clock = Clock.System): Tool<AIAgentTool.AgentToolInput<Input>, AIAgentTool.AgentToolResult<Output>>

Creates an AIAgent and converts it to a Tool that can be used by other AI Agents.

Link copied to clipboard
fun listActiveAgents(executorService: ExecutorService? = null): List<TAgent>

Lists all currently active agents using the configured strategy dispatcher.

Link copied to clipboard
fun listFinishedAgents(executorService: ExecutorService? = null): List<TAgent>

Retrieves a list of finished agents.

Link copied to clipboard
fun listInactiveAgents(executorService: ExecutorService? = null): List<TAgent>

Retrieves a list of all inactive agents.

Link copied to clipboard
expect abstract suspend fun removeAgent(agent: TAgent): Boolean

Removes the specified AI agent from the service.

actual abstract suspend fun removeAgent(agent: TAgent): Boolean

Removes the specified AI agent from the service.

fun removeAgent(agent: TAgent, executorService: ExecutorService? = null): Boolean

Removes the specified agent from the system.

actual abstract suspend fun removeAgent(agent: TAgent): Boolean

Removes the specified AI agent from the service.

Link copied to clipboard
expect abstract suspend fun removeAgentWithId(id: String): Boolean

Removes an AI agent based on its unique identifier.

actual abstract suspend fun removeAgentWithId(id: String): Boolean

Removes an AI agent based on its unique identifier.

fun removeAgentWithId(id: String, executorService: ExecutorService? = null): Boolean

Removes an agent identified by the provided ID.

actual abstract suspend fun removeAgentWithId(id: String): Boolean

Removes an AI agent based on its unique identifier.