IProgramExecutionEngine
Interfaces · AiDotNet.ProgramSynthesis.Interfaces
Defines an execution boundary for running synthesized programs against inputs.
Known implementations: ProcessProgramExecutionEngine, ServingProgramExecutionEngine
For Beginners
This is the “runner” that actually executes the generated code.
Program synthesis can generate code as text, but to verify it works we need to run it safely. This interface lets you plug in a safe execution environment (for example, a container, an isolated process, or a remote service) without embedding unsafe execution inside the library.
How It Works
Implementations should execute code in a sandboxed, resource-limited environment appropriate for the target language (timeouts, memory limits, restricted I/O, etc.).
Methods
| Method | Summary |
|---|---|
Task<ProgramExecuteResponse> ExecuteAsync(ProgramExecuteRequest request, CancellationToken cancellationToken) |
Executes a program request and reports the full outcome, including exit code, captured streams, truncation flags, compilation diagnostics, and a structured error code. |
bool TryExecute(ProgramLanguage language, string sourceCode, string input, string output, string errorMessage, CancellationToken cancellationToken) |
Tries to execute the given program source against the provided input. |