Zum Hauptinhalt springen
Echtzeit-Radar & Feeds
Alle RSS Feeds ➔
👥 Community & Social
YouTube Security VideosNutanix advances legacy and AI app management with AMD(01.10.2026 um 16:00 Uhr)
•
YouTube Security VideosPC-WELT: 32 TB SSD-Speicher in der HMX 6!(01.10.2026 um 16:15 Uhr)
••••
Videos & KonferenzenPC-WELT: 32 TB SSD-Speicher in der HMX 6!(01.10.2026 um 16:15 Uhr)
••
Sicherheitslücken (CVE)USN-8857-1: KCoreAddons vulnerability(01.10.2026 um 12:48 Uhr)
•••
YouTube Security VideosNutanix advances legacy and AI app management with AMD(01.10.2026 um 16:00 Uhr)
•
YouTube Security VideosPC-WELT: 32 TB SSD-Speicher in der HMX 6!(01.10.2026 um 16:15 Uhr)
••••
Videos & KonferenzenPC-WELT: 32 TB SSD-Speicher in der HMX 6!(01.10.2026 um 16:15 Uhr)
••
Sicherheitslücken (CVE)USN-8857-1: KCoreAddons vulnerability(01.10.2026 um 12:48 Uhr)
•••
Intelligence View
⚡ tsecurity.de Intelligence

Building Self-Referential Agents with .NET 10 & Aspire (Part 1)

Series: PMCR-O Framework Tutorial Canonical URL: https://shawndelainebellazan.com/article-building-self-referential-agents-part1 TL;DR Learn to build…

Beitrag
0
Seite
0
↗ Quelle (dev.to)
Social ReaktionenReagiere als Erste:r — dein Feedback zählt!

Series: PMCR-O Framework Tutorial


Canonical URL: https://shawndelainebellazan.com/article-building-self-referential-agents-part1







TL;DR



Learn to build autonomous AI agents using .NET 10, Ollama, and Aspire. This tutorial covers:




  • Production-ready infrastructure setup

  • Native JSON structured output (no regex parsing!)

  • "I AM" identity pattern for better agent behavior

  • GPU-accelerated local LLM inference



Code: GitHub - PMCR-O Framework







Why Local AI Agents Matter



Most AI tutorials rely on OpenAI's API. That's fine for demos, but production systems need:




  • ✅ Zero API costs during development

  • ✅ Data privacy (everything stays local)

  • ✅ Deterministic testing (no rate limits)

  • ✅ Full control over model lifecycle



Enter Ollama + .NET Aspire — the stack for self-hosted AI infrastructure.







Architecture Overview





┌─────────────────┐
│ .NET Aspire │ ← Orchestration Layer
│ AppHost │
└────────┬────────┘
│
┌────┴────┐
│ │
┌───▼───┐ ┌──▼────┐
│Ollama │ │Planner│ ← Agent Services
│Server │ │Service│
└───────┘ └───────┘









The "I AM" Pattern: Why It Matters



Traditional AI prompts:




❌ "You are a helpful assistant. Generate code for the user."






PMCR-O pattern:




✅ "I AM the Planner. I analyze requirements and create plans."






Research-backed: LLMs trained on first-person narration develop stronger task ownership (PROMPTBREEDER 2024).









Setup: Project Structure






# Create solution
mkdir PmcroAgents && cd PmcroAgents
dotnet new sln -n PmcroAgents

# Create projects
dotnet new aspire-apphost -n PmcroAgents.AppHost
dotnet new web -n PmcroAgents.PlannerService
dotnet new classlib -n PmcroAgents.Shared

