{"slug": "i-measured-my-multi-agent-idea-it-failed-i-shipped-the-autopsy-instead", "title": "I measured my multi-agent idea. It failed. I shipped the autopsy instead", "summary": "A developer released B.I.O.M.A., an open-source Rust micro-kernel for LLM applications that reduces input tokens by up to 97% while preserving answer quality, after testing and refuting the multi-agent 'mitosis' approach. The tool provides context apoptosis, a cognitive firewall, and a lock-free signaling bus, and is provider-agnostic, working with Anthropic, Google, and OpenAI.", "body_md": "**🌐 English · Português**\n\n**A local, provider-agnostic efficiency & security micro-kernel for LLM applications.**\n\nB.I.O.M.A. is a drop-in artifact — a lock-free Rust kernel (`bioma_micro`\n\n) plus a\nthin Python layer — that you embed in *any* project or architecture that talks to an\nLLM. It does not try to make the model \"smarter\". It makes the *processing* cheaper,\nfaster and safer, in-process, before your prompt ever leaves the machine:\n\n**Context apoptosis**— dehydrates wasted/stale context (−80% input tokens; up to −97% on long sessions).** Cognitive firewall**— secret redaction, cognitive-DDoS/flood detection, and a dispatch timeout guard.** Hormonal bus**— lock-free μs signalling substrate (~2M signals/s).\n\n100% local. Provider-agnostic: harden the payload here, then send it to **Anthropic,\nGoogle, OpenAI** — or anything — with *your* SDK.\n\nNew here?[explains what B.I.O.M.A. is, the pain it attacks, and the real benchmarks as proof. Step-by-step deployment (local & online providers) is in]`OVERVIEW.md`\n\n[. Every claim is measured and audited in]`IMPLEMENTATION.md`\n\n[, including what we tested and]`FINDINGS.md`\n\nrefuted(multi-LLM \"mitosis\" does not improve quality — it is not part of the product).\n\n``` python\nfrom bioma.firewall_client import CognitiveFirewall\n\nfw = CognitiveFirewall(vault={\"db_password\": DB_PW})   # secrets to protect\n\n# (a) PURE artifact — harden, then call YOUR provider with YOUR SDK:\nh = fw.shield(history, \"refactor this function\")\n#   h.prompt / h.system  → clean, dehydrated, secret-free payload\n#   h.telemetry          → saturation, red_alert, apoptosis_reduction, kernel_latency_us\n\nimport anthropic                                        # or google.genai, or openai\nmsg = anthropic.Anthropic().messages.create(\n    model=\"claude-sonnet-5\", max_tokens=1024,\n    system=h.system or \"\", messages=[{\"role\": \"user\", \"content\": h.prompt}])\n\n# (b) Bring your own async dispatcher (Anthropic/Google/OpenAI), keep the guards:\nshield = await fw.harden(history, \"refactor\", dispatch_fn=my_async_provider_call)\n#   → timeout guard + response-side secret redaction applied automatically\n```\n\nThe Rust kernel is usable directly too:\n\n``` python\nimport bioma_micro as k\nk.dehydrate([(\"system rules\", k.SYSTEM), (\"verbose log \" * 200, k.TOOL)])  # → -80% tokens\nk.saturation_scan(payload)     # cognitive-DDoS score 0..1 (flood ≈ 1.0)\n```\n\n| Capability | Result | Source |\n|---|---|---|\n| Context apoptosis | −80% input tokens (up to −97% long sessions) |\n`tests/test_enxuto_efficiency.py` |\n| Answer-quality preservation | 10/10 parity, 100% correct answers at −97% tokens (5 online models, objective probes) |\n`tests/test_quality_preservation.py` · `reports/BIOMA_QUALITY_PRESERVATION.md` |\n| Measured energy per dispatch | 2,714.7 J → 69.5 J (−97.4%), quality parity (local Llama 3.2 1B, battery fuel gauge, idle subtracted) |\n`tests/test_energy_local.py` · `reports/BIOMA_ENERGY_LOCAL.md` |\n| Vision context apoptosis (agent screenshot loops) | 6/6 parity, 100% correct at −56% real tokens (−77% at 24 steps; dehydrated payload is O(1) in session length) — 3 vision models, probes rendered into the pixels |\n`tests/test_vision_quality_preservation.py` · `reports/BIOMA_VISION_QUALITY.md` |\n| Image distillation (keep-latest dedup + OCR + deterministic shape structure) | 100% answers at −74% tokens vs sending every image — stale images become ~25–86-token text blocks; local VLM captions measured and rejected (label confabulation) |\n`tests/test_vision_distill.py` · `reports/BIOMA_VISION_DISTILL.md` |\n| Dev-workload cost benchmark (7 agent models, real OpenRouter usage & prices) | −57% to −86% median cost at quality parity — 126 real executions, paired replicas, failures reported first-page (Fable 5×T1 arm-B empty 3/3) |\n`tests/benchmark_dev_openrouter.py` · `resultados/relatorio.md` · `resultados/SIMULACAO_MERCADO.md` |\nDrop-in gateway (OpenAI and Anthropic surfaces, cache-safe, tool-pair aware) |\n−78% (OpenAI) / −33% (Anthropic) billed input tokens, answer intact with only `base_url` changed — proven with both official SDKs on real models; Claude Code speaks the Anthropic surface |\n`bioma/gateway.py` · `tests/test_gateway.py` · `tests/prove_gateway_dropin.py` · `tests/prove_anthropic_surface.py` |\n| Apoptosis × prompt caching (real Anthropic cache) | −65% net cost after the cache discount — the durable prefix hits the same cache in both arms; savings come from purging the never-cacheable middle |\n`tests/measure_cache_interaction.py` · `resultados/MEDICOES_GATEWAY.md` |\n| Real Claude Code E2E (CLI through the gateway) | solves real bug+feature tasks, pytest green with only `ANTHROPIC_BASE_URL` changed; apoptosis is a safe no-op here (Claude Code self-manages context — nothing to purge), and the value shows on agents that don't (−84% measured) |\n`tests/e2e_claude_code.py` · `resultados/E2E_CLAUDE_CODE.md` |\n| E2E real tool-calling agent (fixes a real bug to green pytest) | −84% accumulated input tokens at task parity on a long-running agent (−0% on a 3-turn task — apoptosis is a correct no-op with no dead weight) |\n`tests/e2e_agent_gateway.py` · `resultados/MEDICOES_GATEWAY.md` |\n| Hormonal bus | ~2M signals/s @ ~5μs, bounded under 10× load |\narchived bench (research repo) |\n| Cognitive-DDoS mitigation | 15k-token flood → dehydrated pre-dispatch | `tests/test_sovereign_defense.py` |\n| Secret redaction | vault values never reach the model | `reports/BIOMA_IMMUNITY_VERDICT.md` |\n| Pixel secret redaction (closes our own declared gap) | a real vision model transcribes an AWS/OpenAI key from the original screenshot but only — OCR + region masking, client-side`████` from the redacted one |\n`tests/test_vision_secret_redaction.py` · `reports/BIOMA_PIXEL_SECRETS.md` |\n\n```\npip install bioma-framework            # core: the Rust micro-kernel + Python API\npip install \"bioma-framework[gateway]\"   # + the drop-in OpenAI/Anthropic gateway\npip install \"bioma-framework[all]\"       # + client, anthropic, and the vision tier\n# kernel only (no Python layer): pip install bioma-micro\n```\n\nThe core install ships the compiled Rust kernel (`bioma_micro`\n\n) as a binary\nwheel — no Rust toolchain required. Extras (`gateway`\n\n, `client`\n\n, `anthropic`\n\n,\n`vision`\n\n) are opt-in so the base stays light. Publishing is one tag away for\nmaintainers (`git tag v1.0.0 && git push --tags`\n\n→ the `Release`\n\nworkflow builds\nmulti-platform wheels and publishes to PyPI). Local dev from source is in\n[Quickstart](#quickstart-local).\n\nPoint any OpenAI-compatible **or Anthropic-compatible** client's `base_url`\n\nat\nthe gateway and every request gets context apoptosis transparently — no SDK\nswap, no prompt rewrite:\n\n```\npip install fastapi \"uvicorn[standard]\" httpx\nuvicorn bioma.gateway:app --port 8790\npython\n# OpenAI clients:\nfrom openai import OpenAI\nclient = OpenAI(base_url=\"http://localhost:8790/v1\", api_key=\"...\")   # only change\n\n# Anthropic clients (incl. Claude Code — set ANTHROPIC_BASE_URL):\nfrom anthropic import Anthropic\nclient = Anthropic(base_url=\"http://localhost:8790\", api_key=\"...\")   # only change\n```\n\nBoth surfaces proven with the official SDKs on real models:\n\n**OpenAI**(`tests/prove_gateway_dropin.py`\n\n): billed input**−78%** on Sonnet 5 / GLM-5.2 / Gemini 3.5 Flash, answer intact, streaming works.**Anthropic**(`/v1/messages`\n\n`tests/prove_anthropic_surface.py`\n\n): billed input**−33%** on Sonnet 5 / Opus 4.8, answer intact, streaming works — the protocol Claude Code speaks, so`ANTHROPIC_BASE_URL`\n\n→ the gateway just works.\n\nDesign guarantees (each unit-tested in `tests/test_gateway.py`\n\n, 14 tests): the\ncurrent query is never filtered; the surviving `system`\n\n+`FACT`\n\nprefix stays\n**byte-identical** across calls (prompt-cache-safe); tool-call/tool-result pairs\nsurvive or purge as a unit (never orphaned) — on both the OpenAI `tool`\n\nrole and\nthe Anthropic `tool_use`\n\n/`tool_result`\n\nblock structure. Anthropic `system`\n\nis a\ntop-level field, forwarded untouched (never purged).\n\nB.I.O.M.A. is a **client-side Frugal AI layer that auditably reduces the energy\ncost of LLM inference per deployment**. The kernel's per-dispatch audit\n(tokens before/after) *is* the KPI: the reduction percentage is exact and\ncoefficient-independent. A reproducible benchmark (`tests/test_esg_benchmark.py`\n\n→ `reports/BIOMA_ESG_BENCHMARK.md`\n\n) converts the measured token savings into\nbounded Wh/gCO2e estimates using declared literature coefficients\n(0.5–1.3 kWh/M tokens; grid presets; caching-adjusted counterfactual), with the\nconversion helpers shipped in `bioma/esg.py`\n\n. This is a per-deployment claim —\nnot a global one; it scales with adoption and with your grid.\n\nTurn your own real traffic into a case report: run your workload through the\ngateway, then `python -m bioma.esg_report bioma_gateway_audit.jsonl --grid eu --price-in <your $/M>`\n\nprints tokens / Wh / gCO2e / $ avoided from the measured\naudit log — the design-partner instrument (`bioma/esg_report.py`\n\n). A ready-to-run\nNVIDIA-GPU energy harness (`tests/measure_energy_gpu.py`\n\n) awaits datacenter\nhardware; it fabricates no numbers without a GPU.\n\n```\n# Build & install the Rust micro-kernel (PyO3 extension)\npython -m pip install maturin\ncd bioma_micro && maturin build --release && \\\n  pip install --force-reinstall target/wheels/bioma_micro-*.whl && cd ..\n\n# Run the test suite (offline, deterministic)\npip install pytest fastapi \"openai>=1\"\npython -m pytest tests/test_kernel.py tests/test_firewall.py tests/test_server.py -q\n```\n\nOptional: a local FastAPI runner (`bioma.server`\n\n, `GET /health`\n\n+ `POST /v1/dispatch`\n\n)\nand a local container image (`deploy/Dockerfile.lean`\n\n) are included — no hosted\nservice required.\n\n```\nbioma_micro/   Rust/PyO3 micro-kernel — hormonal bus + apoptosis + saturation_scan\nbioma/         Python: CognitiveFirewall, LeanOpenRouterClient, local server\ntests/         unit suite (kernel, firewall, server) + real end-to-end validations\nFINDINGS.md    ground-truth evaluation (proven / refuted), reproducible\nreports/       immunity verdict (APT war-game)\n```\n\nFair-source under the **Functional Source License (FSL-1.1-MIT)** ([ LICENSE](/jonathascordeiro20/bioma-framework/blob/main/LICENSE)):\nread it, run it, and build on it for any non-competing purpose. The only limit is repackaging\nit as a competing product, and each release automatically becomes MIT two years after its date.", "url": "https://wpnews.pro/news/i-measured-my-multi-agent-idea-it-failed-i-shipped-the-autopsy-instead", "canonical_source": "https://github.com/jonathascordeiro20/bioma-framework", "published_at": "2026-07-17 15:05:18+00:00", "updated_at": "2026-07-17 15:21:16.531048+00:00", "lang": "en", "topics": ["artificial-intelligence", "large-language-models", "ai-tools", "ai-infrastructure", "ai-agents"], "entities": ["B.I.O.M.A.", "Anthropic", "Google", "OpenAI", "Llama"], "alternates": {"html": "https://wpnews.pro/news/i-measured-my-multi-agent-idea-it-failed-i-shipped-the-autopsy-instead", "markdown": "https://wpnews.pro/news/i-measured-my-multi-agent-idea-it-failed-i-shipped-the-autopsy-instead.md", "text": "https://wpnews.pro/news/i-measured-my-multi-agent-idea-it-failed-i-shipped-the-autopsy-instead.txt", "jsonld": "https://wpnews.pro/news/i-measured-my-multi-agent-idea-it-failed-i-shipped-the-autopsy-instead.jsonld"}}