Zum Hauptinhalt springen
tsecurity.de LIVE
Echtzeit-Radar & Feeds
Alle RSS Feeds
👥 Community & Social
Windows Tipps & SecurityTestMu AI Review: How AI is Solving the Quality Engineering Problem(23.09.2026 um 13:18 Uhr)
Windows Tipps & SecurityAmazon haut den kabellosen Dyson V8 Stabstaubsauger zum Tiefstpreis raus(24.09.2026 um 09:32 Uhr)
Windows Tipps & SecurityUpdates beheben etliche Schwachstellen in Foxit PDF Reader(24.09.2026 um 09:44 Uhr)
Windows Tipps & Security„Vom Experience Center zum monumentalen Signage-Projekt“(24.09.2026 um 10:30 Uhr)
Windows Tipps & SecurityTestMu AI Review: How AI is Solving the Quality Engineering Problem(23.09.2026 um 13:18 Uhr)
Windows Tipps & SecurityAmazon haut den kabellosen Dyson V8 Stabstaubsauger zum Tiefstpreis raus(24.09.2026 um 09:32 Uhr)
Windows Tipps & SecurityUpdates beheben etliche Schwachstellen in Foxit PDF Reader(24.09.2026 um 09:44 Uhr)
Windows Tipps & Security„Vom Experience Center zum monumentalen Signage-Projekt“(24.09.2026 um 10:30 Uhr)
Intelligence View
⚡ tsecurity.de Intelligence

