# model-harness: Build Controllable AI Agents for .NET

This repository profile is provided by osrepos.com, an open source repository discovery platform.

Source: osrepos.com
Repository profile: https://osrepos.com/repo/anilkerai-model-harness
Generated for open source discovery and AI-assisted research.

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.

GitHub: https://github.com/AnilKerai/model-harness
OSRepos URL: https://osrepos.com/repo/anilkerai-model-harness

## Summary

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.

## Topics

- csharp
- ai-agents
- agent-framework
- agent-harness
- context-engineering
- sensor-based-safety

## Repository Information

Last analyzed by OSRepos: Tue Oct 13 2026 16:07:27 GMT+0100 (Western European Summer Time)
Detail views: 0
GitHub clicks: 2

## Safety Notice

OSRepos shares public repositories for knowledge and discovery only. Review source code, dependencies, licenses, and security implications before running or installing anything.

## Content

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

## Our Take

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.

## Project Health

| Signal | Value |
|---|---|
| Status | **New**: less than six months old and changing fast |
| Last commit | 2026-10-11 (1 day ago) |
| Commits, last 90 days | 71 |
| Releases, last 12 months | 17 (latest v3.1.0, 2026-10-11) |
| Contributors | 1 |
| Issues closed, last 90 days | 12 (typically closed in 1 day) |
| Pull requests merged, last 90 days | 19 (typically merged in 0 days) |
| Project age | 5 months |

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

## Project Facts

- Language: C#
- License: MIT
- Stars: 1
- Forks: 1
- Topics: agent, agent-framework, agentic-ai, agents, agentskills, ai, ai-agents, clean-architecture
- Archived: no

## What You Need

Detected in the repository:

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

## Getting Started

Install the core package:

```sh
dotnet add package SapphireGuard.ModelHarness
```

For the standard setup and provider-specific packages, see the [README](https://github.com/AnilKerai/model-harness#quickstart) and [getting-started project](https://github.com/AnilKerai/model-harness/tree/main/getting-started).

## License in Plain Words

**MIT** (permissive).

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

## Alternatives

- [deepagents](https://osrepos.com/repo/hwchase17-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](https://osrepos.com/repo/jd-opensource-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.

| Project | Language | License | Stars | Status |
|---|---|---|---|---|
| **model-harness** | C# | MIT | 1 | New |
| [deepagents](https://osrepos.com/repo/hwchase17-deepagents) | Python | MIT | 29.9k | Active |
| [OxyGent](https://osrepos.com/repo/jd-opensource-oxygent) | Python | NOASSERTION | 2.1k | Maintained |

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