GroundedVerifierAgent<T>
Models & Types · AiDotNet.Agentic.Agents
Wraps an agent so the trained model grounds its answers: after the inner agent runs, any prediction it obtained from the model-prediction tool is recomputed authoritatively and checked against the numbers in the agent’s final answer. If the answer contradicts the model, the agent is told the model’s actual prediction and asked to revise — up to a bounded number of times.
Implements: IAgent<T>
For Beginners
This makes the assistant honest about the model’s output. If the assistant asks the model for a prediction and then reports a different number, this catches it and makes the assistant fix it.
How It Works
Only a combined ML + agent library can do this: the LLM cannot talk its way past the model it just queried. The check is deliberately conservative — it fires only when the agent actually used the model tool and its stated number disagrees with the model’s real output, so it corrects hallucinated numbers without second- guessing answers the model has nothing to say about.
Constructors
| Constructor | Summary |
|---|---|
GroundedVerifierAgent(IAgent<T> inner, Func<double[], double[]> predict, string modelToolName, int maxRefinements, double relativeTolerance) |
Wraps an agent with model-grounded verification. |
Properties
| Property | Summary |
|---|---|
string Description { get; } |
|
string Name { get; } |
Methods
| Method | Summary |
|---|---|
Task<AgentRunResult> RunAsync(IReadOnlyList<ChatMessage> messages, CancellationToken cancellationToken) |