AgentFramework.Kernel is a minimal .NET 8 library for building agents based on the MAPE-K loop and related control-loop architectures.
It provides:
- A kernel that orchestrates agent execution.
- A pluggable middleware pipeline.
- Extensible loop profiles (e.g. MAPE-K, reactive loops).
- Minimal abstractions to keep agents composable and testable.
From NuGet:
dotnet add package AgentFramework.Kernel
Create a kernel, a profile, and run a tick:
using AgentFramework.Kernel;
using AgentFramework.Kernel.Abstractions;
var profile = new TestProfile(); // sample profile (see HelloKernel)
var kernel = new AgentKernel(profile, new IKernelMiddleware[]
{
new LoggingMiddleware()
});
await kernel.StartAsync();
await kernel.TickAsync();
await kernel.StopAsync();
👉 See the HelloKernel sample for a runnable console app.
The AgentKernel
is the control loop runner.
It starts, stops, and executes ticks, invoking each step defined by the active profile.
A ILoopProfile
defines the ordered steps an agent executes.
Examples:
- MAPE-K (Monitor → Analyze → Plan → Execute → Knowledge update).
- Reactive loop (Sense → Act).
Profiles are the extensibility point for experimenting with different agent families.
Middleware implements IKernelMiddleware
and runs before/after each step:
- Tracing
- Logging
- Metrics
- Policy enforcement
KernelContext
flows through the pipeline and provides:
- The current
StepId
- Cancellation token
- A scratchpad (
Items
) for cross-cutting state
- samples/HelloKernel – minimal console app showing a test profile and logging middleware.
- tests/AgentFramework.Kernel.Tests – xUnit smoke tests for kernel contracts.
Run tests:
make test
Run the sample:
make hello-kernel
- Versions are managed by semantic-release and git tags (
vX.Y.Z
). - Pre-1.0: breaking changes bump minor, not major (
preMajor:true
). - Package versions are injected at build time via MinVer.
- See CHANGELOG.md for release history.
Dry-run a release locally:
make release-dry-run
- Fork & clone
- Run
make build
/make test
- Add features with Conventional Commit messages (
feat: ...
,fix: ...
) - Open a PR
MIT © David Runemalm