Class MessageConvertUtil

java.lang.Object
io.agentscope.core.a2a.agent.utils.MessageConvertUtil

public class MessageConvertUtil extends Object
Message Converter between Agentscope Msg and A2A Message or Artifact.
  • Constructor Details

    • MessageConvertUtil

      public MessageConvertUtil()
  • Method Details

    • convertFromArtifact

      public static io.agentscope.core.message.Msg convertFromArtifact(io.a2a.spec.Artifact artifact, String agentName)
      Convert a single Artifact to Msg.
      Parameters:
      artifact - the artifact to convert
      agentName - the name of the agent that generated the artifact
      Returns:
      the converted Msg object
    • convertFromArtifact

      public static io.agentscope.core.message.Msg convertFromArtifact(List<io.a2a.spec.Artifact> artifacts, String agentName)
      Convert a list of Artifact to Msg.
      Parameters:
      artifacts - the list of artifacts to convert
      agentName - the name of the agent that generated the artifacts
      Returns:
      the converted Msg object
    • convertFromMessage

      public static io.agentscope.core.message.Msg convertFromMessage(io.a2a.spec.Message message, String agentName)
      Convert a single Message to Msg.
      Parameters:
      message - the message to convert
      agentName - the name of the agent that generated the message
      Returns:
      the converted Msg object
    • convertFromMsg

      public static io.a2a.spec.Message convertFromMsg(List<io.agentscope.core.message.Msg> msgs)
      Convert a list of Msg to Message.
      Parameters:
      msgs - the list of Msg to convert
      Returns:
      the converted Message object
    • buildTypeMetadata

      public static Map<String,Object> buildTypeMetadata(String type)
      Build metadata with content block type in Part.
      Parameters:
      type - the content block type, see ContentBlock.
      Returns:
      metadata with content block type.