Class AgentEventConverterRegistry

java.lang.Object
io.agentscope.core.agui.adapter.strategy.AgentEventConverterRegistry

public class AgentEventConverterRegistry extends Object
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 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 converters
      enrichers - 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 converters
      enrichers - enrichers applied after each conversion
      emitSubagentEventsAsNative - when true, child events use the same converters as the parent; when false (default), source != null events become subagent.* 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 event
      context - 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, or null for framework-created events
      events - AG-UI events to enrich
      context - stream conversion context
      Returns:
      enriched AG-UI events