Downloads · 30 days
0
stevenkhan/ai-harness
ai-harness is a machine learning model from stevenkhan. Use it for the machine learning task on the model card, and read the license before you ship it in a product.
A production-grade, model-agnostic CLI harness for agentic AI workflows.
Downloads · 30 days
0
Access
Public
Updated May 30, 2026
Repo size
—
Likes
0
Public
Click a slice to open those files.
.ts93 KB · 86%
From the Hugging Face model README
A production-grade, model-agnostic CLI harness for agentic AI workflows.
╭─────────────────────────────────────╮
│ ⚡ AI Harness v0.1.0 │
│ model-agnostic CLI agent runtime │
╰─────────────────────────────────────╯
A terminal-first agent runtime. Not a toy chatbot. It supports:
# Install dependencies
pnpm install
# Build
pnpm build
# Interactive chat
pnpm chat
# Autonomous task
node dist/cli/index.js run "refactor the auth module to use JWT"
# List providers/models
node dist/cli/index.js providers
# List tools
node dist/cli/index.js tools
# List skills
node dist/cli/index.js skills
Set provider API keys via environment variables:
export OPENAI_API_KEY="sk-..."
export ANTHROPIC_API_KEY="sk-ant-..."
export GEMINI_API_KEY="AI..."
export OPENROUTER_API_KEY="sk-or-..."
Override defaults with CLI flags:
harness chat --provider openai --model gpt-4o --skills coding research --verbose
harness run "build a REST API" --provider anthropic --model claude-sonnet-4-20250514 --budget-tokens 100000
| Command | Description |
|---|---|
harness chat | Interactive multi-turn chat |
harness run <goal> | Autonomous task execution |
harness providers | List providers and models |
harness tools | List available tools |
harness skills | List available skills |
harness config | Show configuration |
src/
core/
events/ — Event types, EventBus
provider/ — ProviderAdapter interface, message types
runtime/ — Session state, orchestration loop
tools/ — ToolRegistry, ToolDef, permissions
skills/ — SkillRegistry, SkillModule
evaluators/ — Evaluation checks, EvalReport
artifacts/ — ArtifactStore, export
policy/ — PolicyEngine, permission enforcement
observability/ — MetricsCollector, MetricEntry
providers/
openai/ — OpenAI adapter
anthropic/ — Anthropic adapter
gemini/ — Google Gemini adapter
openrouter/ — OpenRouter + OpenAI-compatible adapter
tools/
fs/ — read_file, write_file, list_directory
shell/ — shell_exec
web/ — web_fetch
skills/
coding/ — Software engineering instructions
research/ — Research & analysis instructions
docs/ — Technical writing instructions
cli/
index.ts — Commander entry point
commands/ — chat, run, providers, tools, skills, config
renderers/ — EventRenderer, Spinner, box drawing, metrics
state/ — Provider resolver, runtime factory
Everything flows through EventBus. Rendering, logging, metrics collection, and export all subscribe to the same event stream. This means you can add a new consumer (e.g., a web dashboard) without touching core logic.
All providers implement ProviderAdapter with invoke() and stream(). Message format, tool calling conventions, and response parsing are handled per-provider so the runtime never sees vendor-specific shapes.
Every tool declares its input/output schemas with Zod. The runtime validates inputs before execution and can generate JSON Schema for model function-calling automatically.
The PolicyEngine checks permission levels against the current policy mode before executing any tool. Denied tools return structured error messages to the model so it can adapt.
After task completion, the Evaluator runs all registered checks. Failed checks can trigger remediation (retry with error context), preventing premature success declarations.
See EXTENSION_GUIDE.md for detailed instructions on adding:
MIT
<!-- ml-intern-provenance -->This model repository was generated by ML Intern, an agent for machine learning research and development on the Hugging Face Hub.
from transformers import AutoModelForCausalLM, AutoTokenizer
model_id = 'stevenkhan/ai-harness'
tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForCausalLM.from_pretrained(model_id)
For non-causal architectures, replace AutoModelForCausalLM with the appropriate AutoModel class.