Most AI agent demos look incredible until they hit real infrastructure. The disconnect between probabilistic models and deterministic production systems causes failures that tests miss and users find first. A new open-source project, AgentHarness-claude-sdk, tackles this by introducing 'harness engineering'β€”a layer that wraps the Claude Agent SDK (version 0.2.152) to guarantee reliability despite model uncertainty.

The Mismatch of Kinds

The core problem is fundamental: models are probabilistic, but production stacks are deterministic. A model with 90% accuracy wired directly into a system will break one in ten times, often silently. The author argues that prompt engineering and context engineering are insufficient for production safety. Instead, developers need to control execution. The harness doesn't try to make the model perfect; it builds a system that remains stable even when the model hallucinates or loops.

Moving Beyond Tool Calling

The project outlines five stages of agent maturity, identifying the jump from Stage 2 (tool calling) to Stage 3 (deterministic harness) as the critical bottleneck where most projects stall. Stage 2 demos look great but lack sandboxing and loop prevention. The harness introduces strict verification gatesβ€”format, lint, types, and testsβ€”that decide success, not the model's confidence. It also implements path jailing to block symlink escapes and OS-level sandboxing using seatbelt on macOS and bubblewrap on Linux.

Technical Implementation

The solution leverages the claude-agent-sdk rather than the basic anthropic HTTP client because the SDK wraps the Claude Code CLI, handling the agent loop, sessions, and permissions natively. The implementation uses ClaudeSDKClient for live sessions, allowing self-healing loops where gate outputs feed back into the agent's context. Routing is handled by rule-based tiers (scout, worker, architect) to avoid latency taxes from additional LLM calls. The system runs behind a FastAPI backend with SSE streaming and a Streamlit console for visualization.

Key Takeaways

  • Use claude-agent-sdk (0.2.152) for full agent loops, not the basic anthropic client.
  • Implement deterministic verification gates (lint, type, test) to override model output.
  • Prevent doom-loops by detecting alternating read/test cycles and resetting on real progress.
  • The 'flywheel' concept allows failures to patch the environment, improving future runs.

The Bottom Line

Stop trying to prompt your way to reliability. The future of production AI agents isn't better models, it's better cages. If you can't ship your agent, you're likely stuck at Stage 2, and this harness provides the deterministic guardrails you need to break through.