Greetings, I'm trying to rewrite <this course pyth...
# koog-agentic-framework
r
Greetings, I'm trying to rewrite this course python code into
koog
. It is based on "agents", which are basically "nodes" in our case with shared context(thanks JetBrains <3). I'm stuck writing one node that accepts
researchBrief
and should call one tool(tavily-search). I've used
requestLLMForceOnetool
, however the result is just a query to tool call, and I'm expecting the result of web search itself. Am I missing something? Should I
forwardTo
nodeLLMRequest
? link to code
a
Hi Stanislav, there's no need to forward the node to
nodeLLMRequest
, as
requestLLMForceOneTool
is a request itself. You need to process the received response, like this:
Copy code
llm.writeSession {
            updatePrompt {
                system(researchQuestion.researchBrief)
            }
            val response = requestLLMForceOneTool(tavilySearchTool)
        }
    if (response is Message.Tool.Call) {
        // Handle tool call, e.g. with nodeExecuteTool() and then nodeLLMSendToolResult()
    } else {
        // Handle text response
    }
}
Hope this answers your question!
❤️ 1
r
Total success, thank you 🙂 I missed the concept of filtering
Message.Respone
for it to be either
Tool.Call
or not
🙌 1
a
Happy to help! 🙂
r
Viva open-source and community! 🙂
kodee loving 1