in server/src/main/kotlin/ai/koog/book/agent/Agent.kt [35:61]
suspend fun execute(cookingRequest: String, onAgentEvent: suspend (Message) -> Unit): String? {
val agentConfig = AIAgentConfig(
prompt = prompt("cook_agent_system_prompt") {
},
model = OpenAIModels.Chat.GPT4o,
maxAgentIterations = 100
)
val executor = SingleLLMPromptExecutor(OpenAILLMClient(apiKey = token))
val strategy = strategy("cook agent strategy") { }
val agent = AIAgent(
promptExecutor = executor,
strategy = strategy,
agentConfig = agentConfig,
toolRegistry = ToolRegistry { },
installFeatures = { configureFeatures(onAgentEvent) }
)
val agentResult = agent.runAndGetResult(cookingRequest)
logger.info("Agent finished with result: $agentResult")
return agentResult
}