diff options
| author | tanaka takashi <isazaka@gmail.com> | 2026-08-11 22:20:25 +0900 |
|---|---|---|
| committer | tanaka takashi <isazaka@gmail.com> | 2026-08-11 22:20:25 +0900 |
| commit | 842e55654db060c84448f3a0deddb24f77fad5a7 (patch) | |
| tree | faafb9e6f26a0eb5a037d8d3ceff4a512785e8f4 /src/Agent.Core/Runtime/AgentRuntime.cs | |
| parent | d8cf8947ff93230ae5282fc5058b0e49ddae42aa (diff) | |
Verify task-specific external effect evidence
Diffstat (limited to 'src/Agent.Core/Runtime/AgentRuntime.cs')
| -rw-r--r-- | src/Agent.Core/Runtime/AgentRuntime.cs | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/Agent.Core/Runtime/AgentRuntime.cs b/src/Agent.Core/Runtime/AgentRuntime.cs index 894f50e..333d557 100644 --- a/src/Agent.Core/Runtime/AgentRuntime.cs +++ b/src/Agent.Core/Runtime/AgentRuntime.cs @@ -279,7 +279,7 @@ public sealed class AgentRuntime(TaskRegistry registry, IOllamaClient ollama, Ag toolResult = new(false, ex.Message, false, $"{call.Function.Name}:{ex.GetType().Name}:{ex.Message}"); } - externalEffectEvidence |= toolResult.Success && toolResult.ExternalEffect; + externalEffectEvidence |= toolResult.Success && toolResult.ExternalEffect && plannerTask.RequiredEffectTools.Contains(call.Function.Name); // task_update is a metadata tool for graph bookkeeping; its failures should not block completion. bool isMetadataTool = call.Function.Name == "task_update"; if (toolResult.Success) unresolvedToolFailures.Remove(call.Function.Name); @@ -298,6 +298,9 @@ public sealed class AgentRuntime(TaskRegistry registry, IOllamaClient ollama, Ag } ToolUseGuardResult callGuard = guard.Evaluate(requiresExternalEffect, true, externalEffectEvidence, failureFingerprint); if (callGuard.Decision == ToolUseGuardDecision.Fail) throw new InvalidOperationException(callGuard.Observation); + if (callGuard.Decision == ToolUseGuardDecision.Retry) + messages.Add(new OllamaMessage("system", callGuard.Observation + " Required effect Tool(s) for the current Task: " + + string.Join(", ", plannerTask.RequiredEffectTools.Order(StringComparer.Ordinal)) + ".")); continue; } |
