Yaegi is a Go interpreter that executes Go code dynamically within running applications or interactive shells, built entirely in pure Go using only the standard library.
The tool solves the problem of needing to run Go code at runtime without compilation, enabling executable scripts, plugins, and dynamic extensions. It works by implementing a complete Go specification interpreter on top of the Go runtime, allowing developers to evaluate Go code strings through a simple API consisting of `New()`, `Eval()`, and `Use()` methods. All Go and runtime resources are accessible from interpreted scripts, with security controls that prevent the `unsafe` and `syscall` packages from being exported by default.
Yaegi suits projects requiring plugin systems, interactive shells, or scripting capabilities within Go applications. It works on any platform where Go itself runs and supports the latest two major Go releases. The tool is particularly useful when you need to extend compiled programs with interpreted code without rebuilding, or when providing users with a Go REPL environment. Developers should be aware of its limitations: assembly files are not supported, C code cannot be called, Go modules are not yet supported, and interpreted code will run significantly slower than compiled equivalents, making it unsuitable for computation-intensive workloads.
The project maintains active development with regular updates addressing bugs and compatibility. The codebase includes internal design documentation and tracing utilities in `interp/trace.go` to help developers understand compilation behavior. The tool supports multiple usage patterns including embedded interpreters within applications, dynamic extension frameworks where some code is compiled and some interpreted, and command-line usage with an interactive REPL that pre-imports all standard library packages for convenience.