-
Notifications
You must be signed in to change notification settings - Fork 298
KG-597: Fix serialization crashes and optimize content parsing #1329
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
KG-597: Fix serialization crashes and optimize content parsing #1329
Conversation
6d96ea0 to
fd79c50
Compare
fd79c50 to
9f5bada
Compare
EugeneTheDev
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you, generally looks good, a few comments
...nts-core/src/commonMain/kotlin/ai/koog/agents/core/environment/ContextualAgentEnvironment.kt
Outdated
Show resolved
Hide resolved
prompt/prompt-model/src/commonMain/kotlin/ai/koog/prompt/message/Message.kt
Show resolved
Hide resolved
prompt/prompt-model/src/commonMain/kotlin/ai/koog/prompt/streaming/StreamFrame.kt
Outdated
Show resolved
Hide resolved
.../koog/prompt/executor/clients/bedrock/modelfamilies/amazon/BedrockAmazonNovaSerialization.kt
Show resolved
Hide resolved
EugeneTheDev
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've also noticed a number of wrong imports, can you please fix these? Other than that looks good
| import ai.koog.agents.core.tools.Tool | ||
| import ai.koog.prompt.message.ContentPart | ||
| import ai.koog.prompt.message.Message | ||
| import io.ktor.utils.io.CancellationException |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: wrong CancellationException
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch, I missed those. Fixed them in the latest commit!
| import ai.koog.agents.core.feature.model.toAgentError | ||
| import ai.koog.prompt.message.Message | ||
| import io.github.oshai.kotlinlogging.KotlinLogging | ||
| import io.ktor.utils.io.CancellationException |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: wrong CancellationException
| import ai.koog.prompt.message.Message | ||
| import ai.koog.prompt.params.LLMParams | ||
| import ai.koog.prompt.processor.ResponseProcessor | ||
| import io.ktor.utils.io.CancellationException |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: wrong CancellationException
| import ai.koog.agents.snapshot.providers.PersistenceStorageProvider | ||
| import ai.koog.prompt.message.Message | ||
| import io.github.oshai.kotlinlogging.KotlinLogging | ||
| import io.ktor.utils.io.CancellationException |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: wrong CancellationException
| import io.ktor.server.engine.EmbeddedServer | ||
| import io.ktor.server.engine.EngineConnectorConfig | ||
| import io.ktor.server.engine.embeddedServer | ||
| import io.ktor.utils.io.CancellationException |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: wrong CancellationException
Description
This PR adds robust error handling for tool argument parsing, result serialization, and subgraph tool execution failures. Instead of crashing, the agent should now handle these errors and return failure results.
Issue also described in KG-597 / #1169
Changes
Tool Argument Parsing errors
onToolValidationFailedcallback and return aToolResultKind.ValidationErrorwith an error message instead of crashingTool result serialization errors
decodeResult()Result.Failurewith an error messageSubgraph finish tool hanlding
Type of the changes
Checklist
developas the base branchAdditional steps for pull requests adding a new feature