ProgramArtifactStoreObserver
Models & Types · AiDotNet.Evolution.Programs.ArtifactStore
Persists each evaluation’s artifacts so they outlive the run and stay retrievable by genome.
Implements: IEvolutionObserver<ProgramGenome>
For Beginners
Artifacts are the notes an evaluation leaves behind, such as a compiler error or a captured stdout. Without this they vanish when the run ends. With it they are written next to the run, and you can look up everything a given candidate produced afterwards.
How It Works
The engine keeps artifacts in memory and hands them to exactly one follow-up proposal, after which they are
gone. That is the right lifetime for prompt feedback and the wrong one for an audit: once a run ends there is
no way to ask why a particular candidate scored as it did. This observer copies each evaluation’s artifacts
into an IProgramArtifactStore as they are committed, where the store’s own size threshold decides
what stays inline and what is promoted to a file, and its retention policy bounds the total.
Failures are swallowed and counted rather than thrown. An observer runs inside the engine’s commit path, so an
unwritable disk must not be able to end a search that is otherwise progressing; FailureCount and
LastError report what happened. Artifact text is untrusted evaluator output, so it is stored as
data and never interpreted.
Constructors
| Constructor | Summary |
|---|---|
ProgramArtifactStoreObserver(IProgramArtifactStore store, int purgeEveryStores, Func<DateTimeOffset> clock) |
Initializes an observer that writes into the supplied store. |
Properties
| Property | Summary |
|---|---|
int FailureCount { get; } |
Gets the number of evaluations whose artifacts could not be written. |
int RemovedCount { get; } |
Gets how many genomes those sweeps removed in total. |
int StoredCount { get; } |
Gets the number of evaluations whose artifacts were written. |
int SweepCount { get; } |
Gets how many retention sweeps have run. |
string LastError { get; } |
Gets the most recent failure message, or null when nothing has failed. |
Methods
| Method | Summary |
|---|---|
ValueTask OnEventAsync(EvolutionEvent<ProgramGenome> evolutionEvent, CancellationToken cancellationToken) |