summaryrefslogtreecommitdiff
path: root/src/Agent.Core/Runtime/AgentRuntime.cs
diff options
context:
space:
mode:
Diffstat (limited to 'src/Agent.Core/Runtime/AgentRuntime.cs')
-rw-r--r--src/Agent.Core/Runtime/AgentRuntime.cs4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/Agent.Core/Runtime/AgentRuntime.cs b/src/Agent.Core/Runtime/AgentRuntime.cs
index f1c7186..3722ff3 100644
--- a/src/Agent.Core/Runtime/AgentRuntime.cs
+++ b/src/Agent.Core/Runtime/AgentRuntime.cs
@@ -302,6 +302,10 @@ public sealed class AgentRuntime(TaskRegistry registry, IOllamaClient ollama, Ag
if (unresolvedToolFailures.Count > 0)
{
+ string unresolvedFingerprint = string.Join(";", unresolvedToolFailures.OrderBy(static item => item.Key, StringComparer.Ordinal)
+ .Select(static item => $"{item.Key}={item.Value}"));
+ ToolUseGuardResult unresolvedGuard = guard.Evaluate(true, false, false, unresolvedFingerprint);
+ if (unresolvedGuard.Decision == ToolUseGuardDecision.Fail) throw new InvalidOperationException(unresolvedGuard.Observation);
messages.Add(new OllamaMessage("system", "Completion is not allowed while tool failures remain unresolved. Retry or correct: " +
string.Join("; ", unresolvedToolFailures.Select(static item => $"{item.Key}={item.Value}"))));
continue;