web_search) and web fetch (web_fetch). Before a call goes out, a script can rewrite the query or URL, answer the call itself, or block it. When the result comes back, a script can keep it, replace it entirely, or block it, before Vibey ever reads it.
Use it to keep Vibey to sources you trust, drop sites you don’t, add a page you always want considered, or point reads at a mirror.
Turn it on
Open Settings › Experimental › Source filter and switch on Use source filter. Only the Owner of the Avibe can change it. It applies from Vibey’s next turn; turning it off restores the earlier behavior from the next turn. While it is on:- Vibey no longer uses a model’s built-in web search; every search and every page read goes through Avibe’s tools, and so through your scripts.
- Search services, fallback order, and billing work as before. When a search falls back to another provider, your scripts still run once per call, not once per attempt.
- It covers Vibey’s web search and web fetch only. Other tools, MCP servers, the shell, and other Agents reach the web without passing through it.
Where scripts go
Put your scripts in the hooks folder of your Avibe home (by default~/.avibe/hooks/source_filter/; the settings page shows the exact path):
Every file is optional. A missing file is skipped, and with none of them the tools run as usual. Avibe looks for each file when its step comes, so adding or removing a script takes effect from the next call. The settings page shows which scripts it found, and the last run that failed.
Python and dependencies
Scripts run with Python, without a shell, in the hooks folder.- A script that uses only the standard library needs nothing installed: Avibe runs it with its own Python.
-
For third-party packages, make the hooks folder a uv project. All four scripts share it:
When the folder has a
.venv, Avibe runs the scripts with.venv/bin/python(.venv\Scripts\python.exeon Windows). Avibe never installs packages during a search; runuv sync --lockedagain after changing dependencies.
The protocol
Each run reads one JSON request on standard input and writes one JSON response on standard output, both UTF-8. Write anything else, such as debug output, to standard error. A run has 60 seconds.Before a call
The request carries what Vibey asked for:before_fetch gets {"url": "..."} in args. Respond with one of:
Arguments you write still go through the tool’s usual checks when they are sent, including the page reader’s network safety rules.
After a call
The request adds what came back, asoutput, and where it came from, as origin ("gateway", or "before_hook" when your before script answered):
{"ok": false, "error": {"code": "...", "message": "..."}} instead; a search that ended early also keeps the sources it found as result. Respond with {"action": "pass"}, {"action": "replace", "output": {...}}, or {"action": "block", "reason": "..."}.
Output shapes
url is required for each search result, and content for a page; the other fields are optional. Your output can name any source and any content, and can turn a failure into a success or the reverse. Fields not listed here are not passed to Vibey.
Call a model from a script
A script can ask one of your models for help, for example to judge which results look reliable. Every run gets two environment variables:AVIBE_GATEWAY_URL: the address of Avibe’s local model gateway, OpenAI-compatible.AVIBE_GATEWAY_KEY: a key that works only while this run lasts.
$AVIBE_GATEWAY_URL/chat/completions with the key as a bearer token, and name the model in the request: any model from Vibey’s model menu. The call uses your model quota like any other.
The key only answers chat completions. A model called this way cannot search or read pages itself, so your scripts are never bypassed or called again from inside. Don’t print the key, even to standard error.
Leave your HTTP call a shorter timeout than the 60-second run, so the script can still answer.
When a script fails
If a script exits with an error, runs past 60 seconds, or writes something that is not a valid response, the call is blocked: Vibey is told the source filter blocked it, and never sees the unfiltered result. Nothing is retried. If you would rather let results through when your own code fails, catch the error in your script and respond{"action": "pass"}.
Whatever a script returns, Avibe still records what really ran upstream and what it cost.
Examples
Drop some domains from search results, and always add one trusted page (after_search.py):
before_fetch.py):
