summaryrefslogtreecommitdiff
path: root/src/Agent.Core/Runtime
diff options
context:
space:
mode:
Diffstat (limited to 'src/Agent.Core/Runtime')
-rw-r--r--src/Agent.Core/Runtime/AgentRuntime.cs4
-rw-r--r--src/Agent.Core/Runtime/PlannerService.cs2
2 files changed, 6 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;
diff --git a/src/Agent.Core/Runtime/PlannerService.cs b/src/Agent.Core/Runtime/PlannerService.cs
index 7d8c3e1..aa7d3a5 100644
--- a/src/Agent.Core/Runtime/PlannerService.cs
+++ b/src/Agent.Core/Runtime/PlannerService.cs
@@ -289,6 +289,8 @@ public sealed class PlannerService(IOllamaClient ollama, AgentRuntimeSettings se
For pure analysis or informational tasks, requires_external_effect should be false.
For tasks that modify files, run processes, or produce verifiable side effects, requires_external_effect should be true.
Read-only operations (file_read, file_search, and dir list) do not create an external effect and must use requires_external_effect=false.
+ Preserve every user-supplied absolute path, executable, cwd, argument array, operation name, and literal value exactly in the task that uses it; never abbreviate these values into a shell-like command.
+ Keep each task limited to its own described operation. Do not put later dependent operations into an earlier task.
A single task is valid for simple requests.
""";