Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
a5b04e7
perf(core): cache sorted hooks and optimize HookNotifier execution
shlokmestry Dec 21, 2025
46b40c4
Refactor hook caching to AgentBase and delegate from ReActAgent
shlokmestry Dec 22, 2025
aa8a9f7
Make hooks list immutable and simplify hook mutation API
shlokmestry Dec 23, 2025
17863ba
Merge branch 'main' into feature/optimize-hook-notifier
shlokmestry Dec 23, 2025
0289e3e
refactor: make hooks immutable and unify hook mutation APIs
shlokmestry Dec 23, 2025
1daa413
Merge branch 'main' into feature/optimize-hook-notifier
AlbumenJ Dec 23, 2025
b9c8dc7
Move hook caching to AgentBase and remove direct hook mutation
shlokmestry Dec 24, 2025
e55459c
feat: add Kotlin coroutine extension layer for Agent APIs
shlokmestry Dec 26, 2025
4fcf75d
Merge branch 'main' into feature/kotlin-coroutines-extension
shlokmestry Dec 26, 2025
285a779
chore: add Apache license header to agentscope-kotlin pom
shlokmestry Dec 26, 2025
c0b485f
chore: add Apache license header to AgentExtensions
shlokmestry Dec 26, 2025
4c38b54
Merge branch 'main' into feature/kotlin-coroutines-extension
AlbumenJ Dec 28, 2025
4ce7237
chore: add kotlin coroutine extensions module
shlokmestry Jan 1, 2026
bcc2cb9
chore: align kotlin coroutine module with bom and parent poms
shlokmestry Jan 1, 2026
1c26b4f
chore: add Apache 2.0 license headers for kotlin module
shlokmestry Jan 1, 2026
a1cfe8e
Merge branch 'main' into feature/kotlin-coroutines-extension
shlokmestry Jan 1, 2026
2fc4a7e
chore: add Apache license headers to Kotlin extension
shlokmestry Jan 1, 2026
abf3488
fix: align license headers with repository standard
shlokmestry Jan 1, 2026
0b6f6b7
Merge branch 'main' into feature/kotlin-coroutines-extension
shlokmestry Jan 12, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 16 additions & 1 deletion agentscope-dependencies-bom/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,20 @@
<version>${qdrant.version}</version>
</dependency>

<!-- Kotlin Coroutines -->
<dependency>
<groupId>org.jetbrains.kotlinx</groupId>
<artifactId>kotlinx-coroutines-core</artifactId>
<version>${kotlin.coroutines.version}</version>
</dependency>

<dependency>
<groupId>org.jetbrains.kotlinx</groupId>
<artifactId>kotlinx-coroutines-reactor</artifactId>
<version>${kotlin.coroutines.version}</version>
</dependency>


<!-- Milvus Java SDK -->
<dependency>
<groupId>io.milvus</groupId>
Expand Down Expand Up @@ -310,9 +324,10 @@
<version>${a2a-transport-jsonrpc.version}</version>
</dependency>


<!-- Jedis client for Redis-based session implementation -->
<dependency>
<groupId>redis.clients</groupId>
<groupId>redis.clients</groupId>
<artifactId>jedis</artifactId>
<version>${jedis.version}</version>
</dependency>
Expand Down
67 changes: 67 additions & 0 deletions agentscope-extensions/agentscope-kotlin/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
<!--
~ Copyright 2024-2026 the original author or authors.
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->



<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">

<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>io.agentscope</groupId>
<artifactId>agentscope-extensions</artifactId>
<version>${revision}</version>
<relativePath>../pom.xml</relativePath>
</parent>

<artifactId>agentscope-extensions-kotlin</artifactId>
<name>AgentScope Kotlin Coroutine Extensions</name>
<packaging>jar</packaging>

<dependencies>
<!-- AgentScope core -->
<dependency>
<groupId>io.agentscope</groupId>
<artifactId>agentscope-core</artifactId>
</dependency>

