Go is famous for compiling into a single fast static binary with no virtual machine. Yet inside the Traefik reverse proxy lives a full Go interpreter executing source code on the fly. That sounds like a paradox until you need dynamic plugins.
Why interpret a compiled language
Dynamic plugins are modules a host loads at runtime without recompiling its binary. Go's standard plugin package barely helps here: it mostly works on Linux, requires an exact match of Go version and host dependencies, and cannot unload modules. Bump a patch version of the compiler, and you have to rebuild everything.
WebAssembly offers isolation, but pulling in Go libraries is harder and passing data has higher overhead. gRPC plugins like HashiCorp's go-plugin require a separate process. That's why Traefik Labs built Yaegi in 2019 to run plugins directly from .go files.
In November 2026, the rebooted Yaegi v2 arrived. In Traefik Proxy v3.8, it's opt-in via experimental.defaultRuntimeVersion: v2 or runtimeVersion: v2 in .traefik.yml (v1 remains the default).
How Yaegi v2 works under the hood
Version 1 was an AST interpreter: it walked the syntax tree and re-implemented Go's language rules by hand. When Go added generics, Go 1.22 loop semantics, iterators like maps.Keys, and min/max/clear, the custom engine fell behind the compiler.
Yaegi v2 throws out the hand-rolled type checker. Code now goes through official Go packages: go/parser builds the tree, go/types (the same type analyzer used by gc) catches errors, and golang.org/x/tools/go/ssa lowers functions to SSA (Static Single Assignment). In SSA, each variable is assigned exactly once, which compiles much more reliably into register bytecode for the VM. You don't need the Go toolchain on the server: stdlib types are embedded in the binary (~0.9 MB compressed per platform).
One major trap remained: Go cannot create a named type with methods at runtime. Because of that, encoding/json in v1 couldn't see MarshalJSON on Status{Code int} and silently returned {"status":{}} instead of {"status":"status-200"}. The same issue broke fmt, text/template, and log/slog. Version 2 adds a "reflect twin" (a parallel reflect implementation for interpreted types) and 24 rebuilt reflect-based libraries: 24 out of 25 matched go run, up from just 1 in v1.
You can embed the engine in your own service using github.com/traefik/yaegi/v2/host:
// Base options: AOT mode, limits, and empty environment
opts := host.Options()
opts.Dir = pluginDir
opts.Root = rootDir
// Load a plugin directly from source
p, err := host.Load(opts, "github.com/user/myplugin")
if err != nil {
return err
}
// Call plugin functions and extract an http.Handler
res, _ := p.Call(ctx, "CreateConfig")
res, _ = p.Call(ctx, "New", ctx, next, res[0], "my-plugin")
v, _ := res[0].Interface()
handler := v.(http.Handler)
host.Load parses source without the Go toolchain, p.Call returns *vm.Object, and Interface() yields a standard http.Handler ready for your middleware chain.
Tests, speed, and honest boundaries
Across 1,066 Go 1.27 test programs, compiled Go passes 1,055 (11 depend on environment), Yaegi v1 passes 641, and v2 passes 1,044 of 1,066. The remaining 22 involve cgo, runtime internals, and a few tracked bugs. Another 20 heavy plugins (gRPC, protobuf, AWS SDK, OpenTelemetry, Kubernetes, Redis, OpenAI/Anthropic SDKs) matched the compiled build; slices.ContainsFunc and maps.Keys work too.
Per-request timings look like this:
Single-request plugin processing time (lower is better)
On headers and regexes, the new VM beats v1. JSON is slower in v2, but it actually invokes MarshalJSON via the reflect twin and returns the right output instead of an empty object. Cold startup rose to ~110 ms (up from 15 ms in v1) due to decoding stdlib data, while subsequent loads take 6–24 ms; each plugin uses ~16 MB of memory and ~6 KB per request.
Runtime limits guard against buggy plugins: execution budgets, goroutine caps, memory quotas, and isolated env vars and http.DefaultServeMux. Panics, os.Exit, and log.Fatal won't crash Traefik.
Still, the boundaries are strict. Yaegi v2 is not a security sandbox: plugins share memory with the host, unsafe and syscall require useUnsafe: true, and cgo isn't supported. The module is also still marked experimental: the API isn't frozen, and parts of the code were AI-assisted and are undergoing review.

