惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
U
Unit 42
Google DeepMind News
Google DeepMind News
博客园 - 司徒正美
Y
Y Combinator Blog
F
Fortinet All Blogs
云风的 BLOG
云风的 BLOG
T
Tailwind CSS Blog
G
Google Developers Blog
酷 壳 – CoolShell
酷 壳 – CoolShell
罗磊的独立博客
D
DataBreaches.Net
T
The Blog of Author Tim Ferriss
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
MyScale Blog
MyScale Blog
N
Netflix TechBlog - Medium
Microsoft Security Blog
Microsoft Security Blog
GbyAI
GbyAI
P
Proofpoint News Feed
Jina AI
Jina AI
B
Blog RSS Feed
腾讯CDC
阮一峰的网络日志
阮一峰的网络日志
D
Docker

DEV Community

Authentication Security Deep Dive: From Brute Force to Salted Hashing (With Java Examples) Why AI Systems Don’t Fail — They Drift Spilling beans for how i learn for exam😁"Reinforcement Learning Cheat Sheet" I Replaced Chrome with Safari for AI Browser Automation. Here's What Broke (and What Finally Worked) How Python Borrows Other People's Work The $40 Architecture: Processing 1 Billion API Requests with 99.99% Uptime Vibe Coding: A Workflow Guide (From Zero to SaaS) Most webhook security guides protect the wrong side. The scary part is delivery. Headless CMS for TanStack Start: Build a Blog with Cosmic EU Age Verification App "Hacked in 2 Minutes" — What Actually Happened Comfy Cloud’s delete function does not actually remove files Running AI Models on GPU Cloud Servers: A Beginner Guide Event-driven media intelligence with AWS Step Functions and Bedrock I scored 500 AI prompts across 8 quality dimensions — here's what broke How to Call Google Gemini API from Next.js (Free Tier, No Backend Needed) The Portal Protocol: Reclaiming Human Connection in the Age of AI How to Fix Your Team's Scattered Knowledge Problem With a Self-Hosted Forum Intro to tc Cloud Functors: A Graph-First Mental Model for the Modern Cloud Designing Multi-Tenant Backends With Both Ownership and Team Access I Built a Neumorphic CSS Library with 77+ Components — Here's What I Learned PostgreSQL Performance Optimization: Why Connection Pooling Is Critical at Scale Cómo construí un SaaS multi-rubro para gestionar expensas en Argentina con FastAPI + Vue 3 🚀 I Built an Ethical Hacking Scanner Tool – Open Source Project I Replaced /usage and /context in Claude Code With a Single Statusline A Pythonic Way to Handle Emails (IMAP/SMTP) with Auto-Discovery and AI-Ready Design I Collected 8.9 Million Polymarket Price Points — Here's What I Found About How Markets Really Move EcoTrack AI — Carbon Footprint Tracker & Dashboard Everyone's Using AI. No One Agrees How. 5 self-hosted ebook managers worth trying in 2026 Building Your First AI Agent with LangChain: From Chatbot to Autonomous Assistant
Lite-Harness SDK
jeann · 2026-06-25 · via DEV Community

jeann

AI harnesses are the new vendor lock-in. To swap across harnesses easily without rewriting your app, LiteLLM launched the Lite-Harness SDK.

Run your prompt across different harnesses:

from lite_harness import query, AgentOptions

prompt = "Fix the failing test"

# Claude Code harness
async for message in query(
    prompt=prompt,
    options=AgentOptions(harness="claude-code", model="claude-opus-4-8"),
):
    print(message)

# Codex harness
async for message in query(
    prompt=prompt,
    options=AgentOptions(harness="codex", model="gpt-5.5"),
):
    print(message)

To enable cost controls, fallbacks, and logging, point it to your LiteLLM AI Gateway:

export LITELLM_API_BASE=https://litellm.your-company.com/v1
export LITELLM_API_KEY=sk-litellm-...

Engineer's Takeaway:
This SDK unifies how you invoke the agents, not how they run internally. Each harness keeps its native loop and tool-calling semantics. It is perfect for A/B testing agent performance and centralizing costs, but remember it is in public beta, so custom tool injection might require extra work!

The Problem I Had

My team was building an internal bot to fix failing CI/CD tests. We had three engineers advocating for three different harnesses: one wanted Claude Code, another Codex, and another Pi AI. Without an abstraction layer, we would have had to maintain three forks of the same bot, with three different SDKs, three logging systems, and three ways to track costs. It would have been an impossible maintenance burden.

How Lite-Harness Helped

The SDK solved that exact pain point in three concrete dimensions:

1. Unified Invocation (Time Savings)

Instead of maintaining three separate implementations, I had a single query() that routed to whichever harness I wanted. Switching from Claude Code to Codex was literally just changing a string in the options. This allowed us to do real A/B testing in production for two weeks without rewriting any core logic.

2. Cost Observability (The Killer Feature)

By connecting it to the LiteLLM AI Gateway, I could suddenly see on a single dashboard:

  • Claude Code resolved 78% of tests, averaging 4 iterations and $0.12 per fix.
  • Codex resolved 65% of tests with 6 iterations and $0.08 per fix.
  • Pi AI was cheaper but failed on tests involving complex mocks.

Without the gateway, tracking the real cost of an agent (which makes multiple sequential tool calls) is a nightmare of scattered logs.

3. Future Portability

When Anthropic released new capabilities in Claude Opus 4.8, I just updated the model string. I didn't have to touch the bot's underlying code. That's the real promise of LiteLLM: decoupling your application from the provider.

What Hit Me (Lessons Learned)

  • It doesn't unify behavior, only invocation. Each harness interprets the prompt and environment differently. We had to normalize our prompts with highly explicit instructions (e.g., "use grep before editing", "do not modify test files").
  • Lacks native iteration control. Without a built-in max_iterations, an agent can burn $5 in tokens if it gets stuck in an infinite loop. I had to wrap the query() call in an asyncio.wait_for with a strict timeout to protect our budget.
  • Custom tool injection is limited. If your agent needs to call internal APIs (Jira, Slack, internal DBs), the abstraction quickly becomes too restrictive. For those complex use cases, you end up dropping down to the harness's native SDK anyway.

Final Verdict

Lite-Harness probably saved me 3 weeks of integration work and gave me hard data to make an informed architecture decision. We ended up choosing Claude Code as our primary harness and Codex as a fallback for simpler, cost-sensitive tasks.