AnilKerai

model-harness: Build Controllable AI Agents for .NET

A ports-and-adapters framework for building bounded, extensible AI agents in .NET. It combines a model loop with context-shaping guides, safety sensors, tools and budget controls, with adapters for Anthropic, Azure OpenAI and Ollama.

Stars
1
Forks
1
Last commit
1 day ago
Contributors
1
Releases, 12 months
17

Our take

Newless than six months old and changing fast

Health score

54/100

How it is scored
Activity
69
Community
4
Issues
75
Pull requests
68
  • Fewer contributors than 92% of the projects we track

Model Harness is a thoughtfully modular, actively changing .NET agent framework, but its very recent history and dependence on one contributor make it a project to evaluate before relying on it as a long-term foundation.

Good fit if

  • You build in C#/.NET and want explicit extension points for model calls, context shaping, safety checks and budgets.
  • You need to compare hosted model providers with Ollama through a shared agent harness.
  • The MIT license and the option to adopt only selected packages suit your project.

Look elsewhere if

  • You need evidence from published benchmarks that a harness lets a smaller model match a larger one. The README says this has not been benchmarked.
  • Your team needs an established project with a broader contributor base before adopting a core dependency.
  • You need an agent framework for a language or runtime other than .NET.
All health signals
Last commit2026-10-11 (1 day ago)
Commits, last 90 days71
Releases, last 12 months17 (latest v3.1.0, 2026-10-11)
Contributors1
Issues closed, last 90 days12 (typically closed in 1 day)
Pull requests merged, last 90 days19 (typically merged in 0 days)
Project age5 months

Checked on 2026-10-13 with the GitHub API.

Overview

Model Harness is a C# framework that supplies the control layer around a language model: the loop that calls the model, runs tools and manages each turn. Its guides shape the context the model receives, while sensors observe and can intervene at defined points in the loop.

It is aimed at developers who want to build agents without locking their application to one model provider or embedding safety, budget and context logic directly into their own loop. The project provides swappable interfaces and working defaults, including adapters for Anthropic, Azure OpenAI and Ollama. Its claim that a well-designed harness can make smaller models useful is an ambition to test, not a result backed by benchmarks in the repository.

Key Features

  • A ports-and-adapters design lets developers replace model transport, guides, sensors, budget policy, tracing and other components independently.
  • Guides assemble the model's context each turn, including instructions, available tools, memory snippets and rendered history.
  • Sensors can annotate, reject, block, flag or challenge actions at five points in the agent loop.
  • Turn, token, cost and wall-clock limits are checked during a run; exhaustion returns a partial result rather than an exception.
  • Built-in model adapters support Anthropic, Azure OpenAI / AI Foundry and Ollama.
  • Standard wiring includes tools, safety sensors and OpenTelemetry tracing; optional packages add checkpointing, resilience and a live dashboard.
  • Optional capabilities include PII redaction, prompt-injection detection, loop detection, structured output, skills, compaction and human review.

Use Cases

  • A .NET application team can add tool-using agents while keeping model transport and safety policy replaceable.
  • A team evaluating local inference can connect Ollama and try the same harness with a locally hosted model; output quality still needs to be assessed for its own tasks.
  • Developers building agents with cost or runtime limits can use the budget controls to return best-effort partial results when a run reaches a limit.
  • A team needing visibility into agent runs can use OpenTelemetry tracing, or the optional in-process dashboard, to inspect turns and tool activity.
  • Engineers experimenting with agent design can implement custom guides and sensors without changing the central loop.

What you need

Detected in the repository

  • C# (main language on GitHub)
  • A test suite and automated checks on GitHub Actions

License in plain words

MITpermissive

  • Commercial use: yes
  • Modify and redistribute: yes
  • You must keep: the copyright and license notice
  • Share your changes: no

A summary, not legal advice: the LICENSE file is what applies.

Getting Started

Install the core package:

dotnet add package SapphireGuard.ModelHarness

For the standard setup and provider-specific packages, see the README and getting-started project.

Alternatives

  • deepagents: Deep Agents is Python-based and centers on planning, delegation, and file access, while model-harness is a .NET harness with safety sensors and budget controls.
  • OxyGent: OxyGent is a Python framework focused on configurable multi-agent collaboration, while model-harness provides a bounded .NET agent loop with safety sensors and budget controls.
ProjectLanguageLicenseStarsStatus
model-harnessC#MIT1New
deepagentsPythonMIT29.9kActive
OxyGentPythonOther2.1kMaintained

Considerations

The project is new and changing quickly. Recent commits and frequent releases show active development, and issues and pull requests have been handled promptly, but all contributions currently come from one person. Teams should review release changes and verify the APIs they depend on before upgrading.

The repository has not yet demonstrated its central efficiency thesis with benchmarks. Several capabilities are opt-in rather than active by default, and some ports use no-op defaults until configured. Selecting a model adapter and supplying its credentials are still the application's responsibility. The README describes support for .NET 8 and .NET 10; check the package and project requirements against your target environment.

Found this useful?

Share it with someone who would like model-harness.