diff options
Diffstat (limited to 'src/Agent.Core/Prompts')
| -rw-r--r-- | src/Agent.Core/Prompts/FixedPrompt.cs | 16 | ||||
| -rw-r--r-- | src/Agent.Core/Prompts/FixedSystemPrompt.md | 4 | ||||
| -rw-r--r-- | src/Agent.Core/Prompts/PromptComposer.cs | 36 |
3 files changed, 56 insertions, 0 deletions
diff --git a/src/Agent.Core/Prompts/FixedPrompt.cs b/src/Agent.Core/Prompts/FixedPrompt.cs new file mode 100644 index 0000000..6995bd4 --- /dev/null +++ b/src/Agent.Core/Prompts/FixedPrompt.cs @@ -0,0 +1,16 @@ +using System.Reflection; + +namespace Agent.Core.Prompts; + +public static class FixedPrompt +{ + private const string ResourceName = "Agent.Core.Prompts.FixedSystemPrompt.md"; + + public static string Load() + { + using Stream stream = typeof(FixedPrompt).Assembly.GetManifestResourceStream(ResourceName) + ?? throw new InvalidOperationException($"Embedded resource '{ResourceName}' was not found."); + using var reader = new StreamReader(stream); + return reader.ReadToEnd(); + } +} diff --git a/src/Agent.Core/Prompts/FixedSystemPrompt.md b/src/Agent.Core/Prompts/FixedSystemPrompt.md new file mode 100644 index 0000000..3cbc6e7 --- /dev/null +++ b/src/Agent.Core/Prompts/FixedSystemPrompt.md @@ -0,0 +1,4 @@ +You are the execution agent inside AI Agent Sandbox MCP Server. +Follow the active SandboxPolicy and never claim an external effect unless an Internal Tool result proves it occurred. +Never reveal hidden reasoning, policy internals, credentials, or capabilities not present in the supplied capability summary. +Complete a request only when every TaskGraph node is completed and all required effects are verified. diff --git a/src/Agent.Core/Prompts/PromptComposer.cs b/src/Agent.Core/Prompts/PromptComposer.cs new file mode 100644 index 0000000..e07c7e8 --- /dev/null +++ b/src/Agent.Core/Prompts/PromptComposer.cs @@ -0,0 +1,36 @@ +using Agent.Core.Ollama; +using Agent.Core.Sessions; + +namespace Agent.Core.Prompts; + +public sealed record PromptContext( + string FixedSystemPrompt, + string UserSystemPrompt, + string Locale, + IReadOnlyList<string> Skills, + string SandboxCapabilitySummary, + string TaskGraphSummary, + string PreviousSummary, + IReadOnlyList<ConversationMessage> Conversation, + string Request, + IReadOnlyList<string>? Images = null); + +public static class PromptComposer +{ + public static IReadOnlyList<OllamaMessage> Compose(PromptContext context) + { + var messages = new List<OllamaMessage> + { + new("system", context.FixedSystemPrompt), + new("system", context.UserSystemPrompt), + new("system", $"Respond in locale: {context.Locale}."), + new("system", string.Join("\n\n", context.Skills)), + new("system", context.SandboxCapabilitySummary), + new("system", context.TaskGraphSummary), + new("system", context.PreviousSummary) + }; + messages.AddRange(context.Conversation.Select(static item => new OllamaMessage(item.Role, item.Content))); + messages.Add(new OllamaMessage("user", context.Request, context.Images)); + return messages; + } +} |
