The project is in a healthy, maintained state
LLM model pricing data — models.dev and OpenRouter sources
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
 Dependencies
 Project Readme

ActiveHarness

ActiveHarness

Gem Version

⚠️ Work in progress. The API is under active development and may change between versions without notice.

Running a single LLM call is easy. Running a reliable, observable, cost-controlled AI system is not.

ActiveHarness is a Ruby framework for building production-grade LLM pipelines — with deep observability, consensus-based decisions, automatic fallbacks, and real-time cost and timing control. Made for Rails, works in plain Ruby too.

ActiveHarness gem gives you the scaffolding to build multi-step pipelines where every agent is under full control: its inputs are directed, its outputs are observed, its errors are retried, and its cost is tracked. You define the logic; ActiveHarness handles the infrastructure.

What is a "Harness"?

A harness in software is scaffolding that keeps a component under control — directing its inputs, observing its outputs, and enforcing rules around it. ActiveHarness does exactly that for LLM agents.

Build AI-Based Pipelines!

Build multi-step, trackable, cost-effective, and reliable AI flows with a clean, Rails-native DSL.

Pipeline Flow

Build Nested AI Pipelines!

Group related steps into reusable sub-pipelines, and compose complex workflows from smaller ones. Each pipeline is just another step, with its own stop conditions, context forwarding, and execution time tracking.

Nested Pipelines

Compose Hybrid Pipelines!

Orchestrate deterministic and AI steps together.

Image

Control the Cost of Your AI Calls!

With ActiveHarness you can track time, tokens, and dollars for every agent call, pipeline step, and tribunal.

Cost Control
Cost in Application Provider's Cost
Image Image

Use Consensus-Based Decisions!

Use Tribunals to run multiple agents in parallel and make Verdicts based on their agreement — improving reliability and reducing biases and hallucinations.

Tribunal Diagram

Tribunals

Provide Event Tracing & Observability!

Use power of event hooks to log and trace every step of your AI flows, from individual agent calls to multi-step pipelines and parallel tribunals.

Event Tracing Architecture Grafana Dashboard
Event Tracing Grafana Metrics

Backend Agnostic — Built on OpenTelemetry, ready for any collector (Jaeger, Datadog, Honeycomb, or custom).

Use Memory to make your agents stateful!

Store conversation history in JSON, SQLite and PostgreSQL. Inject memory into prompts to make agents that remember past interactions.

Memory

Visualize Models' Cost and Type

Pricing

Add Streaming (SSE)!

Rails App Console
Streaming Streaming

Key Capabilities

Capability What it means
Multi-step Pipelines Chain agents sequentially, with per-step stop conditions and context forwarding
Tribunal Consensus Run multiple agents in parallel and accept the result only if they agree (unanimous, majority, or custom)
Automatic Fallbacks If a model fails, the next one in the chain takes over — zero extra code
Retry Policy Exponential backoff per model, globally configurable or per-agent
Full Observability Lifecycle hooks on every agent event: before_call, after_call, retry, failure — log, stream, or act
Real-time Streaming SSE-ready token streaming from any agent into your Rails response
Execution Time Tracking Per-agent and per-pipeline timing built in
Token  Cost Tracking Know exactly what each call cost in tokens and dollars
Rails-native DSL Clean file structure, Railtie integration, generator support
Event Tracing OpenTelemetry integration for distributed tracing of agents, tribunals, and pipelines

File Structure

File structure for Ruby and Ruby on Rails applications:

Place all of your AI-related code in app/ai to keep it organized and separate from your core application logic. You can further organize it into subdirectories for prompts, agents, tribunals, pipelines, and memory.

app/
├── models/
├── controllers/
├── views/
└── ai/
    ├── prompts/      # system prompt classes
    ├── agents/       # agent classes
    ├── tribunals/    # parallel verdict panels
    ├── pipelines/    # multi-step pipelines
    └── memory/       # custom memory classes

Prompt Documentation

Agent Documentation

Pipeline Documentation

Nested Pipelines Documentation

Tribunal Documentation

Memory Documentation

Installation and Configuration

Tracing and Observability

License

MIT © the-teacher