ServingProgramExecutionEngine
Models & Types · AiDotNet.ProgramSynthesis.Serving
Program execution engine that delegates sandboxed execution to an AiDotNet.Serving instance.
Implements: IProgramExecutionEngine
For Beginners
Instead of running generated code on this machine, this engine sends it to an AiDotNet.Serving server that runs it inside a container and sends back what happened. Use it when you want the strongest isolation available, or when the machine running your evolution has no interpreters installed.
How It Works
The serving deployment runs each candidate inside a container with no network, a read-only mount, and container
CPU and memory limits, so this is the strongest of the execution boundaries — at the cost of needing a reachable
deployment. ExecuteAsync is asynchronous end to end and passes the whole request through, so the
caller sees the exit code, both captured streams, the truncation flags, and any compilation diagnostics the
sandbox produced.
Transport failures are folded into the response rather than thrown, matching every other engine: a fitness function scoring thousands of candidates must not stop because one HTTP call failed.
Constructors
| Constructor | Summary |
|---|---|
ServingProgramExecutionEngine(IProgramSynthesisServingClient client) |
Initializes an engine that uses the client’s own timeout. |
ServingProgramExecutionEngine(IProgramSynthesisServingClient client, TimeSpan timeout) |
Initializes an engine that abandons a call after timeout. |
Methods
| Method | Summary |
|---|---|
Task<ProgramExecuteResponse> ExecuteAsync(ProgramExecuteRequest request, CancellationToken cancellationToken) |
|
bool TryExecute(ProgramLanguage language, string sourceCode, string input, string output, string errorMessage, CancellationToken cancellationToken) |