Class AgentEventConverterRegistry
java.lang.Object
io.agentscope.core.agui.adapter.strategy.AgentEventConverterRegistry
Registry that maps AgentScope
AgentEvent instances to AG-UI protocol events.
Built-in converters are registered first and custom converters are registered afterwards, so
a custom converter can override the mapping for the same AgentEvent type. Event
enrichers run after conversion and can add cross-cutting AG-UI base properties.
-
Constructor Summary
ConstructorsConstructorDescriptionAgentEventConverterRegistry(List<AgentEventConverter> customConverters, List<AguiEventEnricher> enrichers) Create a registry with built-in converters, custom converters, and event enrichers.AgentEventConverterRegistry(List<AgentEventConverter> customConverters, List<AguiEventEnricher> enrichers, boolean emitSubagentEventsAsNative) Create a registry with built-in converters, custom converters, enrichers, and subagent presentation mode. -
Method Summary
Modifier and TypeMethodDescriptionconvert(io.agentscope.core.event.AgentEvent event, AguiStreamContext context) Convert one AgentScope event to zero or more AG-UI events.enrich(io.agentscope.core.event.AgentEvent source, List<AguiEvent> events, AguiStreamContext context) Apply configured enrichers to AG-UI events in registration order.
-
Constructor Details
-
AgentEventConverterRegistry
public AgentEventConverterRegistry() -
AgentEventConverterRegistry
public AgentEventConverterRegistry(List<AgentEventConverter> customConverters, List<AguiEventEnricher> enrichers) Create a registry with built-in converters, custom converters, and event enrichers.- Parameters:
customConverters- converters registered after built-in convertersenrichers- enrichers applied after each conversion
-
AgentEventConverterRegistry
public AgentEventConverterRegistry(List<AgentEventConverter> customConverters, List<AguiEventEnricher> enrichers, boolean emitSubagentEventsAsNative) Create a registry with built-in converters, custom converters, enrichers, and subagent presentation mode.- Parameters:
customConverters- converters registered after built-in convertersenrichers- enrichers applied after each conversionemitSubagentEventsAsNative- whentrue, child events use the same converters as the parent; whenfalse(default),source != nullevents becomesubagent.*CUSTOM / RAW events
-
-
Method Details
-
convert
public List<AguiEvent> convert(io.agentscope.core.event.AgentEvent event, AguiStreamContext context) Convert one AgentScope event to zero or more AG-UI events.- Parameters:
event- source AgentScope eventcontext- stream conversion context- Returns:
- converted and enriched AG-UI events
-
enrich
public List<AguiEvent> enrich(io.agentscope.core.event.AgentEvent source, List<AguiEvent> events, AguiStreamContext context) Apply configured enrichers to AG-UI events in registration order.- Parameters:
source- source AgentScope event, ornullfor framework-created eventsevents- AG-UI events to enrichcontext- stream conversion context- Returns:
- enriched AG-UI events
-