{"slug": "vendor-neutral-llm-harness-with-local-first-support", "title": "Vendor-neutral LLM harness with local-first support", "summary": "A new open-source Python library, llm-harness-lite 0.1.0, has been released as a vendor-neutral, local-first LLM agent harness whose core is roughly 1,000 lines of code and depends only on the Python standard library. The library routes config.yaml through an llm/factory, agent/loop and tools/registry pipeline, supports OpenAI-compatible providers including Ollama and vLLM plus Anthropic, and ships optional extras for pgvector and Qdrant retrieval and an MCP client, requiring Python 3.10 or newer. The release's author states the project is a library rather than a production API service or deployment stack, providing no application authentication, TLS configuration, high availability, backups or centralized monitoring, and asks users to file issues on rough edges in the async loop, MCP lifecycle, routing/cache semantics and API ergonomics.", "body_md": "Local-first, vendor-neutral, cost-aware. Not the next LangChain: ~1k LOC core you can read in an afternoon.\n\n```\nconfig.yaml → llm/factory → agent/loop → tools/registry (+ RAG as tool, MCP tools)\n```\n\n**0.1.0 Feedback Welcome:** This is an early release focused on clean primitives, explicit routing, and readable internals rather than heavyweight abstractions. If you spot rough edges in the async loop, MCP lifecycle, routing/cache semantics, or API ergonomics, please open an issue or start a thread in Discussions.\n\n``` python\nimport asyncio\nfrom llm_harness_lite import Agent, ToolRegistry, create_llm, tool\n\nregistry = ToolRegistry()\n\n@tool(registry)\ndef add_numbers(a: int, b: int) -> int:\n    \"\"\"Add two integers together.\"\"\"\n    return a + b\n\nasync def main() -> None:\n    llm = create_llm(\"openai_compat\", \"qwen3:8b\", base_url=\"http://localhost:11434/v1\")\n    async with llm:\n        agent = Agent(llm=llm, registry=registry)\n        result = await agent.arun(\"What is 17 + 25?\")\n        print(result.answer, result.stop_reason, result.usage)\n\nasyncio.run(main())\n```\n\n`See examples/ (01_basic_chat.py through 07_document_inquirer.py) and LOCAL_SETUP.md for full workflows covering RAG, MCP, caching, and cost comparisons.`\n\n```\npip install llm-harness-lite                 # dependency-free core\npip install \"llm-harness-lite[openai]\"       # OpenAI-compatible providers\npip install \"llm-harness-lite[anthropic]\"    # Anthropic\npip install \"llm-harness-lite[pgvector]\"     # PostgreSQL + pgvector RAG\npip install \"llm-harness-lite[qdrant]\"       # Qdrant RAG\npip install \"llm-harness-lite[mcp]\"          # MCP client\npip install \"llm-harness-lite[full]\"         # all integrations + example config deps\n# or local dev:\n# python -m venv .venv && source .venv/bin/activate\n# pip install -e \".[dev,examples,openai,ollama,pgvector]\"\n# docker compose up -d db\n```\n\nThe core package uses only the Python standard library. Provider SDKs, vector\ndatabase clients, and the MCP SDK are optional; install only the extras your\napplication uses. OpenAI-compatible providers (including Ollama and vLLM) use\nthe `openai` extra.\n\nThe package requires Python 3.10 or newer. For local development, use a virtual\nenvironment and the optional extras for the providers and integrations you\nchoose. [Local setup](https://github.com/abadiape/llm-harness-lite/blob/main/LOCAL_SETUP.md) uses Compose services bound to loopback;\ntheir sample credentials and unauthenticated Qdrant service are for local\ntesting only.\n\nThis project is a library, not a production API service or deployment stack. It does not provide application authentication, network/TLS configuration, high availability, backups, or centralized monitoring. A production application must supply those and deploy its database/vector store with appropriate access controls. The Qdrant adapter can target such a deployment; the bundled Compose service is not one.\n\nThere is no universal CPU or memory minimum: hosted models require network access and provider credentials, while local Ollama requirements depend on the chosen model and context size. Size production resources for the model, workload, and expected concurrency.\n\nThe initial supported vector stores are intentionally limited to **pgvector**\nand **Qdrant**. The default local setup uses pgvector; the Qdrant adapter can\nconnect to a secured production deployment. Both implement the same\n`VectorStore` contract and plug into the same `Retriever`. Embedding generation\nis separate from both storage and chat-model choice, so users own their vectors\nand can change LLM providers without binding retrieval to a model vendor.\n\nCall `store.init()` before ingesting. Re-ingesting a source updates its\nsource/chunk records instead of creating duplicates; direct store records with\nno ID use a stable content-and-metadata key. Both adapters validate vector\ndimensions and finite numeric values on writes and searches. Initializing an\nexisting pgvector table adds the key column and a unique index without removing\nexisting rows.\n\nRun `docker compose up -d qdrant` only when testing the Qdrant path. The Qdrant\nclient is available through the `qdrant` extra.\n\nBuilt-in backends estimate USD cost from reported input and output token usage.\nSupply per-model rates when you want to account for custom or local model\npricing; those overrides take precedence over catalog and fallback prices.\nSee [per-model cost estimates](https://github.com/abadiape/llm-harness-lite/blob/main/docs/configuration.md#per-model-cost-estimates)\nfor the configuration and calculation example.\n\n`LLMRouter` dispatches through a caller-supplied policy; it does not silently\ninfer cost or quality tiers. The policy receives messages, tools, temperature,\nand named candidate routes, then returns one configured route. Keep the policy\ndeterministic for equivalent requests when wrapping the router with `CachedLLM`.\nExact cache keys include model, full messages, tool schemas, and temperature.\nSemantic cache matches are additionally scoped to model, temperature, and\nembedding model, and compare the full message context.\n\n``` python\nfrom llm_harness_lite import LLMRouter\n\ndef policy(request):\n    return \"tool-capable\" if request.tools else \"local\"\n\nllm = LLMRouter({\"local\": local_llm, \"tool-capable\": remote_llm}, policy)\n```\n\nCustom providers can implement the `LLMBackend` protocol and register a factory\nwithout changing the library:\n\n``` python\nimport llm_harness_lite\n\nllm_harness_lite.register_provider(\"my-runtime\", MyBackend)\nllm = llm_harness_lite.create_llm(\"my-runtime\", \"model-name\", endpoint=\"http://localhost\")\npython\nimport llm_harness_lite\n\nllm = llm_harness_lite.create_llm(\n    \"openai_compat\", \"qwen3:8b\", base_url=\"http://localhost:11434/v1\"\n)\n```\n\nThe agent API is async-first: use `await agent.arun(goal)` in async applications.\n`agent.run(goal)` is a synchronous convenience for scripts and must not be called\nfrom an already-running event loop. Agent results expose a structured\n`stop_reason` and usage totals. Tools can raise\n`llm_harness_lite.ToolExecutionError` for recoverable failures to return to the\nmodel; unexpected tool exceptions propagate to the caller.\n\nPass `observer=callback` to `Agent` for structured `AgentEvent` lifecycle\nmetadata, including run IDs, model/tool timings, usage, and stop reason. Events\nomit prompts, tool arguments, and tool results. The synchronous callback runs\ninline and its errors propagate, so keep it fast and handle telemetry failures\nin the callback if they should not abort a run. Provider responses are checked\nfor valid token counts, costs, and latency before budget accounting.\n\nBuilt-in backends provide native `achat()` and `aclose()` methods; configure\ntheir request deadline with `create_llm(..., timeout=60)`. In async applications,\nuse `async with backend` to close provider resources. `MCPClient` follows the\nsame async-context-manager pattern, and `await mcp.register_into(registry)`\npreserves remote tool schemas for use by `Agent.arun()`.\nSynchronous custom backends and tools run in worker threads; cancelling their\nawait does not forcibly stop the underlying synchronous function. Implement\n`achat()` or an async tool for cancellable I/O.\n\nSee `LOCAL_SETUP.md` + `examples/`:\n\n- `01_basic_chat.py` — normalized`chat()` across providers\n- `02_agent_with_tools.py` — minimal agent loop with a registered tool\n- `03_rag_ingest_search.py` — compact pgvector ingest/search example\n- `04_cost_compare.py` — bang-for-buck across models\n- `05_qdrant_mcp_cache.py` — Qdrant + persistent MCP + semantic cache\n- `06_large_files_scanner.py` — expanded tool example: interactive local scan and confirmed deletion\n- `07_document_inquirer.py` — expanded RAG example: interactive Q&A over text files or PDFs\n\n- [Build a purpose-specific agent](https://github.com/abadiape/llm-harness-lite/blob/main/docs/guide.md) — start with one tool and\ngrow the same agent in small steps\n- [Choose an LLM and configure your app](https://github.com/abadiape/llm-harness-lite/blob/main/docs/configuration.md) — providers,\ncredentials, optional YAML configuration, and per-model cost estimates\n- [RAG and MCP integrations](https://github.com/abadiape/llm-harness-lite/blob/main/docs/integrations.md) — add retrieval, remote\ntools, caching, and other optional capabilities\n\nCI runs the test suite and lint on Python 3.10 and 3.15, then separately builds and installs the dependency-free wheel. The PyPI release workflow waits for CI.\n\n- `src/llm_harness_lite/llm/` —`types.py` ,`base.py` (Protocol),`openai_compat.py` ,`anthropic_backend.py` ,`factory.py`\n- `src/llm_harness_lite/agent/loop.py` — framework-agnostic ReAct loop\n- `src/llm_harness_lite/tools/registry.py` —`@tool` + JSON Schema from signature\n- `src/llm_harness_lite/rag/` —`chunker.py` ,`embedder.py` ,`store_base.py` ,`store_pgvector.py` ,`store_qdrant.py` ,`retriever.py`\n- `src/llm_harness_lite/mcp/client.py` —`MCPClient` +`PersistentMCP` background-loop bridge\n- `src/llm_harness_lite/utils/` —`costs.py` ,`cache.py` (exact + semantic)", "url": "https://wpnews.pro/news/vendor-neutral-llm-harness-with-local-first-support", "canonical_source": "https://github.com/abadiape/llm-harness-lite", "published_at": "2026-11-24 17:46:41+00:00", "updated_at": "2026-11-24 18:12:15.898577+00:00", "lang": "en", "topics": ["ai-agents", "ai-tools", "developer-tools", "large-language-models"], "entities": ["llm-harness-lite", "Ollama", "vLLM", "Anthropic", "OpenAI", "pgvector", "Qdrant", "MCP"], "also_reported_by": [], "takeaway": "llm-harness-lite 0.1.0 ships a standard-library-only core of about 1,000 lines with optional extras (openai, anthropic, pgvector, qdrant, mcp) so developers install only the provider and vector-store integrations they use, on Python 3.10 or newer.", "recommendation": null, "alternates": {"html": "https://wpnews.pro/news/vendor-neutral-llm-harness-with-local-first-support", "markdown": "https://wpnews.pro/news/vendor-neutral-llm-harness-with-local-first-support.md", "text": "https://wpnews.pro/news/vendor-neutral-llm-harness-with-local-first-support.txt", "jsonld": "https://wpnews.pro/news/vendor-neutral-llm-harness-with-local-first-support.jsonld"}}