# Add to solution
dotnet sln add **/*.csproj












The Aspire AppHost (Modern 2025 Setup)






using CommunityToolkit.Aspire.Hosting.Ollama;

var builder = DistributedApplication.CreateBuilder(args);

// Ollama with GPU support
var ollama = builder.AddOllama("ollama", port: 11434)
.WithDataVolume()
.WithLifetime(ContainerLifetime.Persistent)
.WithContainerRuntimeArgs("--gpus=all"); // ← GPU acceleration

// Download model
var qwen = ollama.AddModel("qwen2.5-coder:7b");

// Agent service
var planner = builder.AddProject<Projects.PmcroAgents_PlannerService>("planner")
.WithReference(ollama)
.WaitFor(qwen);

builder.Build().Run();






What this does:




  1. Spins up Ollama in Docker

  2. Downloads qwen2.5-coder model (7.4GB)

  3. Injects Ollama connection string into Planner service

  4. Enables GPU passthrough for fast inference









Native JSON Output (No Regex!)






The Old Way ❌






// DON'T: Parse LLM text output with regex
var json = ExtractJsonWithBracketCounter(llmOutput);
var plan = JsonSerializer.Deserialize<Plan>(json);






Problems:




  • ~85% success rate

  • 50-200ms overhead

  • Breaks on nested objects






The New Way ✅






var chatOptions = new ChatOptions
{
ResponseFormat = ChatResponseFormat.Json, // ← Magic happens here
AdditionalProperties = new Dictionary<string, object?>
{
["schema"] = JsonSerializer.Serialize(new
{
type = "object",
properties = new
{
plan = new { type = "string" },
steps = new { type = "array" },
complexity = new {
type = "string",
@enum = new[] { "low", "medium", "high" }
}
}
})
}
};






Results:




  • ~99% success rate

  • <1ms deserialization

  • Schema-enforced validation









Planner Agent Implementation






public override async Task<AgentResponse> ExecuteTask(
AgentRequest request,
ServerCallContext context)
{
_logger.LogInformation("🧭 I AM the Planner. Analyzing: {Intent}", request.Intent);

var messages = new List<ChatMessage>
{
new(ChatRole.System, GetSystemPrompt()),
new(ChatRole.User, request.Intent)
};

var response = await _chatClient.CompleteAsync(messages, chatOptions);

return new AgentResponse
{
Content = response.Message.Text,
Success = true
};
}

private static string GetSystemPrompt() => @"
# IDENTITY
I AM the Planner within the PMCR-O system.
I analyze requirements and create minimal viable plans.

# OUTPUT FORMAT
I output ONLY valid JSON matching this schema:
{
""plan"": ""high-level strategy"",
""steps"": [
{""action"": ""concrete step"", ""rationale"": ""why this step""}
],
""estimated_complexity"": ""low|medium|high""
}
"
;












Testing It






cd PmcroAgents.AppHost
dotnet run






Navigate to http://localhost:15209 for the Aspire dashboard.



Example request:




{
"intent": "Create a console app that prints 'Hello PMCR-O'"
}






Expected output:




{
"plan": "Create minimal C# console app",
"steps": [
{
"action": "Run: dotnet new console -n HelloPmcro",
"rationale": "Use default template"
},
{
"action": "Modify Program.cs",
"rationale": "Add Console.WriteLine statement"
}
],
"estimated_complexity": "low"
}












Performance Benchmarks




























Metric CPU (16-core) GPU (RTX 4090)
First inference 45-60s 3-5s
Subsequent 30-45s 2-3s
Memory usage 8GB 6GB








Key Takeaways





  1. Native JSON > Custom Parsing: Ollama's JSON mode eliminates fragile regex logic


  2. Aspire = DX Win: One dotnet run orchestrates everything


  3. GPU Acceleration: 10-15x faster inference with --gpus=all


  4. "I AM" Identity: First-person prompts improve agent agency









Next in Series



Part 2: Adding Maker, Checker, and Reflector agents to complete the PMCR-O cycle.









Resources








This article originally appeared on shawndelainebellazan.com — The home of Behavioral Intent Programming.



Building resilient systems that evolve. 🚀

🔍 CTI & Forensik

Cyber Threat Intelligence & Forensik

Bedrohungsgraph · ATT&CK-Mapping · Exploit-Belege
CTI Threat Relationship Graph
Akteure · Techniken · Beziehungen
4 Knoten · 3 Relationen
CVE / Incident Threat Actor Software MITRE ATT&CK CWE Weakness IoC
MITRE ATT&CK Matrix Navigator
Enterprise-Matrix · nur belegte Techniken
14 Taktiken
1 belegte Technik
T1190TA0001 · Initial Access
Exploit Public-Facing Application
Mitigation: M1042 Network Segmentation & WAF Rule Enforcement
Quelle: Kontext-Klassifikation des Artikeltextes
Reconnaissance
Resource Development
Initial Access
Execution
Persistence
Privilege Escalation
Defense Evasion
Credential Access
Discovery
Lateral Movement
Collection
Command and Control
Exfiltration
Impact
Ähnliche Beiträge
🔍 Verwandte News

Auch interessante Nachrichten Building Self-Referential Agents with .NET 10 & Aspire (Part 1)

Thematisch verwandte Begriffe: Building, SelfReferential, Agents, with · 6 Treffer

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

💬 Kommentare werden geladen…
Zum Aktualisieren ziehen
tsecurity.de Icon
Offline-Lesen, Eilmeldungen & 0ms Ladezeit

Installiere tsecurity.de direkt auf deinen Home-Bildschirm für das ultimative Vollbild-Magazinerlebnis ohne Browser-Leisten.

Nächster Beitrag