At least, as far as I am aware, there is no programmatic interface
The embedder can decide what variables and functions to provide for each invocation of the script. You could get something like Wireshark filters out of the box:
ip && port==1234 {print size, time}
Graphviz includes a tool "gvpr" which essentially implements this idea for processing graphs but of course, they end up reimplementing a large part of awk.A project that's using it that way is Benthos, a "stream processor" written in Go. Awk is one of the "processors", the components that filter and transform data: https://www.benthos.dev/docs/components/processors/awk
Edit: I see that you have: https://github.com/benhoyt/goawk/issues/152
I am not totally sure if this is what you mean or not, but it's much nicer than embedding the script into a bash source file.
and article on how to use:
https://www.codeproject.com/Articles/5264205/Embedding-AWK-i...