How to use AN struct from a script node? (Animation Nodes)
Looks like you can use ANStruct() in place of a normal dictionary and add to it with the usual commands. So instead of dict = {}, do dict = ANStruct().

But there is a big caveat that doesn't seem to be documented anywhere. When working with a regular dict, you'd add to it with: dict['key'] = value. But ANStruct actually has a 2 part key, with the first part of the key being the Animation Nodes Type (ie, Text, Integer, Text List, etc). So you actually need dict[('Type', 'key')] = value

If you don't have the two part key, you'll get errors when trying to use the outputted Struct with the various Struct nodes, or when trying to Print it.