Class AguiAgentAdapter

java.lang.Object
io.agentscope.core.agui.adapter.AguiAgentAdapter

public class AguiAgentAdapter extends Object
Adapter that bridges AgentScope agents to the AG-UI protocol.

This adapter converts AG-UI protocol inputs to AgentScope messages, invokes the agent, and converts the streaming events back to AG-UI events.

Event Mapping:

  • AgentScope REASONING/SUMMARY events → AG-UI TEXT_MESSAGE_* events (for TextBlock)
  • AgentScope REASONING/SUMMARY events → AG-UI REASONING_* events (for ThinkingBlock, when enabled)
  • AgentScope TOOL_RESULT events → AG-UI TOOL_CALL_END events
  • ToolUseBlock content → AG-UI TOOL_CALL_START events

Reasoning Support:

  • ThinkingBlock content is converted to REASONING_* events according to AG-UI Reasoning draft
  • Reasoning output is disabled by default (enableReasoning=false) for backward compatibility
  • Set enableReasoning=true in AguiAdapterConfig to enable reasoning events
  • Constructor Details

    • AguiAgentAdapter

      public AguiAgentAdapter(io.agentscope.core.agent.Agent agent, AguiAdapterConfig config)
      Creates a new AguiAgentAdapter.
      Parameters:
      agent - The agent to adapt
      config - The adapter configuration
  • Method Details

    • run

      public reactor.core.publisher.Flux<AguiEvent> run(RunAgentInput input)
      Run the agent with AG-UI protocol input.

      This method converts the input messages, invokes the agent's streaming API, and emits AG-UI protocol events.

      Parameters:
      input - The AG-UI run input
      Returns:
      A Flux of AG-UI events