<!-- Kotlin coroutines -->
<dependency>
<groupId>org.jetbrains.kotlinx</groupId>
<artifactId>kotlinx-coroutines-core</artifactId>
</dependency>

<!-- Reactor <-> Coroutine bridge -->
<dependency>
<groupId>org.jetbrains.kotlinx</groupId>
<artifactId>kotlinx-coroutines-reactor</artifactId>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-maven-plugin</artifactId>
<version>${kotlin.version}</version>
</plugin>
</plugins>
</build>

</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
<!--
~ Copyright 2024-2026 the original author or authors.
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->





package io.agentscope.kotlin

import io.agentscope.core.agent.Agent
import io.agentscope.core.agent.Event
import io.agentscope.core.agent.StreamOptions
import io.agentscope.core.message.Msg
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.reactor.awaitFirstOrNull
import kotlinx.coroutines.reactor.awaitSingle
import kotlinx.coroutines.reactive.asFlow

/* ---------- call(...) -> suspend ---------- */

suspend fun Agent.callSuspend(msg: Msg): Msg =
this.call(msg).awaitSingle()

suspend fun Agent.callSuspend(msgs: List<Msg>): Msg =
this.call(msgs).awaitSingle()

suspend fun Agent.callSuspend(): Msg =
this.call().awaitSingle()

suspend fun Agent.callSuspend(
msg: Msg,
structuredModel: Class<*>
): Msg =
this.call(msg, structuredModel).awaitSingle()

suspend fun Agent.callSuspend(
msgs: List<Msg>,
structuredModel: Class<*>
): Msg =
this.call(msgs, structuredModel).awaitSingle()

suspend fun Agent.callSuspend(
structuredModel: Class<*>
): Msg =
this.call(structuredModel).awaitSingle()

/* ---------- observe(...) -> suspend ---------- */

suspend fun Agent.observeSuspend(msg: Msg) {
this.observe(msg).awaitFirstOrNull()
}

suspend fun Agent.observeSuspend(msgs: List<Msg>) {
this.observe(msgs).awaitFirstOrNull()
}

/* ---------- stream(...) -> Flow ---------- */

fun Agent.streamFlow(
msg: Msg,
options: StreamOptions = StreamOptions.defaults()
): Flow<Event> =
this.stream(msg, options).asFlow()

fun Agent.streamFlow(
msgs: List<Msg>,
options: StreamOptions = StreamOptions.defaults()
): Flow<Event> =
this.stream(msgs, options).asFlow()

fun Agent.streamFlow(
msg: Msg,
options: StreamOptions,
structuredModel: Class<*>
): Flow<Event> =
this.stream(msg, options, structuredModel).asFlow()

fun Agent.streamFlow(
msgs: List<Msg>,
options: StreamOptions,
structuredModel: Class<*>
): Flow<Event> =
this.stream(msgs, options, structuredModel).asFlow()
30 changes: 28 additions & 2 deletions agentscope-extensions/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,44 @@

<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">

<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>io.agentscope</groupId>
<artifactId>agentscope-parent</artifactId>
<version>${revision}</version>
<relativePath>../pom.xml</relativePath>
</parent>

<name>AgentScope Java - Extensions</name>
<groupId>io.agentscope</groupId>
<artifactId>agentscope-extensions</artifactId>
<name>AgentScope Java - Extensions</name>
<packaging>pom</packaging>


<properties>
<!-- Kotlin -->
<kotlin.version>1.9.24</kotlin.version>
<kotlin.coroutines.version>1.8.1</kotlin.coroutines.version>
</properties>


<dependencyManagement>
<dependencies>
<dependency>
<groupId>io.agentscope</groupId>
<artifactId>agentscope-dependencies-bom</artifactId>
<version>${revision}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>


<modules>
<module>agentscope-extensions-a2a</module>
<module>agentscope-extensions-autocontext-memory</module>
Expand All @@ -52,4 +77,5 @@
<module>agentscope-extensions-higress</module>
<module>agentscope-extensions-nacos</module>
</modules>

</project>
Loading