From ce550a127b7dc972651bd15b9f09979a2c38688f Mon Sep 17 00:00:00 2001 From: tanaka takashi Date: Wed, 12 Aug 2026 00:02:23 +0900 Subject: 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. --- tests/Agent.Core.Tests/PromptAndRuntimeTests.cs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'tests/Agent.Core.Tests/PromptAndRuntimeTests.cs') 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)); } -- cgit v1.2.3