Make your computer a home for your AI partner. Avibe is the local-first Agent OS: Vibey, its built-in AI partner, works out of the box, and Claude Code, Codex & OpenCode run unchanged beside it — reach them from your browser, phone, or any chat app.
Python agentagent-osaiai-agentsai-partnerchatopsclaudeclaude-codecodexdevtoolsdiscord-botlark-botllmlocal-firstlong-term-memoryopencodeslack-botvibe-codingvibeywechat
fix(model-hub): serve a Gemini hop's hosted tools under its /v1beta base (#3039)
Call Whitefda6125bb8d6
diff --git a/core/handlers/model_hub/turn_gateway.py b/core/handlers/model_hub/turn_gateway.pyindex ad554139c..d6753cf53 100644--- a/core/handlers/model_hub/turn_gateway.py+++ b/core/handlers/model_hub/turn_gateway.py@@ -695,8 +695,10 @@ class ModelHubTurnGateway:client_max_size += 1app = web.Application(client_max_size=client_max_size)app.router.add_get("/{backend}/v1/models", self._handle_models)- # Before the catch-all model route, which would otherwise take it.- app.router.add_post("/vibey/v1/hosted-tools/{tool}", self._handle_hosted_tool)+ # Before the catch-all model route, which would otherwise take it. A hop calls its hosted tools under+ # its own base URL (``vibey-hosted-tools.md`` §6): ``/v1``, or ``/v1beta`` on a ``google`` hop.+ for surface in ("v1", "v1beta"):+ app.router.add_post(f"/vibey/{surface}/hosted-tools/{{tool}}", self._handle_hosted_tool)app.router.add_post("/{backend}/v1/{endpoint:.*}", self._handle_request)app.router.add_post("/{backend}/v1beta/models/{google_action:.*}", self._handle_google_request)runner = web.AppRunner(diff --git a/docs/plans/vibey-hosted-tools.md b/docs/plans/vibey-hosted-tools.mdindex e34eee72b..fc843f342 100644--- a/docs/plans/vibey-hosted-tools.md+++ b/docs/plans/vibey-hosted-tools.md@@ -550,7 +550,8 @@ These rules are C-1 rows in `cross-provider.md` and per-protocol rows in `conver## 6. The search executor-- **Endpoint:** `POST {base_url}/hosted-tools/{tool}` on the gateway, with the turn's Bearer token and its+- **Endpoint:** `POST {base_url}/hosted-tools/{tool}` on the gateway (the hop's base URL: `/vibey/v1`, or+ `/vibey/v1beta` on a `google` hop, amended 2026-10-27), with the turn's Bearer token and its`request_headers`, and the body `{"arguments": <canonical arguments>}`. There is no executor in the body: thegateway resolves the chain from the caller's live turn (`x-avibe-turn-id`). A call without a live turn, or from aturn that no longer admits work, is 409 `turn_not_live`; a tool outside the turn's frozen tool set (§3.4) is 409diff --git a/tests/test_model_hub_hosted_executor.py b/tests/test_model_hub_hosted_executor.pyindex f969dbb5b..4dea02b7c 100644--- a/tests/test_model_hub_hosted_executor.py+++ b/tests/test_model_hub_hosted_executor.py@@ -149,16 +149,18 @@ def _bind(service, tool, executor):_EXECUTOR_MODELS[source.vendor] = (executor[1],)-async def _call(service, tool, body, *, token=None, after_launch=None, language="en"):+async def _call(service, tool, body, *, token=None, after_launch=None, language="en", surface=None):gateway = ModelHubTurnGateway(service, language_provider=lambda: language)router = ModelHubRuntimeRouter(service=service, turn_gateway=gateway)try:hop = await router.resolve_hop("menu-alias", process_scope="vibey:proxy", turn_id="turn-proxy")if after_launch is not None:after_launch(hop)+ # ``surface`` stands the hop's base URL on another gateway surface, as a hop of that protocol has it.+ base = hop["base_url"] if surface is None else f'{hop["base_url"].rsplit("/", 1)[0]}/{surface}'async with aiohttp.ClientSession() as client:async with client.post(- f'{hop["base_url"]}/hosted-tools/{tool}',+ f'{base}/hosted-tools/{tool}',headers={"Authorization": f'Bearer {token or hop["token"]}', **hop["request_headers"]},data=body if isinstance(body, bytes) else json.dumps(body),) as response:@@ -259,6 +261,24 @@ async def test_a_proxied_search_runs_one_native_request_and_answers_its_canonicaassert latest_ok(service, tool) == (executor[0], executor[1], "executor")+async def test_a_google_hop_calls_its_hosted_tools_under_its_own_base_url(tmp_path):+ """MH-HOSTED-GATEWAY-004: a ``google`` hop's base URL is the gateway's ``/v1beta`` surface+ (``vibey-gemini-native.md``), and Vibey calls the hop's hosted tools under it (§6)."""++ served = replace(_outcome(RawOutcomeKind.SUCCESS, source_id=XAI), hosted_tools=frozenset({"web_search"}))+ service = _vibey_service(tmp_path, _sources(), handles=[LiveInvokeHandle(served, _responses(WEB_CALL, WEB_ANSWER))])+ _bind(service, "web_search", (XAI, "grok-4.6"))++ status, answer = await _call(+ service, "web_search", {"arguments": {"query": "CLIProxyAPI latest release"}}, surface="v1beta",+ )++ assert status == 200, answer+ assert answer["record"]["status"] == "completed"+ assert answer["execution"]["executor_source_id"] == XAI++@pytest.mark.asyncioasync def test_an_anthropic_executor_is_buffered_and_keeps_the_providers_results_and_cited_text(tmp_path):"""MH-HOSTED-GATEWAY-004: Anthropic results keep their order and ages; a cited one gains its cited_text."""