summaryrefslogtreecommitdiff
path: root/tests/Agent.Core.Tests/PromptAndRuntimeTests.cs
diff options
context:
space:
mode:
authortanaka takashi <isazaka@gmail.com>2026-08-12 00:02:23 +0900
committertanaka takashi <isazaka@gmail.com>2026-08-12 00:02:23 +0900
commitce550a127b7dc972651bd15b9f09979a2c38688f (patch)
treef4e09d0f64f74a585e015e6f548c5589fd2442ba /tests/Agent.Core.Tests/PromptAndRuntimeTests.cs
parent55db81082f9165a3965f860cd618bac4242c56b1 (diff)
feat: harden Python workflow and structured planning
Replace the uv-specific skill with a portable Python skill and rewrite the default user system prompt as a concise, structured Markdown execution policy. Normalize a single fenced structured-JSON response, retry invalid skill selection with think disabled, validate selected skill output, and make coding plans keep editing and verification in one task. Document the file_edit patch payload, expose that contract in the tool catalog, and convert malformed patch input into a retryable tool failure instead of terminating the agent task. Update configuration and runtime tests for the Python skill, exact tool catalog, structured-output retry, and implementation-and-verification planning guidance. Verified with 82 Agent.Core tests and an agent-mcp Python scheduling scenario with 49 passing unittest cases.
Diffstat (limited to 'tests/Agent.Core.Tests/PromptAndRuntimeTests.cs')
-rw-r--r--tests/Agent.Core.Tests/PromptAndRuntimeTests.cs13
1 files changed, 12 insertions, 1 deletions
diff --git a/tests/Agent.Core.Tests/PromptAndRuntimeTests.cs b/tests/Agent.Core.Tests/PromptAndRuntimeTests.cs
index fef5340..6dad528 100644
--- a/tests/Agent.Core.Tests/PromptAndRuntimeTests.cs
+++ b/tests/Agent.Core.Tests/PromptAndRuntimeTests.cs
@@ -284,6 +284,10 @@ public sealed class PromptAndRuntimeTests
Assert.Equal(AgentTaskState.Completed, completed!.State);
Assert.Equal([null, false], ollama.ThinkOverrides);
Assert.All(ollama.Temperatures, value => Assert.Equal(0.7, value));
+ Assert.Contains(ollama.PlanningMessages[0], message =>
+ message.Role == "system" && message.Content.Contains("There is no file_write Tool", StringComparison.Ordinal));
+ Assert.Contains(ollama.PlanningMessages[0], message =>
+ message.Role == "system" && message.Content.Contains("one implementation-and-verification Task", StringComparison.Ordinal));
Assert.Contains(ollama.PlanningMessages[1], message =>
message.Role == "system" && message.Content.Contains("Do not call or execute any Tool", StringComparison.Ordinal));
}
@@ -615,7 +619,14 @@ public sealed class PromptAndRuntimeTests
Temperatures.Add(temperatureOverride);
PlanningMessages.Add(messages);
string content = ThinkOverrides.Count == 2 && succeedOnRetry
- ? """{"tasks":[{"description":"analyze","dependencies":[],"budget_class":"4K","optimistic_tokens":10,"most_likely_tokens":20,"pessimistic_tokens":30,"requires_external_effect":false}]}"""
+ ? """
+ Here is the requested plan.
+
+ ```json
+ {"tasks":[{"description":"analyze","dependencies":[],"budget_class":"4K","optimistic_tokens":10,"most_likely_tokens":20,"pessimistic_tokens":30,"requires_external_effect":false}]}
+ ```
+ The JSON above is the complete plan.
+ """
: "not-json";
return Task.FromResult(new OllamaResult(content, 1, 1));
}