aiAgent

suspend fun <Input, Output> RoutingContext.aiAgent(inputType: KType, outputType: KType, strategy: AIAgentGraphStrategy<Input, Output>, model: LLModel, tools: ToolRegistry = ToolRegistry.EMPTY): AIAgent<Input, Output>(source)
inline suspend fun <Input, Output> RoutingContext.aiAgent(strategy: AIAgentGraphStrategy<Input, Output>, model: LLModel, tools: ToolRegistry = ToolRegistry.EMPTY): AIAgent<Input, Output>(source)
inline suspend fun <Input, Output, Result> RoutingContext.aiAgent(strategy: AIAgentGraphStrategy<Input, Output>, model: LLModel, block: suspend (agent: AIAgent<Input, Output>) -> Result): Result(source)

Creates an AI agent using the provided AI agent strategy within the specified route.

Return

An instance of AIAgent configured with the specified strategy and the route's resources.

Parameters

Input

The type of input data for the AI agent.

Output

The type of output data for the AI agent.

strategy

The AI agent strategy defining the workflow and execution logic of the agent.

Throws

If the agent configuration (agentConfig) is not set in the route.


inline suspend fun <Input, Output> RoutingContext.aiAgent(strategy: AIAgentGraphStrategy<Input, Output>, model: LLModel, input: Input): Output(source)

Creates an agent using aiAgent, and immediately runs it given the input. When the agent is completed it provides the final Output.


suspend fun <Result> RoutingContext.aiAgent(runMode: ToolCalls = ToolCalls.SINGLE_RUN_SEQUENTIAL, model: LLModel, block: suspend (agent: AIAgent<String, String>) -> Result): Result(source)

A default aiAgent is an agent that runs using singleRunStrategy, by default, it relies on sequential ToolCalls. Inside the block lambda you can use the agent to perform tasks, and calculate a result, such as GraphAIAgent.run.


suspend fun RoutingContext.aiAgent(input: String, model: LLModel, runMode: ToolCalls = ToolCalls.SINGLE_RUN_SEQUENTIAL): String(source)

A default aiAgent is an agent that runs using singleRunStrategy, by default, it relies on sequential ToolCalls. It takes an input, and when the agent finishes running provides a final result String.