Open Harness

Reference

Complete API reference for Open Harness v0.3.0

Reference Documentation

Complete technical reference for Open Harness — APIs, types, and signals.

Core API

The primary functions for building reactive agent workflows:

FunctionDescription
createWorkflow<TState>()Factory returning typed agent() and runReactive()
agent(config)Define a reactive agent with activateOn, emits, when
runReactive(config)Execute a signal-based workflow

Harnesses

Adapters that connect to AI model APIs:

  • ClaudeHarness - Anthropic Claude models
  • CodexHarness - OpenAI Codex models (coming soon)

Signal Types

Signals emitted during workflow execution:

CategorySignals
Workflowworkflow:start, workflow:end
Agentagent:activated, agent:skipped, agent:completed
Harnessharness:start, harness:end, harness:error
Texttext:delta, text:complete
Statestate:\{key\}:changed
CustomAny signal name via emits

API Pages

Detailed reference for runtime components:

  • Runtime - Core runtime execution
  • Events - Signal system reference

Type Definitions

TypeScript types for the signal architecture:

Agent Configuration

agent({
  // Required
  prompt: string,           // Template with {{ state.x }} syntax
  activateOn: string[],     // Signal patterns to react to

  // Optional
  emits?: string[],         // Signals this agent emits
  when?: (ctx) => boolean,  // Guard condition
  updates?: keyof TState,   // Auto-update state field
  harness?: Harness,        // Per-agent harness override
})

runReactive Configuration

runReactive({
  // Required
  agents: Record<string, Agent>,
  state: TState,
  harness: Harness,

  // Optional
  endWhen?: (state: TState) => boolean,
  recording?: {
    mode: "record" | "replay",
    store: SignalStore,
    recordingId?: string,    // Required for replay
    name?: string,           // Recording name
    tags?: string[],         // Recording tags
  },
  reducers?: Record<string, Reducer>,
})

Result Shape

interface WorkflowResult<TState> {
  state: TState;              // Final state
  signals: Signal[];          // Full signal trace
  metrics: {
    durationMs: number;       // Execution time
    activations: number;      // Agent activation count
  };
  terminatedEarly: boolean;   // endWhen triggered
  recordingId?: string;       // If recording
}

On this page