Microsoft Agent Framework with Ollama (.NET/C#)

Introduction This week, I published a blog post explaining how to use Microsoft Agent Framework with Foundry Local. Because Foundry Local does not support native tool calling, we must implement the tool-calling loop manually.…

0
↗ Quelle (dev.to)
Reagiere als Erste:r — dein Feedback zählt!




Introduction



This week, I published a blog post explaining how to use Microsoft Agent Framework with Foundry Local. Because Foundry Local does not support native tool calling, we must implement the tool-calling loop manually. Specifically, the LLM is first given a list of available tools and asked to decide whether a tool invocation is required. We then parse the model’s response, execute the selected tool, and feed the results back into the LLM for final generation. These extra steps are necessary because Foundry Local lacks built-in tool-calling support, meaning the UseFunctionInvocation capability on the ChatClient in Microsoft.Extensions.AI cannot handle this automatically.



Just yesterday, I read the excellent post Building Multi-Agent Workflows in .NET with AgentFactory and Handoff by El Bruno. In that article, he highlights using Microsoft Agent Framework with Ollama via the native Ollama provider included in the framework (sample here). This immediately sparked an idea: we can extend my previous sample at

https://github.com/thangchung/agent-engineering-experiment/tree/main/foundry-local-agent-fx

by adding Ollama as an additional provider, allowing us to switch seamlessly between Foundry Local and Ollama depending on the use case.



This post walks through the design, implementation, and code required to make that approach work in practice.





Prerequisites





> ollama --version
ollama version is 0.13.5






  • Now I have ollama run on my local machine at http://localhost:11434/

  • Because I will use mistral LLM model, I have to run:



> ollama pull mistral
pulling manifest
pulling f5074b1221da: 100% ▕██████████████████████████████████████████████████████████▏ 4.4 GB
pulling 43070e2d4e53: 100% ▕██████████████████████████████████████████████████████████▏ 11 KB
pulling 1ff5b64b61b9: 100% ▕██████████████████████████████████████████████████████████▏ 799 B
pulling ed11eda7790d: 100% ▕██████████████████████████████████████████████████████████▏ 30 B
pulling 1064e17101bd: 100% ▕██████████████████████████████████████████████████████████▏ 487 B
verifying sha256 digest
writing manifest
success







Setup the code structure





Aspire's AppHost





// Active provider: "FoundryLocal" or "Ollama"
var activeProvider = builder.AddParameter("agent-provider", "Ollama");

// Ollama configuration
var ollamaEndpoint = builder.AddParameter("ollama-endpoint", "http://localhost:11434/");
var ollamaModel = builder.AddParameter("ollama-model", "mistral");

var mcpToolServer = builder.AddProject<Projects.McpToolServer>("mcp-tools")
.WithExternalHttpEndpoints();

var agentService = builder.AddProject<Projects.AgentService>("agentservice")
.WithReference(mcpToolServer)
// Provider selection
.WithEnvironment("AGENT_PROVIDER", activeProvider)
// Ollama settings
.WithEnvironment("OLLAMA_ENDPOINT", ollamaEndpoint)
.WithEnvironment("OLLAMA_MODEL", ollamaModel)
// MCP Tools
.WithEnvironment("MCP_TOOLS", mcpToolServer.GetEndpoint("http"))
.WithExternalHttpEndpoints()
.WaitFor(mcpToolServer);

builder.Build().Run();





Check the full code at https://github.com/thangchung/agent-engineering-experiment/blob/main/foundry-local-agent-fx/AppHost/AppHost.cs





Create Microsoft Agent Framework's Ollama factory





public static ChatClientAgent Create(
string endpoint,
string model,
IList<McpClientTool> mcpTools,
string? instructions = null,
string? name = null,
string? description = null,
ILoggerFactory? loggerFactory = null,
bool? enableSensitiveData = null)
{
var ollamaClient = new OllamaApiClient(new Uri(endpoint), model);

var tools = mcpTools.Cast<AITool>().ToList();

// Build the chat client pipeline with OpenTelemetry instrumentation
IChatClient chatClient = new ChatClientBuilder(ollamaClient)
.UseOpenTelemetry(
loggerFactory: loggerFactory,
sourceName: OtelSourceName,
configure: otel =>
{
// Enable sensitive data capture if explicitly set, otherwise respect env var
// OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT=true
if (enableSensitiveData.HasValue)
{
otel.EnableSensitiveData = enableSensitiveData.Value;
}
})
.UseFunctionInvocation(loggerFactory: loggerFactory)
.Build();

// Create the agent with the instrumented chat client
return new ChatClientAgent(
chatClient: chatClient,
instructions: instructions ?? "You are a helpful assistant with access to tools.",
name: name ?? "OllamaAgent",
description: description,
tools: tools);
}





The full source code can be found at https://github.com/thangchung/agent-engineering-experiment/blob/main/foundry-local-agent-fx/AgentService/Providers/OllamaAgentFactory.cs





Create AgentFroviderFactory to choose Ollama or Foundry Local





return providerType switch
{
// Ollama uses official ChatClientAgent with FunctionInvokingChatClient
AgentProviderType.Ollama => services.CreateOllamaAgent(
ollamaEndpoint: config.Endpoint,
model: config.Model,
mcpToolsUrl: config.McpToolsUrl,
mcpTools: mcpTools,
instructions: instructions,
name: name ?? "OllamaAgent",
description: description ?? "AI Agent powered by Ollama"),

AgentProviderType.FoundryLocal => services.CreateFoundryLocalAgent(
foundryEndpoint: config.Endpoint,
model: config.Model,
mcpToolsUrl: config.McpToolsUrl,
mcpTools: mcpTools,
instructions: instructions,
name: name ?? "FoundryLocalAgent",
description: description ?? "AI Agent powered by Foundry Local"),

_ => throw new ArgumentException($"Unknown provider type: {providerType}", nameof(providerType))
};





Full source code at https://github.com/thangchung/agent-engineering-experiment/blob/main/foundry-local-agent-fx/AgentService/Providers/AgentProviderFactory.cs





Wire it up



In the Program.cs, we can wire it all up as.




var agent = AgentProviderFactory.Create(
services: app.Services,
providerType: providerType,
config: providerConfig,
mcpTools: mcpTools,
instructions: instructions,
name: $"{providerType}Agent",
description: $"AI Agent powered by {providerType} with MCP tools");






And /chat endpoint can be easy to use it:




app.MapPost("/chat", async (ChatRequest request) =>
{
try
{
logger.LogInformation("Processing chat: '{Message}'", request.Message);

// Get or create thread
AgentThread agentThread;
string threadId;

if (!string.IsNullOrEmpty(request.ThreadId) && threads.TryGetValue(request.ThreadId, out var existingThread))
{
agentThread = existingThread;
threadId = request.ThreadId;
logger.LogDebug("Using existing thread: {ThreadId}", threadId);
}
else
{
agentThread = agent.GetNewThread();
threadId = GetThreadId(agentThread);
threads[threadId] = agentThread;
logger.LogDebug("Created new thread: {ThreadId}", threadId);
}

// Run the agent
var messages = new[] { new ChatMessage(ChatRole.User, request.Message) };
var response = await agent.RunAsync(messages, agentThread);

// Get the assistant's response
var responseText = response.Messages.LastOrDefault()?.Text ?? "No response generated.";

return Results.Ok(new ChatResponse(responseText, threadId));
}
catch (Exception ex)
{
logger.LogError(ex, "Error processing chat request");
return Results.Problem(ex.Message);
}
});









Some results





scalar-ui





chat-completion-tracing





genai-semantic-tracing








Conclusion



This wraps up what I explored using Ollama with Microsoft Agent Framework. As you can see, the integration is quite straightforward and does not require significant effort to get up and running.



Happy New Year to everyone reading this post. I’m looking forward to seeing Microsoft Agent Framework reach GA very soon and to the innovations the community will build on top of it.



Full source code of this post: https://github.com/thangchung/agent-engineering-experiment/tree/main/foundry-local-agent-fx

IoC Intelligence (2 Indikatoren)
7be39c7db2e75b89be11d6e373fe1780dev[.]to
CTI Threat Relationship Graph3 Knoten / 2 Relationen
CVE / Incident Software MITRE ATT&CK CWE Weakness IoC
SOC Incident Playbook: Remote Code Execution (RCE) Defense
title: Detect Exploitation - Microsoft Agent Framework with Ollama (.NET/C#)
id: 0cf3d1d5-cdce-45f0-8cd0-a9e5bd1c9ff2
status: experimental
description: Automatisch generierte SIEM-Erkennungsregel basierend auf CTI Intelligence
references:
  - https://tsecurity.de/
author: iShareStuff CTI Automated Detection Engine
date: 2026-09-24
logsource:
  category: network_connection
  product: any
detection:
  selection:
      DestinationHostname:
        - 'dev.to'
  condition: selection
falsepositives:
  - Legitime administrative Zugriffe oder Penetrationstests
level: high
tags:
  - attack.initial_access
rule CTI_Threat_Indicator {
    meta:
        author = "iShareStuff CTI Automated Detection Engine"
        date = "2026-09-24"
        description = "YARA Signature for "
    strings:
        $str = "Microsoft Agent Framework with" ascii wide
    condition:
        any of them
}
tsecurity.de Cognitive Threat RAG
Fokus-Vektor:

Kognitive Analyse für identifizierte Bedrohung: Erhöhte Bedrohungslage im Bereich Microsoft Agent Framework with Ollama (..... Basierend auf 368k Vektor-Korrelationen werden sofortige Isolationsmaßnahmen für betroffene Endpunkte empfohlen.

🛡️ Angriffsfläche & Exposure

Netzwerk/Remote-Zugriff ohne Vorauthentifizierung möglich.

Empfohlene Sofortmaßnahmen
  • 1. Perimeter-Inspektion: Relevante Portfreigaben und exponierte Endpunkte unverzüglich scannen.
  • 2. Patch-Applikation: Hersteller-Hotfix einspielen oder betroffene Daemons in isolierte DMZ-Segmente überführen.
  • 3. Telemetrie & EDR-Alerts: Prozessaufrufe und Child-Processes auf anomale Shell-Spawns überwachen.
🔗 Semantisch verwandte Zero-Days MariaDB 11.7 VEC
Ähnliche Beiträge
🔍 Verwandte News

Auch interessante Nachrichten Microsoft Agent Framework with Ollama (.NET/C#)

Thematisch verwandte Begriffe: Microsoft, Agent, Framework, with · 6 Treffer

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 ...

Zum Aktualisieren ziehen
ZERO-DAY CVE-2026-97056 | SigNoz versions from v0.98.0 up to (but not including) v0.143.0, when co…
Advisory →
TTS Reader • tsecurity.de Voice
tsecurity.de Icon
tsecurity.de App
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
Themen-Radar & Intelligence Matrix
Echtzeit-Taxonomie nach Angriffsvektoren & Plattformen

tsecurity.de Live Threat Radar

🔴 LIVE RADAR
MONITORING
AKTIV
CVE-DATENBANK
LIVE
🔍
Community Radar & Live Chat
Sentinel Bot online • Live-Stream
Dein Cluster: Security Explorer
Match:
lädt…
Verbindung zum Community-Stream wird aufgebaut...
Bearbeitungsmodus — Senden überschreibt deine Nachricht
Community-Puls — was gerade passiert
lädt…
Aktivitäten deiner Analysten
lädt…
Neues Thema oder Eilmeldung einreichen

Reiche interessante Links, Zero-Days oder Debatten ein. Die Community entscheidet per Upvote über die Veröffentlichung.

Heiß diskutierte Einreichungen
🔖 Gespeicherte Artikel
📂 Keine gespeicherten Artikel vorhanden.
Zurück Ziehen Vor
Links: vorheriger Artikel Rechts: nächster Artikel unten: schließen
News NIS-2 Frühwarnung Tier-1 Intel TTP ⏱️ 3 Min vor 10 Min
Artikeldaten werden geladen...

Zurück: vorheriger Vor: nächster
↗ Original-Quelle
Social Reaktionen Deine Reaktion zählt
Einstufung & Relevanz-Poll 0 Stimmen
In sozialen Netzwerken teilen 1-Klick