Repository navigation
HFLabs.ML.Agentic v1.0.0 — Zero-Dependency Agentic AI Patterns & Protocol Engine
HFLabs.ML.Agentic is an ultra-lean, production-grade .NET foundation providing 21 canonical agentic patterns alongside native protocol implementations for the Model Context Protocol (MCP) and Agent2Agent (A2A).
Targeting .NET 10 with zero external dependencies (0 PackageReference), it integrates seamlessly into high-performance C# microservices, agent runtimes, and distributed orchestrators.
🌟 Core Capabilities
1. 21 Battle-Tested Agentic Patterns
- Execution & Flow: Tool Registry & Dispatch, ReAct Loop, Chain of Thought (CoT), Chain of Verification (CoVe).
- Multi-Agent Orchestration: Multi-Agent Blackboard, Agent Router & Classifier, Hierarchical Supervisor-Worker, Dynamic Team Assembly.
- Cognition & Strategy: Plan-and-Solve Planner, Tree of Thoughts (ToT), Self-Consistency Majority Voting, Reflection & Self-Correction Loop.
- Safety, Governance & Memory: Human-in-the-Loop Approval Gates, Context Budget Compactor, Conversation Memory Window, Semantic Caching Key Normalizer, Episodic Memory Journal.
- Quality & Evaluation: Goal Progress Monitor, Agent-as-a-Judge Evaluator, Fallback Cascade / Graceful Degradation.
2. Native Protocols
- Model Context Protocol (MCP): Full compliant types for schema version
2025-06-18(Tools, Prompts, Resources, Capabilities, Ping, Notifications). - Agent2Agent Protocol (A2A): Specification
v0.2.5agent discovery cards, task lifecycle state transitions, messages, and artifacts. - JSON-RPC 2.0: Standardized request, batch, response, and error wire serialization.
📦 Installation
NuGet Package Manager
dotnet add package HFLabs.ML.Agentic --version 1.0.0🚀 Quick Start Example
using HFLabs.ML.Agentic;
using HFLabs.ML.Agentic.Protocols;
// 1. Tool Registry with timeout & validation
var registry = new ToolRegistry();
registry.Register(
name: "weather",
description: "Get current temperature",
handler: async (args, ct) => $"{{\"temp\": 72, \"city\": \"{args}\"}}"
);
// 2. Human-in-the-loop gate
var gate = new HumanInTheLoopGate<string, string>(
riskEvaluator: cmd => cmd.Contains("delete") ? RiskLevel.High : RiskLevel.Low,
approvalCallback: async (cmd, risk, ct) => true
);