Skip to content

Conversation

@shlokmestry
Copy link
Contributor

AgentScope-Java Version

1.0.4-SNAPSHOT

Description

This PR adds a Kotlin coroutine extension layer for AgentScope Java to improve the Kotlin developer experience while keeping Reactor as the core async implementation.

A new optional module agentscope-kotlin is introduced under agentscope-extensions, providing Kotlin-friendly APIs on top of existing Reactor-based methods:

  • Mono<Msg>suspend fun
  • Flux<Event>Flow<Event>
  • Mono<Void>suspend fun returning Unit

All extensions are implemented as Kotlin extension functions, so no existing Java APIs or behaviors are changed.

What’s Included

  • New agentscope-kotlin extension module
  • Coroutine wrappers for Agent.call(...), Agent.observe(...), and Agent.stream(...)
  • Uses kotlinx-coroutines-reactor for non-blocking interoperability
  • No changes to core modules or Java implementations

Example Usage

val response = agent.callSuspend(msg)

agent.streamFlow(msg).collect { event ->
    println(event)
}

##How to test:

mvn -pl agentscope-extensions/agentscope-kotlin -am test

@shlokmestry shlokmestry requested a review from a team December 26, 2025 18:17
@shlokmestry
Copy link
Contributor Author

The remaining failure appears to be in agentscope-extensions-a2a-client, which is unrelated to this PR.

Comment on lines +95 to +97
// Cached sorted hooks (invalidated when hooks list changes)
private transient volatile List<Hook> cachedSortedHooks;
private final AtomicBoolean hooksDirty = new AtomicBoolean(true);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please revert these changes

Comment on lines +37 to +38
<kotlin.version>1.9.24</kotlin.version>
<kotlin.coroutines.version>1.8.1</kotlin.coroutines.version>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Version should be managed in agentscope-dependencies-bom

<relativePath>../pom.xml</relativePath>
</parent>

<artifactId>agentscope-kotlin</artifactId>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<artifactId>agentscope-kotlin</artifactId>
<artifactId>agentscope-extensions-kotlin</artifactId>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants