-
Notifications
You must be signed in to change notification settings - Fork 193
Add parallel nodes invocation #220
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
Conversation
Qodana for JVM136 new problems were found
@@ Code coverage @@
+ 52% total lines covered
5890 lines analyzed, 3109 lines covered
# Calculated according to the filters of your coverage tool ☁️ View the detailed Qodana report Detected 116 dependenciesThird-party software listThis page lists the third-party software dependencies used in koog-agents
Contact Qodana teamContact us at [email protected]
|
.../agents-core/src/commonMain/kotlin/ai/koog/agents/core/dsl/builder/AIAgentSubgraphBuilder.kt
Outdated
Show resolved
Hide resolved
.../agents-core/src/commonMain/kotlin/ai/koog/agents/core/dsl/builder/AIAgentSubgraphBuilder.kt
Outdated
Show resolved
Hide resolved
agents/agents-core/src/commonMain/kotlin/ai/koog/agents/core/agent/context/AIAgentContext.kt
Outdated
Show resolved
Hide resolved
agents/agents-core/src/commonMain/kotlin/ai/koog/agents/core/agent/context/AIAgentContext.kt
Outdated
Show resolved
Hide resolved
.../agents-core/src/commonMain/kotlin/ai/koog/agents/core/dsl/builder/AIAgentSubgraphBuilder.kt
Outdated
Show resolved
Hide resolved
.../agents-core/src/commonMain/kotlin/ai/koog/agents/core/dsl/builder/AIAgentSubgraphBuilder.kt
Outdated
Show resolved
Hide resolved
agents/agents-tools/src/commonMain/kotlin/ai/koog/agents/core/tools/ToolDescriptors.kt
Outdated
Show resolved
Hide resolved
.../agents-core/src/commonMain/kotlin/ai/koog/agents/core/dsl/builder/AIAgentSubgraphBuilder.kt
Outdated
Show resolved
Hide resolved
@tiginamaria could you also rebase on latest develop? You have QD inspections because of little bit outdated branch |
agents/agents-core/src/commonMain/kotlin/ai/koog/agents/core/agent/context/AIAgentContext.kt
Outdated
Show resolved
Hide resolved
b903bd5
to
62c9e78
Compare
agents/agents-core/src/commonTest/kotlin/ai/koog/agents/core/dsl/extension/ParallelNodesTest.kt
Outdated
Show resolved
Hide resolved
1e62ca8
to
3f71b34
Compare
.../agents-core/src/commonMain/kotlin/ai/koog/agents/core/dsl/builder/AIAgentSubgraphBuilder.kt
Outdated
Show resolved
Hide resolved
) | ||
|
||
override suspend fun fork(): AIAgentContextBase { | ||
TODO("Not yet implemented") |
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.
Should I implement fork/replace for the DummyAIAgentContext
? And why we actually need it (I don't see any functionality that blocks from using just AIAgentContext
, except all nullable values, or I'm missing something)?
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 was not sure about the cast in the fork
node. But apart from that LGTM.
.../agents-core/src/commonMain/kotlin/ai/koog/agents/core/dsl/builder/AIAgentSubgraphBuilder.kt
Outdated
Show resolved
Hide resolved
.../agents-core/src/commonMain/kotlin/ai/koog/agents/core/dsl/builder/AIAgentSubgraphBuilder.kt
Outdated
Show resolved
Hide resolved
examples/src/main/kotlin/ai/koog/agents/example/parallelexecution/BestJokeAgent.kt
Outdated
Show resolved
Hide resolved
9b9e1d1
to
8c63f49
Compare
891baba
to
b78cc97
Compare
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.
@tiginamaria I pushed a small change , please take a look :)
@tiginamaria please add more tests for the |
agents/agents-core/src/commonMain/kotlin/ai/koog/agents/core/agent/context/AIAgentContext.kt
Show resolved
Hide resolved
agents/agents-core/src/commonMain/kotlin/ai/koog/agents/core/agent/entity/AIAgentState.kt
Outdated
Show resolved
Hide resolved
Add parallel node result type
fdd171a
to
a1a5630
Compare
* @param context The context to replace the current context with.]] | ||
*/ | ||
override suspend fun replace(context: AIAgentContextBase) { |
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.
There's a potential problem with this method that might confuse someone (it confused me initially, at least). From the method signature and according to KDocs it looks like the whole context will be replaced, but in fact it's not the case and only three properties are actually replaced.
private val mutableAIAgentContext = MutableAIAgentContext(llm, stateManager, storage) | ||
|
||
override val llm: AIAgentLLMContext | ||
get() = mutableAIAgentContext.llm |
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.
Also, for all these properties there's no RW lock. Meaning, when the replace operation is in progress, it's still possible to read from these fields, potentially getting inconsistent data (although the chances are probably very low)
* Creates a copy of the current [MutableAIAgentContext]. | ||
* @return A new instance of [MutableAIAgentContext] with copies of all mutable properties. | ||
*/ | ||
suspend fun copy(): MutableAIAgentContext { |
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.
This method is not used
AIAgentLLMContext( | ||
tools.toList(), | ||
toolRegistry, | ||
prompt.copy(), |
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.
There's no need to unnecessary copy prompt and tools, these are already fully immutable
llm.writeSession { | ||
model = OpenAIModels.Chat.GPT4o | ||
updatePrompt { | ||
prompt("best-joke-selector") { |
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.
This part wouldn't work. updatePrompt
accepts PromptBuilder
and in its lambda returns Unit
. It is meant to add more messages to existing prompt. In this case a new prompt is created and returned, but since the lambda is Unit
, this operation essentially has no effect and the prompt remains the same.
Add parallel nodes execution implementation
#255