summaryrefslogtreecommitdiff
path: root/src/Agent.Core/Runtime/PlanResult.cs
diff options
context:
space:
mode:
Diffstat (limited to 'src/Agent.Core/Runtime/PlanResult.cs')
-rw-r--r--src/Agent.Core/Runtime/PlanResult.cs51
1 files changed, 51 insertions, 0 deletions
diff --git a/src/Agent.Core/Runtime/PlanResult.cs b/src/Agent.Core/Runtime/PlanResult.cs
new file mode 100644
index 0000000..bad41fa
--- /dev/null
+++ b/src/Agent.Core/Runtime/PlanResult.cs
@@ -0,0 +1,51 @@
+using System.Text.Json;
+using System.Text.Json.Serialization;
+
+namespace Agent.Core.Runtime;
+
+/// <summary>
+/// LLM-generated plan parsed from structured output.
+/// Each planned task contains a description, dependency references (by index),
+/// token budget class, PERT estimates, and the requires_external_effect attribute.
+/// </summary>
+public sealed class PlanResult
+{
+ [JsonPropertyName("tasks")]
+ public List<PlannedTask> Tasks { get; init; } = [];
+}
+
+public sealed class PlannedTask
+{
+ [JsonPropertyName("description")]
+ public string Description { get; init; } = string.Empty;
+
+ [JsonPropertyName("dependencies")]
+ public List<int> Dependencies { get; init; } = [];
+
+ [JsonPropertyName("budget_class")]
+ public string BudgetClass { get; init; } = "4K";
+
+ [JsonPropertyName("optimistic_tokens")]
+ public long OptimisticTokens { get; init; }
+
+ [JsonPropertyName("most_likely_tokens")]
+ public long MostLikelyTokens { get; init; }
+
+ [JsonPropertyName("pessimistic_tokens")]
+ public long PessimisticTokens { get; init; }
+
+ [JsonPropertyName("requires_external_effect")]
+ public bool RequiresExternalEffect { get; init; }
+}
+
+/// <summary>
+/// JSON Schema for Ollama structured output during Planning.
+/// </summary>
+public static class PlanSchema
+{
+ public static string Json => """{"type":"object","properties":{"tasks":{"type":"array","items":{"type":"object","properties":{"description":{"type":"string"},"dependencies":{"type":"array","items":{"type":"integer"}},"budget_class":{"type":"string","enum":["1K","2K","4K","8K","16K","32K","64K","128K"]},"optimistic_tokens":{"type":"integer","minimum":1},"most_likely_tokens":{"type":"integer","minimum":1},"pessimistic_tokens":{"type":"integer","minimum":1},"requires_external_effect":{"type":"boolean"}},"required":["description","dependencies","budget_class","optimistic_tokens","most_likely_tokens","pessimistic_tokens","requires_external_effect"]}}},"required":["tasks"]}""";
+
+ private static readonly JsonElement _element = JsonDocument.Parse(Json).RootElement.Clone();
+
+ public static JsonElement Element => _element;
+} \ No newline at end of file