Skip to content
Open
Show file tree
Hide file tree
Changes from 21 commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
c6a610b
refactor(agui): redesign event dispatching with strategy pattern and …
jujn May 5, 2026
c8ece67
fix: format code style
jujn May 6, 2026
cce154d
test: add ag-ui CUSTOM event testcase
jujn May 6, 2026
e9d8cb9
fix: duplicate text/reasoning content
jujn May 13, 2026
b660595
fix: duplicate reasoning start/end agui event
jujn May 13, 2026
68d83f1
fix: force end the reasoning event before start the text event
jujn May 13, 2026
a1758d7
fix: add code comments and fix minor bugs
jujn May 16, 2026
f3b18aa
fix: add code comments and fix minor bugs
jujn May 16, 2026
dcb6b0e
fix: optimize the tool call event correlation without default ID
jujn May 16, 2026
5609ac5
fix: code format
jujn May 16, 2026
b82f3c5
fix: optimize the interrupt handling mechanism in text/reasoning events
jujn May 18, 2026
2873a29
fix: remove the logic for handling anonymous tools
jujn May 18, 2026
a229876
fix: remove ag-ui custom event
jujn May 18, 2026
c011db4
feat: support user-defined ContentBlock conversion strategies
jujn May 18, 2026
e3cf742
feat: provide the enableActingChunk configuration in AguiAdapterConfig
jujn May 19, 2026
b5547c5
feat: custom block converters support springboot auto-configuration
jujn May 19, 2026
11c6841
feat: add an example for the ag-ui tool progress event
jujn May 19, 2026
c8b4f31
merge: resolve conflicts
jujn May 19, 2026
9e03c96
docs: update the ag-ui sample project and docs
jujn May 20, 2026
8b0894c
fix: resolve conflicts
jujn Jun 6, 2026
97c19d8
Merge branch 'main' of https://github.com/agentscope-ai/agentscope-ja…
jujn Jun 6, 2026
6f36b22
fix: add tests and resolve problems
jujn Jun 7, 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
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,12 @@
*/
package io.agentscope.core.agui.adapter;

import io.agentscope.core.agui.adapter.strategy.BlockEventConverter;
import io.agentscope.core.agui.model.ToolMergeMode;
import java.time.Duration;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;

/**
* Configuration for the AG-UI agent adapter.
Expand All @@ -30,16 +34,23 @@ public class AguiAdapterConfig {
private final boolean emitStateEvents;
private final boolean emitToolCallArgs;
private final boolean enableReasoning;
private final boolean enableActingChunk;
private final Duration runTimeout;
private final String defaultAgentId;
private final Map<Class<?>, BlockEventConverter<?>> customConverters;

private AguiAdapterConfig(Builder builder) {
this.toolMergeMode = builder.toolMergeMode;
this.emitStateEvents = builder.emitStateEvents;
this.emitToolCallArgs = builder.emitToolCallArgs;
this.enableReasoning = builder.enableReasoning;
this.enableActingChunk = builder.enableActingChunk;
this.runTimeout = builder.runTimeout;
this.defaultAgentId = builder.defaultAgentId;
this.customConverters =
builder.customConverters != null
? Map.copyOf(builder.customConverters)
: Collections.emptyMap();
}

/**
Expand Down Expand Up @@ -82,6 +93,18 @@ public boolean isEnableReasoning() {
return enableReasoning;
}

/**
* Check if intermediate acting chunk emissions should be included.
*
* <p>When enabled, intermediate tool execution outputs (such as progress)
* will be streamed to the frontend.
*
* @return true if acting chunks should be included
*/
public boolean isEnableActingChunk() {
return enableActingChunk;
}

/**
* Get the run timeout duration.
*
Expand All @@ -100,6 +123,15 @@ public String getDefaultAgentId() {
return defaultAgentId;
}

/**
* Get the custom block event converters.
*
* @return Immutable map of custom converters
*/
public Map<Class<?>, BlockEventConverter<?>> getCustomConverters() {
return customConverters;
}

/**
* Creates a new builder for AguiAdapterConfig.
*
Expand Down Expand Up @@ -127,8 +159,10 @@ public static class Builder {
private boolean emitStateEvents = true;
private boolean emitToolCallArgs = true;
private boolean enableReasoning = false;
private boolean enableActingChunk = true;
private Duration runTimeout = Duration.ofMinutes(10);
private String defaultAgentId;
private final Map<Class<?>, BlockEventConverter<?>> customConverters = new HashMap<>();

/**
* Set the tool merge mode.
Expand Down Expand Up @@ -178,6 +212,20 @@ public Builder enableReasoning(boolean enableReasoning) {
return this;
}

/**
* Set whether to enable acting chunk emissions.
*
* <p>When enabled, tools can emit intermediate chunks (e.g., Custom events for progress
* or real-time logs) during execution. Default is true.
*
* @param enableActingChunk true to enable acting chunks
* @return This builder
*/
public Builder enableActingChunk(boolean enableActingChunk) {
this.enableActingChunk = enableActingChunk;
return this;
}

/**
* Set the run timeout duration.
*
Expand All @@ -200,6 +248,22 @@ public Builder defaultAgentId(String defaultAgentId) {
return this;
}

/**
* Register a custom block event converter.
*
* <p>This allows users to override the default conversion strategies for specific
* ContentBlock types, enabling deep customization of AG-UI event generation.
*
* @param converter The custom converter strategy
* @return This builder
*/
public Builder registerConverter(BlockEventConverter<?> converter) {
if (converter != null && converter.supportedBlockType() != null) {
Comment thread
jujn marked this conversation as resolved.
this.customConverters.put(converter.supportedBlockType(), converter);
}
return this;
}

/**
* Build the configuration.
*
Expand Down
Loading
Loading