diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/Agent.Core/Prompts/PromptComposer.cs | 4 | ||||
| -rw-r--r-- | src/Agent.Core/Runtime/AgentRuntime.cs | 4 | ||||
| -rw-r--r-- | src/Agent.Core/Runtime/PlannerService.cs | 2 |
3 files changed, 8 insertions, 2 deletions
diff --git a/src/Agent.Core/Prompts/PromptComposer.cs b/src/Agent.Core/Prompts/PromptComposer.cs index 2899088..de209be 100644 --- a/src/Agent.Core/Prompts/PromptComposer.cs +++ b/src/Agent.Core/Prompts/PromptComposer.cs @@ -44,10 +44,10 @@ public static class PromptComposer } private static string ComposeExecutionRequirement(bool requiresExternalEffect) => requiresExternalEffect - ? "The current Planner Task requires a verified external effect. Call the appropriate available Internal Tool now. " + + ? "Perform only the current Running Planner Task; do not perform Queued Tasks. The current Planner Task requires a verified external effect. Call the appropriate available Internal Tool now. " + "A prose description, promise, plan, or fenced JSON example does not perform the operation and cannot complete this Task. " + "After a successful read, use its returned content and proceed to the required write or process operation without repeating the read unnecessarily." - : "The current Planner Task does not require an external effect. Use an Internal Tool only when its verified result is needed; do not claim an unverified result."; + : "Perform only the current Running Planner Task; do not perform Queued Tasks. The current Planner Task does not require an external effect. Use an Internal Tool only when its verified result is needed; do not claim an unverified result."; private static string ComposeExecutionResults(IReadOnlyList<ExecutionResult> results) { 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. """; |
