Hello all, I am looking for guidance on how to pro...
# koog-agentic-framework
j
Hello all, I am looking for guidance on how to proceed with a bug/feature-request/contribution. In my project, I have a need for a tool argument with a recursive tree-like data structure (essentially a
Node
class with a
children: List<Node>
property). Currently, this kind of tool argument raises a
StackOverflowError
in Koog's internals. I have just now reported this as a bug in YouTrack, but I am also posting here because I am interested in contributing support for recursive data structures in tool arguments using JSON Schema's defs and refs. See the "Recursive schemas are supported" example in OpenAI's docs. https://developers.openai.com/api/docs/guides/structured-outputs I have already used Codex to build a proof-of-concept implementation of this functionality, which is working well for my project's use cases and passes existing tests and new tests which I wrote by hand. If there is interest in this feature and it isn't already being worked on, I would be happy for the opportunity to contribute with a proper pull request after significant manual refinement of the prototype implementation and coordination on design/requirements. Just to be clear, I have been programming professionally in Kotlin since it was in beta, I just used Codex here as a starting point 🙂 The proof-of-concept implementation only pulls types out into a def if the type is either used recursively, or is simply referenced by multiple fields within a tool. Otherwise, the resulting JSON Schemas continue to use inline type definitions as before. My intent here was to minimize change of behavior for existing tool definitions (though continuing to inline for the case where a type is used by multiple fields, but not recursively, would further minimize change of behavior). To the best of my understanding, implementing support for recursive data structures in tool arg schemas requires changes both to model-agnostic and model-specific areas of the Koog codebase, so the change set is quite large (~1.2k lines across 25 files). My proof-of-concept commit is visible here: https://github.com/jshmrsn/koog/commit/d093b6d3ba53b4df807dd3dc12d04dc2e8a3e792 See RecursiveDataStructureArgumentTool / testRecursiveDataStructureArgumentTool for my hand-written test which I used to verify the stack overflow error outside of my project. Here is the YouTrack issue I created: https://youtrack.jetbrains.com/projects/KG/issues/KG-783/StackOverflowError-in-Koog-internals-if-tool-argument-type-is-a-recursive-data-structure Thank you for your time and consideration.